feat: add visual regression testing workflow#21
Conversation
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.
Summary of ChangesHello, 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
Ignored Files
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
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.
| @@ -69,6 +69,39 @@ jobs: | |||
| wp-versions: '["latest", "6.4"]' | |||
| ``` | |||
|
|
|||
| | `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 | |
There was a problem hiding this comment.
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.
| | `update-snapshots` | boolean | `false` | Regenerate baseline screenshots | | |
| | `threshold` | string | `"0.05"` | Pixel diff tolerance (`maxDiffPixelRatio`) | |
|
|
||
| ```yaml | ||
| jobs: | ||
| visual-regression: |
There was a problem hiding this comment.
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.
| visual-regression: | |
| uses: apermo/reusable-workflows/.github/workflows/reusable-wp-visual-regression.yml@v0 |
Summary
reusable-wp-visual-regression.ymlworkflow for Playwright-based screenshot comparison testing against wp-envTest plan
.wp-env.jsonand Playwright visual testsupdate-snapshots: trueproduces downloadable snapshot artifactsCloses #18