Continuously Monitor Visual Regression Tests with CircleCI + BackstopJS (Puppeteer)
We have created a tool to continuously monitor visual changes on web pages by combining CircleCI and BackstopJS.
https://github.com/silverbirder/silver-enigma
Motivation
In operating a web application, system improvements are continuously made. Before releasing these system improvements, it is necessary to pass thorough tests (unit tests, integration tests, E2E tests). However, as the scale of the web application increases, the likelihood of unintentional degradation increases. It is unclear whether the degradation is noticed by "internal pointing out" or "inquiries from end users". Therefore, we wanted a mechanism that could detect unexpected degradation early by regularly monitoring the web application.
The requirements are as follows:
- Able to schedule execution
- Can be used for free
- Easy-to-understand report of visual changes
- Easy-to-customize monitoring method
From here, the combination of CircleCI + BackstopJS (Puppeteer) was born.
Usage
You can build it in the following steps.
~ $ node -v
v12.9.1
- Set the URL you want to monitor in backstop.json
- Set the necessary environment variables in CircleCI (refer to README.md)
- Run the Job in CircleCI and view the report in Artifacts
We are making requests to the web application using Puppeteer. Therefore, it can handle needs such as "disabling Javascript" and "setting cookies".
Conclusion
With this tool, we have been able to detect changes in web applications from the outside at an early stage. However, please be careful with the scheduling interval for making requests. If you make too many requests, the load on the target web application will increase.
Share
Related tags
- Trying Out container-structure-test on a Docker Image
- Integration Testing for Next.js and DB using Testcontainers
- Trying Million Lint
- Trying the Playwright Component Test
- I want to do Document Testing with Typescript
- How to Mock tRPC Communication on Storybook with MSW
- E2E Testing with Cucumber and Screenplay Design
- Comprehensive Testing Pattern Guide for Web Frontend
- Mockable unit testing methodology completed only with BigQuery
- Trying ArchUnit with Typescript
- Investigated and Summarized Testing Perspectives for Web Apps (25 Selections)
- I want to test with Google Apps Script too! (Clasp + Typescript + Jest)
- Things to Keep in Mind When Writing Unit Tests