Skip to content

Commit

Permalink
MAASENG-2182 address cypress intermittent failures (#5177)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jay-Topher authored Oct 4, 2023
1 parent eca83d7 commit 6ce1807
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
5 changes: 4 additions & 1 deletion cypress/e2e/with-users/machines/actions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,10 @@ context("Machine listing - actions", () => {
const machineName = generateName("machine");
cy.addMachine(machineName);
cy.findByRole("searchbox", { name: "Search" }).type(machineName);
cy.findByRole("checkbox", { name: `${machineName}.maas` }).click({
cy.waitForTableToLoad({ name: /Machines/i });
cy.findByRole("checkbox", {
name: `${machineName}.maas`,
}).click({
force: true,
});
openMachineActionForm("Categorise", "Set pool");
Expand Down
8 changes: 6 additions & 2 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ Cypress.Commands.add("deleteMachine", (hostname: string) => {
cy.visit(generateMAASURL("/machines"));
cy.findByRole("combobox", { name: "Group by" }).select("No grouping");
cy.findByRole("searchbox").type(hostname);
cy.findByText(/Showing 1 out of 1 machines/).should("exist");
cy.findByText(/Showing 1 out of 1 machines/, {
timeout: LONG_TIMEOUT,
}).should("exist");
cy.findByRole("grid", { name: /Machines/ }).within(() =>
cy
.findByRole("checkbox", { name: new RegExp(hostname) })
Expand Down Expand Up @@ -146,7 +148,9 @@ Cypress.Commands.add("waitForPageToLoad", () => {

Cypress.Commands.add("waitForTableToLoad", ({ name } = { name: undefined }) => {
cy.findByRole("grid", { name: /Loading/i }).should("exist");
cy.findByRole("grid", { name: /Loading/i }).should("not.exist");
cy.findByRole("grid", { name: /Loading/i, timeout: LONG_TIMEOUT }).should(
"not.exist"
);
return cy.findByRole("grid", { name }).should("exist");
});

Expand Down

0 comments on commit 6ce1807

Please sign in to comment.