I'm using BackstopJS for regression tests and trying to implement GitHub workflow.
At first little introduction how BackstopJS works:
- We have reference images (pictures) of browser pages
- We run BackstopJS test and compare actual browser view and reference image
- Check backstop report HTML page in browser and decide which is correct actual view or reference image
- If browser view is an updated correct version, we run
backstop approve
command to rewrite reference image with new actual image
What can be implemented inside GitHub actions:
- Download reference images from S3 bucket
- Run BackstopJS test
- Save HTML report and actual browser images as artifacts
- Download HTML report stored as artifact and check if new version of images is correct
- ??? Here is a problem
Problem:
Workflow is already ended, and we don't able to approve
new images. So, is here any way to add dialog inside Pull Request if test
Action failed to be able upload new images (stored as artifacts) to S3 as new reference images? Or some way to retry failed test with new parameters (let's say it will be env AUTO_APPROVE=true
) to be able re-run test with new images approvement?
Finally, I implemented interactive workflow:
Flow runs on:
updated
)synchronize
)opened
)If PRs body has line
skip test
(cancel test
) or commits message has tag[skip test]
([cancel test]
), then test will be skippedIf PRs body has line
approve commit-SHA
(wherecommit-SHA
is a sha of a last commit in PR) or commits message has tag[approve me]
, then new reference bitmaps will be createdapprove
line is present in PR, only one test with new reference images will be runapprove
tag is present in commit message, two tests will be run (before and after approvement) and two reports will be savedReference images are uploaded/downloaded/stored from/to/in S3 bucket