Cypress Testing 2

The 11ty logo

Upgrading Our Testing

When we left off we had set up cypress testing. Our test was against our live site and was testing at the point of our pr (if we had recorded the test).

Our goal however is to test our code before it goes live, which is probably more useful.

So back to our cypress docs. This describes what we want to do pretty accurately.

What we need to do is add a github action here: .github/workflows/main.yml

You can see our action takes three steps, first checkout as described by the cypres docs.

Step two:

uses: bahmutov/npm-install@v1
      useLockFile: false

This is the part that I was erroring on the most, what this is doing is installing our sites node packages. This allows the build to use the site for testing. I referenced this codebase to find an example that better fit my need.

Step three runs the cypress tests that we have defined.

Here is what the successful test looks like in github:
Cypress Test
You can see that the tasks defined in our actions reflected here, and importantly that it passed.

Ok, so now we have a way to test our code, against a temporary site pre merge. Now we can start expanding our testing.