npx stably test command, but package it alongside the services your application needs (front end, APIs, databases, queues, and more).
Prerequisites
- Docker (or another OCI-compatible runtime) installed
- Node.js 20+ available in your base image
- A Playwright project initialized in your repository
- Stably installed as a project dependency (
npm install --save-dev stably)
Quick Setup
1. Extend your existing application image with Playwright dependencies
Add the Playwright browsers and keep your build steps for the app under test. The example below installs dependencies, builds a front end, and leaves the app ready to run inside the container:Dockerfile
tester stage above) that shares the same source tree.
2. Build the image or test stage
3. Run tests alongside your stack
Start the supporting containers (API, database, etc.), then run the test image with the same environment you would use locally:BASE_URL to the DNS name of a front-end container (web), but you can add any env vars, secrets, or config files your tests rely on.
Store your Stably API key securely—use environment files, Docker secrets, or your orchestrator’s secret manager instead of hardcoding it in the image.
Coordinate with Other Services
- Compose or orchestration tools: Launch your services with Docker Compose, Kubernetes, or your preferred orchestrator. Attach the Stably test container to the same network so it can call real APIs and front ends.
- Wait for readiness: Use health checks,
dockerize,wait-for-it, or your own scripts to ensure dependent services are ready before tests run. - Seed data: Run migrations or seed scripts in the same compose file so the environment mirrors production as closely as necessary.
docker-compose.yml
Customize Playwright and Stably Flags
Pass any additional CLI flags exactly as you would locally. For example:npx playwright test works with npx stably test, including reporters, --headed, and configuration overrides.
Parallel Runs with Multiple Containers
Shard your suite by spinning up multiple instances of the same test image. Each container can target the same backing services or its own isolated stack, depending on how you model the compose file or orchestrator:docker-compose.yml
Persist Playwright Artifacts
Mount a volume if you want to inspect local reports in addition to the Stably dashboard:Next Steps
- Wire up Slack notifications for containerized runs
- Review GitHub integration for PR status checks and annotations