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.
This commit is contained in:
Simon Knott 2024-09-09 14:00:38 +02:00 committed by GitHub
parent 31e269ad06
commit cc9c4cdd9a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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`);