mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-09 01:53:54 +00:00
perf(test): skip fixture-only browser startup
This commit is contained in:
@@ -335,6 +335,16 @@ async function writePreflight(artifactBase: string) {
|
||||
);
|
||||
}
|
||||
|
||||
async function writeSkippedVisualProof(logPath: string) {
|
||||
const startedAt = Date.now();
|
||||
await writeText(logPath, "blocked: --skip-visual-proof was set\n");
|
||||
return {
|
||||
failureReason: "--skip-visual-proof was set",
|
||||
status: "blocked" as const,
|
||||
wallMs: Date.now() - startedAt,
|
||||
};
|
||||
}
|
||||
|
||||
function isMissingManagedPlaywrightBrowser(error: unknown) {
|
||||
const message = error instanceof Error ? error.message : String(error);
|
||||
return (
|
||||
@@ -389,7 +399,11 @@ async function captureControlUiScreenshot(params: {
|
||||
logPath: string;
|
||||
repoRoot: string;
|
||||
screenshotPath: string;
|
||||
skipVisualProof: boolean;
|
||||
}) {
|
||||
if (params.skipVisualProof) {
|
||||
return writeSkippedVisualProof(params.logPath);
|
||||
}
|
||||
const startedAt = Date.now();
|
||||
try {
|
||||
const { browser } = await launchUxMatrixChromium();
|
||||
@@ -519,15 +533,10 @@ async function captureProducerArtifactFixtureProof(params: {
|
||||
skipVisualProof: boolean;
|
||||
videoPath: string;
|
||||
}) {
|
||||
const startedAt = Date.now();
|
||||
if (params.skipVisualProof) {
|
||||
await writeText(params.logPath, "blocked: --skip-visual-proof was set\n");
|
||||
return {
|
||||
failureReason: "--skip-visual-proof was set",
|
||||
status: "blocked" as const,
|
||||
wallMs: Date.now() - startedAt,
|
||||
};
|
||||
return writeSkippedVisualProof(params.logPath);
|
||||
}
|
||||
const startedAt = Date.now();
|
||||
try {
|
||||
const videoDir = path.join(path.dirname(params.videoPath), "recording");
|
||||
await fs.mkdir(videoDir, { recursive: true });
|
||||
@@ -671,6 +680,7 @@ export async function runUxMatrixEvidenceProducer(options: ProducerOptions) {
|
||||
logPath: path.join(screenshotCellDir, "logs.txt"),
|
||||
repoRoot: options.repoRoot,
|
||||
screenshotPath: matrixScreenshotPath,
|
||||
skipVisualProof: options.skipVisualProof,
|
||||
});
|
||||
|
||||
const initialCells: MatrixCell[] = [
|
||||
|
||||
@@ -124,9 +124,21 @@ describe("QA UX Matrix evidence producer CLI", () => {
|
||||
path.join(artifactBase, "surfaces", "cli", "stages", "entrypoint-help", "logs.txt"),
|
||||
"utf8",
|
||||
);
|
||||
const visualLog = fs.readFileSync(
|
||||
path.join(
|
||||
artifactBase,
|
||||
"surfaces",
|
||||
"control-ui",
|
||||
"stages",
|
||||
"screenshot-artifact",
|
||||
"logs.txt",
|
||||
),
|
||||
"utf8",
|
||||
);
|
||||
expect(evidence).not.toContain(fakeRepoRoot);
|
||||
expect(cliLog).not.toContain(fakeRepoRoot);
|
||||
expect(`${evidence}\n${cliLog}`).toContain("<repo-root>");
|
||||
expect(visualLog).toBe("blocked: --skip-visual-proof was set\n");
|
||||
} finally {
|
||||
fs.rmSync(artifactBase, { recursive: true, force: true });
|
||||
fs.rmSync(fakeRepoRoot, { recursive: true, force: true });
|
||||
|
||||
Reference in New Issue
Block a user