Playwright Visual Testing
Integrating Playwright Visual Comparison tools with Currents - including Argos, Percy and Applitools.
Last updated
Integrating Playwright Visual Comparison tools with Currents - including Argos, Percy and Applitools.
Last updated
Playwright has a built-in support for Visual Comparisons, allowing generation of screenshots and failing a test in case reference screenshots differ from the actual ones.
Here's an example of a test that includes visual comparison:
Currents automatically detects tests with visual comparison enabled and shows a dedicated widget for the relevant tests:
While Native Playwright Visual Comparison is a good start as a basic tool, a more advanced and dedicated visual testing solution can greatly improve the effectiveness of your testing suite. Our friends at Argos offer a comprehensive, open-source (and loved) visual testing platform that takes care of the difficult parts of visual testing:
stabilization: prevent visual testing flakiness by preventing font and styling changes
test across various resolutions: ensuring every detail is captured without missing a thing
pull request comments and status checks
Argos is 100% compatible with Playwright Sharding and Currents Reporting + Orchestration, allowing effective and painless CI setup, continuous reporting, debugging with supercharged visual testing.
Argos and Currents natively support Playwright Sharding for parallel CI executions - follow the setup instructions and configure both reporters to see the visual testing artifacts reported to Argos and the rest of test results reported to Currents.
Using Argos with Playwright Orchestration requires an additional step - notifying Argos after run's completion. This is necessary because Currents Orchestration can have an arbitrary number of CI machines participating in an execution and the allocation of tests to CI machines is dynamic.
Requires @currents/playwright 1.6.0+
See the example repository which showcases using GitHub Actions with 3 parallel containers + Currents Orchestration + Argos.
You can use the same concept to send a "finalize" command to other visual testing tools like Applitools and Percy.
Applitools - refer to Closing the Batch section the Parallel Test Suites guide
Percy - refer to percy build:finalize
step in Percy documentation