From 99e3de56dfccff28874459fb18ab8d091d470c25 Mon Sep 17 00:00:00 2001 From: Julien Isorce Date: Mon, 24 Jun 2019 13:41:42 -0700 Subject: [PATCH] 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. --- spec-main/api-browser-window-spec.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spec-main/api-browser-window-spec.ts b/spec-main/api-browser-window-spec.ts index 8dd2b186011..0335e1d0131 100644 --- a/spec-main/api-browser-window-spec.ts +++ b/spec-main/api-browser-window-spec.ts @@ -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()