I am wondering the best way to tackle this problem:
- I have multiple DOM elements that I want to iterate through, they all have the same src path aside from the character name.
- I want to validate that each src matches any player name value from an array
const playerName = ["_player_One_", "_player_two_", "_player_three_", "_player_four_"]
cy.get("myElement").each(($match) => {
cy.wrap($match).each(($el) => {
cy.get($el).should("include.attr", "src", `/foo/bar/art/all-art-${playerCharacter[]}.png`);
});
});
I recognise in it's current form, I'll be returned with the whole array output but I'm just sharing for reference the angle I'm coming from.
Any help would be appreciated, even if it's a new way to structure that I hadn't considered.
Thanks in advance!