Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: fix cypress #5137 #5229

Merged
merged 1 commit into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 9 additions & 19 deletions cypress/e2e/with-users/base/navigation.spec.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
import { generateMAASURL } from "../../utils";

const expectCollapsedNavigation = () => {
cy.findByRole("navigation", { name: /main navigation/i })
.invoke("width")
.should("equal", 64);
cy.findByRole("navigation", { name: /main navigation/i }).within(() =>
cy.getMainNavigation().invoke("width").should("equal", 64);
cy.getMainNavigation().within(() =>
cy.findByRole("link", { name: /machines/i }).should("not.exist")
);
};
const expectExpandedNavigation = () => {
cy.findByRole("navigation", { name: /main navigation/i })
.invoke("width")
.should("equal", 240);
cy.findByRole("navigation", { name: /main navigation/i }).within(() =>
cy.getMainNavigation().invoke("width").should("equal", 240);
cy.getMainNavigation().within(() =>
cy.findByRole("link", { name: /machines/i }).should("exist")
);
};
Expand Down Expand Up @@ -72,20 +68,14 @@ context("Navigation - admin - collapse", () => {

it("opens and closes the menu on mobile", () => {
cy.viewport("iphone-8");
const getMainNavigation = () =>
cy.findByRole("navigation", {
name: /main navigation/i,
});
getMainNavigation().should("not.be.visible");
cy.findByRole("banner", { name: /navigation/i }).within(() =>
cy.getMainNavigation().should("not.be.visible");
cy.findByRole("banner", { name: "navigation" }).within(() =>
cy.findByRole("button", { name: "Menu" }).click()
);
getMainNavigation()
cy.getMainNavigation()
.should("be.visible")
.within(() =>
cy.findByRole("button", { name: /collapse main navigation/ }).click()
);
getMainNavigation().should("not.be.visible");
.within(() => cy.findByRole("button", { name: /close menu/i }).click());
cy.getMainNavigation().should("not.be.visible");
});
});

Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/with-users/machines/actions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const MACHINE_ACTIONS_GROUPS = [
],
},
{
label: "Power cycle",
label: "Power",
actions: ["Power on", "Power off", "Soft power off"],
},
{
Expand Down
2 changes: 1 addition & 1 deletion cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ Cypress.Commands.add("waitForTableToLoad", ({ name } = { name: undefined }) => {
});

Cypress.Commands.add("getMainNavigation", () => {
return cy.findByRole("navigation", { name: /main navigation/i });
return cy.findByRole("banner", { name: /main navigation/i });
});

Cypress.Commands.add("expandMainNavigation", () => {
Expand Down
Loading