Skip to main content

Prerequisites

Before running tests locally, ensure you have:
  • Node.js 18 or newer: Required for the Playmatic CLI
  • Playmatic CLI: Install with npm install -g playmatic
  • Test application: An application with Playmatic tests
Playwright is included with the Playmatic SDK - no separate installation required.

Testing localhost environments

To test applications running on localhost, Playmatic automatically creates a secure tunnel to your localhost application that allows our cloud runners to access your development server.
# Example config for localhost testing
# env: {
#   development: {
#      baseUrl: "http://localhost:3000",
#    },
#  },

# Start your local development server
pnpm dev

# Run tests against localhost with tunneling
playmatic run --env development
Performance when testing localhost depends on your machine’s specs and internet connection, which may lead to more timeouts in cached steps.

Testing remote environments

For testing staging, production, or other remote test environments, make sure these environments are publicly accessible via the baseUrl.
# Run tests in the default test environment (as defined in playmatic.config.ts)
playmatic run

# Run tests in a specific test environment
playmatic run --env production
playmatic run --env staging
You can override the default test environment using the --env flag. Learn more about configuring test environments in the Configuration documentation.

Run all tests

Execute your entire test suite:
playmatic run
This command:
  • Discovers all test files in your project
  • Runs tests in parallel by default
  • Displays results in the terminal

Run specific tests

Target specific test files or patterns:
# Run a single test file
playmatic run playmatic-tests/login.spec.ts

# Run multiple test files
playmatic run playmatic-tests/login.spec.ts playmatic-tests/purchase.spec.ts

# Run tests in a directory
playmatic run playmatic-tests/checkout

# Run tests in multiple directories
playmatic run playmatic-tests/checkout playmatic-tests/auth

Test Execution Summary

After each run, you’ll receive a detailed summary report with test results, execution times, and any self-healing that occurred:
📊 Summary
├── Total: 2 tests
├── Passed: 1 ✅
├── Failed: 1 ❌
├── Duration: 1m 56s
└── Self-healed: 1 steps

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

📝 Test Details

❌ analytics.spec.ts (1m 17s)
   Failed step: "Navigate to Analytics page from sidebar"
   Code cache failure reason:
         page.getByRole: Unable to locate
   Computer Use failure reason:
        I was unable to find the analytics tab on the side bar, suggesting the feature has been removed or hidden.

✅ test-editing-fast.spec.ts (1m 52s) - 1 step self-healed
   Self-healed step:
   └─ "Navigate to login page"
      └─ Code cache failure reason:
           page.goto: Timeout 30000ms exceeded.
           Call log:
             - navigating to "https://petite-crews-run.loca.lt/login", waiting until "load"

Next Steps