End-to-End Testing
When creating or updating a core feature in ToyNet, it is expected to update or create an e2e test for it. Cypress is used for e2e testing of ToyNet. The end-to-end tests, test the working functionality between the frontend, backend, and mininet.
Folder and File Structure
Writing an e2e Test
Cypress looks for tests in cypress/integration
directory and runs any files that match the *.spec.ts
.
If the feature being created is part of a file that is already created, simply add a new it
block to the top level describe
. If the feature is part of a brand new page, then create a new file called {page name}.spec.ts
and add a new describe
block to the top level.
Running e2e Tests
It is best to run e2e test in the same way that the app will be deployed. ToyNet uses docker containers for this.
Run
npm run start:cypress:test
to start the frontend, backend, and mininet services using docker compose.Run Cypress
To run all of the e2e tests run
npm run cy:run
this will run Cypress headless.To run individual tests run
npx cypress open
and select thespec
file to run.
Last updated