Videos
Videos record everything that happened in the browser during a test — every click, navigation, and visual state change. I use retain-on-failure so videos only keep around when a test actually breaks. Combined with traces, they make debugging CI failures possible without reproducing locally.
Video recording modes
Four modes, each for a different need. Configure in use.video in playwright.config.ts.
Where videos end up
After the test run, videos are in test-results/. Each failed test gets its own subfolder with the video alongside the trace and screenshots. In the HTML report (npx playwright show-report) you can play the video directly in the browser.
Video is saved when the browser context closes at the end of a test. If you create a context manually, you must await context.close() to flush the video file.
Video size and annotations
By default video resolution matches the viewport, scaled to fit 800×800. You can specify size explicitly. Playwright also supports annotating the video — highlighting actions with outlines and titles, useful for sharing recordings with non-technical stakeholders.
Access the video path in a test
If you need to attach the video to a report or send it somewhere, you can get the file path via page.video().path(). Note: this resolves only after the page closes.