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.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

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

License:MIT License


Languages

Language:JavaScript 98.8%Language:HTML 1.2%