mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Switch to using test hooks
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
fe1105b60b
commit
a873e79bc3
@ -25,16 +25,23 @@
|
|||||||
TEST_NAMESPACE namespace. This is done to minimize destructive impact of the cluster tests on an existing minikube
|
TEST_NAMESPACE namespace. This is done to minimize destructive impact of the cluster tests on an existing minikube
|
||||||
cluster and vice versa.
|
cluster and vice versa.
|
||||||
*/
|
*/
|
||||||
|
import { Page } from "playwright";
|
||||||
import * as utils from "../helpers/utils";
|
import * as utils from "../helpers/utils";
|
||||||
|
|
||||||
describe("preferences page tests", () => {
|
describe("preferences page tests", () => {
|
||||||
it('shows "preferences" and can navigate through the tabs', async () => {
|
let window: Page, cleanup: () => Promise<void>;
|
||||||
const { window, cleanup } = await utils.start();
|
|
||||||
|
|
||||||
try {
|
beforeEach(async () => {
|
||||||
|
({ window, cleanup } = await utils.start());
|
||||||
await utils.clickWelcomeButton(window);
|
await utils.clickWelcomeButton(window);
|
||||||
await window.keyboard.press("Meta+,");
|
await window.keyboard.press("Meta+,");
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(async () => {
|
||||||
|
await cleanup();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('shows "preferences" and can navigate through the tabs', async () => {
|
||||||
const pages = [
|
const pages = [
|
||||||
{
|
{
|
||||||
id: "application",
|
id: "application",
|
||||||
@ -54,26 +61,14 @@ describe("preferences page tests", () => {
|
|||||||
await window.click(`[data-testid=${id}-tab]`);
|
await window.click(`[data-testid=${id}-tab]`);
|
||||||
await window.waitForSelector(`[data-testid=${id}-header] >> text=${header}`);
|
await window.waitForSelector(`[data-testid=${id}-header] >> text=${header}`);
|
||||||
}
|
}
|
||||||
} finally {
|
|
||||||
await cleanup();
|
|
||||||
}
|
|
||||||
}, 10*60*1000);
|
}, 10*60*1000);
|
||||||
|
|
||||||
it("ensures helm repos", async () => {
|
it("ensures helm repos", async () => {
|
||||||
const { window, cleanup } = await utils.start();
|
|
||||||
|
|
||||||
try {
|
|
||||||
await utils.clickWelcomeButton(window);
|
|
||||||
await window.keyboard.press("Meta+,");
|
|
||||||
|
|
||||||
await window.click("[data-testid=kubernetes-tab]");
|
await window.click("[data-testid=kubernetes-tab]");
|
||||||
await window.waitForSelector("[data-testid=repository-name]", {
|
await window.waitForSelector("[data-testid=repository-name]", {
|
||||||
timeout: 100_000,
|
timeout: 100_000,
|
||||||
});
|
});
|
||||||
await window.click("#HelmRepoSelect");
|
await window.click("#HelmRepoSelect");
|
||||||
await window.waitForSelector("div.Select__option");
|
await window.waitForSelector("div.Select__option");
|
||||||
} finally {
|
|
||||||
await cleanup();
|
|
||||||
}
|
|
||||||
}, 10*60*1000);
|
}, 10*60*1000);
|
||||||
});
|
});
|
||||||
@ -27,6 +27,7 @@
|
|||||||
*/
|
*/
|
||||||
import * as utils from "../helpers/utils";
|
import * as utils from "../helpers/utils";
|
||||||
import { minikubeReady } from "../helpers/minikube";
|
import { minikubeReady } from "../helpers/minikube";
|
||||||
|
import { Frame, Page } from "playwright";
|
||||||
|
|
||||||
const TEST_NAMESPACE = "integration-tests";
|
const TEST_NAMESPACE = "integration-tests";
|
||||||
|
|
||||||
@ -303,14 +304,20 @@ const commonPageTests: CommonPageTest[] = [{
|
|||||||
}];
|
}];
|
||||||
|
|
||||||
utils.describeIf(minikubeReady(TEST_NAMESPACE))("Minikube based tests", () => {
|
utils.describeIf(minikubeReady(TEST_NAMESPACE))("Minikube based tests", () => {
|
||||||
it("should navigate around common cluster pages", async () => {
|
let window: Page, cleanup: () => Promise<void>, frame: Frame;
|
||||||
const { window, cleanup } = await utils.start();
|
|
||||||
|
|
||||||
try {
|
beforeEach(async () => {
|
||||||
|
({ window, cleanup } = await utils.start());
|
||||||
await utils.clickWelcomeButton(window);
|
await utils.clickWelcomeButton(window);
|
||||||
|
|
||||||
const frame = await utils.lauchMinikubeClusterFromCatalog(window);
|
frame = await utils.lauchMinikubeClusterFromCatalog(window);
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(async () => {
|
||||||
|
await cleanup();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should navigate around common cluster pages", async () => {
|
||||||
for (const test of commonPageTests) {
|
for (const test of commonPageTests) {
|
||||||
if (isTopPageTest(test)) {
|
if (isTopPageTest(test)) {
|
||||||
const { href, expectedText, expectedSelector } = test.page;
|
const { href, expectedText, expectedSelector } = test.page;
|
||||||
@ -339,23 +346,10 @@ utils.describeIf(minikubeReady(TEST_NAMESPACE))("Minikube based tests", () => {
|
|||||||
await frame.click(selectors.expandSubMenu);
|
await frame.click(selectors.expandSubMenu);
|
||||||
await frame.waitForSelector(mainPageSelector, { state: "hidden" });
|
await frame.waitForSelector(mainPageSelector, { state: "hidden" });
|
||||||
}
|
}
|
||||||
} finally {
|
|
||||||
await cleanup();
|
|
||||||
}
|
|
||||||
}, 10*60*1000);
|
}, 10*60*1000);
|
||||||
|
|
||||||
it("show logs and highlight the log search entries", async () => {
|
it("show logs and highlight the log search entries", async () => {
|
||||||
const { window, cleanup } = await utils.start();
|
|
||||||
|
|
||||||
try {
|
|
||||||
await utils.clickWelcomeButton(window);
|
|
||||||
|
|
||||||
const frame = await utils.lauchMinikubeClusterFromCatalog(window);
|
|
||||||
|
|
||||||
if ((await frame.innerText(`a[href="/workloads"] .expand-icon`)) === "keyboard_arrow_down") {
|
|
||||||
await frame.click(`a[href="/workloads"]`);
|
await frame.click(`a[href="/workloads"]`);
|
||||||
}
|
|
||||||
|
|
||||||
await frame.click(`a[href="/pods"]`);
|
await frame.click(`a[href="/pods"]`);
|
||||||
|
|
||||||
const namespacesSelector = await frame.waitForSelector(".NamespaceSelect");
|
const namespacesSelector = await frame.waitForSelector(".NamespaceSelect");
|
||||||
@ -390,35 +384,15 @@ utils.describeIf(minikubeReady(TEST_NAMESPACE))("Minikube based tests", () => {
|
|||||||
const showPreviousButton = await frame.waitForSelector(".LogControls .show-previous");
|
const showPreviousButton = await frame.waitForSelector(".LogControls .show-previous");
|
||||||
|
|
||||||
await showPreviousButton.click();
|
await showPreviousButton.click();
|
||||||
} finally {
|
|
||||||
await cleanup();
|
|
||||||
}
|
|
||||||
}, 10*60*1000);
|
}, 10*60*1000);
|
||||||
|
|
||||||
it("should show the default namespaces", async () => {
|
it("should show the default namespaces", async () => {
|
||||||
const { window, cleanup } = await utils.start();
|
|
||||||
|
|
||||||
try {
|
|
||||||
await utils.clickWelcomeButton(window);
|
|
||||||
|
|
||||||
const frame = await utils.lauchMinikubeClusterFromCatalog(window);
|
|
||||||
|
|
||||||
await frame.click('a[href="/namespaces"]');
|
await frame.click('a[href="/namespaces"]');
|
||||||
await frame.waitForSelector("div.TableCell >> text='default'");
|
await frame.waitForSelector("div.TableCell >> text='default'");
|
||||||
await frame.waitForSelector("div.TableCell >> text='kube-system'");
|
await frame.waitForSelector("div.TableCell >> text='kube-system'");
|
||||||
} finally {
|
|
||||||
await cleanup();
|
|
||||||
}
|
|
||||||
}, 10*60*1000);
|
}, 10*60*1000);
|
||||||
|
|
||||||
it(`should create the ${TEST_NAMESPACE} and a pod in the namespace`, async () => {
|
it(`should create the ${TEST_NAMESPACE} and a pod in the namespace`, async () => {
|
||||||
const { window, cleanup } = await utils.start();
|
|
||||||
|
|
||||||
try {
|
|
||||||
await utils.clickWelcomeButton(window);
|
|
||||||
|
|
||||||
const frame = await utils.lauchMinikubeClusterFromCatalog(window);
|
|
||||||
|
|
||||||
await frame.click('a[href="/namespaces"]');
|
await frame.click('a[href="/namespaces"]');
|
||||||
await frame.click("button.add-button");
|
await frame.click("button.add-button");
|
||||||
await frame.waitForSelector("div.AddNamespaceDialog >> text='Create Namespace'");
|
await frame.waitForSelector("div.AddNamespaceDialog >> text='Create Namespace'");
|
||||||
@ -485,8 +459,5 @@ utils.describeIf(minikubeReady(TEST_NAMESPACE))("Minikube based tests", () => {
|
|||||||
await frame.click("button.Button >> text='Create & Close'");
|
await frame.click("button.Button >> text='Create & Close'");
|
||||||
await frame.click("div.TableCell >> text=nginx-create-pod-test");
|
await frame.click("div.TableCell >> text=nginx-create-pod-test");
|
||||||
await frame.waitForSelector("div.drawer-title-text >> text='Pod: nginx-create-pod-test'");
|
await frame.waitForSelector("div.drawer-title-text >> text='Pod: nginx-create-pod-test'");
|
||||||
} finally {
|
|
||||||
await cleanup();
|
|
||||||
}
|
|
||||||
}, 10*60*1000);
|
}, 10*60*1000);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -19,20 +19,25 @@
|
|||||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { Page } from "playwright";
|
||||||
import * as utils from "../helpers/utils";
|
import * as utils from "../helpers/utils";
|
||||||
|
|
||||||
describe("Lens command palette", () => {
|
describe("Lens command palette", () => {
|
||||||
|
let window: Page, cleanup: () => Promise<void>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
({ window, cleanup } = await utils.start());
|
||||||
|
await utils.clickWelcomeButton(window);
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(async () => {
|
||||||
|
await cleanup();
|
||||||
|
});
|
||||||
|
|
||||||
describe("menu", () => {
|
describe("menu", () => {
|
||||||
it("opens command dialog from keyboard shortcut", async () => {
|
it("opens command dialog from keyboard shortcut", async () => {
|
||||||
const { window, cleanup } = await utils.start();
|
|
||||||
|
|
||||||
try {
|
|
||||||
await utils.clickWelcomeButton(window);
|
|
||||||
await window.keyboard.press("Meta+Shift+p");
|
await window.keyboard.press("Meta+Shift+p");
|
||||||
await window.waitForSelector(".Select__option >> text=Hotbar: Switch");
|
await window.waitForSelector(".Select__option >> text=Hotbar: Switch");
|
||||||
} finally {
|
|
||||||
await cleanup();
|
|
||||||
}
|
|
||||||
}, 10*60*1000);
|
}, 10*60*1000);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user