From cc9c4cdd9a502ccbbe4b9c5cbb917010fd72799d Mon Sep 17 00:00:00 2001 From: Simon Knott Date: Mon, 9 Sep 2024 14:00:38 +0200 Subject: [PATCH] chore: fix flaky screenshot test (#32517) In this test, the trace recording goes super fast. Sometimes, this means that the recording is finished before the screen recorder got a chance to take a screenshot. If that happens, the tests fail because we never show a screenshot. This PR fixes the flakiness by delaying the trace recording so that there's always a screenshot taken. --- tests/library/trace-viewer.spec.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/library/trace-viewer.spec.ts b/tests/library/trace-viewer.spec.ts index f8aaf9d0df..8f8d69116f 100644 --- a/tests/library/trace-viewer.spec.ts +++ b/tests/library/trace-viewer.spec.ts @@ -1469,6 +1469,7 @@ test('should serve css without content-type', async ({ page, runAndTrace, server test('should allow showing screenshots instead of snapshots', async ({ runAndTrace, page, server }) => { const traceViewer = await runAndTrace(async () => { await page.goto(server.PREFIX + '/one-style.html'); + await page.waitForTimeout(1000); // ensure we could take a screenshot }); const screenshot = traceViewer.page.getByAltText(`Screenshot of page.goto > Action`);