I'm testing a search functionality that filters the entered characters against users' Firstname, Lastname, role, or email.
I have a table with multiple tr and each tr has multiple td.
I want to assert that the returned rows contain a value in any td that matches the entered keyword.
I created the below helper function but cy.get('td').contains(searchKeyword); causes the browser to hang up. any idea what could be the solution here.
assertCorrectFilterResults(searchKeyword: string) {
this.elements.tableBody().find("tr").then(rows => {
rows.toArray().forEach(row => {
cy.get('td').contains(searchKeyword);
})
});
};
My helper was inspired from the solution mentioned here How to get the total number of Rows in a table | Cypress
