From cd75ac826a8d294c3046452ff9ce81177724c562 Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Mon, 25 Jan 2021 08:44:39 -0500 Subject: [PATCH] add handling no repos to list from helm in integration test Signed-off-by: Sebastian Malton --- integration/__tests__/app.tests.ts | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/integration/__tests__/app.tests.ts b/integration/__tests__/app.tests.ts index c986e4804e..08e79ac88b 100644 --- a/integration/__tests__/app.tests.ts +++ b/integration/__tests__/app.tests.ts @@ -96,12 +96,20 @@ describe("Lens integration tests", () => { }); it("ensures helm repos", async () => { - const { stdout: reposJson } = await promiseExec("helm repo list -o json"); - const repos = JSON.parse(reposJson); + try { + const { stdout: reposJson } = await promiseExec("helm repo list -o json"); + const repos = JSON.parse(reposJson); - await app.client.waitUntilTextExists("div.repos #message-bitnami", repos[0].name); // wait for the helm-cli to fetch the repo(s) - await app.client.click("#HelmRepoSelect"); // click the repo select to activate the drop-down - await app.client.waitUntilTextExists("div.Select__option", ""); // wait for at least one option to appear (any text) + await app.client.waitUntilTextExists("div.repos #message-bitnami", repos[0].name); // wait for the helm-cli to fetch the repo(s) + await app.client.click("#HelmRepoSelect"); // click the repo select to activate the drop-down + await app.client.waitUntilTextExists("div.Select__option", ""); // wait for at least one option to appear (any text) + } catch (err) { + expect(err.stderr).toContain("Error: no repositories to show"); // other errors should be + + await app.client.waitUntilTextExists("div.repos #message-bitnami", "bitnami"); // if no repos in list then bitnami should be showed + await app.client.click("#HelmRepoSelect"); // click the repo select to activate the drop-down + await app.client.waitUntilTextExists("div.Select__option", ""); // wait for at least one option to appear (any text) + } }); });