Great post! 😃 Cypress is my favorite testing tool as it makes writing tests fun! It's a very satisfying feeling to see the tests happening live with cypress open.
Just a question: in the last part, are you installing Cypress during the Netlify build? I tried it once last year and it was not so good: Netlify took a long time to unzip Cypress and wouldn't cache it afterward.
Have you checked out the Cypress Netlify Build Plugin? It can also prevent a deploy if the tests are failing and it caches Cypress properly between builds.
However, my favorite approach is to run the Cypress tests in the GitHub Action, but against a branch deploy on Netlify! This is as close as we can get to the production environment and "bad" code cannot be committed to the production branch.
Thanks I just modified article as yes the Netlify plugin is really nice. Interesting approach to test it on the preview branch. How do you then check your tests are ok? wait on email if it fails or ??
I protected the master branch so that branches with GitHub Action that failed cannot be merged.
I can check the test details in the GitHub Action, but the best way is to connect the GitHub repository to the Cypress dashboard. There I can see screenshots and videos of the test runs.
Great post! 😃 Cypress is my favorite testing tool as it makes writing tests fun! It's a very satisfying feeling to see the tests happening live with
cypress open
.Just a question: in the last part, are you installing Cypress during the Netlify build? I tried it once last year and it was not so good: Netlify took a long time to unzip Cypress and wouldn't cache it afterward.
Have you checked out the Cypress Netlify Build Plugin? It can also prevent a deploy if the tests are failing and it caches Cypress properly between builds.
However, my favorite approach is to run the Cypress tests in the GitHub Action, but against a branch deploy on Netlify! This is as close as we can get to the production environment and "bad" code cannot be committed to the production branch.
I posted about it here:
Adding CI to your JAMstack with Cypress, GitHub Actions and Netlify Deploy Preview
Jérôme Pott ・ Jan 25 ・ 4 min read
Thanks I just modified article as yes the Netlify plugin is really nice. Interesting approach to test it on the preview branch. How do you then check your tests are ok? wait on email if it fails or ??
Here's an example of such a pull request: github.com/mornir/copywork-portfol...