1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Opening cluster list by data-testId

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev 2021-06-18 16:36:50 +03:00
parent 3ec08eaf24
commit f8d2892a74
5 changed files with 8 additions and 5 deletions

View File

@ -45,7 +45,8 @@ describe("Lens cluster pages", () => {
utils.describeIf(ready)("test common pages", () => {
let clusterAdded = false;
const addCluster = async () => {
await app.client.waitForExist("#hotbarIcon-catalog-entity");
await app.client.waitForEnabled("[data-testId='browseClustersButton']");
await app.client.click("[data-testId='browseClustersButton']");
await waitForMinikubeDashboard(app);
await app.client.click('a[href="/nodes"]');
await app.client.waitUntilTextExists("div.TableCell", "Ready");

View File

@ -99,8 +99,8 @@ export async function appStart() {
}
export async function showCatalog(app: Application) {
await app.client.waitForExist("#hotbarIcon-catalog-entity");
await app.client.click("#hotbarIcon-catalog-entity");
await app.client.waitForExist("#hotbarIcon-catalog-entity .Icon");
await app.client.click("#hotbarIcon-catalog-entity .Icon");
}
type AsyncPidGetter = () => Promise<number>;

View File

@ -25,6 +25,7 @@ export interface WelcomeMenuRegistration {
title: string | (() => string);
icon: string;
click: () => void | Promise<void>;
testId?: string;
}
export class WelcomeMenuRegistry extends BaseRegistry<WelcomeMenuRegistration> {}

View File

@ -44,7 +44,7 @@ export class Welcome extends React.Component {
<ul className="box">
{WelcomeMenuRegistry.getInstance().getItems().map((item, index) => (
<li key={index} className="flex grid-12" onClick={() => item.click()}>
<li key={index} className="flex grid-12" onClick={() => item.click()} data-testId={item.testId}>
<Icon material={item.icon} className="box col-1" /> <a className="box col-10">{typeof item.title === "string" ? item.title : item.title()}</a> <Icon material="navigate_next" className="box col-1" />
</li>
))}

View File

@ -29,7 +29,8 @@ export function initWelcomeMenuRegistry() {
{
title: "Browse Clusters",
icon: "view_list",
click: () => navigate(catalogURL({ params: { group: "entity.k8slens.dev", kind: "KubernetesCluster" } } ))
click: () => navigate(catalogURL({ params: { group: "entity.k8slens.dev", kind: "KubernetesCluster" } } )),
testId: "browseClustersButton"
}
]);
}