-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactored tests + added test debug | #1079
- Loading branch information
Tom James Holub
committed
May 18, 2018
1 parent
f93bda5
commit 34a46f6
Showing
5 changed files
with
147 additions
and
88 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
window.onload = function() { | ||
var iframe = document.createElement('iframe'); | ||
iframe.src = chrome.runtime.getURL("iframe.htm"); | ||
document.body.appendChild(iframe); | ||
}; |
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,7 @@ | ||
<html> | ||
<head> | ||
</head> | ||
<body> | ||
<b>I was added by an extension</b> | ||
</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,10 @@ | ||
{ | ||
"manifest_version": 2, | ||
"name": "Add iframe to google 404 page", | ||
"description": "...", | ||
"version": "0.0.1", | ||
"permissions": ["https://google.com/404"], | ||
"content_scripts": [{"matches": ["https://google.com/404"], "js": ["add_iframe.js"]}], | ||
"web_accessible_resources": ["iframe.htm"], | ||
"minimum_chrome_version": "55" | ||
} |
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,32 @@ | ||
|
||
const puppeteer = require('../node_modules/puppeteer'); | ||
|
||
let browser; | ||
|
||
(async() => { | ||
|
||
browser = await puppeteer.launch({ | ||
args: [ | ||
'--disable-features=site-per-process', | ||
'--disable-extensions-except=add_iframe', | ||
'--load-extension=add_iframe', | ||
], | ||
headless: false, | ||
slowMo: 50, | ||
}); | ||
|
||
let page = await browser.newPage(); | ||
await page.goto('https://google.com/404'); | ||
|
||
await page.waitForSelector('iframe', {timeout: 5000, visible: true}); | ||
let iframeHandle = await page.$('iframe'); | ||
let iframeSrc = await (await iframeHandle.getProperty('src')).jsonValue(); | ||
|
||
let frames = await page.frames(); | ||
let urls = frames.map(frame => frame.url()); | ||
|
||
console.log(`parsed iframe src: ${iframeSrc}`); | ||
console.log(`page.frames() url: ${JSON.stringify(urls)}`); | ||
console.log(urls.indexOf(iframeSrc) === -1 ? 'FAIL' : 'PASS'); | ||
|
||
})(); |
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