From 7d4c0a25b744e8eea510f512a5de2a034340d446 Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Sat, 30 Jan 2016 20:27:26 +0100 Subject: [PATCH] TravisCI: add FF 44.0 and run under workaround harness --- .travis.yml | 6 ++++-- data/panel.js | 2 ++ lib/automatic-mode.js | 2 ++ ...85.sh => run_tests_with_travisci_workaround.sh} | 6 +++--- test/test-automatic-mode.js | 14 ++++++++++++-- 5 files changed, 23 insertions(+), 7 deletions(-) rename test/{workaround_for_bug_1103385.sh => run_tests_with_travisci_workaround.sh} (57%) diff --git a/.travis.yml b/.travis.yml index 208f0906e..3b49f552e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,8 +13,9 @@ env: matrix: - FIREFOX_RELEASE='latest' - FIREFOX_RELEASE='beta-latest' - - FIREFOX_RELEASE='esr-latest' + - FIREFOX_RELEASE='44.0' - FIREFOX_RELEASE='43.0' + - FIREFOX_RELEASE='esr-latest' matrix: fast_finish: true allow_failures: @@ -32,5 +33,6 @@ before_script: - tar xvf firefox-$FIREFOX_RELEASE.tar.bz2 - sh -e /etc/init.d/xvfb start script: - - npm run jpm + #- npm run jpm + - bash test/run_tests_with_travisci_workaround.sh - npm run eslint diff --git a/data/panel.js b/data/panel.js index cd508aa83..6f9aca111 100644 --- a/data/panel.js +++ b/data/panel.js @@ -1,3 +1,5 @@ +'use strict' + /* global self */ function getById (id) { diff --git a/lib/automatic-mode.js b/lib/automatic-mode.js index f575ca544..6233b72ee 100644 --- a/lib/automatic-mode.js +++ b/lib/automatic-mode.js @@ -1,3 +1,5 @@ +'use strict' + const { setInterval, clearInterval } = require('sdk/timers') const notifications = require('sdk/notifications') const prefs = require('sdk/simple-prefs').prefs diff --git a/test/workaround_for_bug_1103385.sh b/test/run_tests_with_travisci_workaround.sh similarity index 57% rename from test/workaround_for_bug_1103385.sh rename to test/run_tests_with_travisci_workaround.sh index a0cbe0408..30676d5b5 100644 --- a/test/workaround_for_bug_1103385.sh +++ b/test/run_tests_with_travisci_workaround.sh @@ -1,13 +1,13 @@ #!/bin/bash -JPM_OUT=$(jpm -b $FIREFOX_BIN test --verbose 2>&1 | tee >(cat - >&2) ; (exit ${PIPESTATUS[0]})) +JPM_OUT=$(npm run jpm 2>&1 | tee >(cat - >&2) ; (exit ${PIPESTATUS[0]})) RESULT=$? TOTAL=$(echo $JPM_OUT | sed -n 's/.* \([0-9]\+\) tests passed.*/\1/p') PASSED=$(echo $JPM_OUT | sed -n 's/.* \([0-9]\+\) of [0-9]\+ tests passed.*/\1/p') -LOCALE_BUG=$(echo "$JPM_OUT" | grep "Plural form unknown for locale \"null\"") +LOCALE_BUG=$(echo "$JPM_OUT" | grep -Pzo "(?s)fail:\s+Should not be any unexpected windows open.+Windows open:.+chrome://browser/content/browser.xul - about:blank.+Location {\"href\":\"chrome://global/content/alerts/alert.xul\"") TESTS_FAILED=$(echo $JPM_OUT | sed -n 's/.*The following tests failed:\(.*\)/\1/p' | tr -d '[[:space:]]') if [ -z "$TESTS_FAILED" ] && [ ! -z "$LOCALE_BUG" ] && [ 0 -eq $(($TOTAL-1-$PASSED)) ]; then - echo "Detected bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1103385" + echo "Detected ephemeral TravisCI bug:" echo "Running workaround to return code 0 (passed)" let RESULT=0 fi diff --git a/test/test-automatic-mode.js b/test/test-automatic-mode.js index d49cd36c4..502389526 100644 --- a/test/test-automatic-mode.js +++ b/test/test-automatic-mode.js @@ -2,9 +2,12 @@ const { setTimeout } = require('sdk/timers') const { prefs } = require('sdk/simple-prefs') +const tabs = require('sdk/tabs') const gw = require('../lib/gateways.js') const autoMode = require('../lib/automatic-mode.js') +const ipfsPath = 'ipfs/QmTkzDwWqPbnAh5YiV5VwcTLnGdwSNsNTn2aDxdXBFca7D/' + exports['test automatic mode disabling redirect when IPFS API is offline'] = function (assert, done) { let apiPort = prefs.customApiPort prefs.customApiPort = 59999 // change to something that will always fail @@ -15,8 +18,15 @@ exports['test automatic mode disabling redirect when IPFS API is offline'] = fun assert.equal(prefs.automatic, true, 'automatic mode should be enabled') assert.equal(prefs.useCustomGateway, false, 'redirect should be automatically disabled') assert.equal(gw.redirectEnabled, false, 'redirect should be automatically disabled') - prefs.customApiPort = apiPort - done() + tabs.open({ + url: 'http://ipfs.io/' + ipfsPath, + onReady: function onReady (tab) { + assert.equal(tab.url, 'http://ipfs.io/' + ipfsPath, 'expected no redirect') + prefs.automatic = false + prefs.customApiPort = apiPort + tab.close(done) + } + }) }, autoMode.interval + 100) }