Just a minimal repo to set up Cypress integration tests running in a GitHub Action after a successful Netlify preview build.
Why not run these tests on Netlify, you ask? I tried, but there are several reasons why running these on GitHub is better:
- There are no (known) way to run tests on Netlify on the published site and fail the Netlify build.
- Setting up the Cypress environment can be a hassle -- there are ready-to-use GitHub Actions with matching Docker containers for this.
- GitHub builds are cheaper (or … more free)
See the GitHub Action workflow file. This workflow triggers on Pull Request status updates from Netlify, runs the Cypress tests when the Netlify preview is ready, and updates the PR's test status to be one of pending
, failure
or success
.
The workflow can be tested with Ack locally:
act status -e test-event.json