Use Firefox headless where appropriate.
Significantly reduce the number of external web requests made by Firefox
and Chrome during testing.
MODIFY
karma-base.js
karma-base.js
@@ -234,6 +234,8 @@ module.exports = function (config) {
flags: [
'--no-sandbox', // necessary to run tests in a docker
'--no-pings', // no auditing pings
+ '--disable-background-networking',
+ '--disable-component-extensions-with-background-pages',
'--touch-events'
]
},
@@ -242,6 +244,8 @@ module.exports = function (config) {
flags: [
'--no-sandbox', // necessary to run tests in a docker
'--no-pings', // no auditing pings
+ '--disable-background-networking',
+ '--disable-component-extensions-with-background-pages',
'--device-scale-factor=1',
'--window-position=0,0',
'--start-fullscreen',
@@ -256,25 +260,98 @@ module.exports = function (config) {
flags: [
'--no-sandbox', // necessary to run tests in a docker
'--no-pings', // no auditing pings
+ '--disable-background-networking',
+ '--disable-component-extensions-with-background-pages',
'--device-scale-factor=1',
'--window-position=0,0',
'--start-fullscreen',
'--kiosk',
'--incognito',
+ '--translate-script-url=""',
'--proxy-pac-url=' + config.protocol + '//' + config.hostname + ':' + config.port + '/testdata/proxy-for-tests.pac'
]
},
- FirefoxTouch: {
- base: 'Firefox',
+ FirefoxHeadlessTouch: {
+ base: 'FirefoxHeadless',
prefs: {
- 'dom.w3c_touch_events.enabled': 1
+ // enable touch
+ 'dom.w3c_touch_events.enabled': 1,
+ /* By default, Firefox makes many connections when it starts to
+ * sites like mozilla.org, yahoo.com, google.com, etc. This limits
+ * these connections (but doesn't eliminate them completely,
+ * especially when accessing the 2d canvas). See
+ * https://support.mozilla.org/en-US/kb/how-stop-firefox-making-automatic-connections
+ */
+ 'browser.aboutHomeSnippets.updateUrl': '',
+ 'browser.casting.enabled': false,
+ 'browser.library.activity-stream.enabled': false,
+ 'browser.newtabpage.activity-stream.enabled': false,
+ 'browser.search.geoip.url': '',
+ 'browser.selfsupport.enabled': false,
+ 'browser.selfsupport.url': '',
+ 'browser.startup.homepage_override.mstone': 'ignore',
+ 'extensions.getAddons.cache.enabled': false,
+ 'extensions.pocket.enabled': false,
+ 'extensions.update.enabled': false,
+ 'network.captive-portal-service.enabled': false,
+ 'network.dns.disablePrefetch': true,
+ 'network.http.speculative-parallel-limit': 0,
+ 'network.prefetch-next': false,
+ // these further limit firefox connections
+ 'browser.safebrowsing.provider.mozilla.gethashURL': '',
+ 'browser.safebrowsing.provider.mozilla.updateURL': '',
+ 'browser.safebrowsing.provider.google.gethashURL': '',
+ 'browser.safebrowsing.provider.google.updateURL': '',
+ 'browser.safebrowsing.provider.google4.dataSharingURL': '',
+ 'browser.safebrowsing.provider.google4.gethashURL': '',
+ 'browser.safebrowsing.provider.google4.updateURL': '',
+ 'datareporting.healthreport.uploadEnabled': false,
+ 'datareporting.policy.dataSubmissionEnabled': false,
+ 'media.gmp-gmpopenh264.autoupdate': false,
+ 'media.gmp-manager.url': ''
}
},
FirefoxWithProxy: {
- base: 'FirefoxTouch',
+ base: 'Firefox',
prefs: {
+ // enable proxy
'network.proxy.type': 2,
- 'network.proxy.autoconfig_url': config.protocol + '//' + config.hostname + ':' + config.port + '/testdata/proxy-for-tests.pac'
+ 'network.proxy.autoconfig_url': config.protocol + '//' + config.hostname + ':' + config.port + '/testdata/proxy-for-tests.pac',
+ // enable touch
+ 'dom.w3c_touch_events.enabled': 1,
+ /* By default, Firefox makes many connections when it starts to
+ * sites like mozilla.org, yahoo.com, google.com, etc. This limits
+ * these connections (but doesn't eliminate them completely,
+ * especially when accessing the 2d canvas). See
+ * https://support.mozilla.org/en-US/kb/how-stop-firefox-making-automatic-connections
+ */
+ 'browser.aboutHomeSnippets.updateUrl': '',
+ 'browser.casting.enabled': false,
+ 'browser.library.activity-stream.enabled': false,
+ 'browser.newtabpage.activity-stream.enabled': false,
+ 'browser.search.geoip.url': '',
+ 'browser.selfsupport.enabled': false,
+ 'browser.selfsupport.url': '',
+ 'browser.startup.homepage_override.mstone': 'ignore',
+ 'extensions.getAddons.cache.enabled': false,
+ 'extensions.pocket.enabled': false,
+ 'extensions.update.enabled': false,
+ 'network.captive-portal-service.enabled': false,
+ 'network.dns.disablePrefetch': true,
+ 'network.http.speculative-parallel-limit': 0,
+ 'network.prefetch-next': false,
+ // these further limit firefox connections
+ 'browser.safebrowsing.provider.mozilla.gethashURL': '',
+ 'browser.safebrowsing.provider.mozilla.updateURL': '',
+ 'browser.safebrowsing.provider.google.gethashURL': '',
+ 'browser.safebrowsing.provider.google.updateURL': '',
+ 'browser.safebrowsing.provider.google4.dataSharingURL': '',
+ 'browser.safebrowsing.provider.google4.gethashURL': '',
+ 'browser.safebrowsing.provider.google4.updateURL': '',
+ 'datareporting.healthreport.uploadEnabled': false,
+ 'datareporting.policy.dataSubmissionEnabled': false,
+ 'media.gmp-gmpopenh264.autoupdate': false,
+ 'media.gmp-manager.url': ''
}
}
},

MODIFY
package.json
package.json
"karma": "^0.13.22",
"karma-chrome-launcher": "^2.2.0",
"karma-coverage": "^1.0.0",
- "karma-firefox-launcher": "^1.0.1",
+ "karma-firefox-launcher": "^1.1.0",
"karma-jasmine": "^1.0.2",
"karma-jasmine-html-reporter": "^0.2.0",
"karma-phantomjs-launcher": "^1.0.0",
"build-website-tutorials": "node tutorials/build-website.js && webpack --config webpack-website-tutorials.config.js",
"lint": "eslint --cache .",
"puglint": "pug-lint src examples",
- "test": "GEOJS_TEST_CASE=tests/test-unit.js karma start karma-cov.conf.js --single-run --browsers ChromeHeadlessTouch,FirefoxTouch,PhantomJS",
- "test-all": "GEOJS_TEST_CASE=tests/test-unit.js karma start karma-cov.conf.js --single-run --browsers ChromeHeadlessTouch,FirefoxTouch,PhantomJS",
+ "test": "GEOJS_TEST_CASE=tests/test-unit.js karma start karma-cov.conf.js --single-run --browsers ChromeHeadlessTouch,FirefoxHeadlessTouch,PhantomJS",
+ "test-all": "GEOJS_TEST_CASE=tests/test-unit.js karma start karma-cov.conf.js --single-run --browsers ChromeHeadlessTouch,FirefoxHeadlessTouch,PhantomJS",
"start": "karma start karma.conf.js",
"glci": "GEOJS_TEST_CASE=tests/test-gl.js karma start karma-cov.conf.js --single-run --browsers ChromeHeadlessTouch",
- "glci-all": "GEOJS_TEST_CASE=tests/test-gl.js karma start karma-cov.conf.js --single-run --browsers ChromeHeadlessTouch,FirefoxTouch",
+ "glci-all": "GEOJS_TEST_CASE=tests/test-gl.js karma start karma-cov.conf.js --single-run --browsers ChromeHeadlessTouch,FirefoxHeadlessTouch",
"headedci": "GEOJS_TEST_CASE=tests/test-headed.js karma start karma-cov.conf.js --single-run --browsers ChromeWithProxy",
"headedci-all": "GEOJS_TEST_CASE=tests/test-headed.js karma start karma-cov.conf.js --single-run --browsers ChromeWithProxy,FirefoxWithProxy",
"tutorialsci": "GEOJS_TEST_CASE=tests/tutorials.js karma start karma-cov.conf.js --single-run --browsers ChromeHeadlessTouch,PhantomJS",
- "tutorialsci-all": "GEOJS_TEST_CASE=tests/tutorials.js karma start karma-cov.conf.js --single-run --browsers ChromeHeadlessTouch,FirefoxTouch,PhantomJS",
+ "tutorialsci-all": "GEOJS_TEST_CASE=tests/tutorials.js karma start karma-cov.conf.js --single-run --browsers ChromeHeadlessTouch,FirefoxHeadlessTouch,PhantomJS",
"test-webgl": "GEOJS_TEST_CASE=tests/test-gl.js karma start karma-cov.conf.js --single-run --browsers ChromeHeadlessTouch",
"test-headed": "GEOJS_TEST_CASE=tests/test-headed.js xvfb-run -s '-ac -screen 0 1280x1024x24' karma start karma-cov.conf.js --single-run --browsers ChromeWithProxy",
"codecov": "codecov",

Use Firefox headless where appropriate.

Significantly reduce the number of external web requests made by Firefox
and Chrome during testing.