mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
fix integration tests, clean up
Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
parent
b9f7d73e18
commit
41aea61621
@ -53,12 +53,13 @@ describe("Lens cluster pages", () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
function getSidebarItemSelectors(itemId: string) {
|
function getSidebarSelectors(itemId: string) {
|
||||||
const baseSelector = `.Sidebar [data-test-id="${itemId}"]`;
|
const root = `.SidebarItem[data-test-id="${itemId}"]`;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
sidebarItemRoot: baseSelector,
|
mainLink: `${root} .nav-item a`,
|
||||||
expandSubMenu: `${baseSelector} .nav-item a`,
|
expandSubMenu: `${root} .nav-item`,
|
||||||
|
menuLink: (href: string) => `.Sidebar .sub-menu a[href^="/${href}"]`,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -319,19 +320,19 @@ describe("Lens cluster pages", () => {
|
|||||||
}];
|
}];
|
||||||
|
|
||||||
tests.forEach(({ drawer = "", drawerId = "", pages }) => {
|
tests.forEach(({ drawer = "", drawerId = "", pages }) => {
|
||||||
const selectors = getSidebarItemSelectors(drawerId);
|
const selectors = getSidebarSelectors(drawerId);
|
||||||
|
|
||||||
if (drawer !== "") {
|
if (drawer !== "") {
|
||||||
it(`shows ${drawer} drawer`, async () => {
|
it(`shows ${drawer} drawer`, async () => {
|
||||||
expect(clusterAdded).toBe(true);
|
expect(clusterAdded).toBe(true);
|
||||||
await app.client.click(selectors.expandSubMenu);
|
await app.client.click(selectors.expandSubMenu);
|
||||||
await app.client.waitUntilTextExists(`a[href^="/${pages[0].href}"]`, pages[0].name);
|
await app.client.waitUntilTextExists(selectors.menuLink(pages[0].href), pages[0].name);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
pages.forEach(({ name, href, expectedSelector, expectedText }) => {
|
pages.forEach(({ name, href, expectedSelector, expectedText }) => {
|
||||||
it(`shows ${drawer}->${name} page`, async () => {
|
it(`shows ${drawer}->${name} page`, async () => {
|
||||||
expect(clusterAdded).toBe(true);
|
expect(clusterAdded).toBe(true);
|
||||||
await app.client.click(`a[href^="/${href}"]`);
|
await app.client.click(drawer ? selectors.menuLink(href) : selectors.mainLink);
|
||||||
await app.client.waitUntilTextExists(expectedSelector, expectedText);
|
await app.client.waitUntilTextExists(expectedSelector, expectedText);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -341,7 +342,7 @@ describe("Lens cluster pages", () => {
|
|||||||
it(`hides ${drawer} drawer`, async () => {
|
it(`hides ${drawer} drawer`, async () => {
|
||||||
expect(clusterAdded).toBe(true);
|
expect(clusterAdded).toBe(true);
|
||||||
await app.client.click(selectors.expandSubMenu);
|
await app.client.click(selectors.expandSubMenu);
|
||||||
await expect(app.client.waitUntilTextExists(`a[href^="/${pages[0].href}"]`, pages[0].name, 100)).rejects.toThrow();
|
await expect(app.client.waitUntilTextExists(selectors.menuLink(pages[0].href), pages[0].name, 100)).rejects.toThrow();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -359,7 +360,7 @@ describe("Lens cluster pages", () => {
|
|||||||
it(`shows a logs for a pod`, async () => {
|
it(`shows a logs for a pod`, async () => {
|
||||||
expect(clusterAdded).toBe(true);
|
expect(clusterAdded).toBe(true);
|
||||||
// Go to Pods page
|
// Go to Pods page
|
||||||
await app.client.click(getSidebarItemSelectors("workloads").expandSubMenu);
|
await app.client.click(getSidebarSelectors("workloads").expandSubMenu);
|
||||||
await app.client.waitUntilTextExists('a[href^="/pods"]', "Pods");
|
await app.client.waitUntilTextExists('a[href^="/pods"]', "Pods");
|
||||||
await app.client.click('a[href^="/pods"]');
|
await app.client.click('a[href^="/pods"]');
|
||||||
await app.client.click(".NamespaceSelect");
|
await app.client.click(".NamespaceSelect");
|
||||||
@ -426,7 +427,7 @@ describe("Lens cluster pages", () => {
|
|||||||
|
|
||||||
it(`creates a pod in ${TEST_NAMESPACE} namespace`, async () => {
|
it(`creates a pod in ${TEST_NAMESPACE} namespace`, async () => {
|
||||||
expect(clusterAdded).toBe(true);
|
expect(clusterAdded).toBe(true);
|
||||||
await app.client.click(getSidebarItemSelectors("workloads").expandSubMenu);
|
await app.client.click(getSidebarSelectors("workloads").expandSubMenu);
|
||||||
await app.client.waitUntilTextExists('a[href^="/pods"]', "Pods");
|
await app.client.waitUntilTextExists('a[href^="/pods"]', "Pods");
|
||||||
await app.client.click('a[href^="/pods"]');
|
await app.client.click('a[href^="/pods"]');
|
||||||
|
|
||||||
|
|||||||
@ -11,8 +11,12 @@
|
|||||||
padding: $itemSpacing;
|
padding: $itemSpacing;
|
||||||
border: none;
|
border: none;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 25px;
|
||||||
|
|
||||||
a {
|
a {
|
||||||
|
grid-row: 2;
|
||||||
|
grid-column: 1 / span 2;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
@ -28,6 +32,9 @@
|
|||||||
|
|
||||||
.expand-icon {
|
.expand-icon {
|
||||||
--size: 20px;
|
--size: 20px;
|
||||||
|
grid-row: 2;
|
||||||
|
grid-column: 2;
|
||||||
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user