I'm trying to test and click the table row that appears after I type text in the input component. The table loads after delay (after getting response from external API). What woroked is using timeout that waits until certain element is loaded:
cy.get('[data-cy=searchBar]').type("Name")
cy.get('[data-cy=dataTable]').get('tbody').contains("td", "Result of name search", {timeout: 15000}).click()
So cypress waits until there is such row with given value, but the value my change and wont always be the same so is there a way to do exatcly same thing as above but selecting second row after table loads? (by default there are no items in the table)
I tried using this:
cy.get('[data-cy=searchBar]').type("Name")
cy.get('[data-cy=dataTable]').get('tbody').get("tr").eq(2, {timeout: 15000}).click()
But it seems cypress loads the table after checking for the second tr
which fails the test.