We have written numerous end-to-end (E2E) Cypress tests to validate that our web applications still work as expected with the backend. After writing these browser automation tests, we would still like these Cypress tests to run or be triggered in some way like our unit tests before merging the code and deploying it to certain environments. This led us to want to run our Cypress tests in a Docker container to integrate with our Continuous Integration (CI) provider and the machines we use in the cloud to run those containers. For deployment streams, we use Buildkite as our CI provider. This allows us to generate an automated step build for our application in a Buildkite pipeline when we plan to move code across tiers.
For more context, a pipeline is a place usually tied to an application's repository where we can review builds or trigger builds with certain steps to run when you create pull requests, push new code changes, merge code to master and deploy in different environments. . We create multiple pipelines for separate purposes, such as deployment, triggered Cypress tests, and specific Cypress tests run on a schedule. This blog post assumes that you have already job title email list written Cypress tests and have some tests running, but want ideas on how to run these tests continuously in your development and deployment workflows . If you want an overview of writing Cypress tests instead, you can check out this previous blog post and then come back to it when you have something to run. Our goal is to walk you through how to integrate Cypress testing into a Docker container with your
CI vendor by looking at how we've done it with Docker Compose and Buildkite in our deployment pipeline. These ideas can be expanded into your framework for policies, commands, and environment variables to apply when triggering Cypress tests. Our standard CICD flow In our standard development and deployment flow, we have configured two pipelines: The first manages our deployment steps when we push the code. The second triggers the parallel execution of our Cypress tests and their recording. The success or failure of this operation affects the deployment pipeline. In our deployment pipeline, we develop our web application assets, run unit tests, and have steps to trigger selected Cypress tests before deployment to each environment. We make sure they succeed before we remove the ability to deploy a push button. These Cypress tests triggered in the second pipeline also run in a Docker container and are connected to the paid