首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >GitLab CI Cypress E2E挂起“验证Cypress”

GitLab CI Cypress E2E挂起“验证Cypress”
EN

Stack Overflow用户
提问于 2021-02-02 16:39:04
回答 1查看 387关注 0票数 0

我正在学习如何使用GitLab CI / CD。我的示例项目是一个样板VueJS应用程序。

我有单元测试,docker构建和到注册表的推送工作,但我在Cypress e2e测试中苦苦挣扎。

e2e测试在验证cypress时挂起,并且测试永远不会结束。以下是log的输出。

代码语言:javascript
运行
复制
Running with gitlab-runner 13.8.0 (775dd39d)
  on Cypress/base:14.15.4 GGTzNUZr
Preparing the "docker" executor
00:12
Using Docker executor with image cypress/base:14.15.4 ...
Pulling docker image cypress/base:14.15.4 ...
Using docker image sha256:7bdb668124f5113a85870e35e904cda83549e6d2953493b1a3f566f63b242161 for cypress/base:14.15.4 with digest cypress/base@sha256:dad8727e107f61f48a3c6ef22cb651069cfd29fd377addcfbd7986c0a2659903 ...
Preparing environment
00:01
Running on runner-ggtznuzr-project-5-concurrent-0 via a467d812c00c...
Getting source from Git repository
00:01
Fetching changes with git depth set to 50...
Initialized empty Git repository in /builds/learning/gitlab/vuejs_devops/.git/
Created fresh repository.
Checking out 127f8b87 as master...
Skipping Git submodules setup
Executing "step_script" stage of the job script
59:46
$ npm install
> nodent-runtime@3.2.1 install /builds/learning/gitlab/vuejs_devops/node_modules/nodent-runtime
> node build.js
## Built /builds/learning/gitlab/vuejs_devops/node_modules/nodent-runtime/dist/index.js
> yorkie@2.0.0 install /builds/learning/gitlab/vuejs_devops/node_modules/yorkie
> node bin/install.js
CI detected, skipping Git hooks installation
> node-sass@4.14.1 install /builds/learning/gitlab/vuejs_devops/node_modules/node-sass
> node scripts/install.js
Downloading binary from https://github.com/sass/node-sass/releases/download/v4.14.1/linux-x64-83_binding.node
Download complete
Binary saved to /builds/learning/gitlab/vuejs_devops/node_modules/node-sass/vendor/linux-x64-83/binding.node
Caching binary to /root/.npm/node-sass/4.14.1/linux-x64-83_binding.node
> core-js@2.6.12 postinstall /builds/learning/gitlab/vuejs_devops/node_modules/@babel/runtime-corejs2/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
> core-js@3.8.3 postinstall /builds/learning/gitlab/vuejs_devops/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
> ejs@2.7.4 postinstall /builds/learning/gitlab/vuejs_devops/node_modules/ejs
> node ./postinstall.js
> cypress@3.8.3 postinstall /builds/learning/gitlab/vuejs_devops/node_modules/cypress
> node index.js --exec install
[08:07:00]  Downloading Cypress     [started]
[08:07:03]  Downloading Cypress     [completed]
[08:07:03]  Unzipping Cypress       [started]
[08:07:08]  Unzipping Cypress       [completed]
[08:07:08]  Finishing Installation  [started]
[08:07:08]  Finishing Installation  [completed]
> node-sass@4.14.1 postinstall /builds/learning/gitlab/vuejs_devops/node_modules/node-sass
> node scripts/build.js
Binary found at /builds/learning/gitlab/vuejs_devops/node_modules/node-sass/vendor/linux-x64-83/binding.node
Testing binary
Binary is fine
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/webpack-dev-server/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/watchpack-chokidar2/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/mochapack/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.1 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
added 1610 packages from 1535 contributors and audited 1617 packages in 30.945s
72 packages are looking for funding
  run `npm fund` for details
found 3 low severity vulnerabilities
  run `npm audit fix` to fix them, or `npm audit` for details
$ npm run test:unit
> cicd_test@0.1.0 test:unit /builds/learning/gitlab/vuejs_devops
> vue-cli-service test:unit
Download the Vue Devtools extension for a better development experience:
https://github.com/vuejs/vue-devtools
You are running Vue in development mode.
Make sure to turn on production mode when deploying for production.
See more tips at https://vuejs.org/guide/deployment.html
 WEBPACK  Compiling...
 DONE  Compiled successfully in 2532ms
 WEBPACK  Compiled successfully in 2532ms
 MOCHA  Testing...
  HelloWorld.vue
    ✓ renders props.msg when passed
  1 passing (24ms)
 MOCHA  Tests completed successfully
$ npm run test:e2e
> cicd_test@0.1.0 test:e2e /builds/learning/gitlab/vuejs_devops
> vue-cli-service test:e2e
 INFO  Starting e2e tests...
 INFO  Starting development server...
 DONE  Compiled successfully in 5366ms8:07:24 AM
  App running at:
  - Local:   http://localhost:8080/ 
  It seems you are running Vue CLI inside a container.
  Access the dev server via http://localhost:<your container's external mapped port>/
  App is served in production mode.
  Note this is for preview or E2E testing only.
[08:07:24]  Verifying Cypress can run /root/.cache/Cypress/3.8.3/Cypress [started]
[08:07:26]  Verifying Cypress can run /root/.cache/Cypress/3.8.3/Cypress [completed]
ERROR: Job failed: execution took longer than 1h0m0s seconds

这是我的.gitlab-ci.yml文件

代码语言:javascript
运行
复制
stages:
  - test
  - build

test:
  stage: test
  tags:
    - e2e-test
  script:
    - npm install
    - npm run test:unit
    - npm run test:e2e


docker-build:
  tags:
    - DOCKER
  image: docker:latest
  stage: build
  services:
    - docker:dind
  before_script:
    - echo $CI_BUILD_TOKEN | docker login -u "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY
  script:
    - docker build --pull -t "$CI_REGISTRY_IMAGE" .
    - docker push "$CI_REGISTRY_IMAGE"

我的GitLab运行程序使用的是docker镜像版本cypress/base:14.15.4,尽管我也尝试过cypress/base:10

EN

回答 1

Stack Overflow用户

发布于 2021-02-02 18:01:38

我解决了这个问题。我忘了我必须在无头模式下运行cypress。下面是我对.gitlab-ci.yml文件所做的更改

代码语言:javascript
运行
复制
...
test:
  stage: test
  tags:
    - e2e-test
  script:
    - npm install
    - npm run test:unit
    - npm run test:e2e --headless
...
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66006177

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档