Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 4 additions & 14 deletions test/e2e/fixtures/baseTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,25 +136,15 @@ export const test = base.extend<TestFixtures>({
await page.waitForTimeout(3_000);
await dismissAllNotifications(page);

// 4. Optional tracing
if (testInfo.retry > 0 || !process.env.CI) {
await page.context().tracing.start({ screenshots: true, snapshots: true, title: testInfo.title });
}
// Tracing is handled by Playwright's built-in `use.trace` config
// (see playwright.config.ts). No manual tracing.start/stop needed.

// ---- hand off to the test ----
await use(page);

// ---- teardown ----
// Save trace on failure/retry
if (testInfo.status !== "passed" || testInfo.retry > 0) {
const tracePath = testInfo.outputPath("trace.zip");
try {
await page.context().tracing.stop({ path: tracePath });
testInfo.attachments.push({ name: "trace", path: tracePath, contentType: "application/zip" });
} catch {
// Tracing may not have been started
}
}
// Trace saving is handled automatically by Playwright's `use.trace`
// config — no manual tracing.stop() needed here.

await electronApp.close();

Expand Down
8 changes: 4 additions & 4 deletions test/e2e/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ export default defineConfig({
},
globalSetup: path.join(__dirname, "globalSetup.ts"),
use: {
// Automatically take a screenshot when a test fails.
screenshot: "only-on-failure",
// Capture full trace on retry for deep debugging (includes screenshots, DOM snapshots, network).
trace: "on-first-retry",
// Capture full trace on every test run locally (includes screenshots,
// DOM snapshots, and network at each Playwright action). In CI,
// retain traces only for failing tests to limit artifact size.
trace: process.env.CI ? "retain-on-failure" : "on",
},
outputDir: path.join(__dirname, "..", "..", "test-results", "e2e"),
});
Loading