This project demonstrates Playwright end-to-end testing with automatic test result reporting to PractiTest API.
- macOS (for other platforms, adjust package manager commands accordingly)
- A PractiTest account with API access
- Press
Command + Spaceto open Spotlight Search - Type "Terminal" and press Enter
- A terminal window will open - this is where you'll run all the commands below
If you don't have Homebrew installed yet, run this command in Terminal:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"Follow the on-screen instructions. After installation completes, you may need to add Homebrew to your PATH (the installer will tell you if needed).
brew install node- On the GitHub repository page, click the green "Code" button
- Select "Download ZIP"
- The ZIP file will download to your Downloads folder
- Double-click the ZIP file to extract it
- The extracted folder will be named something like
playwright_maps-main
In Terminal, navigate to the downloaded project folder:
cd ~/Downloads/playwright_maps-mainNote: If your folder has a different name, adjust the command accordingly.
npm installThis will install Playwright and all required dependencies.
Option 1: JSON Configuration File (Recommended)
-
Copy the example configuration file:
cp practitest.config.example.json practitest.config.json
-
Edit
practitest.config.jsonwith your actual credentials:{ "baseUrl": "https://api.practitest.com", "email": "[email protected]", "apiToken": "your-api-token-here", "projectId": "your-project-id" }
Note: The practitest.config.json file is gitignored to protect your credentials.
Run all tests:
npx playwright testRun tests in headed mode (with visible browser):
npx playwright test --headedTo enable automatic result reporting to PractiTest, add an instanceId annotation to your tests:
test('test name', {
annotation: { type: 'instanceId', description: '1877220' }
}, async ({ page }) => {
// Your test code here
});The instanceId corresponds to the test instance ID in PractiTest where results should be uploaded.
tests/- Test filespractitest-reporter.ts- Custom reporter for PractiTest integrationplaywright.config.ts- Playwright configurationpractitest.config.example.json- Example configuration file
When tests complete, the custom PractiTest reporter:
- Reads test results and annotations
- Maps Playwright test statuses to PractiTest statuses
- Uploads results to PractiTest API with test duration and notes
- Logs success/failure of each upload