Skip to main content
AI agents are now live in Website Scanner! Enter your URL and fix website issues 3x faster with AI. Explore now!
No Result Found
Connect and get help from 7,000+ developers on our Discord community. Ask the CommunityAsk the Community

Integrate Maestro with Percy

Learn how to integrate Maestro with Percy to run visual tests on your Maestro web flows.

This page guides you through integrating Maestro with Percy, from creating a Percy project to capturing your first snapshot.

Use the @percy/maestro-web SDK to integrate Percy visual testing with your Maestro web test suite. This is the only Percy SDK you need to install for Maestro, the steps below cover the full setup.

  • This SDK supports Maestro web flows only.
  • @percy/maestro-web uses the same full DOM capture engine as Percy’s other web SDKs, so every Percy feature works the same way.

Prerequisites

Before you begin, ensure you have the following installed:

Set the JAVA_HOME environment variable before running your Maestro flow. If you encounter a JAVA_HOME not set error, follow the OS-specific setup steps in the Maestro installation guide.

Steps

Follow these steps to set up the Percy - Maestro integration:

Step 1: Create a Percy project.

  1. Sign in to Percy.
  2. Create a new project, select Web as the project type, and name your project.
  3. Once you create the project, Percy generates a unique project token. Copy the token. Use it as an environment variable in the next step.

Step 2: Set the Percy token as an environment variable so the Percy CLI can authenticate with your project. Choose the command for your operating system and shell:

export PERCY_TOKEN="your-percy-token"
$Env:PERCY_TOKEN="your-percy-token"
set PERCY_TOKEN=your-percy-token

Step 3: Install Percy dependencies using the following command:

npm install --save-dev @percy/maestro-web @percy/cli

This installs the SDK and the Percy CLI.

Step 4: Update your Maestro flow.

To capture a Percy snapshot at a specific point in your Maestro flow, add a runScript: block that points to the SDK’s snapshot script.

Minimum flow:

url: https://example.com
---
- launchApp
- runScript:
    file: ../node_modules/@percy/maestro-web/scripts/snapshot.js
    env:
      NAME: "Home page"

NAME is the only required field, every other option is read from .percy.yml (Step 5) or can be overridden per-snapshot.

Multi-snapshot flow with overrides:

url: https://example.com
---
- launchApp
- runScript:
    file: ../node_modules/@percy/maestro-web/scripts/snapshot.js
    env:
      NAME: "Home"
      TEST_CASE: "homepage-suite"
- tapOn: "Sign in"
- inputText: "user@example.com"
- tapOn: "Continue"
- runScript:
    file: ../node_modules/@percy/maestro-web/scripts/snapshot.js
    env:
      NAME: "Sign-in form"
      WIDTHS: "375,1280"
      LABELS: "auth,critical-path"

Step 5: Configure project defaults.

Create a .percy.yml at your project root:

version: 2
snapshot:
  widths: [375, 1280]
  minHeight: 1024

Per-snapshot env: overrides take precedence over .percy.yml defaults. For more information, refer to Percy SDK configuration.

Step 6: Run Percy with your Maestro flow:

percy-maestro-web exec -- maestro test flow.yaml

Sample output:

[percy] Percy has started!
[percy] Created build #142
[percy] Snapshot taken: Home page
[percy] Snapshot taken: Sign-in form
[percy] Finalized build #142
[percy] Done!

Percy renders each snapshot in Chrome, Safari, Firefox, and Edge across every configured width.

Step 7: A build link appears in the CLI output. Click the link to view your Percy snapshots.

When you run another build with visual changes to your application, Percy takes new snapshots. You can then see the comparisons between the two runs on the new build.

Per-snapshot overrides

Names are case-insensitive and accepted with or without the PERCY_SNAPSHOT_ prefix.

Env var Maps to Description Example
NAME name (Required) Snapshot name. Home page
WIDTHS widths Comma-separated widths (in pixels). 375,1280
MIN_HEIGHT minHeight Minimum render height in pixels. 1024
PERCY_CSS percyCSS Inline CSS injected at render time. For more information, check Percy specific CSS. iframe { display: none; }
SCOPE scope CSS selector to capture only a DOM subtree. .selector
ENABLE_JS enableJavaScript Set to true to run JavaScript at render time. true
TEST_CASE testCase Groups snapshots in the Test Cases panel. homepage-suite
LABELS labels Comma-separated chips. auth,critical-path
REGIONS regions JSON array of unified regions. [{...}]
IGNORE_REGIONS ignoreRegions Legacy, prefer REGIONS. [{...}]
CONSIDER_REGIONS considerRegions Legacy, prefer REGIONS. [{...}]
SYNC sync Set to true to block until build finalizes. true
RESPONSIVE responsiveSnapshotCapture Set to true to re-capture DOM at each viewport. true

Once set up, Maestro flows that include the Percy snapshot script will automatically capture and upload visual snapshots to Percy, allowing you to review visual changes alongside your functional tests in the Percy dashboard.

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked





Thank you for your valuable feedback

Is this page helping you?

Yes
No

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked





Thank you for your valuable feedback!

Talk to an Expert
Download Copy Check Circle