site-kit-wp: VRT tests cannot be run on ARM Macs/M1 Macs
Bug Description
Using an ARM/M1 Mac, running npm run test:visualtest will fail with an error because the Docker image for Backstop is not configured to run an ARM64 image. It will segfault and fail. If you are on a machine that you migrated from an Intel Mac, it will then open whatever previous results you ran in your project folder.
Until BackstopJS provides a fully-integrated solution (see: https://github.com/garris/BackstopJS/issues/1300), we will need to update our codebase to allow the VRTs to run on ARM Macs, as several core team members are using these machines and can’t run (and thus can’t update) the VRTs locally.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- It should be possible to run the VRT (Visual Regression Tests) using
npm run test:visualtestlocally on both Intel and ARM machines. It would be preferable if these could be run on ARM without needing to create any custom images/etc. locally.
Implementation Brief
- Create a custom Docker image based on the one in this comment: https://github.com/google/site-kit-wp/issues/4619#issuecomment-1201808910
- It should be noted this image let me run the VRTs on macOS after updating Docker to use at least 4 CPU cores. This might need to be added to the docs or a script to detect CPUs available to Docker. 🤔
- Publish the image to GitHub Packages so CI and team members can use the image
- Ensure the BackstopJS code uses our new
googlesitekit/vrt:VERSIONimage instead ofbackstopjs/backstopjs:VERSION - Update reference images in case of any minor/font differences
- Ensure tests run on ARM and Intel macs do not differ; ensure CI tests still pass after being updated by an ARM-based Mac.
Test Coverage
- VRT reference images will likely need updating after this change.
QA Brief
- No QA needed.
Changelog entry
- Update Visual Regression test code to run on ARM-based Macs.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 3
- Comments: 16
Creating a custom Docker image using this
Dockerfile:And then building it and using that image, along with ensuring Docker for Mac could use at least 4 CPUs let me run the VRTs. Without upping the CPU limit to at least 4, it would hang:
Another update: looks like Puppeteer will soon have an ARM build, there’s a PR here: https://github.com/puppeteer/puppeteer/pull/7546 and the issue is here: https://github.com/puppeteer/puppeteer/issues/6622.
Waiting a bit longer on this one as the workarounds aren’t working for me…