An open API service indexing awesome lists of open source software.

https://github.com/bep/netlify-cypress-test

Just a minimal repo to set up a Cypress integration test running in a GitHub Action after a successful Netlify preview build.
https://github.com/bep/netlify-cypress-test

Last synced: about 1 year ago
JSON representation

Just a minimal repo to set up a Cypress integration test running in a GitHub Action after a successful Netlify preview build.

Awesome Lists containing this project

README

          

Just a minimal repo to set up [Cypress](https://www.cypress.io/) integration tests running in a GitHub Action after a successful [Netlify](https://www.netlify.com/) 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](.github/workflows/cypress.yml). 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](https://github.com/nektos/act) locally:

```bash
act status -e test-event.json
```