Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run the integration tests in headless Chrome #1157

Merged
merged 1 commit into from May 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 11 additions & 18 deletions integration-test/helpers/harness.js
Expand Up @@ -21,7 +21,7 @@ const setup = async (ops) => {
args: [
`--user-data-dir=${dataDir}`
],
headless: false
headless: 'chrome'
}

if (loadExtension) {
Expand Down Expand Up @@ -53,23 +53,16 @@ const setup = async (ops) => {
const requests = []

if (loadExtension) {
// grab a handle on the background page for the extension
// we can't use the long ID as it could possibly change
for (const t of await browser.targets()) {
// for some reason we need to init a blank page
// before the extension is initialized
await browser.newPage()

const title = t._targetInfo.title

if (title === 'DuckDuckGo Privacy Essentials') {
bgPage = await t.page()
break
}
}

if (!bgPage) {
throw new Error('couldn\'t get background page')
// Grab a handle on the background page for the extension.
try {
const backgroundPageTarget =
await browser.waitForTarget(
target => target.type() === 'background_page',
{ timeout: 2000 }
)
bgPage = await backgroundPageTarget.page()
} catch (e) {
throw new Error('Couldn\'t find background page.')
}

bgPage.on('request', (req) => { requests.push(req.url()) })
Expand Down
43 changes: 10 additions & 33 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -61,7 +61,7 @@
"karma-source-map-support": "1.4.0",
"load-grunt-tasks": "5.1.0",
"node-fetch": "^3.2.3",
"puppeteer": "13.6.0",
"puppeteer": "13.7.0",
"sass": "^1.50.1",
"standard": "17.0.0",
"timekeeper": "^2.1.1",
Expand Down