Commit 334ecea2 authored by Colin PUY's avatar Colin PUY Committed by benjaminParisel

test(e2e): launch chrome in headless mode (#474) (#477)

Launch chrome in headless mode so we don't need any GUI server anymore
Also open crhome in a fixed window size instead of maximazing it with some js.

Prepare integration to new CI
parent 372fddf0
......@@ -31,6 +31,9 @@ You can run specific e2e class test with this command line.
yarn run e2eOnly --specs=path_to_file.e2e.js
### Launch end to end tests in headless mode
yarn run e2e:headless
### Build project
yarn run build
......
......@@ -6,6 +6,7 @@
"babel-preset-bonita": "1.0.1",
"bower": "1.5.3",
"copyfiles": "^0.2.1",
"cross-env": "^5.1.4",
"glob": "4.0.6",
"grunt": "0.4.5",
"grunt-angular-gettext": "2.1.0",
......@@ -84,6 +85,7 @@
"pot": "grunt pot",
"pree2e": "webdriver-manager update --versions.standalone=3.11.0 --versions.chrome=2.38 && npm-run-all --parallel build:*",
"e2e": "node --max-old-space-size=2048 ./node_modules/grunt-cli/bin/grunt default testE2e",
"e2e:headless": "cross-env HEADLESS=true npm-run-all e2e",
"e2eOnly": "node --max-old-space-size=2048 ./node_modules/grunt-cli/bin/grunt testE2e",
"dev:serve": "grunt serve",
"dev:less": "watch --wait=1 \"npm-run-all --parallel build:*\" main/styles",
......
......@@ -97,7 +97,7 @@
</goals>
<phase>integration-test</phase>
<configuration>
<arguments>run e2e</arguments>
<arguments>run e2e:headless</arguments>
</configuration>
</execution>
</executions>
......
// A reference configuration file.
'use strict';
const capabilities = {
browserName: 'chrome',
chromeOptions: {
args: ['--window-size=1920,1080']
}
};
// activate chrome in headless mode
// see https://developers.google.com/web/updates/2017/04/headless-chrome
if (process.env.HEADLESS) {
capabilities.chromeOptions.args = capabilities.chromeOptions.args.concat([
'--headless',
// Temporarily needed if running on Windows.
'--disable-gpu',
// We must disable the Chrome sandbox when running Chrome inside Docker
'--no-sandbox'
]);
}
exports.config = {
chromeDriver: '../node_modules/webdriver-manager/selenium/chromedriver_2.38',
......@@ -10,9 +30,7 @@ exports.config = {
'e2e/**/*.e2e.js'
],
capabilities: {
'browserName': 'chrome'
},
capabilities,
baseUrl: 'http://localhost:' + (process.env.PROTRACTOR_PORT || 9002),
......@@ -39,18 +57,6 @@ exports.config = {
consolidateAll: true
}));
// maximize window - xvnc approved
setTimeout(function() {
browser.driver.executeScript(function() {
return {
width: window.screen.availWidth,
height: window.screen.availHeight
};
}).then(function(result) {
browser.driver.manage().window().setSize(result.width, result.height);
});
});
var disableNgAnimate = function() {
angular.module('disableNgAnimate', []).run(['$animate', function($animate) {
$animate.enabled(false);
......
......@@ -1662,7 +1662,14 @@ create-error-class@^3.0.0:
dependencies:
capture-stack-trace "^1.0.0"
cross-spawn@^5.0.1:
cross-env@^5.1.4:
version "5.1.4"
resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-5.1.4.tgz#f61c14291f7cc653bb86457002ea80a04699d022"
dependencies:
cross-spawn "^5.1.0"
is-windows "^1.0.0"
cross-spawn@^5.0.1, cross-spawn@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449"
dependencies:
......@@ -3606,6 +3613,10 @@ is-utf8@^0.2.0:
version "0.2.1"
resolved "https://registry.yarnpkg.com/is-utf8/-/is-utf8-0.2.1.tgz#4b0da1442104d1b336340e80797e865cf39f7d72"
is-windows@^1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d"
isarray@0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment