I recommend using Cypress Testing Library to extend the commands cypress can use. I very rarely use cy.get and instead use the commands that Cypress Testing Library gives you.
You can do things like cy.findByPlaceholderText, cy.findByText, or cy.findByTestId for hard to grab elements. And retries are built in if I remember correctly.
If you have more than one element that matches you can just add All after the find, for example cy.findAllByText and if you want to grab the first you'd do cy.findAllByText("hello button").eq(0).click()
I recommend using Cypress Testing Library to extend the commands cypress can use. I very rarely use
cy.get
and instead use the commands that Cypress Testing Library gives you.You can do things like
cy.findByPlaceholderText
,cy.findByText
, orcy.findByTestId
for hard to grab elements. And retries are built in if I remember correctly.If you have more than one element that matches you can just add
All
after the find, for examplecy.findAllByText
and if you want to grab the first you'd docy.findAllByText("hello button").eq(0).click()
testing-library.com/docs/cypress-t...