The `playwright-testrail-reporter` is a custom reporter designed to integrate Playwright Test results seamlessly with TestRail. It automates the process of creating new TestRail runs or updating existing ones, and then posts test outcomes by matching specific case IDs (e.g., `C12345`) embedded directly within Playwright test titles. The current stable version is 1.3.3, released in October 2025, with a consistent cadence of minor quality-of-life improvements and dependency updates. Key differentiators include robust environment variable validation and auto-sanitization, support for using TestRail API keys instead of passwords, and flexible custom status mappings for different test outcomes. It simplifies the reporting workflow, allowing developers to focus on writing tests rather than manually updating TestRail.
npm install playwright-testrail-reporterVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to configure `playwright-testrail-reporter` in `playwright.config.ts` and tag tests with TestRail case IDs (e.g., C12345) for automatic reporting. It also highlights the necessary environment variables for TestRail integration.
Rename `TESTRAIL_PASSWORD` to `TESTRAIL_API_KEY` in your `.env` file and provide a TestRail API key instead of a regular user password.
Upgrade to `playwright-testrail-reporter@1.3.3` or newer, which includes smart environment variable validation and auto-sanitization. Always ensure `TESTRAIL_HOST` includes `https://` and IDs are numeric.
Generate an API key in your TestRail 'My Settings' and use that for the `TESTRAIL_API_KEY` environment variable.
Add `TESTRAIL_STATUS_SKIPPED=6` (or your custom skipped status ID) to your `.env` file.
Ensure `TESTRAIL_HOST` (including `https://`), `TESTRAIL_USERNAME`, `TESTRAIL_API_KEY`, `TESTRAIL_PROJECT_ID`, and `TESTRAIL_SUITE_ID` are correctly set and formatted in your `.env` file. Upgrade to `v1.3.3` or higher for automatic sanitization.
Verify `TESTRAIL_HOST`, `TESTRAIL_USERNAME`, and `TESTRAIL_API_KEY` are accurate and have the necessary permissions. Double-check for typos and ensure `TESTRAIL_HOST` includes `https://`.
Add TestRail case IDs in the format `C12345` to your Playwright test names. Ensure `['playwright-testrail-reporter']` is present in the `reporter` array within your `playwright.config.ts`.