Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,7 @@ dist
*.mp4

# Browser snapshots
browser-snapshots
browser-snapshots

# Test output artifacts
test/artifacts/output/
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"dependencies": {
"@apidevtools/json-schema-ref-parser": "^14.2.1",
"@ffmpeg-installer/ffmpeg": "^1.1.0",
"@puppeteer/browsers": "^2.10.12",
"@puppeteer/browsers": "^2.10.13",
"ajv": "^8.17.1",
"appium": "^2.19.0",
"appium-chromium-driver": "1.5.1",
Expand All @@ -44,7 +44,7 @@
"json-schema-faker": "^0.5.9",
"pixelmatch": "^5.3.0",
"pngjs": "^7.0.0",
"posthog-node": "^5.10.4",
"posthog-node": "^5.11.0",
"sharp": "^0.34.4",
"tree-kill": "^1.2.2",
"webdriverio": "8.45.0"
Expand Down
5 changes: 3 additions & 2 deletions src/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ async function runSpecs({ resolvedTests }) {
context.platform
}", "apps": ${JSON.stringify(context.apps)}}`
);
contextReport = { result: { status: "SKIPPED" }, ...contextReport };
contextReport = { result: "SKIPPED", ...contextReport };
report.summary.contexts.skipped++;
testReport.contexts.push(contextReport);
continue;
Expand Down Expand Up @@ -563,7 +563,8 @@ async function runSpecs({ resolvedTests }) {
" Make sure you've run `safaridriver --enable` in a terminal and enabled 'Allow Remote Automation' in Safari's Develop menu.";
log(config, "error", errorMessage);
contextReport = {
result: { status: "SKIPPED", description: errorMessage },
result: "SKIPPED",
resultDescription: errorMessage,
...contextReport,
};
report.summary.contexts.skipped++;
Expand Down
58 changes: 58 additions & 0 deletions test/core.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,62 @@ describe("Run tests successfully", function () {
fs.unlinkSync(tempFilePath);
}
});

it("Test is marked as skipped when all contexts are skipped", async () => {
// Create a spec with a context for a different platform than the current one.
// The resolver will generate a context that doesn't match the current platform,
// which will cause it to be skipped.
const currentPlatform = require("os").platform();
const targetPlatform =
currentPlatform === "win32" ? "linux" : "windows";

const allContextsSkippedTest = {
id: "test-all-contexts-skipped",
contexts: [
{
app: { name: "firefox" },
platforms: [targetPlatform], // Will be skipped on current platform
},
],
tests: [
{
id: "test-1",
steps: [
{
action: "runShell",
command: "echo 'This should not run'",
},
],
},
],
};

// Write the test to a temporary file
const tempFilePath = path.resolve("./test/temp-all-contexts-skipped.json");
fs.writeFileSync(
tempFilePath,
JSON.stringify(allContextsSkippedTest, null, 2)
);
const config = {
input: tempFilePath,
logLevel: "silent",
};
let result;
try {
result = await runTests(config);
// Verify that the test is marked as skipped, not passed
assert.equal(result.summary.tests.skipped, 1);
assert.equal(result.summary.tests.pass, 0);
assert.equal(result.summary.specs.skipped, 1);
assert.equal(result.summary.specs.pass, 0);
assert.equal(result.summary.contexts.skipped, 1);
// Also verify the actual test result
assert.equal(result.specs[0].result, "SKIPPED");
assert.equal(result.specs[0].tests[0].result, "SKIPPED");
assert.equal(result.specs[0].tests[0].contexts[0].result, "SKIPPED");
} finally {
// Ensure cleanup even on failure
fs.unlinkSync(tempFilePath);
}
});
});