From f89ffb66bca24c7f813868bbcf64488909ba7bb7 Mon Sep 17 00:00:00 2001 From: Jim Ehrismann Date: Wed, 26 Jan 2022 15:24:28 -0500 Subject: [PATCH] added integration test bulletproofing to workaround a playwright issue with Electron 14 on windows Signed-off-by: Jim Ehrismann --- integration/helpers/utils.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/integration/helpers/utils.ts b/integration/helpers/utils.ts index e79ff1ca72..b3994eb931 100644 --- a/integration/helpers/utils.ts +++ b/integration/helpers/utils.ts @@ -40,7 +40,7 @@ async function getMainWindow(app: ElectronApplication, timeout = 50_000): Promis throw new Error(`Lens did not open the main window within ${timeout}ms`); } -export async function start() { +async function attemptStart() { const CICD = path.join(os.tmpdir(), "lens-integration-testing", uuid.v4()); // Make sure that the directory is clear @@ -76,6 +76,19 @@ export async function start() { } } +export async function start() { + // this is an attempted workaround for an issue with playwright not always getting the main window when using Electron 14.2.4 (observed on windows) + for (let i = 0; ; i++) { + try { + return await attemptStart(); + } catch (error) { + if (i === 4) { + throw error; + } + } + } +} + export async function clickWelcomeButton(window: Page) { await window.click("[data-testid=welcome-menu-container] li a"); }