Prerequisites
- A GitHub repository with an existing GitHub Actions workflow (or the ability to create one)
- Node.js 18+ configured in your workflow
- Playwright tests in your repository
Quick Setup
1. Install Stably Playwright SDK
Update your project dependencies to use Stably’s Playwright SDK instead of the standard Playwright package:package.json
and lock file to your repository.
2. Update Test Imports
Replace all imports from@playwright/test
with @stablyai/playwright-test
in your test files:
3. Configure GitHub Secrets
Add your Stably API key as a GitHub secret:- Get your Team API Key from Stably Settings
- Go to your repository’s
Settings > Secrets and variables > Actions
- Create a new secret named
STABLY_API_KEY
with your API key
4. Update Your GitHub Actions Workflow
Your workflow remains the same—just ensure theSTABLY_API_KEY
environment variable is set:
.github/workflows/playwright.yml
The Stably SDK is a drop-in replacement for Playwright, so you continue using
npx playwright test
instead of a different command. All your existing Playwright CLI flags and options work the same way.Running Tests in Parallel
Stably works with GitHub Actions matrix strategy to run your tests in parallel across multiple containers, reducing overall execution time and providing faster feedback.Example: Parallel Execution with Matrix
Here’s a complete workflow that runs tests across 4 parallel containers:.github/workflows/playwright.yml
How Matrix Parallelization Works
By using GitHub Actions’ matrix execution strategy:- Multiple containers are created automatically (4 in the example above)
- Each container receives a unique shard of tests to execute
- Tests run simultaneously across all containers, reducing total execution time
- Results are collected and aggregated in the Stably dashboard
shardIndex
and shardTotal
arrays. For example, to run 8 parallel jobs:
Add Stably Reporter (Optional)
To integrate with Stably’s cloud platform and view test results in the dashboard, add the Stably reporter:1. Install the Reporter
2. Configure in playwright.config.ts
playwright.config.ts
3. Add Environment Variables
In your GitHub Actions workflow, add theSTABLY_PROJECT_ID
:
Find your Project ID in your project settings on the Stably Dashboard and add it to your GitHub repository secrets.
- Test execution timeline showing parallel run progress
- Screenshots and videos for failed tests
- AI-generated failure analysis and suggested fixes
- Historical trends and flakiness detection
- Detailed logs from each parallel container
Complete Workflow Examples
- Basic Setup
- Parallel with Artifacts
- Multiple Browsers
- With Stably Reporter
Minimal configuration for single-threaded execution:
.github/workflows/playwright.yml
Next Steps
- Learn about AI-powered auto-healing to reduce flaky test failures
- Explore AI assertions for intelligent test validation
- Set up Slack notifications for test results
- Configure GitHub integration for PR comments and status checks