Skip to content

feat: add visual regression testing workflow#21

Merged
apermo merged 3 commits into
release/0.4.0from
feature/visual-regression
Apr 8, 2026
Merged

feat: add visual regression testing workflow#21
apermo merged 3 commits into
release/0.4.0from
feature/visual-regression

Conversation

@apermo
Copy link
Copy Markdown
Owner

@apermo apermo commented Apr 8, 2026

Summary

  • Add reusable-wp-visual-regression.yml workflow for Playwright-based screenshot comparison testing against wp-env
  • Supports configurable thresholds, viewports, color schemes, multisite, Mailpit, and snapshot regeneration
  • Document the new workflow in README, CLAUDE.md inventory, and CHANGELOG

Test plan

  • Verify YAML syntax is valid (no workflow_call parse errors)
  • Confirm matrix-prep job correctly generates WP version and multisite matrices
  • Test in a consuming repo with .wp-env.json and Playwright visual tests
  • Verify update-snapshots: true produces downloadable snapshot artifacts
  • Confirm failure case uploads visual diff artifacts

Closes #18

apermo added 2 commits April 8, 2026 20:03
Playwright-based visual regression testing for
WordPress using wp-env. Supports screenshot
comparison with configurable thresholds,
viewports, and color schemes.

Closes #18
Add workflow documentation to README, CLAUDE.md
inventory table, and CHANGELOG entry for v0.4.0.
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request expands the project's testing capabilities by adding a reusable workflow designed to automate visual regression testing for WordPress projects. By leveraging Playwright, this addition allows developers to easily integrate screenshot comparison into their CI pipelines, complete with support for snapshot management and environment-specific configurations.

Highlights

  • New Workflow Added: Introduced a reusable GitHub Actions workflow for Playwright-based visual regression testing in WordPress environments.
  • Configuration Support: The new workflow supports customizable thresholds, viewports, color schemes, multisite configurations, and Mailpit integration.
  • Documentation Updates: Updated README.md, CLAUDE.md, and CHANGELOG.md to include instructions and details for the new visual regression testing capability.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/reusable-wp-visual-regression.yml
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.


Screenshots captured in the light, Comparing pixels, doing it right. With Playwright's power, tests now run, Visual regression, finally done.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@apermo apermo merged commit 02b4e2d into release/0.4.0 Apr 8, 2026
@apermo apermo deleted the feature/visual-regression branch April 8, 2026 18:06
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces documentation and changelog entries for a new Playwright-based visual regression testing workflow, reusable-wp-visual-regression.yml. However, the actual workflow file itself is missing from the current changes. Feedback focuses on lowering the default pixel difference threshold to improve testing accuracy and ensuring the documentation example pins the workflow version to a major version (e.g., @v0) instead of @main to align with the repository's style guide.

Comment thread README.md
@@ -69,6 +69,39 @@ jobs:
wp-versions: '["latest", "6.4"]'
```

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The workflow file reusable-wp-visual-regression.yml is documented and added to the changelog, but the file itself is missing from the pull request. Please ensure the new workflow file is included in the commit.

Comment thread README.md
| `wp-versions` | string (JSON) | `["latest"]` | WP versions (`"latest"`, `"6.7"`) |
| `multisite` | string | `"none"` | `"none"`, `"both"`, or `"only"` |
| `mailpit` | boolean | `false` | Run Mailpit mail catcher (SMTP `:1025`, API `:8025`) |
| `update-snapshots` | boolean | `false` | Regenerate baseline screenshots |
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The default value of "0.2" for maxDiffPixelRatio is quite high for visual regression testing, as it allows up to 20% of pixels to differ before failing. For most projects, a much lower threshold (e.g., 0.01 or 0.05) is preferred to catch subtle visual regressions. If this was intended to be the color threshold (which defaults to 0.2 in Playwright), please clarify the description. Also, consider renaming the input to max-diff-pixel-ratio to match Playwright's terminology and avoid confusion with the color threshold option.

Suggested change
| `update-snapshots` | boolean | `false` | Regenerate baseline screenshots |
| `threshold` | string | `"0.05"` | Pixel diff tolerance (`maxDiffPixelRatio`) |

Comment thread README.md

```yaml
jobs:
visual-regression:
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

According to the repository style guide, action versions should be pinned to the major version (e.g., @v0) rather than @main. This ensures stability for caller repositories.

Suggested change
visual-regression:
uses: apermo/reusable-workflows/.github/workflows/reusable-wp-visual-regression.yml@v0
References
  1. Action versions must be pinned to major (e.g. @v4, not @v4.1.2 or a SHA). (link)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant