1

I've added data-cy id's to specific DOM elements in my Next/react application.

Yet, when it proceeeds to the cy.get() command it errors out with

Timed out retrying after 4000ms: Expected to find element: [data-cy=button-buy], but never found it.

Surprisingly, I can still confirm the existence of these data-cy's in my codebase when running tests with the playground selector tool in the Cypress browser, they appear on the respective page.

When I visit() these pages I don't receive any error codes, so it should be that the test is authorized to visit these pages. SO why aren't the tests able to access these specific DOM elements?

Aaron Z
  • 73
  • 1
  • 5
  • Please add the structure of the DOM element. – Alapan Das Jan 26 '22 at 12:56
  • Can you post the code of your Cypress test? – lpizzinidev Jan 26 '22 at 13:22
  • Yes, but I think it's authorization issue, I'm getting 401 errors. I can't access the url in the GET request. The thing that I'm confused about is that my login command seems to be working from before. And it also seems that I can visit the page. I just cant GET the payload from the server since I'm unauthorized. ```cy.login(EMAIL, PASSWORD).visit(`http://localhost:3000/properties/8418893f-c5a7-491a-83b4-a6a3b1980565`).get('[data-cy=button-buy]')``` – Aaron Z Jan 26 '22 at 15:30

0 Answers0