如何在 CI 中安装 chrome for cypress

fav*_*red 6 jenkins cypress

我编写了一些 cypress 测试,并使用 Electron 浏览器在 CI 上运行。我想使用 chrome 浏览器在 Jenkins 中运行这些测试。下面是我如何设置 cypress 在 Jenkins 中运行。

            stage("Setup Cypress") {
                echo "SETUP CYPRESS"
                sh "curl --fail https://chromium-blinger.cf.berw-agb-01.cloud.uk.aeee/cypress-4.2.0-linux64.zip > cypress.zip"
                sh "CYPRESS_INSTALL_BINARY=${workspacePath}/${env.repositoryFolder}/cypress.zip npm install cypress && npm run cypress:verify"
            }
Run Code Online (Sandbox Code Playgroud)

CYPRESS_BASE_URL=$ABGENV CYPRESS_ENV=development cypress run --browser chrome **/*.features

我在控制台中遇到的错误如下:

Can't run because you've entered an invalid browser name.

Browser: 'chrome' was not found on your system.

Available browsers found are: electron
Run Code Online (Sandbox Code Playgroud)

Sow*_*mya 0

在 CI 中运行时,我总是更喜欢使用 docker 镜像。这解决了我有关浏览器的问题。

代理 { docker { image 'cypress/base:10' } }