mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix integration test not assigning to clusterAdded correctly
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
7058193295
commit
dccdcd6b63
@ -54,29 +54,26 @@ describe("Lens cluster pages", () => {
|
|||||||
await app.client.waitUntilTextExists("div.TableCell", "Ready");
|
await app.client.waitUntilTextExists("div.TableCell", "Ready");
|
||||||
};
|
};
|
||||||
|
|
||||||
describe("cluster add", () => {
|
|
||||||
utils.beforeAllWrapped(async () => {
|
|
||||||
app = await utils.appStart();
|
|
||||||
});
|
|
||||||
|
|
||||||
utils.afterAllWrapped(async () => {
|
|
||||||
if (app?.isRunning()) {
|
|
||||||
return utils.tearDown(app);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
it("allows to add a cluster", async () => {
|
|
||||||
await addCluster();
|
|
||||||
clusterAdded = true;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
const appStartAddCluster = async () => {
|
const appStartAddCluster = async () => {
|
||||||
app = await utils.appStart();
|
app = await utils.appStart();
|
||||||
await addCluster();
|
await addCluster();
|
||||||
clusterAdded = true;
|
clusterAdded = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const tearDown = () => utils.tearDown(app);
|
||||||
|
|
||||||
|
describe("cluster add", () => {
|
||||||
|
utils.beforeAllWrapped(async () => {
|
||||||
|
app = await utils.appStart();
|
||||||
|
});
|
||||||
|
|
||||||
|
utils.afterAllWrapped(tearDown);
|
||||||
|
|
||||||
|
it("allows to add a cluster", async () => {
|
||||||
|
await addCluster();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
function getSidebarSelectors(itemId: string) {
|
function getSidebarSelectors(itemId: string) {
|
||||||
const root = `.SidebarItem[data-test-id="${itemId}"]`;
|
const root = `.SidebarItem[data-test-id="${itemId}"]`;
|
||||||
|
|
||||||
@ -87,13 +84,8 @@ describe("Lens cluster pages", () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
describe("cluster pages", () => {
|
describe("cluster pages", () => {
|
||||||
utils.beforeAllWrapped(appStartAddCluster);
|
utils.beforeEachWrapped(appStartAddCluster);
|
||||||
|
utils.afterEachWrapped(tearDown);
|
||||||
utils.afterAllWrapped(async () => {
|
|
||||||
if (app?.isRunning()) {
|
|
||||||
return utils.tearDown(app);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const tests: {
|
const tests: {
|
||||||
drawer?: string
|
drawer?: string
|
||||||
@ -378,12 +370,7 @@ describe("Lens cluster pages", () => {
|
|||||||
|
|
||||||
describe("viewing pod logs", () => {
|
describe("viewing pod logs", () => {
|
||||||
utils.beforeEachWrapped(appStartAddCluster);
|
utils.beforeEachWrapped(appStartAddCluster);
|
||||||
|
utils.afterEachWrapped(tearDown);
|
||||||
utils.afterEachWrapped(async () => {
|
|
||||||
if (app?.isRunning()) {
|
|
||||||
return utils.tearDown(app);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
it(`shows a log for a pod`, async () => {
|
it(`shows a log for a pod`, async () => {
|
||||||
expect(clusterAdded).toBe(true);
|
expect(clusterAdded).toBe(true);
|
||||||
@ -433,12 +420,7 @@ describe("Lens cluster pages", () => {
|
|||||||
|
|
||||||
describe("cluster operations", () => {
|
describe("cluster operations", () => {
|
||||||
utils.beforeEachWrapped(appStartAddCluster);
|
utils.beforeEachWrapped(appStartAddCluster);
|
||||||
|
utils.afterEachWrapped(tearDown);
|
||||||
utils.afterEachWrapped(async () => {
|
|
||||||
if (app?.isRunning()) {
|
|
||||||
return utils.tearDown(app);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
it("shows default namespace", async () => {
|
it("shows default namespace", async () => {
|
||||||
expect(clusterAdded).toBe(true);
|
expect(clusterAdded).toBe(true);
|
||||||
|
|||||||
@ -105,7 +105,11 @@ export async function showCatalog(app: Application) {
|
|||||||
|
|
||||||
type AsyncPidGetter = () => Promise<number>;
|
type AsyncPidGetter = () => Promise<number>;
|
||||||
|
|
||||||
export async function tearDown(app: Application) {
|
export async function tearDown(app?: Application) {
|
||||||
|
if (!app?.isRunning()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const pid = await (app.mainProcess.pid as any as AsyncPidGetter)();
|
const pid = await (app.mainProcess.pid as any as AsyncPidGetter)();
|
||||||
|
|
||||||
await app.stop();
|
await app.stop();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user