Skip to content

Commit

Permalink
test(extensions): add background page devtools test
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelmaddock committed Mar 2, 2020
1 parent d7c71b8 commit 5a80956
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
11 changes: 11 additions & 0 deletions spec-main/extensions-spec.ts
Expand Up @@ -207,6 +207,17 @@ ifdescribe(process.electronBinding('features').isExtensionsEnabled())('chrome ex
const receivedMessage = await w.webContents.executeJavaScript(`window.completionPromise`)
expect(receivedMessage).to.deep.equal({ some: 'message' })
})

it('can open devtools of background page', async () => {
const customSession = session.fromPartition(`persist:${require('uuid').v4()}`)
await customSession.loadExtension(path.join(fixtures, 'extensions', 'persistent-background-page'))
const w = new BrowserWindow({ show: false, webPreferences: { session: customSession } })
const promise = emittedOnce(app, 'web-contents-created')
await w.loadURL(`about:blank`)
const [, bgPageContents] = await promise
expect(bgPageContents.getType()).to.equal('backgroundPage')
bgPageContents.openDevTools()
})
})

describe('devtools extensions', () => {
Expand Down
@@ -0,0 +1 @@
/* eslint-disable no-undef */
@@ -0,0 +1,9 @@
{
"name": "persistent-background-page",
"version": "1.0",
"background": {
"scripts": ["background.js"],
"persistent": true
},
"manifest_version": 2
}

0 comments on commit 5a80956

Please sign in to comment.