I have a function which returns array
getOffersCategories() {
cy.get(offersHeaders).then($els => {
cy.wrap(Cypress._.map(Cypress.$.makeArray($els), 'innerText')).as("categories")
})
return this;
}
Now I need to call this function and use array with forEach block having multiple test cases (something like this)
offersCategories.forEach((item, index) => {
it("Validate Max Carousels Limit, Left Right Swipe, See All link of " + item, function ()
{
...
}
})
For me it works fine if I array value is declared in same spec file Like var offersCategories = ["a", "b",c"] or fetched from fixtures, but not finding any way to use the same functionality when array details fetched from function.
Thanks in advance :)