How to test if a value (here title) is in the right category with Cypress? #28407
-
I am looking for a solution to identify if a value is in the correct category and both are in the same column of a table. I only find solutions to find matching results inside a row of a table. Like this for instance:
But I found nothing to check "categories". For example a table like this: `
I want to check for instance if "title 2" is in "category 2". I do not find any approach to test if a value is in the correct category. Any ideas? Tahnk you very much. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
OK, found an example.
Case closed. |
Beta Was this translation helpful? Give feedback.
OK, found an example.
cy.get('.table1 > tbody > tr:nth-child(4) > td:nth-child(1)') .should('contain', 'title 2') // row 4 col 1 .parent('tr') // row 4 .find('td:nth-child(3)') // row 4 col 3 .should('contain', 'value 2') .parent('tr') // row 4 .prev('tr') // row 3 .find('td:nth-child(1)') // row 3 col 1 .should('contain', 'category 2')
Case closed.