Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
24 changes: 11 additions & 13 deletions test/e2e/fixtures/baseTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,24 +136,22 @@ 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 });
}
// 4. Start tracing — captures screenshots and DOM snapshots at every
// Playwright action so failures can be replayed step-by-step.
await page.context().tracing.start({ screenshots: true, snapshots: true, title: testInfo.title });

Comment thread
wenytang-ms marked this conversation as resolved.
Outdated
// ---- 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
}
// Always save trace — on failure it's essential for debugging,
// on success it's useful for verifying the interaction flow.
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
Comment thread
wenytang-ms marked this conversation as resolved.
Outdated
}

await electronApp.close();
Expand Down
6 changes: 4 additions & 2 deletions test/e2e/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ export default defineConfig({
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 (includes screenshots, DOM
// snapshots, and network at each Playwright action). This makes it
// easy to diagnose failures — especially when reviewed by AI.
trace: "on",
Comment thread
wenytang-ms marked this conversation as resolved.
Outdated
},
outputDir: path.join(__dirname, "..", "..", "test-results", "e2e"),
});
Loading