diff --git a/integration/__tests__/app-preferences.tests.ts b/integration/__tests__/app-preferences.tests.ts index 4afa8cfd96..989218797f 100644 --- a/integration/__tests__/app-preferences.tests.ts +++ b/integration/__tests__/app-preferences.tests.ts @@ -27,6 +27,7 @@ */ import type { Page } from "playwright"; import * as utils from "../helpers/utils"; +import { listHelmRepositories } from "../helpers/utils"; describe("preferences page tests", () => { let window: Page, cleanup: () => Promise; @@ -65,6 +66,12 @@ describe("preferences page tests", () => { it("ensures helm repos", async () => { await window.click("[data-testid=kubernetes-tab]"); + const repos = await listHelmRepositories(); // wait for default helm repo to be added + + if (repos.length === 0) { + fail("Lens failed to add any repositories"); + } + await window.waitForSelector("[data-testid=repository-name]", { timeout: 100_000, }); diff --git a/integration/helpers/utils.ts b/integration/helpers/utils.ts index 3bc9ad3ae4..b6154bd801 100644 --- a/integration/helpers/utils.ts +++ b/integration/helpers/utils.ts @@ -25,6 +25,8 @@ import * as path from "path"; import * as uuid from "uuid"; import { ElectronApplication, Frame, Page, _electron as electron } from "playwright"; import { noop } from "lodash"; +import { promisify } from "util"; +import { exec } from "child_process"; export const AppPaths: Partial> = { "win32": "./dist/win-unpacked/OpenLens.exe", @@ -67,7 +69,10 @@ export async function start() { args: ["--integration-testing"], // this argument turns off the blocking of quit executablePath: AppPaths[process.platform], bypassCSP: true, - env: { CICD }, + env: { + CICD, + ...process.env + }, timeout: 100_000, } as Parameters[0]); @@ -114,3 +119,24 @@ export async function lauchMinikubeClusterFromCatalog(window: Page): Promise{ + for (let i = 0; i < 10; i += 1) { + try { + const { stdout } = await promiseExec("helm repo list -o json"); + + return JSON.parse(stdout); + } catch { + await new Promise(r => setTimeout(r, 2000)); // if no repositories, wait for Lens adding bitnami repository + } + } + + return []; +}