Reputation: 11
I have a dynamic table displayed based on a value selected from a radio button in my project. The radio button field "Doctor Name"
field has different choices like "Frank", "Michael", "Josh", "Jessica"
. When I select the "Frank"
value, it displays a dynamic table with the list of appointments for "Frank"
, The first column in the table is "Doctor Name"
. When I select "Frank"
from the radio button, I have to validate if all the appointments listed are for "Frank"
. So I have to write coding in cypress
to check if all the first column cell values are "Frank"
.
How can I achieve this?
Upvotes: 0
Views: 1248
Reputation: 11
retrieve all the first columns using cy.get() with the proper selector, then use the each command to validate the content of each cell, something like this
cy.get("selector for first colums").each(($el, index, $list) => {
cy.wrap($el).contains('Frank')
})
Upvotes: 1