fleet/cypress/integration/basic/observer.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

67 lines
1.8 KiB
TypeScript

describe("Basic tier - Observer user", () => {
beforeEach(() => {
cy.setup();
cy.login();
cy.seedBasic();
cy.seedQueries();
cy.addDockerHost("apples");
cy.logout();
});
afterEach(() => {
cy.stopDockerHost();
});
it("Can perform the appropriate basic global observer actions", () => {
cy.login("oliver@organization.com", "user123#");
cy.visit("/");
// Ensure page is loaded
cy.contains("All hosts");
// Host manage page: Can see team column
cy.visit("/hosts/manage");
cy.get("thead").within(() => {
cy.findByText(/team/i).should("exist");
});
// Host details page: Can see team on host
cy.get("tbody").within(() => {
// Test host text varies
cy.findByRole("button").click();
});
cy.get(".title").within(() => {
cy.findByText("Team").should("exist");
});
cy.contains("button", /transfer/i).should("not.exist");
// Query pages: Can see team in select targets dropdown
cy.visit("/queries/manage");
cy.findByText(/detect presence/i).click();
cy.findByRole("button", { name: /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");
});
});
// Pseudo code for team observer only
// TODO: Rebuild this test according to new manual QA
it("Can perform the appropriate basic team observer only actions", () => {
cy.login("toni@organization.com", "user123#");
cy.visit("/hosts/manage");
cy.findByText("All hosts which have enrolled in Fleet").should("exist");
cy.findByText("Packs").should("not.exist");
cy.findByText("Settings").should("not.exist");
cy.contains(".table-container .data-table__table th", "Team").should(
"be.visible"
);
});
});