Q28 of 38 · CI/CD & DevOps
How do you capture and publish test reports, screenshots, and video artifacts in CI?
Short answer
Short answer: Configure your test runner to write reports and media to a named directory, then use your CI platform's artifact upload step to persist them after the job completes — including on failure.
Detail
When a test fails in CI, log output alone rarely tells you enough. Screenshots at the point of failure, videos, and an HTML report showing exactly which assertions failed are essential for fast diagnosis.
Most CI platforms have a native artifact upload: GitHub Actions has actions/upload-artifact, GitLab CI has the artifacts block. These persist files for a configurable retention period and make them downloadable from the pipeline UI.
For Playwright: set outputDir in playwright.config.ts and always upload the playwright-report and test-results directories with if: failure() to reduce noise on green runs. For structured reporting, add the JUnit reporter (["junit", { outputFile: "results/junit.xml" }]) — most CI dashboards and tools like Allure can ingest JUnit XML and show trends over time.