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
1 change: 1 addition & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
E2E_TEST_PASSWORD: visual-test-password
steps:
- uses: actions/checkout@v7
- run: node scripts/test-e2e-visual-snapshot-files.mjs
- uses: actions/setup-node@v7
with:
node-version: "24"
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"test:collector-runtime": "node scripts/test-local-collector-runtime.mjs",
"test:cf-token-map": "bash scripts/test-cf-token-map.sh",
"test:replica-status-probe": "bash scripts/test-replica-status-probe.sh",
"test:e2e-visual-snapshot-files": "node scripts/test-e2e-visual-snapshot-files.mjs",
"test:audit-ci": "node scripts/test-audit-ci.mjs",
"test:sentry-ci-report": "python3 scripts/test-sentry-ci-report.py",
"verify": "npm run test:sentry-ci-report && npm run lint && npm run typecheck && npm test && npm run test:receipt-inbox-worker && npm run test:migrate-safe && npm run test:sqlite-backup && npm run test:r2-archive && npm run test:startup-config && npm run test:oracle-deploy && npm run test:apple-projects && npm run test:antigravity-collector && npm run test:session-token-collectors && npm run test:collector-runtime && npm run test:cf-token-map && npm run test:replica-status-probe && npm run build"
Expand Down
31 changes: 31 additions & 0 deletions scripts/test-e2e-visual-snapshot-files.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env node
/**
* Fail fast when visual.spec.ts references a screenshot baseline that is not
* committed under tests/e2e/visual.spec.ts-snapshots/. Playwright only
* reports missing files at assertion time (#1615 landed fleet-budget shots
* without PNGs).
*/
import { readFileSync, existsSync } from "node:fs";
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";

const root = join(dirname(fileURLToPath(import.meta.url)), "..");
const specPath = join(root, "tests/e2e/visual.spec.ts");
const snapDir = join(root, "tests/e2e/visual.spec.ts-snapshots");
const spec = readFileSync(specPath, "utf8");
const re = /toHaveScreenshot\(\s*['"]([^'"]+)['"]/g;
const names = [...spec.matchAll(re)].map((match) => match[1]);
const missing = names.filter((name) => {
const base = name.replace(/\.png$/i, "");
return !existsSync(join(snapDir, `${base}-chromium-linux.png`));
});

if (missing.length > 0) {
console.error("Missing committed Playwright visual baselines:");
for (const name of missing) {
console.error(` ${name} -> ${snapDir}/${name.replace(/\.png$/i, "")}-chromium-linux.png`);
}
process.exit(1);
}

console.log(`ok: ${names.length} visual baseline PNG(s) present`);
Loading