Skip to main content
Regression Testing 5.3 registers twelve abilities in the mainwp-regression-testing category. They use the mainwp/ namespace on your MainWP Dashboard. Use these abilities to automate the work you do on the Regression Testing pages: read each site’s latest change scores, change a site’s target pages and schedule, start a scan and wait for its result, or pick the snapshot that later scans compare against.

What You’ll Learn

  • Read site statuses, page observations, and diff summaries
  • Replace a site’s configuration, baseline, and schedule
  • Start a scan and track it to completion
  • Find the scan that covers a site update

Prerequisites

  • WordPress 6.9 or later on your MainWP Dashboard site
  • MainWP Dashboard with Abilities API support; use version 6.2 or later for the input_json examples below
  • Regression Testing 5.3 or later, active in your Dashboard
  • An authenticated user with access to the Regression Testing Add-on
  • Access to each site you read or change
Use an Application Password or the authentication methods in the Abilities API overview. The examples use an Application Password.

Permissions

Read abilities require access to the Regression Testing Add-on and to the requested site. The five abilities that change data (replace configuration, run scan, replace baseline, replace schedule, and manage operation) also require the WordPress manage_options capability or the Regression Testing Management permission. With Team Control, assign Regression Testing Management to a custom role to let its users make these changes without full administrator rights. The same rule applies on the Regression Testing pages: saving settings, changing Overwrite General Settings, and running scans require manage_options or Regression Testing Management.

Available Abilities

Discover the abilities and their full input and output schemas:
All twelve abilities are marked idempotent. The five that change data are marked destructive, so WordPress runs them with DELETE, including for previews. You can also send them as a POST request with a JSON body that contains input; your Dashboard handles it as the matching DELETE request. Each input schema rejects extra properties. Every listed property is required unless the ability says otherwise. Send null for optional values you do not use.
The abilities never return page HTML, CSS or JavaScript contents, or recipient email addresses. They return content hashes, counts, and opaque references instead. List reads never load stored page content.

Baselines and scores

The abilities score each page against a fixed baseline snapshot. The baseline moves only when you call replace-regression-testing-baseline-v1. A page whose content changed keeps reporting that change on every scan until you accept the new content as its baseline. The Regression Testing pages, the change notification email, and the Scan Site result score each page against its previous snapshot instead, as in earlier releases. An intended change shows on one scan there, and the next unchanged scan reads 0%. When you update to 5.3, each existing page uses its newest stored snapshot as its baseline.

Change a site with preview and confirm

The five abilities that change data use a two-step preview and confirm flow:
  1. Send the request with dry_run: true, confirm: false, and preview_token: null. Include a new UUID as request_ref. Set if_match to the current revision you read.
  2. Review the response, then send the same request with dry_run: false, confirm: true, and the returned preview_token.
If the site changes between the two steps, the confirm request fails with stale_revision or preview_mismatch. Read the site again and repeat the preview. Reuse the same request_ref to retry a confirm request safely. Your Dashboard replays the stored result instead of applying the change twice. Use a new UUID for each new change.

Read site statuses

limit accepts 1 to 100. after_site_id is optional. When truncated is true, pass next_after_site_id as after_site_id to read the next page. Example response:
last_run_state is succeeded, partial, failed, unknown, cancelled, or null when the site has not been scanned.

Read and replace a site configuration

Read the configuration first. Its revision is the if_match value for scans, schedule changes, and configuration changes. Each page’s revision is the if_match value for a baseline change.
Example response:
replace-regression-testing-site-config-v1 replaces the whole configuration. Send every field: Target paths follow the same rules as Additional target pages on the settings page. This ability does not change the settings it does not manage, such as highlight colors, excluded HTML elements, and CSS/JS exclusions.
The response contains mode (dry_run or completed), page_count, recipient_count, the new revision, and the preview_token to confirm with.

Read snapshots and diffs

List stored snapshots for a site, or pass a page_ref for one page:
page_ref and after_snapshot_ref are optional. Each observation includes page_ref, relative_path, snapshot_ref, status, change_percent against the baseline, content_hash, asset_count, and observed_at. When truncated is true, pass next_after_snapshot_ref as after_snapshot_ref. Compare two stored snapshots of the same page:
The diff summary returns change_percent, added_units, removed_units, changed_asset_count, and summary_state. A summary_state of too_large or truncated means the pages were too large to compare in full. Use the Raw HTML Diff in your Dashboard to see the actual changes.

Set a baseline

Accept a stored snapshot as the page’s new baseline. Pass the page revision from get-regression-testing-site-config-v1 as if_match.
The snapshot must be a complete snapshot of the same page.

Replace a schedule

A month_day past the end of a short month runs on the month’s last day.
The response includes the schedule state and its next_run_at time.

Run a scan and track it

1

Preview the scan

Call run-regression-testing-scan-v1 with dry_run: true. Pass the configuration revision as if_match.
2

Confirm the scan

Send the same request with dry_run: false, confirm: true, and the returned preview_token. Save the returned operation_id.
3

Wait for the result

Call get-regression-testing-operation-v1 with the operation_id as operation_ref until status is succeeded, partial, failed, unknown, or cancelled.
4

Read the page outcomes

Call list-regression-testing-operation-pages-v1 to see each page’s status and change score.
Leave page_refs empty to scan every active page of the site. Use trigger: "manual" with update_generation: null. A site whose configuration has enabled: false cannot be scanned and returns stale_revision. A site runs one scan at a time. Starting a manual scan while another scan of the site is queued or running returns lock_busy. A confirmed scan returns mode: "accepted" and status: "queued". A background worker on your Dashboard checks the queue every minute. For details, see How scans run.
Example response:
kind is manual_scan, scheduled_scan, post_update_scan, or reconcile. You can read only scans you started. list-regression-testing-operation-pages-v1 takes operation_ref, limit (1 to 100), and an optional after_page_ref. Each page has a status, change_percent, snapshot_ref, error_code, and finished_at. For a scan of several pages, finished pages appear only after the whole scan ends.

Cancel a scan

Call manage-regression-testing-operation-v1 with action: "cancel" for a scan that is queued or running. A queued scan is cancelled at once and returns mode: "completed". A running scan moves to cancelling and returns mode: "accepted". Use action: "reconcile" to queue a scan that ended as failed, partial, or unknown again. Its kind becomes reconcile. Other states return state_conflict.

Find the scan that covers an update

get-regression-testing-update-operation-v1 answers “did a post-update scan check this update, and what did it find?”
Example response:
The response describes the newest update recorded for the site at or after updated_after:
  • update_event is null when no update was recorded since that time.
  • attachment is new_scan when the update started a post-update scan, joined_scan when it joined one that was already queued, or not_attached when no scan covers it.
  • reason explains a not_attached update: post_update_disabled, scans_disabled, site_not_configured, retry_pending, retry_exhausted, storage_unavailable, or enqueue_failed.
  • operation is the scan the update was attached to, or null. Its change_percent is the highest change against the baseline among the scan’s pages. pages_without_baseline counts pages that had no baseline yet.
An update can join a scan that was queued before it, so the covering scan’s accepted_at can be earlier than the update.

Updating to 5.3

When you update to Regression Testing 5.3, your Dashboard copies your existing configurations, pages, and snapshots to new storage in batches. The copy runs on admin page loads and from the background worker. The Regression Testing pages keep working while it runs. Until it finishes, every ability returns storage_unavailable with HTTP 503.

Handle errors

Over REST, some errors found while checking permissions, such as site_not_found, return HTTP 403 instead of the status listed. Read the error code, not only the HTTP status. A site you cannot access answers like a site that does not exist.