E2e Testing: Fleet Core global maintainer and Fleet Basic global maintainer (#1095)

* Basic global maintainer e2e test match manual QA doc
* Core global maintainer e2e test match manual QA doc
This commit is contained in:
RachelElysia 2021-06-15 15:21:57 -04:00 committed by GitHub
parent 233cce6120
commit 8fd35b9626
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 155 additions and 2 deletions

View file

@ -4,9 +4,15 @@ if (Cypress.env("FLEET_TIER") === "basic") {
cy.setup();
cy.login();
cy.seedBasic();
cy.seedQueries();
cy.addDockerHost();
cy.logout();
});
afterEach(() => {
cy.stopDockerHost();
});
it("Can perform the appropriate actions", () => {
cy.login("mary@organization.com", "user123#");
cy.visit("/");
@ -14,7 +20,46 @@ if (Cypress.env("FLEET_TIER") === "basic") {
// Ensure page is loaded
cy.contains("All hosts");
// TODO write the test!
// Host manage page: Teams column, select a team
cy.visit("/hosts/manage");
cy.get("thead").within(() => {
cy.findByText(/team/i).should("exist");
});
cy.contains("button", /add new host/i).click();
// TODO: Check Team Apples is in Select a team dropdown
cy.contains("button", /done/i).click();
// Host details page: Can see team UI
cy.get("tbody").within(() => {
// Test host text varies
cy.findByRole("button").click();
});
cy.get(".title").within(() => {
cy.findByText("Team").should("exist");
});
// Query pages: Can see teams UI for create, edit, and run query
cy.visit("/queries/manage");
cy.findByRole("button", { name: /create new query/i }).click();
cy.get(".target-select").within(() => {
cy.findByText(/Label name, host name, IP address, etc./i).click();
cy.findByText(/teams/i).should("exist");
});
cy.visit("/queries/manage");
cy.findByText(/detect presence/i).click();
cy.findByRole("button", { name: /edit or run query/i }).click();
cy.get(".target-select").within(() => {
cy.findByText(/Label name, host name, IP address, etc./i).click();
cy.findByText(/teams/i).should("exist");
});
});
});
}

View file

@ -4,9 +4,15 @@ if (Cypress.env("FLEET_TIER") === "core") {
cy.setup();
cy.login();
cy.seedCore();
cy.seedQueries();
cy.addDockerHost();
cy.logout();
});
afterEach(() => {
cy.stopDockerHost();
});
it("Can perform the appropriate actions", () => {
cy.login("mary@organization.com", "user123#");
cy.visit("/");
@ -14,7 +20,109 @@ if (Cypress.env("FLEET_TIER") === "core") {
// Ensure page is loaded
cy.contains("All hosts");
// TODO write the test!
// Settings restrictions
cy.findByText(/settings/i).should("not.exist");
cy.visit("/settings/organization");
cy.findByText(/you do not have permissions/i).should("exist");
// Host manage page: No team UI, can add host and label
cy.visit("/hosts/manage");
cy.findByText(/teams/i).should("not.exist");
cy.contains("button", /add new host/i).click();
cy.findByText("select a team").should("not.exist");
cy.contains("button", /done/i).click();
cy.contains("button", /add new label/i).click();
cy.contains("button", /cancel/i).click();
// Host details page: No team UI, can delete and create new query
cy.get("tbody").within(() => {
// Test host text varies
cy.findByRole("button").click();
});
cy.get(".title").within(() => {
cy.findByText(/team/i).should("not.exist");
});
cy.contains("button", /delete/i).click();
cy.contains("button", /cancel/i).click();
cy.contains("button", /query/i).click();
cy.contains("button", /create custom query/i).click();
// Queries pages: Can create, edit, and run query
cy.visit("/queries/manage");
cy.get("thead").within(() => {
cy.findByText(/observers can run/i).should("exist");
});
cy.findByRole("button", { name: /create new query/i }).click();
cy.findByLabelText(/query name/i)
.click()
.type("Query all window crashes");
cy.get(".ace_scroller")
.click({ force: true })
.type("{selectall}{backspace}SELECT * FROM windows_crashes;");
cy.findByLabelText(/description/i)
.click()
.type("See all window crashes");
cy.findByRole("button", { name: /save/i }).click();
cy.findByRole("button", { name: /save as new/i }).click();
cy.findByLabelText(/observers can run/i).click({ force: true });
cy.get(".target-select").within(() => {
cy.findByText(/Label name, host name, IP address, etc./i).click();
cy.findByText(/teams/i).should("not.exist");
});
cy.findByRole("button", { name: /run/i }).should("exist");
cy.visit("/queries/manage");
cy.findByText(/query all/i).click();
cy.findByRole("button", { name: /edit or run query/i }).click();
// Packs pages: Can create, edit, delete a pack
cy.visit("/packs/manage");
cy.findByRole("button", { name: /create new pack/i }).click();
cy.findByLabelText(/query pack title/i)
.click()
.type("Errors and crashes");
cy.findByLabelText(/description/i)
.click()
.type("See all user errors and window crashes.");
cy.findByRole("button", { name: /save query pack/i }).click();
cy.visit("/packs/manage");
cy.findByText(/errors and crashes/i).click();
cy.findByRole("link", { name: /edit pack/i }).should("exist");
cy.get("#select-pack-1").check({ force: true });
cy.findByRole("button", { name: /delete/i }).click();
// Can't figure out how attach findByRole onto modal button
// Can't use findByText because delete button under modal
cy.get(".all-packs-page__modal-btn-wrap > .button--alert")
.contains("button", /delete/i)
.click();
cy.findByText(/successfully deleted/i).should("be.visible");
cy.findByText(/server errors/i).should("not.exist");
});
});
}