Configure e2e tests for gitlab runner
- Create another Protractor config file
e2e-tests/protractor-ci.conf.js
that will be used by gitlab-runner. In this configuration we will usepuppeteer
instead of usual Chrome browser:
e2e-tests/protractor-ci.conf.js
process.env.CHROME_BIN = process.env.CHROME_BIN || require('puppeteer').executablePath();
exports.config = {
allScriptsTimeout: 11000,
specs: [
'*.js'
],
exclude: [
'*.conf.js'
],
capabilities: {
browserName: 'chrome',
chromeOptions: {
args: ['--headless', '--no-sandbox'],
binary: process.env.CHROME_BIN
}
},
baseUrl: 'http://localhost:8000/',
framework: 'jasmine',
jasmineNodeOpts: {
defaultTimeoutInterval: 30000
}
};
- Add
test-ci
andhttp-server-ci
commands topackage.json
. We need to run http server as a background process:
"scripts": {
"test": "karma start karma.conf.js",
"protractor": "protractor e2e-tests/protractor.conf.js",
"start": "http-server . -a localhost -p 8000 -c-1",
"test-ci": "karma start karma-ci.conf.js",
"protractor-ci": "protractor e2e-tests/protractor-ci.conf.js",
"http-server-ci": "http-server . -a localhost -p 8000 -c-1 &"
},
- Push changes to the repository, then you can see a new pipeline: