Team Details Page: Add new CTA buttons to e2e team flow (#3888)

This commit is contained in:
RachelElysia 2022-01-26 16:34:06 -05:00 committed by GitHub
parent ffabf803a3
commit 0402bb3407
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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");
});
});
});