Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/react-native/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Continuous integration 如何在CI(Gitlab)中运行Fullstack E2E测试_Continuous Integration_Gitlab Ci_E2e Testing_Gitlab Ci Runner - Fatal编程技术网

Continuous integration 如何在CI(Gitlab)中运行Fullstack E2E测试

Continuous integration 如何在CI(Gitlab)中运行Fullstack E2E测试,continuous-integration,gitlab-ci,e2e-testing,gitlab-ci-runner,Continuous Integration,Gitlab Ci,E2e Testing,Gitlab Ci Runner,我有一个由 -前端存储库(8) -后端存储库(Node.js/NestJS 6) 我使用Gitlab作为SCM提供程序、docker注册表和CI/CD工具。 安装、脱毛、测试(单元)和建筑已与CI配合使用 现在我想介绍我使用Cypress在前端存储库中添加的E2E测试 为了让测试有效,我需要 -运行后端(使用docker compose),包括S3模拟和DB(mongo) -将演示数据插入后端(获得了一个脚本) -运行指向后端API的前端 -运行cypress测试 我的问题是:如何在CI阶段中运

我有一个由 -前端存储库(8) -后端存储库(Node.js/NestJS 6)

我使用Gitlab作为SCM提供程序、docker注册表和CI/CD工具。 安装、脱毛、测试(单元)和建筑已与CI配合使用

现在我想介绍我使用Cypress在前端存储库中添加的E2E测试

为了让测试有效,我需要 -运行后端(使用docker compose),包括S3模拟和DB(mongo) -将演示数据插入后端(获得了一个脚本) -运行指向后端API的前端 -运行cypress测试

我的问题是:如何在CI阶段中运行包含依赖项的停靠后端,以便有一个后端实例来运行e2e测试

我已经尝试过在后台通过docker compose运行后台。这导致容器开始使用,但无法从gitlab runner容器中访问它们

这是前端回购中的一个阶段。gitlab-ci.yml:

e2e:
  image: docker:stable
  stage: e2e
  script:
    - apk add --no-cache py-pip python-dev libffi-dev openssl-dev gcc libc-dev make nodejs npm git curl
    - pip install docker-compose
    - npm install -g wait-on spa-http-server forever
    - docker-compose up -d
    - wait-on http://localhost:4000/api/ && curl -X POST http://localhost:4000/global/createDemoData
    - npm run build
    - forever start -c http-server dist/XXX/ -p 4200 --push-state
    - wait-on http://localhost:4200 && npm run e2e-ci
    - forever stopall
    - docker-compose down

你解决过这个问题吗?@mufasa如果我没记错的话,我用的是Docker GitLab runner,但它不起作用。然后,我转而直接在操作系统上安装GitLab runner,而不使用docker,并将所有端口绑定到本地机器上,最终运行正常。非常感谢,非常感谢!