-
Notifications
You must be signed in to change notification settings - Fork 4
Testing
Jonathan Flynn edited this page May 13, 2022
·
7 revisions
End to end testing was added in this PR: https://github.com/guardian/manage-frontend/pull/790. The description of the PR states the benefits of using Cypress and the current state of how we are mocking data and application state.
The steps to run these tests correctly are defined in the yml file: https://github.com/guardian/manage-frontend/blob/main/.github/workflows/cypress.yml
- Run
yarn cypress:server
(this bypasses the Identity Gateway) - Run
yarn cypress:open
to test visually locally, or runyarn cypress:run
to run tests with command line coverage
-
cy.getByText()
fails if it can't find anything whereascy.findByText()
queries the DOM, but won't fail the test if nothing is found. Adding an extra function like.should('exist')
is therefore necessary. - Use
cy.get('@api_call.all').should('have.length', 1);
to determine how many times an endpoint was called during a test run.
Not what you're looking for? Be sure to use the navigation sidebar on the right. ➡️