samedi 21 mars 2020

Cypress import spec file

I would like to import spec files to the one main test

import heroBannerTest from './hero-banner.spec'
import fabTest from './fab.spec'
import dealerLocatorTest from './dealer-locator.spec'

let urls = getUrls()
urls.forEach((url) => {
  describe(url, () => {
    it(`Visit Page`, () => {
      cy.visit(url, { timeout: 30000 })
    })
    it(`Hero Banner`, () => {
      heroBannerTest()
    })
    it(`FAB button`, () => {
      fabTest()
    })
    it(`Dealer Locator Link`, () => {
      dealerLocatorTest()
    })
  })
})

but spec file need to look like

export default function() {
  cy.get('.main-nav-list', { timeout: 3000 })
  cy.get('.main-nav-list [class^=icon-map-pin] a', { timeout: 10000 })
  .click()
  cy.get('#cms20 .results-sidebar.map-locations > ul li')
    .should('exist')
  })
}

and I can't run this test separately any1 can help ?

Aucun commentaire:

Enregistrer un commentaire