Skip to main content
To run Playmatic tests locally, use the Playwright runner. All Playmatic SDK capabilities like AI actions and the environment manager are fully Playwright compatible, allowing you to get the benefit of AI reasoning with all the built-in tools of Playwright.

Prerequisites

Before running tests locally, ensure you have:
  • Node.js 18 or newer: Required for Playwright & Playmatic SDK
  • Playmatic tests: Tests written in the playmatic/ directory
  • Configuration files: playmatic.config.ts and playwright.config.ts in your test directory

Step 1: Navigate to your test directory

Navigate to the playmatic/ directory in your project root where your Playmatic tests are located:

Step 2: Install the dependencies to run tests locally

Step 3: Add your Playmatic API key

The API key is required for AI actions (like aiClick and aiVerify) to work locally. Go to your Playmatic dashboard → Settings and create an API key. Then, add it to your shell environment:
Tests that only use standard Playwright actions will run without an API key. AI actions require authentication to the Playmatic service.

Step 4: Configure your test environment

Initialize your test environment in the playwright.config.ts file. The environment determines which baseUrl and variables your tests will use.
Learn more about configuring different testing environments in the environment manager
playwright.config.ts
By default, tests will use the defaultEnv specified in your playmatic.config.ts. To run tests against a different environment, set the PLAYMATIC_TEST_ENV variable:

Step 5: Run the tests

Common Playwright Commands

Here are useful commands for running and debugging your Playmatic tests:
Learn more about Playwright test runner options in the Playwright documentation.