This is a demo application intended to help users better understand how to use Docker to test a Next.js application using Cypress.
This is a Next.js project bootstrapped with create-next-app
.
To build the Docker images and run the development server:
yarn up:dev
Open http:https://localhost:3000 with your browser to see the result.
You can start editing the page by modifying pages/index.tsx
. The page auto-updates as you edit the file.
This demo uses the cypress/included:9.2.0
image. That image comes with the 9.2.0.
version of Cypress as well as any dependencies needed.
Start by running this command in a terminal window
yarn up:ci
That will do the following:
- Create a new container with everything needed to run the Next.js app
- Create a container with Cypress installed
- Start the app and serve it at port 3000
- Run Cypress tests against the app and exit on completion
Note: This more closely simulates CI, since it exits on completion instead of allowing for continual development.
To learn more, take a look at the following resources:
- Cypress Documentation - learn about Cypress and how it helps you write faster, easier, more reliable tests.
- Cypress Docker Documentation - learn about Cypress custom images and see examples.
- Cypress CI/CD Documentation - learn how to use Cypress in your CI/CD processes.
- Next.js Documentation - learn about Next.js features and API.
- Learn Next.js - an interactive Next.js tutorial.
You can check out the cypress-docker-images GitHub repository - your feedback and contributions are welcome!