dimanche 18 octobre 2020

How to run cypress tests with opera

In cypress documentation cypress could run chromium, so I tried to run cypress test with opera, but it's not working.connection requests always timed out.How can i fix this problem?

In my integration file, I put this. this is my test

describe('login page', () => {
    it('login', () => {
        cy.visit({url: '', failOnStatusCode: false});
        cy.get("input[name='account[email]']").type('')
        cy.get("input[name='account[password]']").type('')
        cy.get("input[name='commit']").click()
        cy.screenshot()
    })
})

this is cypress setting

// cypress/plugins/index.js
const execa = require('execa')
const findBrowser = () => {
  // the path is hard-coded for simplicity
  const browserPath =
    '/usr/bin/opera'

  return execa(browserPath, ['--version']).then((result) => {
    const ver_num = result["stdout"]
    const version = "Opera" + ver_num
    const majorVersion = ver_num.split('.')[0]

    return {
      name: 'opera',
      channel: 'stable',
      family: 'chromium',
      displayName: 'opera',
      version,
      path: browserPath,
      majorVersion
    }
  })
}

module.exports = (on, config) => {
  return findBrowser().then((browser) => {
    return {
      browsers: config.browsers.concat(browser)
    }
  })
}


Aucun commentaire:

Enregistrer un commentaire