fleet/cypress/integration/basic/admin.spec.ts
Martavis Parker 672db9e2a7
Host Status Dropdown (#1556)
* #1372 created dropdown for status

* #1372 fixed default state for dropdown

* #1372 added help text and styling

* clean up

* fixed linting

* created changes log

* fixed e2e test

* created new header

* clean up

* added logic to edit and delete label using icons

* reworked selectedFilter to support status & label

* fixed multiple params in url

* comment clean up

* fixed tests

* linting fixes

* fixed height of status dropdown

* bug fix for selecting status 1st, label 2nd

* fixed e2e test

* minor style fix for side panel label scroll

* fixed label e2e test

* removed SQL editor for label selection

* removed edit and delete for platform labels

* fixed bugs loading hosts for every label click

* fixed linting

* fixed basic e2e test

* fixed observer basic e2e test

* modified changes file

* fixed bug with label replacement logic for url
2021-08-06 15:09:49 -07:00

91 lines
3.4 KiB
TypeScript

describe("Basic tier - Admin user", () => {
beforeEach(() => {
cy.setup();
cy.login();
cy.seedBasic();
cy.setupSMTP();
cy.seedQueries();
cy.addDockerHost("apples");
cy.logout();
});
afterEach(() => {
cy.stopDockerHost();
});
it("Can perform the appropriate basic-tier admin actions", () => {
cy.login("anna@organization.com", "user123#");
cy.visit("/");
// Ensure the hosts page is loaded
cy.contains("All hosts");
// On the hosts page, they should…
// See the “Teams” column in the Hosts table
cy.get("thead").contains(/team/i).should("exist");
// See and select the “Add new host” button
cy.contains("button", /add new host/i).click();
// See the “Select a team for this new host” in the Add new host modal. This modal appears after the user selects the “Add new host” button
cy.get(".add-host-modal__team-dropdown-wrapper .Select-control").click();
cy.get(".add-host-modal__team-dropdown-wrapper").within(() => {
cy.findByText(/no team/i).should("exist");
cy.findByText(/apples/i).should("exist");
cy.findByText(/oranges/i).should("exist");
});
cy.contains("button", /done/i).click();
// On the Host details page, they should…
// See the “Team” information below the hostname
// Be able to transfer Teams
cy.visit("/hosts/1");
cy.findByText(/team/i).next().contains("Apples");
cy.contains("button", /transfer/i).click();
cy.get(".Select-control").click();
cy.findByText(/create a team/i).should("exist");
cy.get(".Select-menu").within(() => {
cy.findByText(/no team/i).should("exist");
cy.findByText(/apples/i).should("exist");
cy.findByText(/oranges/i).click();
});
cy.get(".transfer-action-btn").click();
cy.findByText(/transferred to oranges/i).should("exist");
cy.findByText(/team/i).next().contains("Oranges");
// On the Queries - new / edit / run page, they should…
// See the “Teams” section in the Select target picker. This picker is summoned when the “Select targets” field is selected.
cy.visit("/queries/new");
cy.get(".target-select").within(() => {
cy.findByText(/Label name, host name, IP address, etc./i).click();
cy.findByText(/teams/i).should("exist");
});
// On the Packs pages (manage, new, and edit), they should…
// ^^General admin functionality for packs page is being tested in app/packflow.spec.ts
// On the Schedule pages (manage, new, and edit), they should…
// ^^General admin functionality for packs page is being tested in app/queryflow.spec.ts
// On the Settings pages, they should…
// See the “Teams” navigation item and access the Settings - Teams page
cy.visit("/settings/organization");
cy.get(".react-tabs").within(() => {
cy.findByText(/teams/i).click();
});
// Access the Settings - Team details page
cy.findByText(/apples/i).click();
cy.findByText(/apples/i).should("exist");
cy.findByText(/manage users with global access here/i).should("exist");
// See the “Team” section in the create user modal. This modal is summoned when the “Create user” button is selected
cy.visit("/settings/organization");
cy.get(".react-tabs").within(() => {
cy.findByText(/users/i).click();
});
cy.findByRole("button", { name: /create user/i }).click();
cy.findByText(/assign teams/i).should("exist");
});
});