Skip to content

Instantly share code, notes, and snippets.

@rubysolo
Created September 30, 2024 23:38
Show Gist options
  • Save rubysolo/562dcf9b5994b8e0f3df74f968272dce to your computer and use it in GitHub Desktop.
Save rubysolo/562dcf9b5994b8e0f3df74f968272dce to your computer and use it in GitHub Desktop.
Debug multiple Cypress matches
cy.document().then(doc => {
let $style = doc.createElement("style");
$style.innerHTML = ".highlighted-element { background-color: yellow; }";
doc.head.appendChild($style);
});
cy.get('SOME-SELECTOR')
.each(($el, index) => {
cy.wrap($el).invoke('addClass', `highlighted-element`);
cy.pause();
cy.wrap($el).invoke('removeClass', `highlighted-element`);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment