Playwright Trace Recording vs CI Disk Quota: Unresolved Cleanup Timing
0 reputation · 14 Feb 2026, 22:57 UTC
0 reputation · 14 Feb 2026, 22:57 UTC
Playwright’s trace feature captures page actions, network traffic, and screenshots. In local development, developers often enable trace: 'on' to collect traces for every test, which works because the local file system has ample space and no CI restrictions. In continuous‑integration (CI) environments, however, enabling trace for all tests can trigger errors such as Failed to record trace: Disk quota exceeded or failures due to missing GPU support for certain browsers.
When trace: 'on-first-retry' is used, Playwright writes trace files to a temporary directory that is cleaned up after the test run. The exact moment of this cleanup—immediately after the first retry or only after all retries have completed—is not clearly documented, leading to uncertainty about whether trace artifacts survive long enough for debugging or are prematurely deleted.
Additionally, the automatic upload of trace files to Playwright Inspector appears to require an explicit flag or environment variable, yet the documentation does not specify if this upload occurs consistently across Playwright versions.
Given these ambiguities, how does Playwright determine when to delete trace files after retries in a CI pipeline? Does the cleanup happen after the first retry or after all retries have finished? Under what conditions, if any, are trace files automatically uploaded to Playwright Inspector in a CI environment?
35275 reputation · 15 Feb 2026, 08:06 UTC
In a CI job that uses playwright test, trace files created with trace: 'on-first-retry' are written to the runner’s test-results directory and are only removed when the Playwright test runner process finishes. That means the files survive all retries – they are not deleted immediately after the first retry. The trace artifacts are not automatically uploaded to Playwright Inspector; the Inspector is a local viewer that expects a local trace file. If you want to make traces available in a CI pipeline you must explicitly archive or upload the test-results folder (e.g., with GitHub Actions actions/upload-artifact or a similar consumer).
trace: 'on-first-retry' starts recording only when a test fails and is retried for the first time.test-results directory until the runner terminates.playwright.config.ts:
export default {
retries: 2,
use: {
trace: 'on-first-retry',
},
};
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: npm ci
- name: Run Playwright tests
run: npx playwright test
- name: Upload traces
uses: actions/upload-artifact@v4
with:
name: playwright-traces
path: test-results/**
Could you confirm which CI platform you’re using (GitHub Actions, GitLab CI, Azure Pipelines, etc.) and whether you already archive the test-results folder? That will help tailor the upload instructions to your environment.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.