集成 Cypress 时 Concurse 出错。找不到赛普拉斯可执行文件

Error on Concurse while integrating Cypress. Cypress executable not found

我正在尝试将 cypress 与 concourse 集成。我指的是这些步骤。这里提到, https://notes.dmitriydubson.com/testing/e2e-testing/cypress-and-concourse/ 。但是,我收到此错误。非常感谢任何帮助。

    > cypressAutomation@1.0.0 testHeadless /tmp/build/ae3c03f4/cypressgit
> cypress run

No version of Cypress is installed in: /root/.cache/Cypress/7.3.0/Cypress

Please reinstall Cypress by running: cypress install

----------

Cypress executable not found at: /root/.cache/Cypress/7.3.0/Cypress/Cypress

----------

Platform: linux (Debian - 8.11)
Cypress Version: 7.3.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! cypressAutomation@1.0.0 testHeadless: `cypress run`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the cypressAutomation@1.0.0 testHeadless script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2022-01-03T05_27_23_867Z-debug.log

这是我的 yaml 文件。

pipeline.yml

resources:
- name: cypressgit
  type: git
  icon: github
  source:
    uri: https://github.com/Sparsh79/LearningCypress.git
    branch: master

jobs: 
- name: test
  serial: true
  plan:
  - get: cypressgit
    trigger: true
  - task: runtests
    privileged: true
    file: cypressgit/test.yml

test.yml

    platform: linux

image_resource:
  type: docker-image
  source:
    repository: ddubson/cypress-e2e

inputs:
  - name: cypressgit
outputs:
  - name: npm-output

run:
  path: /bin/bash
  args:
    - cypressgit/ci/e2e.sh

e2e.sh

    cd cypressgit/

npm run testHeadless

package.json

中的测试命令
"scripts": {
    "testHeadless": "node_modules/.bin/cypress run",
    "withHeadTest": "npm run testHeadless -- --headed",
    "chromeTest": "npm run testHeadless -- --browser chrome"
}

快速修复:如果要将作业推送完成,请修改e2e.sh文件以在容器中安装 cypress 及其依赖项:

# new e2e.sh
cd cypressgit/
apt install -y libgbm1
npx cypress install
npm run testHeadless

它会工作,但是,每次您 运行 容器时它都会重新安装 cypress。所以...

正确修复:

  1. ddubson/cypress-e2e 创建一个 docker 容器;在其上安装 cypresslibgbm1 并将其发布到 docker.
  2. test.yml 中的 repository 更新为您在 dockerhub 中新发布的容器句柄。
  3. 重运行 test又赚了!