Cypress – pierwsze info

  cypress

Spoko artykuły

https://levelup.gitconnected.com/what-ive-learnt-using-cypress-io-for-the-past-three-weeks-c1597999cd2f

Grupowanie kilku warunków jednocześnie

cy.location().should((location) => {
      expect(location.hash).to.be.empty
      expect(location.href).to.eq('https://example.cypress.io/commands/location')
      expect(location.host).to.eq('example.cypress.io')
      expect(location.hostname).to.eq('example.cypress.io')
      expect(location.origin).to.eq('https://example.cypress.io')
      expect(location.pathname).to.eq('/commands/location')
      expect(location.port).to.eq('')
      expect(location.protocol).to.eq('https:')
      expect(location.search).to.be.empty
    })

Logowanie do konsoli w trybie headless

najpierw dodaj task w plugins/index.js

module.exports = (on, config) => {
  // `on` is used to hook into various events Cypress emits
  // `config` is the resolved Cypress config\

  on('task', {
    log(message) {
      console.log(message)

      return null
    }
  })
}

następnie w akcji dodaj

cy.task('log', 'Text to log in');

DOCZYTAJ O FIXTURES

cy.fixture()
cy.route('GET', 'activities/*', 'fixture:activities.json')