baseUrl не найден при запуске кипарисовых тестов через gitlab-ci - PullRequest
0 голосов
/ 04 мая 2020

У меня недавно были giltab-ci и кипарис, и я пытаюсь проверить кипарис-тесты с помощью gitlab-ci, в настоящее время у меня есть сценарий gitlab-ci.yml:

image: docker:latest

services:
  - docker:dind

variables:
  npm_config_cache: "$CI_PROJECT_DIR/.npm"
  CYPRESS_CACHE_FOLDER: "$CI_PROJECT_DIR/cache/Cypress"

stages:
  - build
  - test

cache:
  paths:
  - .npm
  - cache/Cypress
  - node_modules

install:
  image: cypress/base:12.16.1
  stage: build
  script:
  - npm ci
  - $(npm bin)/cypress cache path
  - $(npm bin)/cypress cache list
  - $(npm bin)/cypress verify

cypress-e2e:
  stage: test
  image: cypress/base:12.16.1
  script:
  - $(npm bin)/cypress run

  artifacts:
    paths:
    - cypress/screenshots
    - cypress/videos
    expire_in: 1 day

test:e2e:
  stage: test
  image: cypress/browsers:chrome67
  script:
  - $(npm bin)/cypress run --browser chrome
  artifacts:
    paths:
    - cypress/screenshots
    - cypress/videos
    expire_in: 1 day

и как у меня as cypress. json:

{
  "baseUrl": "http://localhost:3000"
}

К сожалению, конвейер gitlab выдает следующую ошибку при попытке запустить мои тесты Cypress:

Cypress could not verify that this server is running:
   > http://localhost:3000
 We are verifying this server because it has been configured as your `baseUrl`.
 Cypress automatically waits until your server is accessible before running tests.
 We will try connecting to it 3 more times...
 We will try connecting to it 2 more times...
 We will try connecting to it 1 more time...
 Cypress failed to verify that your server is running.
 Please start this server and then run Cypress again.

1 Ответ

1 голос
/ 04 мая 2020

К вашему сведению сообщение об ошибке отличается Please start this server and then run Cypress again. Проблема в том, что вы запускаете свои тесты без запуска приложения внутри docker! Таким образом, вам нужно переконфигурировать ваш файл * .yml и добавить команду в соответствии с вашим способом запуска приложения, например npm start

...