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 machine list tests #5286

Merged
merged 1 commit into from
Jan 16, 2024
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
2 changes: 1 addition & 1 deletion cypress/e2e/with-users/machines/list.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ context("Machine listing", () => {
);
cy.findByRole("button", { name: /Delete/i }).click();
cy.findByRole("button", { name: /Delete 3 machines/ }).click();
cy.findByText(/No machines match the search criteria./).should("exist");
cy.findByText(/No machines available./).should("exist");
});

it("can filter machine list by deployment target", () => {
Expand Down
4 changes: 2 additions & 2 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Cypress.Commands.add("loginNonAdmin", () => {

Cypress.Commands.add("addMachine", (hostname = generateName()) => {
cy.visit(generateMAASURL("/machines"));
cy.get("[data-testid='add-hardware-dropdown'] button").click();
cy.findByRole("button", { name: "Add hardware" }).click();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Every test id replacement with a semantic query has has my 👍

cy.get(".p-contextual-menu__link").contains("Machine").click();
cy.get("input[name='hostname']").type(hostname);
cy.get("input[name='pxe_mac']").type(generateMac());
Expand Down Expand Up @@ -82,7 +82,7 @@ Cypress.Commands.add("deletePool", (pool: string) => {

Cypress.Commands.add("addMachines", (hostnames: string[]) => {
cy.visit(generateMAASURL("/machines"));
cy.get("[data-testid='add-hardware-dropdown'] button").click();
cy.findByRole("button", { name: "Add hardware" }).click();
cy.get(".p-contextual-menu__link").contains("Machine").click();
hostnames.forEach((hostname, index) => {
cy.get("input[name='hostname']").type(hostname);
Expand Down