首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在gitlab上运行角e2e测试时的误差

在gitlab上运行角e2e测试时的误差
EN

Stack Overflow用户
提问于 2017-11-28 23:55:09
回答 1查看 2K关注 0票数 0

在运行e2e测试时,我的gitlab服务器上出现了一个不太有意义的错误。

代码语言:javascript
复制
[22:40:18] I/launcher - Running 1 instances of WebDriver
[22:40:18] I/local - Starting selenium standalone server...
[22:40:18] E/launcher - Error: Error: Server terminated early with status 1
    at earlyTermination.catch.e (/selenium-webdriver/remote/index.js:252:52)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
[22:40:18] E/launcher - Process exited with error code 100
npm ERR! code ELIFECYCLE
npm ERR! errno 100
npm ERR! guide-scanner-web@0.0.0 e2e-ci: `ng e2e --conf protractor-ci.conf.js`
npm ERR! Exit status 100
npm ERR! 
npm ERR! Failed at the guide-scanner-web@0.0.0 e2e-ci script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2017-11-28T22_40_19_015Z-debug.log
ERROR: Job failed: exit code 1

这是protractor.conf.js

代码语言:javascript
复制
const { SpecReporter } = require('jasmine-spec-reporter');

exports.config = {
  allScriptsTimeout: 11000,
  specs: [
    './e2e/**/*.e2e-spec.ts'
  ],
  capabilities: {
    'browserName': 'chrome',
    'chromeOptions': {
      args: ["--headless", '--no-sandbox', "--disable-gpu", "--window-size=800x600"]
    }
  },
  chromeDriver: '/selenium-grid/chromedriver_2.33',
  seleniumServerJar: "/selenium-grid/selenium-server-standalone-3.7.1.jar",
  baseUrl: 'http://localhost:4200/',
  framework: 'jasmine',
  jasmineNodeOpts: {
    showColors: true,
    defaultTimeoutInterval: 30000,
    print: function() {}
  },
  onPrepare() {
    require('ts-node').register({
      project: 'e2e/tsconfig.e2e.json'
    });
    jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
  }
};

在我的实验室工作

代码语言:javascript
复制
before_script:
  - npm install

e2e:
  stage: testing
  script:
    - apt-get update -y
    - apt-get install default-jre -y
    - npm install -g webdriver-manager
    - webdriver-manager update --out_dir /selenium-grid
    - npm run e2e

这是我的package.json:

  • @角/语言-服务“:"^5.0.0”
  • @类型/茉莉花:"~2.5.53“
  • “@type/jasminewd2 2”:"~2.0.2“
  • @类型/节点:"~6.0.60“
  • “代码”:"~3.2.2“
  • “茉莉花核”:"~2.6.2“
  • “茉莉花-规格-记者”:"~4.1.0“
  • “业力”:"~1.7.0“
  • “业力-铬发射器”:"~2.1.1“
  • “因果报应”:"~1.0.1“
  • “业力-报道-伊斯坦布尔-记者”:"^1.2.1“
  • “业力-茉莉花”:"~1.1.0“
  • “业力-茉莉花-html-记者”:"^0.2.2“
  • “量角器”:"~5.1.2“
  • “ts-节点”:"~3.2.0“
  • "tslint":"~5.7.0“
  • “打字本”:"~2.4.2“

我在建立CI上已经挣扎了一段时间,所以任何建议都会非常感谢^^。

EN

回答 1

Stack Overflow用户

发布于 2018-05-31 10:50:23

只需使用图像与无头铬预装。下面是我的Gitlab管道脚本:

代码语言:javascript
复制
cache:
  paths:
    - node_modules/

before_script:
  - npm cache clean --force
  - npm install && npm rebuild

stages:
  - test
  - build


build:
  image: node:alpine
  stage: build
  script:
    - ./node_modules/@angular/cli/bin/ng build --prod

test:
  image: gnomeontherun/docker-node-chrome-headless:latest
  stage: test
  script:
    - ./node_modules/@angular/cli/bin/ng test --watch=false --single-run=true
票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/47542910

复制
相关文章

相似问题

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