Sample project with basic "backend" and frontend, running Cypress tests on GitHub Actions.
To run this project, you will need:
- git (I've used version
2.34.1
while writing this doc) - Node.js (I've used version
v18.15.0
while writing this doc) - npm (I've used version
9.5.0
while writing this doc)
Note: When installing Node.js, npm is automatically installed too.
Read the following doc to install and start the backend and frontend servers.
After cloning this project, to install the dev dependencies, run npm install
(or npm i
for short.)
Run npm run test:frontend:unit
to run the frontend unit tests.
Run npm run test:api:with:servers
to run the API tests.
Note: These scripts starts the required servers before-hand, and shuts them down when tests finish running.
Run npm run test:frontend:with:server
to run the UI tests in headless mode.
Note 2: This script starts the frontend server before-hand, and shuts it down when tests finish running.
Note 3: When running in headless mode, if tests fail, Cypress automatically saves screenshots of the failures at
cypress/screenshots/
.
- Run
npm run cy:open:with:servers
to open the Cypress Test Runner to run tests in interactive mode.
Note 4: This script starts the required servers before-hand, and shuts them down after the runner is closed.
- With the test runner opened, click on the test file you want to test.
Made with ❤️ by Walmyr.