From e037ff190cf414b7df56f5813ee6f1b5b033b3bb Mon Sep 17 00:00:00 2001 From: RachelElysia <71795832+RachelElysia@users.noreply.github.com> Date: Fri, 13 Jan 2023 16:05:58 -0500 Subject: [PATCH] Frontend: Fix flaky cypress (#9328) --- cypress/integration/free/maintainer.spec.ts | 1 - cypress/integration/pages/manageHostsPage.ts | 3 ++- cypress/integration/pages/managePacksPage.ts | 1 + cypress/integration/premium/admin.spec.ts | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cypress/integration/free/maintainer.spec.ts b/cypress/integration/free/maintainer.spec.ts index bc32fa74ff..8a225e3fc2 100644 --- a/cypress/integration/free/maintainer.spec.ts +++ b/cypress/integration/free/maintainer.spec.ts @@ -85,7 +85,6 @@ describe( it("allows maintainer to see and click 'Add label', 'Add hosts', and 'Manage enroll secrets' buttons", () => { manageHostsPage.allowsAddHosts(); manageHostsPage.allowsManageAndAddSecrets(); - manageHostsPage.allowsAddHosts(); }); }); describe("Host details page", () => { diff --git a/cypress/integration/pages/manageHostsPage.ts b/cypress/integration/pages/manageHostsPage.ts index 419f575b8a..5732d06e21 100644 --- a/cypress/integration/pages/manageHostsPage.ts +++ b/cypress/integration/pages/manageHostsPage.ts @@ -7,10 +7,11 @@ const manageHostsPage = { cy.getAttached(".button-wrap") .contains("button", /manage enroll secret/i) .click(); + cy.wait(500); // eslint-disable-line cypress/no-unnecessary-waiting cy.contains("button", /add secret/i).click(); + cy.wait(500); // eslint-disable-line cypress/no-unnecessary-waiting cy.contains("button", /save/i).click(); cy.findByText(/successfully added/i); - cy.getAttached(".modal__ex").click(); }, allowsAddHosts: () => { diff --git a/cypress/integration/pages/managePacksPage.ts b/cypress/integration/pages/managePacksPage.ts index 6683f5ae6c..7d7a0611ae 100644 --- a/cypress/integration/pages/managePacksPage.ts +++ b/cypress/integration/pages/managePacksPage.ts @@ -8,6 +8,7 @@ const managePacksPage = { }, allowsCreatePack: () => { + cy.getAttached(".empty-table__container"); cy.findByRole("button", { name: /create new pack/i }).click(); cy.findByLabelText(/name/i).click().type("Errors and crashes"); cy.findByLabelText(/description/i) diff --git a/cypress/integration/premium/admin.spec.ts b/cypress/integration/premium/admin.spec.ts index 625901e51e..58503cc2ca 100644 --- a/cypress/integration/premium/admin.spec.ts +++ b/cypress/integration/premium/admin.spec.ts @@ -380,8 +380,8 @@ describe("Premium tier - Global Admin user", () => { }); it("allows global admin to see and click all CTA buttons", () => { manageHostsPage.allowsAddHosts(); - manageHostsPage.allowsManageAndAddSecrets(); manageHostsPage.allowsAddLabelForm(); + manageHostsPage.allowsManageAndAddSecrets(); }); }); describe("Host details page", () => {