Performs visual regression testing using BackstopJS.
Contains a base collection of configurations to run a visual regression test between a baseline/reference URL, and a test environment URL. Tests the baseline URL and test URL for a 200 response before initiating the test.
By default, will test the home page /
of an environment and a/path/to/nowhere/
to force a 404.
You can add more locations to test by copying the default-paths.js
file to ./.github/tests/vrt/
(or see paths_location
option below) and renaming it template-paths.js
. See comments at the top of that file for
additional directions. Advanced scenario properties/options can be added.
baseline_url
- REQUIRED. Full URL to the "production" version of the site/project. This URL is used to create the reference set of images in the visual regression tests. It must include a trailing slash.test_url
- REQUIRED. Full URL of the pull request environment that will be tested against the baseline. It must include a trailing slash.report_results
- Optional. Should the action report the results back to the calling workflow (true) or pass/fail directly (false)? Default is false.paths_location
- Optional. Path to the template-paths.js file. Default is./.github/tests/vrt/
from the template's repository root.baseline_url_response
- Optional. The HTTP response status code we expect from the server for the baseline URL. Defaults to 200test_url_response
- Optional. The HTTP response status code we expect from the server for the test URL. Defaults to 200baseline_url_insecure
- Optional. Should we use the--insecure
flag with curl when testing the baseline URL? Defaults to falsetest_url_insecure
- Optional. Should we use the--insecure
flag with curl when testing the test URL? Defaults to false
results
- String oftrue
|false
indicating if the visual regression test passed/failed.
- name: 'Visual Regression Testing'
id: test-environment
uses: platformsh/gha-vrt
with:
baseline_url: ${{ vars.baseline-url }}
test_url: ${{ vars.target_url }}
report_results: true
- Add input for
*-paths.js
file instead of being statically named - Implement
threshold
input - Allow for overriding default viewports