Skip to main content
Running Stably-powered Playwright tests locally uses the exact same workflow you use with Playwright. Everything documented in Playwright’s Running Tests guide applies—Stably SDK is a drop-in extension that adds AI-powered capabilities while maintaining 100% Playwright compatibility.
Stably’s no-code AI tests run in the cloud only. Local execution is supported for the Playwright SDK workflow described here.

Prerequisites

  • Node.js 18+ installed on your machine
  • A test directory for your e2e tests

Setup

1

Install Playwright and Stably SDK

Navigate to your e2e tests directory:
cd your-e2e-tests-directory
npm install @playwright/test @stablyai/playwright-test
2

Setup API Key

Get a Team API Key from your Stably Settings and set it as an environment variable:
export STABLY_API_KEY=your_api_key_here
You can also programmatically set the key using the setApiKey function:
import { setApiKey } from "@stablyai/playwright-test";

setApiKey("your_api_key_here");
3

Update Your Test Imports

Replace all imports from @playwright/test with @stablyai/playwright-test:
// Before
import { test, expect } from "@playwright/test";

// After
import { test, expect } from "@stablyai/playwright-test";

Run Tests

Use the same Playwright commands you’re already familiar with:
npx playwright test
The Stably SDK supports all standard Playwright commands and flags:
  • 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
  • Filter tests by name: npx playwright test --grep "login"
For complete command reference, see the Playwright CLI documentation.

Next Steps