Action during Cypress multiple click

Viewed 136

Is it possible to make some verification on several elements after click() with option {multiple:true}?

I have to check text after each click on several buttons with the same selector. What I want to do:

cy.get(".copy-button").click({multiple: true}).then(() => {
    cy.get(".tooltip-name").should('contain', 'Copied successfully!')
]);
1 Answers

You can do with each(), something like:

cy.get('.copy-button').each(($ele) => {
  cy.wrap($ele).click()
  cy.get('.tooltip-name')
    .should('be.visible')
    .and('contain', 'Copied successfully!')
})
Related