First, update your playwright.config.ts
file to record traces on the first retry of each test:
import { PlaywrightTestConfig } from '@playwright/test';
const config: PlaywrightTestConfig = {
// ...
retries: process.env.CI ? 2 : 0,
trace: 'on-first-retry',
};
export default config;
Execute your tests with the --trace
option:
npx playwright test --trace on
This generates a trace.zip
file for each failed test run.
In your GitHub Actions workflow, use the actions/upload-artifact@v2
action to upload the trace files:
- name: Upload Trace Artifacts
uses: actions/upload-artifact@v2
with:
name: Traces
path: **/trace/*.zip
Generate an HTML report with the following command:
npx playwright show-report
Host the report on a service like GitHub Pages or Netlify, using your preferred domain, such as https://ray.run/
.
Now, you can share the URL for remote viewing of trace files in the trace viewer.
If you still have questions, please ask a question and I will try to answer it.
Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].