From 9d882a011986d6b2e1ddf2e6ea4a1281a04506fc Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Thu, 16 Aug 2018 22:54:59 +0200 Subject: [PATCH] build: do not e2e tests on saucelabs (#12700) * No longer runs e2e tests inside of Saucelabs because Chrome is also installed on Travis CI and we should keep Saucelabs available for other browsers that don't run inside of Dockers or Travis. --- scripts/ci/sources/tunnel.sh | 6 ++--- scripts/ci/travis-testing.sh | 4 ++- scripts/saucelabs/sauce_config.js | 1 - test/protractor.conf.js | 41 +++++++++++-------------------- 4 files changed, 21 insertions(+), 31 deletions(-) delete mode 100644 scripts/saucelabs/sauce_config.js diff --git a/scripts/ci/sources/tunnel.sh b/scripts/ci/sources/tunnel.sh index 5256422d507..18384f56eb3 100644 --- a/scripts/ci/sources/tunnel.sh +++ b/scripts/ci/sources/tunnel.sh @@ -8,7 +8,7 @@ WAIT_RETRIES=2 start_tunnel() { case "$MODE" in - e2e*|saucelabs*) + saucelabs*) ./scripts/saucelabs/start-tunnel.sh ;; browserstack*) @@ -21,7 +21,7 @@ start_tunnel() { wait_for_tunnel() { case "$MODE" in - e2e*|saucelabs*) + saucelabs*) retryCall ${WAIT_RETRIES} ./scripts/saucelabs/wait-tunnel.sh ;; browserstack*) @@ -34,7 +34,7 @@ wait_for_tunnel() { teardown_tunnel() { case "$MODE" in - e2e*|saucelabs*) + saucelabs*) ./scripts/saucelabs/stop-tunnel.sh ;; browserstack*) diff --git a/scripts/ci/travis-testing.sh b/scripts/ci/travis-testing.sh index 9ab10831ba9..e81143ebe62 100755 --- a/scripts/ci/travis-testing.sh +++ b/scripts/ci/travis-testing.sh @@ -34,7 +34,9 @@ wait_for_tunnel if is_lint; then $(npm bin)/gulp ci:lint elif is_e2e; then - $(npm bin)/gulp ci:e2e + # Run e2e tests inside of Xvfb because we need to test the HTML Fullscreen API's that cannot + # be tested within Chrome headless. + xvfb-run -a --server-args='-screen 0, 1024x768x16' $(npm bin)/gulp ci:e2e elif is_aot; then $(npm bin)/gulp ci:aot elif is_payload; then diff --git a/scripts/saucelabs/sauce_config.js b/scripts/saucelabs/sauce_config.js deleted file mode 100644 index 52d4df6a4b3..00000000000 --- a/scripts/saucelabs/sauce_config.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = process.env.SAUCE_ACCESS_KEY.split('').reverse().join(''); diff --git a/test/protractor.conf.js b/test/protractor.conf.js index ef63197e094..3aad215c1ba 100644 --- a/test/protractor.conf.js +++ b/test/protractor.conf.js @@ -5,9 +5,9 @@ require('ts-node').register({ project: path.join(__dirname, '../e2e/') }); - const E2E_BASE_URL = process.env['E2E_BASE_URL'] || 'http://localhost:4200'; -const config = { + +exports.config = { useAllAngular2AppRoots: true, specs: [ path.join(__dirname, '../e2e/**/*.spec.ts') ], baseUrl: E2E_BASE_URL, @@ -27,34 +27,23 @@ const config = { // Exclude mat-menu elements because those are empty if not active. { id: 'aria-required-children', selector: '*:not(mat-menu)' }, - // Disable color constrast checks since the final colors will vary based on the theme. + // Disable color contrast checks since the final colors will vary based on the theme. { id: 'color-contrast', enabled: false }, ] } - ] -}; + ], -if (process.env['TRAVIS']) { - const key = require('../scripts/saucelabs/sauce_config'); + capabilities: { + browserName: 'chrome', - config.sauceUser = process.env['SAUCE_USERNAME']; - config.sauceKey = key; - config.capabilities = { - 'browserName': 'chrome', - 'version': 'latest', - 'tunnel-identifier': process.env['TRAVIS_JOB_ID'], - 'build': process.env['TRAVIS_JOB_ID'], - 'name': 'Material E2E Tests', + chromeOptions: { + // Inside of Travis, we need to specify `--no-sandbox` because otherwise Chrome cannot + // be launched properly due to insufficient permissions in a non-sudo environment. + args: process.env['TRAVIS'] ? ['--no-sandbox'] : [], + }, // Enables concurrent testing in the Webdriver. Currently runs five e2e files in parallel. - 'maxInstances': 5, - 'shardTestFiles': true, - - // By default Saucelabs tries to record the whole e2e run. This can slow down the builds. - 'recordVideo': false, - 'recordScreenshots': false - }; -} - - -exports.config = config; + shardTestFiles: true, + maxInstances: 5, + } +};