-
Notifications
You must be signed in to change notification settings - Fork 791
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(collect-results-from-frames): add frameWaitTime option (#661)
Closes #660
- Loading branch information
1 parent
595f209
commit 8016ad1
Showing
6 changed files
with
118 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
test/integration/full/frame-wait-time/frame-wait-time.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<title>frame-wait-time test</title> | ||
<meta charset="utf8"> | ||
<link rel="stylesheet" type="text/css" href="/node_modules/mocha/mocha.css" /> | ||
<script src="/node_modules/mocha/mocha.js"></script> | ||
<script src="/node_modules/chai/chai.js"></script> | ||
<script src="/axe.js"></script> | ||
<script> | ||
mocha.setup({ | ||
timeout: 10000, | ||
ui: 'bdd' | ||
}); | ||
var assert = chai.assert; | ||
</script> | ||
</head> | ||
<body> | ||
<main> | ||
<iframe id="frame" title="frame-wait-time test frame" src="frames/frame.html"></iframe> | ||
</main> | ||
<div id="mocha"></div> | ||
<script src="frame-wait-time.js"></script> | ||
<script src="/test/integration/adapter.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
|
||
describe('frame-wait-time option', function () { | ||
'use strict'; | ||
|
||
before(function (done) { | ||
if (document.readyState !== 'complete') { | ||
window.addEventListener('load', done.bind(this, null)); | ||
} else { | ||
done(); | ||
} | ||
}); | ||
|
||
describe('when set', function () { | ||
var opts = { | ||
frameWaitTime: 1 | ||
}; | ||
|
||
it('should modify the default frame timeout', function (done) { | ||
var start = new Date(); | ||
// Run axe with an unreasonably short wait time, | ||
// expecting the frame to time out | ||
axe.run('main', opts, function (err, res) { | ||
assert.isNotNull(err); | ||
assert.isUndefined(res); | ||
assert.equal(err.message, 'Axe in frame timed out: #frame'); | ||
// Ensure that axe waited less than the default wait time | ||
assert.isBelow(new Date() - start, 60000); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('when not set', function () { | ||
|
||
it('should use the default frame timeout', function (done) { | ||
axe.run('main', function (err, res) { | ||
assert.isNull(err); | ||
assert.isAbove(res.violations.length, 0); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<title>frame-wait-time test frame</title> | ||
<meta charset="utf8"> | ||
<script src="/axe.js"></script> | ||
</head> | ||
<body> | ||
<h1 style="opacity: 0.1;">So Dim</h1> | ||
</body> | ||
</html> |