Vue.js Cypress E2E使用GitLab Runner测试VueJS返回404未找到

Vue.js Cypress E2E使用GitLab Runner测试VueJS返回404未找到,vue.js,cypress,gitlab-ci-runner,Vue.js,Cypress,Gitlab Ci Runner,我有以下简单的GitLab CI文件 stages: - e2e_test e2e_test: stage: e2e_test tags: - test script: - npm config set strict-ssl false - npm install - npm run test:e2e:ci 出于非常具体的公司原因,我在shell运行程序中运行上述脚本 此脚本导致以下日志出现404错误 npm run test:e2e:ci

我有以下简单的GitLab CI文件

stages:
  - e2e_test

e2e_test:
  stage: e2e_test
  tags:
    - test
  script:
    - npm config set strict-ssl false
    - npm install
    - npm run test:e2e:ci
出于非常具体的公司原因,我在shell运行程序中运行上述脚本

此脚本导致以下日志出现404错误

 npm run test:e2e:ci
> todo-app@0.1.0 test:e2e:ci /home/gitlab-runner/builds/UHz6XzwM/0/microservices-and-cognitive-solutions/demos/microservice-concept/todo-app
> vue-cli-service test:e2e --headless
 INFO  Starting e2e tests...
 INFO  Starting development server...
 DONE  Compiled successfully in 8865ms6:51:36 PM
  App running at:
  - Local:   http://localhost:8083/ 
  - Network: http://10.108.201.150:8083/
  App is served in production mode.
  Note this is for preview or E2E testing only.
====================================================================================================
  (Run Starting)
tput: No value for $TERM and no -T specified
  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ Cypress:    3.8.3                                                                              │
  │ Browser:    Electron 78 (headless)                                                             │
  │ Specs:      1 found (test.js)                                                                  │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘
────────────────────────────────────────────────────────────────────────────────────────────────────
                                                                                                    
  Running:  test.js                                                                         (1 of 1)
Browserslist: caniuse-lite is outdated. Please run the following command: `npm update`
  My First Test
    1) Visits the app root url
  0 passing (341ms)
  1 failing
  1) My First Test Visits the app root url:
     CypressError: cy.visit() failed trying to load:
http://localhost:8083/
The response we received from your web server was:
  > 404: Not Found
This was considered a failure because the status code was not '2xx'.
If you do not want status codes to cause failures pass the option: 'failOnStatusCode: false'
      at Object.cypressErr (http://localhost:8083/__cypress/runner/cypress_runner.js:86207:11)
      at Object.throwErr (http://localhost:8083/__cypress/runner/cypress_runner.js:86162:18)
      at Object.throwErrByPath (http://localhost:8083/__cypress/runner/cypress_runner.js:86194:17)
      at http://localhost:8083/__cypress/runner/cypress_runner.js:71493:31
      at visitFailedByErr (http://localhost:8083/__cypress/runner/cypress_runner.js:71006:12)
      at http://localhost:8083/__cypress/runner/cypress_runner.js:71474:22
      at tryCatcher (http://localhost:8083/__cypress/runner/cypress_runner.js:120203:23)
      at Promise._settlePromiseFromHandler (http://localhost:8083/__cypress/runner/cypress_runner.js:118139:31)
      at Promise._settlePromise (http://localhost:8083/__cypress/runner/cypress_runner.js:118196:18)
      at Promise._settlePromise0 (http://localhost:8083/__cypress/runner/cypress_runner.js:118241:10)
      at Promise._settlePromises (http://localhost:8083/__cypress/runner/cypress_runner.js:118316:18)
      at Async../node_modules/bluebird/js/release/async.js.Async._drainQueue (http://localhost:8083/__cypress/runner/cypress_runner.js:114928:16)
      at Async../node_modules/bluebird/js/release/async.js.Async._drainQueues (http://localhost:8083/__cypress/runner/cypress_runner.js:114938:10)
      at Async.drainQueues (http://localhost:8083/__cypress/runner/cypress_runner.js:114812:14)

如果我在同一台服务器上克隆了同一个存储库,并在终端上手动运行以下命令,则效果良好

npm install
npm run test:e2e:ci

知道为什么同样的命令在GitLab runner shell中失败,但在用户shell中工作吗?我找到了解决问题的方法。我需要在gitlab runner config.toml文件中设置一个no_代理环境条目。这不会影响到所有人,但因为我是公司代理的幕后黑手,所以我需要它

export no_proxy="localhost"