Skip to content

Commit a905eb4

Browse files
committed
perf(test): skip fixture-only browser startup
1 parent 37c67b0 commit a905eb4

2 files changed

Lines changed: 29 additions & 7 deletions

File tree

scripts/qa/ux-matrix-evidence-producer.ts

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,16 @@ async function writePreflight(artifactBase: string) {
335335
);
336336
}
337337

338+
async function writeSkippedVisualProof(logPath: string) {
339+
const startedAt = Date.now();
340+
await writeText(logPath, "blocked: --skip-visual-proof was set\n");
341+
return {
342+
failureReason: "--skip-visual-proof was set",
343+
status: "blocked" as const,
344+
wallMs: Date.now() - startedAt,
345+
};
346+
}
347+
338348
function isMissingManagedPlaywrightBrowser(error: unknown) {
339349
const message = error instanceof Error ? error.message : String(error);
340350
return (
@@ -389,7 +399,11 @@ async function captureControlUiScreenshot(params: {
389399
logPath: string;
390400
repoRoot: string;
391401
screenshotPath: string;
402+
skipVisualProof: boolean;
392403
}) {
404+
if (params.skipVisualProof) {
405+
return writeSkippedVisualProof(params.logPath);
406+
}
393407
const startedAt = Date.now();
394408
try {
395409
const { browser } = await launchUxMatrixChromium();
@@ -519,15 +533,10 @@ async function captureProducerArtifactFixtureProof(params: {
519533
skipVisualProof: boolean;
520534
videoPath: string;
521535
}) {
522-
const startedAt = Date.now();
523536
if (params.skipVisualProof) {
524-
await writeText(params.logPath, "blocked: --skip-visual-proof was set\n");
525-
return {
526-
failureReason: "--skip-visual-proof was set",
527-
status: "blocked" as const,
528-
wallMs: Date.now() - startedAt,
529-
};
537+
return writeSkippedVisualProof(params.logPath);
530538
}
539+
const startedAt = Date.now();
531540
try {
532541
const videoDir = path.join(path.dirname(params.videoPath), "recording");
533542
await fs.mkdir(videoDir, { recursive: true });
@@ -671,6 +680,7 @@ export async function runUxMatrixEvidenceProducer(options: ProducerOptions) {
671680
logPath: path.join(screenshotCellDir, "logs.txt"),
672681
repoRoot: options.repoRoot,
673682
screenshotPath: matrixScreenshotPath,
683+
skipVisualProof: options.skipVisualProof,
674684
});
675685

676686
const initialCells: MatrixCell[] = [

test/scripts/qa-ux-matrix-evidence-producer.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,21 @@ describe("QA UX Matrix evidence producer CLI", () => {
124124
path.join(artifactBase, "surfaces", "cli", "stages", "entrypoint-help", "logs.txt"),
125125
"utf8",
126126
);
127+
const visualLog = fs.readFileSync(
128+
path.join(
129+
artifactBase,
130+
"surfaces",
131+
"control-ui",
132+
"stages",
133+
"screenshot-artifact",
134+
"logs.txt",
135+
),
136+
"utf8",
137+
);
127138
expect(evidence).not.toContain(fakeRepoRoot);
128139
expect(cliLog).not.toContain(fakeRepoRoot);
129140
expect(`${evidence}\n${cliLog}`).toContain("<repo-root>");
141+
expect(visualLog).toBe("blocked: --skip-visual-proof was set\n");
130142
} finally {
131143
fs.rmSync(artifactBase, { recursive: true, force: true });
132144
fs.rmSync(fakeRepoRoot, { recursive: true, force: true });

0 commit comments

Comments
 (0)