Merge "WebdriverIO should be able to run Chrome headlessly"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 10 Apr 2018 16:39:17 +0000 (16:39 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 10 Apr 2018 16:39:17 +0000 (16:39 +0000)
tests/selenium/README.md
tests/selenium/wdio.conf.js

index 2dbf271..b15d407 100644 (file)
@@ -21,6 +21,11 @@ Set up MediaWiki-Vagrant:
 
     npm run selenium
 
+By default, Chrome will run in headless mode. If you want to see Chrome, set DISPLAY
+environment variable to any value:
+
+    DISPLAY=:1 npm run selenium
+
 To run only one file (for example page.js), you first need to spawn the chromedriver:
 
     chromedriver --url-base=wd/hub --port=4444
index 5565bc3..7b74328 100644 (file)
@@ -80,9 +80,10 @@ exports.config = {
                maxInstances: 1,
                //
                browserName: 'chrome',
-               // Since Chrome v57 https://bugs.chromium.org/p/chromedriver/issues/detail?id=1625
                chromeOptions: {
-                       args: [ '--enable-automation' ]
+                       // Run headless when there is no DISPLAY
+                       // --headless: since Chrome 59 https://chromium.googlesource.com/chromium/src/+/59.0.3030.0/headless/README.md
+                       args: process.env.DISPLAY ? [] : [ '--headless' ]
                }
        } ],
        //