Before in a forEach loop #20934
Answered
by
jjhelguero
Ilie-c
asked this question in
Questions and Help
-
Beta Was this translation helpful? Give feedback.
Answered by
jjhelguero
Apr 6, 2022
Replies: 1 comment 3 replies
-
It sounds like import 'cypress-each'
const array = [
['/', 'Home page'],
['/about', 'About Page'],
['/contact', 'Contact Page']
]
describe('iterate and hit each page', () => {
it.each(array)('%s page has %s header', (page, header) => {
cy.visit(page)
cy.contains('h1', header).should('be.visible')
})
}) |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
Ilie-c
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It sounds like
cypress-each
would help you out here. You'll have the visit inside theit
block and group all your tests together.