Installation & Setup
1
Setup API Key
Get a Team API Key from your Stably Dashboard and set it as an environment variable:
The tests will expect 
process.env.STABLY_API_KEY, but you can also programmatically set a key using the setApiKey function from @stablyai/playwright-test:2
Install Playwright and Stably SDK
Stably SDK now supports bringing your own Playwright version. Install both:
If you already have 
@playwright/test installed, you only need to add @stablyai/playwright-test. The SDK is compatible with Playwright 1.52.0+.Usage
1. Update Your Code
Replace all imports from@playwright/test with @stablyai/playwright-test:

2. Setup AI Rules (Optional)
Teach AI codegen agents (like Cursor, Claude Code, or Codex) how to properly use Stably SDK’s AI capabilities instead of writing basic Playwright code.1
Copy the AI rules below
2
Paste into your AI codegen agent's configuration
Add the copied rules to your agent’s custom instructions (e.g., 
.cursorrules, .windsurfrules, claude.md, or any method that supports custom prompts).3
Start using Stably SDK patterns
Your codegen agent now knows Stably SDK patterns: auto-heal with 
.describe(), toMatchScreenshotPrompt() for AI assertions, and extract() for data extraction.3. Run Tests
Use the same Playwright commands you’re already familiar with:- Run tests in headed mode: npx playwright test --headed
- Run a specific test file: npx playwright test tests/example.spec.ts
- Run tests in UI mode: npx playwright test --ui
- Run a single project/browser: npx playwright test --project=chromium
4. Add Stably CI Reporter (Optional)
To integrate with Stably’s cloud platform and view test results in the dashboard, configure the reporter in yourplaywright.config.ts:
playwright.config.ts
- Get your Team API Key from Stably Dashboard
- Find your Project ID in your project settings on the Stably Dashboard
- The reporter is now included in @stablyai/playwright-test- no separate package needed!
Prefer a no-code approach?
If you don’t want to manage Playwright configuration, runners, and maintenance yourself, you can use Stably’s no-code AI tests to get the same capabilities—AI test generation, AI assertions, AI actions, and auto-heal—running on our scalable cloud platform without writing code.- Same power, simpler UX: Built on top of Playwright, with a streamlined editor UI.
- AI-first: Natural-language test generation, AI assertions, AI actions, and self-healing.
- Cloud-native: Record, run, and triage at scale with zero local setup.
- Portable: Export tests to Playwright anytime if you need advanced customization.
Quick start (no-code)
- Sign in to the Stably Dashboard: Open Dashboard.
- Create a project and open the recorder in the no-code editor.
- Record steps or use AI to generate them in the editor: see No-code Editor.
- Add intelligence to your test with AI Assertions and AI Actions.
- Run in the cloud and review results: see Viewing Run Results and Test Results.
The no-code editor is Playwright-compatible under the hood. You can export tests to Playwright at any time and continue in code when you need more advanced workflows. Learn more in Full Playwright Compatibility.