Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(respondable): work with CDP
Page.setDocumentContent
(#3921)
* chore(origin): fix CDP Page.setDocumentContent origin null hanging audits * add test * 🤖 Automated formatting fixes * fix --------- Co-authored-by: j-mendez <jeff@a11ywatch.com> Co-authored-by: straker <straker@users.noreply.github.com>
- Loading branch information
1 parent
b3c52bb
commit 66f23e5
Showing
3 changed files
with
45 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
const assert = require('assert'); | ||
const puppeteer = require('puppeteer'); | ||
const axe = require('axe-core'); | ||
|
||
(async () => { | ||
const browser = await puppeteer.launch(); | ||
const page = await browser.newPage(); | ||
|
||
await page.setContent(` | ||
<html lang="en"> | ||
<head> | ||
<title>Test Page</title> | ||
</head> | ||
<body> | ||
<main> | ||
<h1>Hello World</h1> | ||
<button id="empty-button"></button> | ||
<iframe title="iframe" srcdoc="<button id='iframe-empty-button'></button>"></iframe> | ||
</main> | ||
</body> | ||
</html> | ||
`); | ||
|
||
await page.evaluate(axe.source); | ||
const frames = page.frames(); | ||
for (let i = 0; i < frames.length; i++) { | ||
await frames[i].evaluate(axe.source); | ||
} | ||
|
||
const results = await page.evaluate(`window.axe.run()`); | ||
assert(results.violations.length); | ||
|
||
await browser.close(); | ||
})(); |
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