diff --git a/build/tasks/test-webdriver.js b/build/tasks/test-webdriver.js index 04c73a1ff3..53c730ae1b 100644 --- a/build/tasks/test-webdriver.js +++ b/build/tasks/test-webdriver.js @@ -35,12 +35,12 @@ module.exports = function (grunt) { /** * Test each URL */ - function runTestUrls(driver, urls) { + function runTestUrls(driver, urls, errors) { var url = urls.shift(); - var errors = []; + errors = errors || []; // Give each page enough time - driver.manage().timeouts().setScriptTimeout(600); + driver.manage().timeouts().setScriptTimeout(60000); return driver.get(url) // Get results @@ -69,8 +69,9 @@ module.exports = function (grunt) { }).then(function () { // Start the next job, if any if (urls.length > 0) { - return runTestUrls(driver, urls); + return runTestUrls(driver, urls, errors); } else { + driver.quit(); return Promise.resolve(errors); } }); @@ -168,10 +169,6 @@ module.exports = function (grunt) { }).catch(function (err) { grunt.log.error(err); done(false); - - // Lastly, always close the browser - }).then(function () { - return driver.quit(); }); }); diff --git a/test/commons/color/get-background-color.js b/test/commons/color/get-background-color.js index 6ebc85a531..dd542e974d 100644 --- a/test/commons/color/get-background-color.js +++ b/test/commons/color/get-background-color.js @@ -6,6 +6,7 @@ describe('color.getBackgroundColor', function () { afterEach(function () { document.getElementById('fixture').innerHTML = ''; axe.commons.color.incompleteData.clear(); + document.body.scrollTop = 0; }); it('should return the blended color if it has no background set', function () { diff --git a/test/commons/color/get-foreground-color.js b/test/commons/color/get-foreground-color.js index 93cb3e7a30..b215531572 100644 --- a/test/commons/color/get-foreground-color.js +++ b/test/commons/color/get-foreground-color.js @@ -5,6 +5,8 @@ describe('color.getForegroundColor', function () { afterEach(function () { document.getElementById('fixture').innerHTML = ''; + axe.commons.color.incompleteData.clear(); + document.body.scrollTop = 0; }); it('should return the blended color if it has alpha set', function () { diff --git a/test/integration/full/options/options.js b/test/integration/full/options/options.js index 454d3a77b3..7e62278a4d 100644 --- a/test/integration/full/options/options.js +++ b/test/integration/full/options/options.js @@ -3,13 +3,13 @@ describe('Options', function() { before(function (done) { var frame = document.getElementById('myframe'); - if (frame.contentWindow.document.readyState === 'complete') { - done(); - } else { - frame.addEventListener('load', function () { + var interval = setInterval(function () { + var win = frame.contentWindow; + axe.utils.respondable(win, 'axe.ping', null, undefined, function() { + clearInterval(interval); done(); }); - } + }, 100); }); function $id(id) { @@ -17,19 +17,19 @@ describe('Options', function() { } describe('iframes', function() { - it('should include iframes by default', function(done) { - var config = {}; + it('should include iframes if `iframes` is true', function(done) { + var config = { iframes: true }; axe.a11yCheck(document, config, function(results) { try { assert.lengthOf(results.violations, 0, 'violations'); assert.lengthOf(results.passes, 1, 'passes'); - assert.lengthOf(results.passes[0].nodes, 2, 'results from main and iframe'); assert.isTrue(results.passes[0].nodes.some(function(node) { if (node.target.length !== 2) { return false; } return node.target[0] === '#myframe'; }), 'couldn\'t find iframe result'); + assert.lengthOf(results.passes[0].nodes, 2, 'results from main and iframe'); done(); } catch (e) { done(e); @@ -37,19 +37,19 @@ describe('Options', function() { }); }); - it('should include iframes if `iframes` is true', function(done) { - var config = { iframes: true }; + it('should exclude iframes if `iframes` is false', function(done) { + var config = { iframes: false }; axe.a11yCheck(document, config, function(results) { try { assert.lengthOf(results.violations, 0, 'violations'); assert.lengthOf(results.passes, 1, 'passes'); - assert.lengthOf(results.passes[0].nodes, 2, 'results from main and iframe'); - assert.isTrue(results.passes[0].nodes.some(function(node) { + assert.isFalse(results.passes[0].nodes.some(function(node) { if (node.target.length !== 2) { return false; - } + } return node.target[0] === '#myframe'; - }), 'couldn\'t find iframe result'); + }), 'unexpectedly found iframe result'); + assert.lengthOf(results.passes[0].nodes, 1, 'results from main frame only'); done(); } catch (e) { done(e); @@ -57,19 +57,19 @@ describe('Options', function() { }); }); - it('should exclude iframes if `iframes` is false', function(done) { - var config = { iframes: false }; + it('should include iframes by default', function(done) { + var config = {}; axe.a11yCheck(document, config, function(results) { try { assert.lengthOf(results.violations, 0, 'violations'); assert.lengthOf(results.passes, 1, 'passes'); - assert.lengthOf(results.passes[0].nodes, 1, 'results from main frame only'); - assert.isFalse(results.passes[0].nodes.some(function(node) { + assert.isTrue(results.passes[0].nodes.some(function(node) { if (node.target.length !== 2) { return false; - } + } return node.target[0] === '#myframe'; - }), 'unexpectedly found iframe result'); + }), 'couldn\'t find iframe result'); + assert.lengthOf(results.passes[0].nodes, 2, 'results from main and iframe'); done(); } catch (e) { done(e);