wait for window to be focused in openDevTools test

This commit is contained in:
Jeremy Apthorp 2019-01-11 15:33:35 -08:00
parent 4b45a5fc6d
commit ded316cd5e

View file

@ -264,7 +264,9 @@ describe('webContents module', () => {
describe('openDevTools() API', () => { describe('openDevTools() API', () => {
it('can show window with activation', async () => { it('can show window with activation', async () => {
const focused = emittedOnce(w, 'focus')
w.show() w.show()
await focused
assert.strictEqual(w.isFocused(), true) assert.strictEqual(w.isFocused(), true)
const devtoolsOpened = emittedOnce(w.webContents, 'devtools-opened') const devtoolsOpened = emittedOnce(w.webContents, 'devtools-opened')
w.webContents.openDevTools({ mode: 'detach', activate: true }) w.webContents.openDevTools({ mode: 'detach', activate: true })