mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
stop getting logs on test timeout
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
1 parent
624b7b50ee
commit
401908f4e5
16 files changed
+4152
-37
No files matched your search
@@ -3,15 +3,23 @@ import * as utils from "../helpers/utils";
|
||||
import { listHelmRepositories } from "../helpers/utils";
|
||||
import { fail } from "assert";
|
||||
import open from "open";
|
||||
import { AbortController } from "abort-controller";
|
||||
|
||||
jest.setTimeout(60000);
|
||||
|
||||
// FIXME (!): improve / simplify all css-selectors + use [data-test-id="some-id"] (already used in some tests below)
|
||||
describe("Lens integration tests", () => {
|
||||
let app: Application;
|
||||
let abortContoller: AbortController;
|
||||
|
||||
describe("app start", () => {
|
||||
beforeAll(async () => app = await utils.appStart(), 20000);
|
||||
beforeAll(async () => {
|
||||
app = await utils.appStart();
|
||||
}, 20000);
|
||||
|
||||
beforeEach(() => {
|
||||
abortContoller = new AbortController();
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
if (app?.isRunning()) {
|
||||
@@ -19,6 +27,10 @@ describe("Lens integration tests", () => {
|
||||
}
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
abortContoller.abort();
|
||||
});
|
||||
|
||||
it('shows "whats new"', async () => {
|
||||
await utils.clickWhatsNew(app);
|
||||
});
|
||||
@@ -32,11 +44,16 @@ describe("Lens integration tests", () => {
|
||||
it("should handle opening lens:// links", async () => {
|
||||
await open("lens://app/foobar");
|
||||
|
||||
await utils.waitForLogsToContain(app, {
|
||||
await utils.waitForLogsToContain(app, abortContoller, {
|
||||
main: ["No handler", "lens://app/foobar"],
|
||||
renderer: ["No handler", "lens://app/foobar"],
|
||||
});
|
||||
});
|
||||
|
||||
it("should opening lens://app/preferences", async () => {
|
||||
await open("lens://app/preferences");
|
||||
await app.client.waitUntilTextExists("h2", "Preferences");
|
||||
});
|
||||
});
|
||||
|
||||
describe("preferences page", () => {
|
||||
|
||||
@@ -9,6 +9,8 @@ import * as utils from "../helpers/utils";
|
||||
import { addMinikubeCluster, minikubeReady, waitForMinikubeDashboard } from "../helpers/minikube";
|
||||
import { exec } from "child_process";
|
||||
import * as util from "util";
|
||||
import { delay } from "../../src/common/utils";
|
||||
import { AbortController } from "abort-controller";
|
||||
|
||||
export const promiseExec = util.promisify(exec);
|
||||
|
||||
@@ -337,12 +339,19 @@ describe("Lens cluster pages", () => {
|
||||
});
|
||||
|
||||
describe("viewing pod logs", () => {
|
||||
beforeEach(appStartAddCluster, 40000);
|
||||
let abortContoller: AbortController;
|
||||
|
||||
beforeEach(async () => {
|
||||
await appStartAddCluster();
|
||||
abortContoller = new AbortController();
|
||||
}, 40000);
|
||||
|
||||
afterEach(async () => {
|
||||
if (app && app.isRunning()) {
|
||||
return utils.tearDown(app);
|
||||
if (app?.isRunning()) {
|
||||
await utils.tearDown(app);
|
||||
}
|
||||
|
||||
abortContoller.abort();
|
||||
});
|
||||
|
||||
it(`shows a logs for a pod`, async () => {
|
||||
@@ -355,19 +364,13 @@ describe("Lens cluster pages", () => {
|
||||
await app.client.keys("kube-system");
|
||||
await app.client.keys("Enter");// "\uE007"
|
||||
await app.client.waitUntilTextExists("div.TableCell", "kube-apiserver");
|
||||
let podMenuItemEnabled = false;
|
||||
|
||||
// Wait until extensions are enabled on renderer
|
||||
while (!podMenuItemEnabled) {
|
||||
const logs = await app.client.getRenderProcessLogs();
|
||||
await utils.waitForLogsToContain(app, abortContoller, {
|
||||
renderer: ["[EXTENSION]: enabled lens-pod-menu@"],
|
||||
});
|
||||
|
||||
podMenuItemEnabled = !!logs.find(entry => entry.message.includes("[EXTENSION]: enabled lens-pod-menu@"));
|
||||
await delay(500); // Give some extra time to prepare extensions
|
||||
|
||||
if (!podMenuItemEnabled) {
|
||||
await new Promise(r => setTimeout(r, 1000));
|
||||
}
|
||||
}
|
||||
await new Promise(r => setTimeout(r, 500)); // Give some extra time to prepare extensions
|
||||
// Open logs tab in dock
|
||||
await app.client.click(".list .TableRow:first-child");
|
||||
await app.client.waitForVisible(".Drawer");
|
||||
|
||||
Reference in new issue
Block a user