dx: collect info on ui-tests failure
Massimo Melina committed
Apr 10, 2026 at 00:36 UTC
75dee6cd5a44eef783316c31169500f23c47a3a3
2 files changed
+7
e2e/common.ts
+6
@@ -10,6 +10,12 @@ const t = Date.UTC(2025, 0, 20, 3, 0, 0, 0) / 1000 // a fixed timestamp, for vis
10
11
test.beforeAll(clearUploads)
12
13
+// dump page DOM on failure to help diagnose flaky tests
14
+test.afterEach(async ({ page }, testInfo) => {
15
+ if (testInfo.status === 'failed')
16
+ await testInfo.attach('dom', { body: await page.content(), contentType: 'text/html' })
17
+})
18
+
19
export function clearUploads() {
20
fs.unlink('tests/' + uploadName, () => {});
21
resetTimestamp()
playwright.config.ts
+1
@@ -29,6 +29,7 @@ export default defineConfig({
29
30
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
31
trace: 'on-first-retry',
32
+ screenshot: 'only-on-failure',
33
timezoneId: 'Europe/Rome',
34
},
35