mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
* basic workspace overview Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com> * css tweaks for landing page as a PageLayout Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com> * address review comments Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com> * more review comment addressing, added overview to workspace command palette Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com> * added back the landing page startup hint Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com> * refactoring as per review comments Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com> * added original landing page back only for default workspace with no clusters Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com> * Workspace overview layout tweaks (#2302) * tweaks workspace overview layout Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * cluster settings on top Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * header logo for add cluster page Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * tweak landing page Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * combine left menu icons Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * always show bottom status bar Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * tweak Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * integration test fixes Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * change cluster menu Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * first attempt to fix integration test Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com> * lint Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com> * get selectors right for integration test Signed-off-by: Jim Ehrismann <jehrismann@miranits.com> Co-authored-by: Jim Ehrismann <jehrismann@mirantis.com> Co-authored-by: Jim Ehrismann <jehrismann@miranits.com> * address review comments, and rebased to master Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com> Co-authored-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> Co-authored-by: Jim Ehrismann <jehrismann@miranits.com>
99 lines
2.4 KiB
TypeScript
99 lines
2.4 KiB
TypeScript
import { Application } from "spectron";
|
|
import * as util from "util";
|
|
import { exec } from "child_process";
|
|
|
|
const AppPaths: Partial<Record<NodeJS.Platform, string>> = {
|
|
"win32": "./dist/win-unpacked/Lens.exe",
|
|
"linux": "./dist/linux-unpacked/kontena-lens",
|
|
"darwin": "./dist/mac/Lens.app/Contents/MacOS/Lens",
|
|
};
|
|
|
|
export function itIf(condition: boolean) {
|
|
return condition ? it : it.skip;
|
|
}
|
|
|
|
export function describeIf(condition: boolean) {
|
|
return condition ? describe : describe.skip;
|
|
}
|
|
|
|
export function setup(): Application {
|
|
return new Application({
|
|
path: AppPaths[process.platform], // path to electron app
|
|
args: [],
|
|
startTimeout: 30000,
|
|
waitTimeout: 60000,
|
|
env: {
|
|
CICD: "true"
|
|
}
|
|
});
|
|
}
|
|
|
|
export const keys = {
|
|
backspace: "\uE003"
|
|
};
|
|
|
|
export async function appStart() {
|
|
const app = setup();
|
|
|
|
await app.start();
|
|
// Wait for splash screen to be closed
|
|
while (await app.client.getWindowCount() > 1);
|
|
await app.client.windowByIndex(0);
|
|
await app.client.waitUntilWindowLoaded();
|
|
|
|
return app;
|
|
}
|
|
|
|
export async function clickWhatsNew(app: Application) {
|
|
await app.client.waitUntilTextExists("h1", "What's new?");
|
|
await app.client.click("button.primary");
|
|
await app.client.waitUntilTextExists("h2", "default");
|
|
}
|
|
|
|
export async function clickWelcomeNotification(app: Application) {
|
|
const itemsText = await app.client.$("div.info-panel").getText();
|
|
|
|
if (itemsText === "0 item") {
|
|
// welcome notification should be present, dismiss it
|
|
await app.client.waitUntilTextExists("div.message", "Welcome!");
|
|
await app.client.click("i.Icon.close");
|
|
}
|
|
}
|
|
|
|
type AsyncPidGetter = () => Promise<number>;
|
|
|
|
export async function tearDown(app: Application) {
|
|
const pid = await (app.mainProcess.pid as any as AsyncPidGetter)();
|
|
|
|
await app.stop();
|
|
|
|
try {
|
|
process.kill(pid, "SIGKILL");
|
|
} catch (e) {
|
|
console.error(e);
|
|
}
|
|
}
|
|
|
|
export const promiseExec = util.promisify(exec);
|
|
|
|
type HelmRepository = {
|
|
name: string;
|
|
url: string;
|
|
};
|
|
|
|
export async function listHelmRepositories(retries = 0): Promise<HelmRepository[]>{
|
|
if (retries < 5) {
|
|
try {
|
|
const { stdout: reposJson } = await promiseExec("helm repo list -o json");
|
|
|
|
return JSON.parse(reposJson);
|
|
} catch {
|
|
await new Promise(r => setTimeout(r, 2000)); // if no repositories, wait for Lens adding bitnami repository
|
|
|
|
return await listHelmRepositories((retries + 1));
|
|
}
|
|
}
|
|
|
|
return [];
|
|
}
|