Playwright
The official Flakiness.io reporter for Playwright Test.
Installation
Section titled “Installation”To install Flakiness.io Playwright Test reporter, follow these steps:
-
Install the Flakiness.io SDK package:
Terminal window npm i @flakiness/sdk@latest -
Configure the reporter in your
playwright.config.tsfile:playwright.config.ts import { defineConfig } from '@playwright/test';export default defineConfig({reporter: [['@flakiness/sdk/playwright-test'],],});
CI/CD Integration
Section titled “CI/CD Integration”To upload reports, you need your project’s Access Token. You can find this in your project settings on flakiness.io.
When the Access Token is provided, the reporter will upload the report to Flakiness.io in the end of the run. You will see a confirmation in your terminal:
45 passed (1.5m)[flakiness.io] ✓ Report uploaded[flakiness.io] https://flakiness.io/flakiness/flakiness/run/6574Add your Flakiness.io access token to your repository:
- Navigate to your GitHub repository settings
- Go to Secrets and Variables → Actions
- Add a new secret named
FLAKINESS_ACCESS_TOKEN - Set its value to the access token from your Flakiness.io project settings
- Pass the secret as an environment variable to the
npx playwright teststep
# In your GitHub workflow file (.github/workflows/playwright.yml)jobs: test: runs-on: ubuntu-latest steps: # ... other steps like checkout, setup Node.js, etc. - name: Run Playwright tests env: FLAKINESS_ACCESS_TOKEN: ${{ secrets.FLAKINESS_ACCESS_TOKEN }} run: npx playwright testOnce installed, every test run will produce a flakiness-report folder in the current working directory. This folder will contain a report.json file along with all the attachments.
To open the report, use flakiness CLI tool:
flakiness show# optionally pass a path to flakiness-report folderflakiness show ./flakiness-reportEnvironment Configuration
Section titled “Environment Configuration”By default, the Flakiness.io Playwright Test reporter collects information about the operating system, Playwright Project configuration path, and project name.
You can also define custom key-value pairs using the FK_ENV_* environment variables:
export FK_ENV_ENDPOINT=stagingexport FK_ENV_DB_PROVIDER=mysql