如何用Opera进行赛普拉斯测试

时间:2020-10-19 04:48:14

标签: javascript testing cypress

在cypress文档中,它说cypress可以在铬上运行,所以我试图用Opera运行cypress测试,但是它不起作用。当我将yarn cypress run --browser opera放在终端上时,它总是超时。如何使用Opera进行赛普拉斯测试?

这是我的考验

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()
    })
})

这是柏树设置

// 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)
    }
  })
}


0 个答案:

没有答案