arrow-left Back to topicQuizTrace viewerCheck yourself1.What does trace: 'on-first-retry' do?Records a trace for every test run, both passing and failingRecords a trace only when a failed test is retried for the first timeRecords a trace only for the first test in each spec file2.What is the difference between trace: 'on-first-retry' and trace: 'retain-on-failure'?They are the same — both save the trace only when the test fails'on-first-retry' records a trace only during the first retry of a failed test; 'retain-on-failure' records a trace for every run but deletes it if the test passes'retain-on-failure' only works on CI, while 'on-first-retry' works locally too'on-first-retry' captures network requests; 'retain-on-failure' only captures DOM snapshots3.Where does Playwright save the trace.zip file after a test run?In the project root as trace.zipIn the test-results/ directory, in a sub-folder named after the testInside node_modules/.playwright/traces/Alongside the spec file in the same directory4.You open a trace and want to see what the page looked like just before a failing expect() assertion. What do you click in Trace Viewer?The Console tab to read the error messageThe action immediately before the highlighted failing step in the Actions list, then inspect the DOM SnapshotThe Network tab to check what API requests were madeThe failing step itself — it shows the DOM state at that exact point5.How do you open a trace file without using the terminal?Double-click the trace.zip file in the file explorerDrag and drop the trace.zip file onto https://trace.playwright.dev/ in a browserOpen it from within Playwright Inspector using File > Open TraceRun npx playwright open trace.zip6.A test fails on CI with a 401 Unauthorized error. How would you use the trace to confirm this?Check the DOM Snapshot panel for any text that says '401'Open the Network tab in Trace Viewer — it shows every HTTP request with status codes, headers, and response bodiesLook at the Timeline at the top — 401 errors appear as red barsCheck the Console tab — 401 errors are always logged there7.What can you do with the DOM Snapshot panel in Trace Viewer that you cannot do with a regular screenshot?Nothing — DOM Snapshot and a screenshot show the same informationHover over and click elements in the snapshot to see their locators, inspect styles, and understand element hierarchy — it's an interactive live DOM reconstructionDOM Snapshot lets you rerun the failed assertion against the captured DOMDOM Snapshot allows you to download and replay the full test from that point8.How do you force a trace to be recorded for a single test run locally, even though the config has trace: 'on-first-retry'?Change the config to trace: 'on' temporarilyRun npx playwright test --trace on — the CLI flag overrides the config valueAdd await page.context().tracing.start() at the top of the testSet PWDEBUG=1 — it also enables trace recordingSubmit answersarrow-left PreviousDebugging TestsScreenshotsNext arrow-right