1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
lens/integration/__tests__/workspace.tests.ts
Jari Kolehmainen b5e7be7591
Initial command palette feature (#1957)
* wip: command palette

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* register shortcut to global menu

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* introduce openCommandDialog & closeCommandDialog

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* fix ipc broadcast to frames from renderer

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* tweak

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* add more commands

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* cleanup

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* ipc fix

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* add integration tests

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* ipc fix

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* implement workspace edit

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* workspace edit fixes

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* make tests green

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* fixes from code review

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* cleanup ipc

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* cleanup CommandRegistry

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* ipc fix

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* fix ClusterManager cluster auto-init

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* ensure cluster view is active before sending a command

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* switch to last active cluster when workspace change

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* tweak integration tests

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* run integration tests serially

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* cleanup

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* fixes based on code review

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* cleanup

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* cleanup more

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* cleanup

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* add workspace fixes

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* cleanup

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
2021-02-02 12:34:13 +02:00

76 lines
2.7 KiB
TypeScript

import { Application } from "spectron";
import * as utils from "../helpers/utils";
import { addMinikubeCluster, minikubeReady } from "../helpers/minikube";
import { exec } from "child_process";
import * as util from "util";
export const promiseExec = util.promisify(exec);
jest.setTimeout(60000);
describe("Lens integration tests", () => {
let app: Application;
const ready = minikubeReady("workspace-int-tests");
utils.describeIf(ready)("workspaces", () => {
beforeAll(async () => {
app = await utils.appStart();
await utils.clickWhatsNew(app);
}, 20000);
afterAll(async () => {
if (app && app.isRunning()) {
return utils.tearDown(app);
}
});
const switchToWorkspace = async (name: string) => {
await app.client.click("[data-test-id=current-workspace]");
await app.client.keys(name);
await app.client.keys("Enter");
await app.client.waitUntilTextExists("[data-test-id=current-workspace-name]", name);
};
const createWorkspace = async (name: string) => {
await app.client.click("[data-test-id=current-workspace]");
await app.client.keys("add workspace");
await app.client.keys("Enter");
await app.client.keys(name);
await app.client.keys("Enter");
await app.client.waitUntilTextExists("[data-test-id=current-workspace-name]", name);
};
it("creates new workspace", async () => {
const name = "test-workspace";
await createWorkspace(name);
await app.client.waitUntilTextExists("[data-test-id=current-workspace-name]", name);
});
it("edits current workspaces", async () => {
await createWorkspace("to-be-edited");
await app.client.click("[data-test-id=current-workspace]");
await app.client.keys("edit current workspace");
await app.client.keys("Enter");
await app.client.keys("edited-workspace");
await app.client.keys("Enter");
await app.client.waitUntilTextExists("[data-test-id=current-workspace-name]", "edited-workspace");
});
it("adds cluster in default workspace", async () => {
await switchToWorkspace("default");
await addMinikubeCluster(app);
await app.client.waitUntilTextExists("pre.kube-auth-out", "Authentication proxy started");
await app.client.waitForExist(`iframe[name="minikube"]`);
await app.client.waitForVisible(".ClustersMenu .ClusterIcon.active");
});
it("adds cluster in test-workspace", async () => {
await switchToWorkspace("test-workspace");
await addMinikubeCluster(app);
await app.client.waitUntilTextExists("pre.kube-auth-out", "Authentication proxy started");
await app.client.waitForExist(`iframe[name="minikube"]`);
});
});
});