Testing with Cypress


Uncategorized

Updated Dec 8th, 2021

Official site is cypress.io with docs here.

Some notes from leerob video

E2E tests with Cypress (npm install cypress @testing-library/cypress -D then run “cypress open” and also add the commands)

*cypress testing is super fast!

describe()
it()
cy.visit()
cy.findByRole.type()
cy.findByRole.check()
cy.findByText()
.should()
.to.equal

In cypress can click “data-test” attribute which is the last resort but useful for highly dynamic data, (balance info).

“testing playground” chrome extension that helps you suggest queries you can copy/paste.

To use a unique note/id with uuidv4 in testing to avoid having the same text in your DB every time you run your tests.

May get error if element is not in view, scrollIntoView. Force cypress to click a button not in view with {force: true}


Top