1

我正在尝试将柏树与大厅整合在一起。我指的是这些步骤。这里提到,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 文件。

管道.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

测试.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"
}
4

1 回答 1

1

快速修复:如果您想推动作业完成,请修改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. repository将in更新为test.ymldockerhub 中新发布的容器句柄。
  3. 重新运行test并获利!
于 2022-01-09T01:33:50.660 回答