Run & Auto-Fix Tests

Maeris MCP includes an AI-powered auto-fix loop that runs your Playwright tests and automatically repairs broken selectors, timeout issues, and assertion failures. When a test fails, Maeris reads the logs, rewrites the affected code using Claude AI, and retries — repeating until all tests pass or the retry limit is reached.

Running All Tests

To run your full test suite with the auto-fix loop enabled:

maeris test run

This executes all tests in your Maeris application against your running app. Make sure your application is running locally before executing this command.

Run Flags

The maeris test run command supports several flags for targeted execution:

# Run a specific test by name maeris test run --name login_valid_credentials # Run all tests in a folder maeris test run --folder Authentication # Run only smoke tests (fast, critical-path subset) maeris test run --smoke # Run full regression suite maeris test run --regression

Flag Reference

  • --name <test-name> — Execute a single named test case
  • --folder <folder-name> — Execute all tests within a specific folder
  • --smoke — Execute only tests tagged as smoke tests
  • --regression — Execute the full regression suite

The Auto-Fix Loop

When a test fails, Maeris does not just report the error — it attempts to fix it automatically:

Step 1: Failure Analysis

Maeris reads the full Playwright error log, including the failing selector, the screenshot at point of failure, and the DOM state captured during the run.

Step 2: AI-Powered Repair

Claude AI analyzes the failure and rewrites the broken test code — fixing CSS selectors, adjusting wait conditions, correcting assertion values, or adding missing timeout parameters.

Step 3: Retry

The repaired test is executed again. The loop continues until the test passes or the maximum retry count is exhausted (default: 5 retries per test).

During the fix loop you will see live output showing which tests are passing, which are being retried, and what changes were made:

[PASS] login_valid_credentials (1.2s)
[FAIL] login_invalid_password — selector '.error-msg' not found
  → Fixing: updating selector to '[data-testid="error-message"]'
  → Retry 1/5...
[PASS] login_invalid_password (0.9s)
[PASS] register_new_user (2.1s)

Targeted Fix Command

To run the fix loop on a single failing test without running your entire suite:

maeris test fix --name <test-name>

This is useful when you've made a targeted UI change and only one specific test broke.

Recalibrating After UI Changes

After significant UI changes — such as a redesign, framework migration, or component library swap — many selectors may break at once. Instead of fixing them one by one, use:

maeris test recalibrate

What recalibrate does

Recalibrate re-scans your updated codebase, rebuilds the selector map, and patches all affected tests to use the new selectors. It is a bulk repair operation and may take several minutes on large test suites.

Viewing Test Results

After a run completes, view the results summary:

# View latest run results maeris report tests # View results for a specific folder maeris report tests --folder Authentication

Reports can be exported as HTML, JSON, or CSV for sharing with your team or integrating into CI/CD dashboards.

Next Steps

Once your tests are passing, push them to the Maeris Portal to share with your team and enable scheduled runs. See the Push Tests to Portal guide.