Skip to main content
Running Stably-powered Playwright tests locally uses the exact same workflow you use with Playwright. 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 20+ installed on your machine
  • A test directory for your e2e tests

Setup

See the SDK Setup Guide to integrate Stably SDK into your Playwright tests.

Run Tests

You have two options for running tests locally:
npx stably test
Using npx stably test automatically injects the Stably reporter when running locally, providing enhanced test analytics and reporting.
The Stably CLI supports all standard Playwright commands and flags:
  • Run tests in headed mode: npx stably test --headed
  • Run a specific test file: npx stably test tests/example.spec.ts
  • Run tests in UI mode: npx stably test --ui
  • Run a single project: npx stably test --project=smoke
  • Run multiple projects: npx stably test --project=smoke --project=critical
  • Filter tests by name: npx stably test --grep "login"
  • Combine project and grep: npx stably test --project=critical --grep @p0

Using Playwright CLI Directly

npx playwright test
You can also use the standard Playwright CLI directly. However, this won’t include the Stably reporter unless you’ve manually configured it in your playwright.config.ts.

Running Specific Test Groups

If you’ve organized your tests using Playwright projects, you can run specific groups:
# Run smoke tests only
npx stably test --project=smoke

# Run multiple test groups
npx stably test --project=smoke --project=release

# Combine with grep for fine-grained control
npx stably test --project=critical --grep @p0

Advanced Options

Pass environment variables to your tests:
BASE_URL=http://localhost:3000 npx stably test
Run tests in debug mode with Playwright Inspector:
npx stably test --debug
Control the number of parallel workers:
# Run with 4 workers
npx stably test --workers=4

# Run serially (one test at a time)
npx stably test --workers=1
Configure test retries:
# Retry failed tests twice
npx stably test --retries=2

Next Steps