Link Search Menu Expand Document

GithubActions: assert the latest screen captures

Install a yaml to your PJ.

mkdir -p ./.github/workflows
curl -s https://raw.githubusercontent.com/yabe-diverta/katalon2puppeteer/main/docs/misc/screen.yaml -o ./.github/workflows/screen.yaml

Next, commit & update.

git add ./.github
git commit -m "test: add tester"
git push

Now you can find the workflow created in your Github repo website. Image from Gyazo

Dispatch it manually.
Image from Gyazo

After a while,
you can find an artifact either the test is scceeded or not.
Please download it, uzip it, and open it by Chrome. Image from Gyazo

You can find a result GUI screen powered by reg-cli.
(below is the example as an error, 1 diff detected) Image from Gyazo

In the middle of the workflow,
there are several lines to take new screen captures and to compare old-new difference.
So a conclusion what the workflow does is:

  • installs dependencies
  • serves local web server (if it’s required)
  • takes new screen captures using the same test files you’ve done
  • asserts old-new compalison
  • ships a result as an artifact

Moreover,
in the head part of the workflow,
defined regular execution written as cron command,
thus this test will be dispatched every day.

Setup notification

You can even have notifications when the test are failed.
Please checkout commented out lines in screen.yml,
and setup notification with Webhook.
Please refere to slack-notify GithubActions app.