From 5a7410dfd38fc037ec49601dbe5cd3a49a327687 Mon Sep 17 00:00:00 2001 From: Jamie Stackhouse Date: Wed, 28 Aug 2019 15:37:18 -0300 Subject: [PATCH] Addressing PR feedback from Tom. Also a test of the travis.dev domain for local. --- .travis.yml | 2 +- tests/functional/auto/setup.js | 42 +++++++++++++++++----------------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/.travis.yml b/.travis.yml index 87189d24597..df9f8ee0805 100644 --- a/.travis.yml +++ b/.travis.yml @@ -71,6 +71,6 @@ jobs: env: TRAVIS_MODE=funcTests UA=safari OS="OS X 10.11" UA_VERSION="9.0" addons: sauce_connect: - direct_domains: test-streams.mux.dev,playertest.longtailvideo.com,player.webvideocore.net,pl.streamingvideoprovider.com,storage.googleapis.com,*.akamaihd.net,s3.amazonaws.com + tunnel_domains: travis.dev jwt: secure: TxJT041jqRf4raCwtNJRb0rz2gGvEaADZjWO41UQND2+YIZ//S9qB2C4YyrL1BBsn8/ebdHr0cd18PwCzoBSEmoCdoAWXmqBaaLvM1DOeQkKJbU3+pFmWtv1qGqRXJLEAysNvzhG0sLdvBc0M7a/CWxqRfx1O3lGhLnTlAW33LlQndjJ8vh3SGQm8HxFR1503ujPd7V1jGwduVwaQp4zbAKTnQ4MLugmJf6UKiTc+YILMrVWOwipOIyYHh2GqbChd/v1PXff26XCNJXcaRZKJ8JosWyBpq5t4zlPO0qDfHpqbEuYK44xm4vzbZS94P/KF8BYzdtxQYLrxoS1UlnUYU7RmzqgL3y3AM7nzX/cXvJcoNXfUK2BpsB754XNyQfRmXOdRiHoC8+wwPqGkH/KCrmS4UIOqv4THfmDbrtewfcDTgKOzHxGcT1IsUq9BTxMNtxSwpHTHUXTXrzpS/UBDvrlc+9qPTqf+e6QL1aG+JT5sOg5REm2hMy0j18/Kr+HLXkehxEgJ6JrybyHUkkJrfcuWgVDu7Lv3cxlrtSMXi7TIwSB75NMoM8AE71GEVjXwpOw/0giwnmGsJNNi01ztod0UFe2V2rS+yPI1WNZIJ7Fw66U0oOKJ1rb4Iksl86n5Y2snHsxK8q5jhKaAaiWgGK5kVTAgF89t/GXYyNH6cI= diff --git a/tests/functional/auto/setup.js b/tests/functional/auto/setup.js index a2db5648734..3bf0dc2d2e9 100644 --- a/tests/functional/auto/setup.js +++ b/tests/functional/auto/setup.js @@ -52,12 +52,14 @@ if (browserConfig.platform) { browserDescription += `, ${browserConfig.platform}`; } +let hostname = (onTravis) ? 'travis.dev' : '127.0.0.1'; + // Launch static server HttpServer.createServer({ showDir: false, autoIndex: false, root: './' -}).listen(8000, '127.0.0.1'); +}).listen(8000, hostname); const wait = ms => new Promise(resolve => setTimeout(resolve, ms)); async function retry (attempt, numAttempts = 5, interval = 2000) { @@ -68,11 +70,8 @@ async function retry (attempt, numAttempts = 5, interval = 2000) { // reject with the last error throw e; } - return wait(interval) - .then(retry.bind(null, attempt, numAttempts, interval)) - .catch(e => { - throw e; - }); + await wait(interval); + return retry(attempt, numAttempts, interval); } } @@ -241,25 +240,26 @@ describe(`testing hls.js playback in the browser on "${browserDescription}"`, fu } browser = browser.withCapabilities(capabilities).build(); - try { - console.log('Retrieving web driver session...'); - const [timeouts, session] = await Promise.all([ - browser.manage().setTimeouts({ script: 75000 }), - browser.getSession() - ]); - console.log(`Web driver session id: ${session.getId()}`); - if (onTravis) { - console.log(`Job URL: https://saucelabs.com/jobs/${session.getId()}`); - } - } catch (err) { - console.log(`failed setting up session: ${err}`); - } - try { await retry(async () => { + console.log('Retrieving web driver session...'); + try { + const [timeouts, session] = await Promise.all([ + browser.manage().setTimeouts({ script: 75000 }), + browser.getSession() + ]); + if (onTravis) { + console.log(`Job URL: https://saucelabs.com/jobs/${session.getId()}`); + } else { + console.log(`WebDriver SessionID: ${session.getId()}`); + } + } catch (err) { + throw new Error(`failed setting up session: ${err}`); + } + console.log('Loading test page...'); try { - await browser.get('http://127.0.0.1:8000/tests/functional/auto/index.html'); + await browser.get(`http://${hostname}:8000/tests/functional/auto/index.html`); } catch (e) { throw new Error('failed to open test page'); }