Skip to content
Discussion options

You must be logged in to vote

It's not possible to re-use the it however you could pull out the logic into a re-usable function that is shared between tests or you could dynamically create these cases if it helped clean things up for you.

describe('nested tabs', ()=> {
  ;[
      { name: 'primary', tabs: primaryTabs},
      { name: 'second', tabs: secondTabs},
   ].forEach(({ name, tabs }) => {
        it(`switches ${name} tabs`, () => {
             tabs.forEach((t) => {
                 cy.contains(t).click();
             })
         })
    })
})

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@iamyoki
Comment options

Answer selected by iamyoki
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants