小编pet*_*pko的帖子

Cypress/GitLab CI/CD 集成 - Cypress 不会在无头模式下启动

在 Cypress 中编写了几个测试并以无头方式和有头方式在本地尝试它们(两者都工作得很好)之后,在集成过程中插入测试后,我无法让我们的 GitLab 以无头方式启动 Cypress。这似乎是一个问题:\n [FAILED] Your system is missing the dependency: Xvfb\n为什么我需要 Xvfb 在 Cypress 中运行无头测试?我已经被困在这个问题上两天了,任何帮助或想法将不胜感激。

\n

.gitlab-ci.yml 中的测试配置:

\n
test:\n  image: node:latest\n  stage: test\n  script:\n    - npm ci\n    - npm start &\n    - npm test\n
Run Code Online (Sandbox Code Playgroud)\n

package.json 中的相关行:

\n
"start": "ng serve --proxy-config proxy.conf.json --port 4222 -o"\n"test": "cypress run --spec cypress/integration/test_zber/test.spec.js"\n
Run Code Online (Sandbox Code Playgroud)\n

成功通过后尝试运行测试时的 gitlab 输出npm ci

\n
$ npm start &\n$ npm test\n> sdcl@0.1.30 start\n> ng serve --proxy-config proxy.conf.json --port 4222 -o\n> sdcl@0.1.30 test\n> cypress …
Run Code Online (Sandbox Code Playgroud)

gitlab cypress

6
推荐指数
1
解决办法
8876
查看次数

标签 统计

cypress ×1

gitlab ×1