From abc3226e33a0c2d958fa1844d75c8cf9c78e9f98 Mon Sep 17 00:00:00 2001 From: Matthew Amato Date: Mon, 23 Jul 2018 22:09:28 -0400 Subject: [PATCH 1/2] Use Chrome Headless instead of Electron Since Chrome added an officially supported headless mode, there's no reason to use Electron for our unit tests. This will be both more accurate (uses actual Chrome) and also gets rid of the rather large Electron dependency. WebGL is disabled in headless, so we only use headless on CI (because we also disable webGL tests there). When running locally, it just shows an actual Chrome window. Chrome has an issue and plans to address this: https://bugs.chromium.org/p/chromium/issues/detail?id=765284 --- .travis.yml | 6 ++++-- Specs/karma.conf.js | 10 ++++++++-- package.json | 2 -- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 77bf18d47eff..8adb1b96de6f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,8 @@ language: node_js node_js: - "8" sudo: false +addons: + chrome: stable before_script: - export DISPLAY=:99.0 - sh -e /etc/init.d/xvfb start @@ -17,7 +19,7 @@ script: - echo 'test webgl-stub' && echo -en 'travis_fold:start:script.test\\r' - npm run build - - npm run test -- --browsers Electron --webgl-stub --failTaskOnError --suppressPassed + - npm run test -- --browsers ChromeCI --webgl-stub --failTaskOnError --suppressPassed - echo -en 'travis_fold:end:script.test\\r' - echo 'makeZipFile' && echo -en 'travis_fold:start:script.makeZipFile\\r' @@ -36,7 +38,7 @@ script: - echo -en 'travis_fold:end:script.deploy\\r' - echo 'test webgl-stub release' && echo -en 'travis_fold:start:script test.release\\r' - - npm run test -- --browsers Electron --failTaskOnError --webgl-stub --release --suppressPassed + - npm run test -- --browsers ChromeCI --failTaskOnError --webgl-stub --release --suppressPassed - echo -en 'travis_fold:end:script test.release\\r' - echo 'test node' && echo -en 'travis_fold:start:script test.node\\r' diff --git a/Specs/karma.conf.js b/Specs/karma.conf.js index d0122212f53d..f87b21c136ad 100644 --- a/Specs/karma.conf.js +++ b/Specs/karma.conf.js @@ -64,8 +64,14 @@ module.exports = function(config) { // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher browsers : ['Chrome'], - electronOpts : { - show : false + //In Travis, we need to run with the no-sandbox flag + customLaunchers: { + ChromeCI: { + base: 'ChromeHeadless', + flags: [ + '--no-sandbox' + ] + } }, browserNoActivityTimeout : 30000, diff --git a/package.json b/package.json index 7da4eccc80a2..34224906fe00 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,6 @@ "cloc": "^2.3.3", "compressible": "^2.0.9", "compression": "^1.6.2", - "electron": "^1.6.1", "eslint": "^4.0.0", "eslint-plugin-html": "^4.0.2", "event-stream": "^3.3.4", @@ -58,7 +57,6 @@ "karma-chrome-launcher": "^2.0.0", "karma-detect-browsers": "^2.2.3", "karma-edge-launcher": "^0.4.2", - "karma-electron": "^5.1.1", "karma-firefox-launcher": "^1.0.0", "karma-ie-launcher": "^1.0.0", "karma-jasmine": "^1.1.0", From 0348410a98ae62947cbba23b215b7569a50db99a Mon Sep 17 00:00:00 2001 From: Hannah Date: Wed, 25 Jul 2018 10:59:19 -0400 Subject: [PATCH 2/2] update testing doc --- Documentation/Contributors/TestingGuide/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/Contributors/TestingGuide/README.md b/Documentation/Contributors/TestingGuide/README.md index b562a0dc00eb..1b65891942d6 100644 --- a/Documentation/Contributors/TestingGuide/README.md +++ b/Documentation/Contributors/TestingGuide/README.md @@ -758,7 +758,7 @@ You can run or debug the tests by using the first two buttons. The third button This runner has lots of options, such as only showing failing tests or automatically re-running the tests on a test interval (great for development when combined with `fdefineSuite`!). You can hover over each of the buttons to see what they do. -Instead of using Chrome or Firefox, the WebStorm configuration uses [Electron](https://github.com/atom/electron) as the browser, which runs V8 (Chrome) inside of a node process. We have configured it to run headless so that no browser window pops up while testing. If you ever have a need to run a specific browser from within WebStorm, simply click the `Run tests` combo box and select `edit configuration`. From there it's self-explanatory.' +The WebStorm configuration uses Chrome Headless as the browser, which runs Chrome inside of a node process and no browser window pops up while testing. If you ever have a need to run a specific browser from within WebStorm, simply click the `Run tests` combo box and select `edit configuration`. From there it's self-explanatory.' To make jumping between the source and spec files easier download the [Cesium WebStorm plugin](https://github.com/AnalyticalGraphicsInc/cesium-webstorm-plugin).