spec: fix flakiness of test BrowserWindow.moveTop (#18962)

Wait for the focus event because checking focus status.
BrowserWindow.show gives focus to the window but there is
a moment where the window is shown but does not have the
focus yet. And the test was failing at this moment.
This commit is contained in:
Julien Isorce 2019-06-24 13:41:42 -07:00 committed by Jeremy Apthorp
parent 1304f259cc
commit 99e3de56df

View file

@ -606,8 +606,10 @@ describe('BrowserWindow module', () => {
const otherWindow = new BrowserWindow({ show: false, title: 'otherWindow' })
const otherWindowShown = emittedOnce(otherWindow, 'show')
const otherWindowFocused = emittedOnce(otherWindow, 'focus')
otherWindow.show()
await otherWindowShown
await otherWindowFocused
expect(otherWindow.isFocused()).to.equal(true)
w.moveTop()