Below is a step & datatable in my Cypress / Cucumber test:
And Results per page drop down has the below options
| 10 |
| 50 |
| 80 |
| 100 |
| 150 |
In my test, I want to loop through the options inside a select control, & validate the option values match the above values.
Below is my step defintion code.
And('Results per page drop down has the below options', (dataTable) => {
dataTable.rawTable.forEach(($ele) => {
cy.log($ele.toString());
});
cy.get('[id=mat-select-2-panel]').find('.mat-option').each(($el, index, $list) => {
cy.log($el.text());
});
});
I've been able to loop through the datatable & loop through the option's, but I want to know how can I merge the above code so that I can compare each option value against the datatable.
Can someone please tell me how I can do this, & what changes to my code are required.