Skip to content

Commit

Permalink
test: fix cypress failures #5281 WIP (#5301)
Browse files Browse the repository at this point in the history
  • Loading branch information
petermakowski committed Jan 23, 2024
1 parent f049c15 commit 1f3c7c9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cypress/e2e/with-users/controllers/details.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ context("Controller details", () => {
it("lists valid actions on the controller details page", () => {
cy.findByText(/Take action/).click();

[/Import images/i, /Delete/i].forEach((name) =>
[/Set zone/i, /Delete/i].forEach((name) =>
cy
.findByRole("button", {
name,
Expand Down
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 available./).should("exist");
cy.findByText(/No machines match the search criteria./).should("exist");
});

it("can filter machine list by deployment target", () => {
Expand Down
8 changes: 6 additions & 2 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,13 @@ Cypress.Commands.add("deleteMachine", (hostname: string) => {
Cypress.Commands.add("deletePool", (pool: string) => {
cy.visit(generateMAASURL("/pools"));
cy.findByRole("row", { name: new RegExp(`${pool}`) }).within(() => {
cy.findByRole("button", { name: /Delete/i }).click();
cy.findByTestId("action-confirm").click();
cy.findByRole("link", { name: /Delete/i }).click();
});
cy.findByRole("complementary", { name: /Delete/i })
.should("be.visible")
.within(() => {
cy.findByRole("button", { name: /Delete/i }).click();
});
cy.get(`[data-testid='message']:contains(${pool} removed successfully.)`, {
timeout: LONG_TIMEOUT,
});
Expand Down

0 comments on commit 1f3c7c9

Please sign in to comment.