From 0402bb3407299568832e6bbf19d0eabf19e96e88 Mon Sep 17 00:00:00 2001 From: RachelElysia <71795832+RachelElysia@users.noreply.github.com> Date: Wed, 26 Jan 2022 16:34:06 -0500 Subject: [PATCH] Team Details Page: Add new CTA buttons to e2e team flow (#3888) --- cypress/integration/premium/teamflow.spec.ts | 83 +++++++++++++++----- 1 file changed, 65 insertions(+), 18 deletions(-) diff --git a/cypress/integration/premium/teamflow.spec.ts b/cypress/integration/premium/teamflow.spec.ts index 78052b3851..0295e9d19a 100644 --- a/cypress/integration/premium/teamflow.spec.ts +++ b/cypress/integration/premium/teamflow.spec.ts @@ -43,28 +43,30 @@ describe("Teams flow (seeded)", () => { cy.loginWithCySession(); cy.visit("/settings/teams"); }); - it("edits an existing team", () => { + it("edits name of an existing team", () => { cy.getAttached(".table-container").within(() => { - cy.contains("Apples").click({ force: true }); + cy.contains("Apples"); + cy.getAttached("tbody").within(() => { + cy.getAttached("tr") + .first() + .within(() => { + cy.getAttached(".Select-arrow-zone").click(); + cy.findByText(/edit/i).click({ force: true }); + }); + }); }); - cy.findByText(/agent options/i).click(); - cy.contains(".ace_content", "config:"); - cy.get(".ace_text-input") - .first() - .focus() - .type("{selectall}{backspace}config:\n options:"); - - cy.findByRole("button", { name: /save options/i }).click(); - - cy.contains("span", /successfully saved/i).should("exist"); - cy.visit("/settings/teams/1/options"); - - cy.contains(/config:/i).should("be.visible"); - cy.contains(/options:/i).should("be.visible"); + cy.getAttached(".edit-team-modal").within(() => { + cy.findByLabelText(/team name/i) + .clear() + .type("Bananas"); + cy.findByRole("button", { name: /save/i }).click(); + }); + cy.findByText(/successfully edited/i).should("be.visible"); + cy.findByText(/apples/i).should("not.exist"); }); it("deletes an existing team", () => { cy.getAttached(".table-container").within(() => { - cy.contains("Apples"); + cy.contains("Bananas"); cy.getAttached("tbody").within(() => { cy.getAttached("tr") .first() @@ -78,7 +80,7 @@ describe("Teams flow (seeded)", () => { cy.findByRole("button", { name: /delete/i }).click(); }); cy.findByText(/successfully deleted/i).should("be.visible"); - cy.findByText(/apples/i).should("not.exist"); + cy.findByText(/bananas/i).should("not.exist"); }); }); // describe("Manage schedules page", () => { @@ -91,4 +93,49 @@ describe("Teams flow (seeded)", () => { // // TODO: Unable to add tests because "Schedule a query" button detattaches even when using `getAttached` // }); // }); + describe("Team details page", () => { + beforeEach(() => { + cy.loginWithCySession(); + cy.visit("/settings/teams"); + cy.getAttached(".table-container").within(() => { + cy.contains("Oranges").click({ force: true }); + }); + }); + it("allows to add new enroll secret to team", () => { + cy.getAttached(".team-details__team-actions") + .contains("button", /manage enroll secret/i) + .click(); + cy.getAttached(".enroll-secret-modal__add-secret") + .contains("button", /add secret/i) + .click(); + cy.getAttached(".secret-editor-modal__button-wrap") + .contains("button", /save/i) + .click(); + cy.getAttached(".enroll-secret-modal__button-wrap") + .contains("button", /done/i) + .click(); + }); + it("allows to see and click generate installer", () => { + cy.getAttached(".team-details__team-actions") + .contains("button", /generate installer/i) + .click(); + cy.getAttached(".modal__content").contains("button", /done/i).click(); + }); + it("edits agent options of an existing team", () => { + cy.findByText(/agent options/i).click(); + cy.contains(".ace_content", "config:"); + cy.getAttached(".ace_text-input") + .first() + .focus() + .type("{selectall}{backspace}config:\n options:"); + + cy.findByRole("button", { name: /save options/i }).click(); + + cy.contains("span", /successfully saved/i).should("exist"); + cy.visit("/settings/teams/2/options"); + + cy.contains(/config:/i).should("be.visible"); + cy.contains(/options:/i).should("be.visible"); + }); + }); });