运行e2e测试时,我的gitlab CI服务器上出现了一个非常有意义的错误。
[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
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 } }));
}
};
我的gitlab-ci.yml中的工作原理
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:
我一直在努力设置CI一段时间,所以任何建议都会非常感激^^'
答案 0 :(得分:0)
只需使用预装无头镀铬的图像。这是我的Gitlab管道脚本:
joblib