From 0b8868a14e880c85f5a6b04db2fdf6f933fd53d9 Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Tue, 4 Oct 2022 10:13:37 -0400 Subject: [PATCH] And handling for tests failing to start Signed-off-by: Sebastian Malton --- integration/__tests__/app-preferences.tests.ts | 5 +++-- integration/__tests__/cluster-pages.tests.ts | 6 ++++-- integration/__tests__/command-palette.tests.ts | 8 +++++--- integration/helpers/utils.ts | 1 + 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/integration/__tests__/app-preferences.tests.ts b/integration/__tests__/app-preferences.tests.ts index 8a74a8160c..04a4929c6a 100644 --- a/integration/__tests__/app-preferences.tests.ts +++ b/integration/__tests__/app-preferences.tests.ts @@ -13,7 +13,8 @@ import type { ElectronApplication, Page } from "playwright"; import * as utils from "../helpers/utils"; describe("preferences page tests", () => { - let window: Page, cleanup: () => Promise; + let window: Page; + let cleanup: undefined | (() => Promise); beforeEach(async () => { let app: ElectronApplication; @@ -31,7 +32,7 @@ describe("preferences page tests", () => { }, 10*60*1000); afterEach(async () => { - await cleanup(); + await cleanup?.(); }, 10*60*1000); it('shows "preferences" and can navigate through the tabs', async () => { diff --git a/integration/__tests__/cluster-pages.tests.ts b/integration/__tests__/cluster-pages.tests.ts index 897694caba..4b9cc26b8c 100644 --- a/integration/__tests__/cluster-pages.tests.ts +++ b/integration/__tests__/cluster-pages.tests.ts @@ -19,7 +19,9 @@ import { describeIf } from "../../src/test-utils/skippers"; const TEST_NAMESPACE = "integration-tests"; describeIf(minikubeReady(TEST_NAMESPACE))("Minikube based tests", () => { - let window: Page, cleanup: () => Promise, frame: Frame; + let window: Page; + let cleanup: undefined | (() => Promise); + let frame: Frame; beforeEach(async () => { ({ window, cleanup } = await utils.start()); @@ -29,7 +31,7 @@ describeIf(minikubeReady(TEST_NAMESPACE))("Minikube based tests", () => { }, 10 * 60 * 1000); afterEach(async () => { - await cleanup(); + await cleanup?.(); }, 10 * 60 * 1000); it("shows cluster context menu in sidebar", async () => { diff --git a/integration/__tests__/command-palette.tests.ts b/integration/__tests__/command-palette.tests.ts index 8356379b60..7b4d675ef4 100644 --- a/integration/__tests__/command-palette.tests.ts +++ b/integration/__tests__/command-palette.tests.ts @@ -7,15 +7,17 @@ import type { ElectronApplication, Page } from "playwright"; import * as utils from "../helpers/utils"; describe("Lens command palette", () => { - let window: Page, cleanup: () => Promise, app: ElectronApplication; - + let window: Page; + let cleanup: undefined | (() => Promise); + let app: ElectronApplication; + beforeEach(async () => { ({ window, cleanup, app } = await utils.start()); await utils.clickWelcomeButton(window); }, 10*60*1000); afterEach(async () => { - await cleanup(); + await cleanup?.(); }, 10*60*1000); describe("menu", () => { diff --git a/integration/helpers/utils.ts b/integration/helpers/utils.ts index 3054d44a08..cc0652c166 100644 --- a/integration/helpers/utils.ts +++ b/integration/helpers/utils.ts @@ -28,6 +28,7 @@ async function getMainWindow(app: ElectronApplication, timeout = 50_000): Promis if (page.url().startsWith("http://localhost")) { cleanup(); + console.log(stdoutBuf); resolve(page); } };