@pipulpant/playwright-testmo-reporter
v1.0.7
Published
Playwright reporter for Testmo - automatically submit test results with C{ID} linking
Downloads
30
Maintainers
Readme
@playwright/testmo-reporter
Playwright reporter for Testmo integration. Automatically submits test results to Testmo with automatic test case linking via C{ID} prefixes.
Features
- ✅ Automatic Test Case Linking: Uses
C{ID}prefix in test titles (e.g.,C123 should display login page) - ✅ Testmo CLI Integration: Uses official Testmo CLI for reliable result submission
- ✅ JUnit XML Support: Automatically submits JUnit XML reports
- ✅ Fallback Methods: Multiple submission methods for maximum compatibility
- ✅ Sync Tool: CLI tool to sync test case IDs from Testmo to your test files
Installation
npm install @playwright/testmo-reporterSetup
1. Configure Environment Variables
Create a .env file in your project root:
TESTMO_URL=https://your-instance.testmo.net
TESTMO_TOKEN=your-api-token
TESTMO_PROJECT_ID=1
TESTMO_GROUP_ID=1 # Optional: filter by group2. Configure Playwright
Add the reporter to your playwright.config.ts:
import { defineConfig } from '@playwright/test';
import * as dotenv from 'dotenv';
dotenv.config();
export default defineConfig({
reporter: [
['line'],
['junit', { outputFile: './test-results/results.xml' }],
['@playwright/testmo-reporter'], // Add this
],
// ... rest of your config
});3. Sync Test Cases (One-Time Setup)
Run the sync tool to add C{ID} prefixes to your test titles:
npx sync-testmo testsThis will:
- Fetch test cases from Testmo
- Match them to your Playwright tests
- Add
C{ID}prefixes to test titles for automatic linking
4. Run Your Tests
Run your Playwright tests as usual. Results will automatically be submitted to Testmo:
npx playwright testHow It Works
- Test Case Linking: The reporter extracts
C{ID}from test titles (e.g.,C123 should display login page) - Result Collection: During test execution, results are collected with their case IDs
- Submission: After tests complete, results are submitted via:
- Primary: Testmo CLI (if installed) - most reliable
- Fallback 1: JUnit XML API submission
- Fallback 2: JSON API submission
Manual Test Case ID Assignment
You can manually add test case IDs to your tests:
test('C123 should display login page', async ({ page }) => {
// test code
});The C{ID} prefix enables automatic linking in Testmo.
CLI Tool
The package includes a CLI tool for syncing test case IDs:
# Sync all tests in a directory
npx sync-testmo tests
# Sync specific directory
npx sync-testmo tests/e2e/frontendRequirements
- Node.js 18+ (for native
fetchAPI) - Playwright 1.20+
- Testmo account with API access
- Testmo CLI (optional but recommended):
npm install -g @testmo/testmo-cli
License
MIT
Support
For issues or questions:
- GitHub Repository: https://github.com/PipulPant/playwright-testmo-reporter
- Check Testmo API documentation: https://docs.testmo.com/api
- Review console output for detailed error messages
- Verify your Testmo plan includes Automation API access
