fleet/cypress/integration/basic/teamflow.spec.ts
Martavis Parker 5d0c7e510e
New Cypress configs and commands (#1268)
* #1024 added configs and commands to run

* #1024 fixed github actions for e2e tests

* #1024 optimized test configs
2021-07-01 10:32:12 -07:00

72 lines
2 KiB
TypeScript

describe("Teams flow", () => {
beforeEach(() => {
cy.setup();
cy.login();
});
it("Create, edit, and delete a team successfully", () => {
cy.visit("/settings/teams");
cy.findByRole("button", { name: /create team/i }).click();
cy.findByLabelText(/team name/i)
.click()
.type("Valor");
// ^$ forces exact match
cy.findByRole("button", { name: /^create$/i }).click();
cy.visit("/settings/teams");
// Allow rendering to settle
// TODO this might represent a bug in the React code.
cy.wait(100); // eslint-disable-line cypress/no-unnecessary-waiting
cy.contains("Valor").click({ force: true });
cy.findByText(/agent options/i).click();
cy.get(".ace_content")
.click()
.type("{selectall}{backspace}apiVersion: v1{enter}kind: options");
cy.findByRole("button", { name: /save/i }).click();
cy.visit("/settings/teams/1/options");
cy.contains(/apiVersion: v1/i).should("be.visible");
cy.contains(/kind: options/i).should("be.visible");
cy.visit("/settings/teams");
cy.contains("Valor").get(".Select-arrow-zone").click();
// need force:true for dropdown
cy.findByText(/edit/i).click({ force: true });
cy.findByLabelText(/team name/i)
.click()
.type("{selectall}{backspace}Mystic");
cy.findByRole("button", { name: /save/i }).click();
cy.visit("/settings/teams");
// Allow rendering to settle
// TODO this might represent a bug in the React code.
cy.wait(100); // eslint-disable-line cypress/no-unnecessary-waiting
cy.contains("Mystic").get(".Select-arrow-zone").click();
cy.findByText(/delete/i).click({ force: true });
cy.findByRole("button", { name: /delete/i }).click();
cy.findByText(/successfully deleted/i).should("be.visible");
cy.visit("/settings/teams");
// Allow rendering to settle
// TODO this might represent a bug in the React code.
cy.wait(100); // eslint-disable-line cypress/no-unnecessary-waiting
cy.findByText(/mystic/i).should("not.exist");
});
});