Registry / testing / playwright-testrail-reporter

playwright-testrail-reporter

JSON →
library1.3.3jsnpmunverified

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-reporter
INSTALL
IMPORT
SIG · PLAYWRIGHT-TESTRAI
P
playwright-testrail-reporter
testingjavascriptv1.3.3
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

playwright-testrail-reporter
['playwright-testrail-reporter']
import { TestRailReporter } from 'playwright-testrail-reporter';
The reporter is integrated into Playwright's configuration by providing its package name as a string in the `reporter` array within `playwright.config.ts`, not by importing a specific class or function.
defineConfig
import { defineConfig } from '@playwright/test';
const defineConfig = require('@playwright/test').defineConfig;
Standard Playwright configuration helper. Playwright config files (`playwright.config.ts`) are typically run as ESM.

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.

import { defineConfig } from '@playwright/test'; // To ensure environment variables are loaded if using a .env file // require('dotenv').config(); // Uncomment if you are using dotenv export default defineConfig({ testDir: './tests', fullyParallel: true, forbidOnly: !!process.env.CI, retries: process.env.CI ? 2 : 0, workers: process.env.CI ? 1 : undefined, reporter: [ ['list'], // Keep the default list reporter ['playwright-testrail-reporter'] // Add TestRail reporter ], use: { baseURL: 'http://127.0.0.1:3000', trace: 'on-first-retry', }, }); // Example test file (tests/example.spec.ts) // Make sure to set these environment variables in your .env file: // TESTRAIL_HOST=https://yourcompany.testrail.io // TESTRAIL_USERNAME=your.email@company.com // TESTRAIL_API_KEY=your_api_key_here // TESTRAIL_PROJECT_ID=123 // TESTRAIL_SUITE_ID=456 // TESTRAIL_RUN_NAME=Automated Playwright Run import { test, expect } from '@playwright/test'; test('C12345: User can log in with valid credentials', async ({ page }) => { await page.goto('/'); // Simulate login console.log('Test C12345 executed.'); expect(true).toBe(true); }); test('C67890 C98765: Dashboard loads correctly after login', async ({ page }) => { await page.goto('/dashboard'); // Simulate dashboard checks console.log('Test C67890 and C98765 executed.'); expect(page.url()).toContain('/dashboard'); });
Debug
Known issues
deprecatedThe environment variable `TESTRAIL_PASSWORD` is deprecated. Using it will result in a warning message in the console.
fix
Rename `TESTRAIL_PASSWORD` to `TESTRAIL_API_KEY` in your `.env` file and provide a TestRail API key instead of a regular user password.
affects: >=1.3.0
gotchaPrior to v1.3.3, incorrect or malformed environment variables (e.g., missing `https://` in `TESTRAIL_HOST`, or non-numeric IDs) could lead to runtime errors like `AggregateError` or 'TestRail Run ID: NaN'.
fix
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.
affects: <1.3.3
gotchaIt is critical to use your TestRail API key for `TESTRAIL_API_KEY`, not your regular login password. Using the password may lead to authentication failures or unexpected behavior.
fix
Generate an API key in your TestRail 'My Settings' and use that for the `TESTRAIL_API_KEY` environment variable.
affects: >=1.0.0
gotchaFor Playwright to report skipped tests to TestRail, you must explicitly define `TESTRAIL_STATUS_SKIPPED` in your environment variables, as it does not have a default mapping.
fix
Add `TESTRAIL_STATUS_SKIPPED=6` (or your custom skipped status ID) to your `.env` file.
affects: >=1.0.0
Errors
Common errors & fixes
AggregateError: Multiple errors occurred...
Malformed or missing environment variables for TestRail configuration, or non-numeric values for ID variables.
fix
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.
playwright-testrail-reporter] ℹ️ No existing 'TESTRAIL_RUN_ID' provided by user. Creating a new TestR... [playwright-testrail-reporter] ❌ Error: Test results could not be added. Check TestRail configuration.
TestRail API key, host, or user credentials are incorrect, leading to authentication or API errors when creating/updating runs.
fix
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://`.
No test results appearing in TestRail after a Playwright test run completes.
Test cases in Playwright are not tagged with TestRail case IDs (e.g., C12345), or the `playwright-testrail-reporter` is not correctly configured in `playwright.config.ts`.
fix
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`.
Upgrade
Version history
1.3.3latest on npm
Audit
Dependencies
@playwright/testrequiredRequired for Playwright Test integration as a peer dependency.
Agent activity
38 hits · last 30 days
node
31
OpenAI (training)
2
Resources
playwright-testrail-reporter — npm install playwright-testrail-reporter · libregistry