在 Cypress 中编写了几个测试并以无头方式和有头方式在本地尝试它们(两者都工作得很好)之后,在集成过程中插入测试后,我无法让我们的 GitLab 以无头方式启动 Cypress。这似乎是一个问题:\n [FAILED] Your system is missing the dependency: Xvfb\n为什么我需要 Xvfb 在 Cypress 中运行无头测试?我已经被困在这个问题上两天了,任何帮助或想法将不胜感激。
.gitlab-ci.yml 中的测试配置:
\ntest:\n image: node:latest\n stage: test\n script:\n - npm ci\n - npm start &\n - npm test\nRun Code Online (Sandbox Code Playgroud)\npackage.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"\nRun Code Online (Sandbox Code Playgroud)\n成功通过后尝试运行测试时的 gitlab 输出npm ci
$ 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)