mirror of
https://github.com/fleetdm/fleet
synced 2026-05-22 16:39:01 +00:00
Frontend e2e tests: Refactor using page objects (#7869)
This commit is contained in:
parent
c23a15394e
commit
db348351ac
27 changed files with 1343 additions and 1954 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import AppSettingsPage from "../../../pages/appSettingsPage";
|
||||
import dashboardPage from "../../pages/dashboardPage";
|
||||
|
||||
describe("Dashboard", () => {
|
||||
before(() => {
|
||||
|
|
@ -15,23 +15,19 @@ describe("Dashboard", () => {
|
|||
describe("Operating systems card", () => {
|
||||
beforeEach(() => {
|
||||
cy.loginWithCySession();
|
||||
cy.visit("/dashboard");
|
||||
dashboardPage.visitsDashboardPage();
|
||||
});
|
||||
|
||||
it("displays operating systems card if macOS platform is selected", () => {
|
||||
cy.getAttached(".homepage__platform_dropdown").click();
|
||||
cy.getAttached(".Select-menu-outer").within(() => {
|
||||
cy.findAllByText("macOS").click();
|
||||
});
|
||||
cy.getAttached(".operating-systems").should("exist");
|
||||
dashboardPage.switchesPlatform("macOS");
|
||||
});
|
||||
|
||||
it("displays operating systems card if Windows platform is selected", () => {
|
||||
cy.getAttached(".homepage__platform_dropdown").click();
|
||||
cy.getAttached(".Select-menu-outer").within(() => {
|
||||
cy.findAllByText("Windows").click();
|
||||
});
|
||||
cy.getAttached(".operating-systems").should("exist");
|
||||
dashboardPage.switchesPlatform("Windows");
|
||||
});
|
||||
|
||||
it("displays operating systems card if Linux platform is selected", () => {
|
||||
dashboardPage.switchesPlatform("Linux");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
import * as path from "path";
|
||||
import { format } from "date-fns";
|
||||
import manageHostsPage from "../../pages/manageHostsPage";
|
||||
import hostDetailsPage from "../../pages/hostDetailsPage";
|
||||
|
||||
let hostname = "";
|
||||
|
||||
|
|
@ -22,12 +24,10 @@ describe("Hosts flow", () => {
|
|||
describe("Manage hosts page", () => {
|
||||
beforeEach(() => {
|
||||
cy.loginWithCySession();
|
||||
cy.visit("/hosts/manage");
|
||||
manageHostsPage.visitsManageHostsPage();
|
||||
});
|
||||
it("adds a new host and downloads installation files", () => {
|
||||
// Download add hosts files
|
||||
cy.visit("/hosts/manage");
|
||||
|
||||
cy.getAttached(".manage-hosts").within(() => {
|
||||
cy.contains("button", /add hosts/i).click();
|
||||
});
|
||||
|
|
@ -71,7 +71,6 @@ describe("Hosts flow", () => {
|
|||
}
|
||||
});
|
||||
it(`exports hosts to CSV`, () => {
|
||||
cy.visit("/hosts/manage");
|
||||
cy.getAttached(".manage-hosts").within(() => {
|
||||
cy.getAttached(".manage-hosts__export-btn").click();
|
||||
});
|
||||
|
|
@ -85,7 +84,6 @@ describe("Hosts flow", () => {
|
|||
}
|
||||
});
|
||||
it(`hides and shows "Used by" column`, () => {
|
||||
cy.visit("/hosts/manage");
|
||||
cy.getAttached("thead").within(() =>
|
||||
cy.findByText(/used by/i).should("not.exist")
|
||||
);
|
||||
|
|
@ -104,7 +102,7 @@ describe("Hosts flow", () => {
|
|||
describe("Manage policies page", () => {
|
||||
beforeEach(() => {
|
||||
cy.loginWithCySession();
|
||||
cy.visit("/hosts/manage");
|
||||
manageHostsPage.visitsManageHostsPage();
|
||||
});
|
||||
it(
|
||||
"runs policy on an existing host",
|
||||
|
|
@ -158,7 +156,7 @@ describe("Hosts flow", () => {
|
|||
describe("Host details page", () => {
|
||||
beforeEach(() => {
|
||||
cy.loginWithCySession();
|
||||
cy.visit("/hosts/manage");
|
||||
manageHostsPage.visitsManageHostsPage();
|
||||
cy.getAttached("tbody").within(() => {
|
||||
cy.getAttached(".button--text-link").first().click();
|
||||
});
|
||||
|
|
@ -269,23 +267,8 @@ describe("Hosts flow", () => {
|
|||
}
|
||||
);
|
||||
it("deletes an existing host", () => {
|
||||
cy.getAttached(".host-details__action-button-container")
|
||||
.within(() => {
|
||||
cy.findByText(/delete/i).click();
|
||||
})
|
||||
.then(() => {
|
||||
cy.getAttached(".modal__modal_container")
|
||||
.within(() => {
|
||||
cy.findByText(/delete host/i).should("exist");
|
||||
cy.findByRole("button", { name: /delete/i }).click();
|
||||
})
|
||||
.then(() => {
|
||||
cy.findByText(/add your devices to fleet/i).should("exist");
|
||||
cy.findByText(/add hosts/i).should("exist");
|
||||
cy.findByText(/about this host/i).should("not.exist");
|
||||
cy.findByText(hostname).should("not.exist");
|
||||
});
|
||||
});
|
||||
hostDetailsPage.allowsDeleteHost();
|
||||
hostDetailsPage.verifiesDeletedHost(hostname);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
import manageHostsPage from "../../pages/manageHostsPage";
|
||||
|
||||
describe("Labels flow", () => {
|
||||
before(() => {
|
||||
Cypress.session.clearAllSavedSessions();
|
||||
|
|
@ -14,7 +16,7 @@ describe("Labels flow", () => {
|
|||
describe("Manage hosts page", () => {
|
||||
beforeEach(() => {
|
||||
cy.loginWithCySession();
|
||||
cy.visit("/hosts/manage");
|
||||
manageHostsPage.visitsManageHostsPage();
|
||||
});
|
||||
it("creates a custom label", () => {
|
||||
cy.getAttached(".label-filter-select__control").click();
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
import managePacksPage from "../../pages/managePacksPage";
|
||||
|
||||
describe("Pack flow (empty)", () => {
|
||||
before(() => {
|
||||
Cypress.session.clearAllSavedSessions();
|
||||
|
|
@ -12,15 +14,11 @@ describe("Pack flow (empty)", () => {
|
|||
describe("Manage packs page", () => {
|
||||
beforeEach(() => {
|
||||
cy.loginWithCySession();
|
||||
cy.visit("/packs/manage");
|
||||
managePacksPage.visitsManagePacksPage();
|
||||
});
|
||||
it("creates a new pack", () => {
|
||||
cy.findByRole("button", { name: /create new pack/i }).click();
|
||||
cy.findByLabelText(/name/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();
|
||||
managePacksPage.allowsCreatePack();
|
||||
managePacksPage.verifiesCreatedPack();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
@ -40,7 +38,7 @@ describe("Pack flow (seeded)", () => {
|
|||
describe("Pack details page", () => {
|
||||
beforeEach(() => {
|
||||
cy.loginWithCySession();
|
||||
cy.visit("/packs/manage");
|
||||
managePacksPage.visitsManagePacksPage();
|
||||
cy.getAttached(".name__cell > .button--text-link").first().click();
|
||||
});
|
||||
it("adds a query to an existing pack", () => {
|
||||
|
|
@ -74,35 +72,18 @@ describe("Pack flow (seeded)", () => {
|
|||
.click();
|
||||
});
|
||||
it("edits an existing pack", () => {
|
||||
cy.findByLabelText(/name/i).clear().type("Server errors");
|
||||
cy.findByLabelText(/description/i)
|
||||
.clear()
|
||||
.type("See all server errors.");
|
||||
cy.findByRole("button", { name: /save/i }).click();
|
||||
managePacksPage.allowsEditPack();
|
||||
managePacksPage.verifiesEditedPack();
|
||||
});
|
||||
});
|
||||
describe("Manage packs page", () => {
|
||||
beforeEach(() => {
|
||||
cy.loginWithCySession();
|
||||
cy.visit("/packs/manage");
|
||||
managePacksPage.visitsManagePacksPage();
|
||||
});
|
||||
it("deletes an existing pack", () => {
|
||||
cy.getAttached("tbody").within(() => {
|
||||
cy.getAttached("tr")
|
||||
.first()
|
||||
.within(() => {
|
||||
cy.getAttached(".fleet-checkbox__input").check({ force: true });
|
||||
});
|
||||
});
|
||||
cy.findByRole("button", { name: /delete/i }).click();
|
||||
cy.getAttached(".remove-pack-modal .modal-cta-wrap > .button--alert")
|
||||
.contains("button", /delete/i)
|
||||
.click({ force: true });
|
||||
cy.findByText(/successfully deleted/i).should("be.visible");
|
||||
cy.visit("/packs/manage");
|
||||
cy.getAttached(".table-container").within(() => {
|
||||
cy.findByText(/windows starter pack/i).should("not.exist");
|
||||
});
|
||||
managePacksPage.allowsDeletePack();
|
||||
managePacksPage.verifiesDeletedPack();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import CONSTANTS from "../../../support/constants";
|
||||
import managePoliciesPage from "../../pages/managePoliciesPage";
|
||||
|
||||
const {
|
||||
CONFIG_INTEGRATIONS_AUTOMATIONS,
|
||||
|
|
@ -139,7 +140,7 @@ describe("Policies flow (empty)", () => {
|
|||
describe("Manage policies page", () => {
|
||||
beforeEach(() => {
|
||||
cy.loginWithCySession();
|
||||
cy.visit("/policies/manage");
|
||||
managePoliciesPage.visitManagePoliciesPage();
|
||||
});
|
||||
it("creates a custom policy", () => {
|
||||
cy.getAttached(".policies-table__action-button-container").within(() => {
|
||||
|
|
@ -166,20 +167,15 @@ describe("Policies flow (empty)", () => {
|
|||
});
|
||||
|
||||
it("creates a default policy", () => {
|
||||
cy.getAttached(".manage-policies-page__header-wrap").within(() => {
|
||||
cy.findByText(/add a policy/i).click();
|
||||
});
|
||||
cy.findByText(/gatekeeper enabled/i).click();
|
||||
cy.findByRole("button", { name: /save/i }).click();
|
||||
cy.findByRole("button", { name: /save policy/i }).click();
|
||||
cy.findByText(/policy created/i).should("exist");
|
||||
managePoliciesPage.allowsAddDefaultPolicy();
|
||||
managePoliciesPage.verifiesAddedDefaultPolicy();
|
||||
});
|
||||
});
|
||||
|
||||
describe("Platform compatibility", () => {
|
||||
beforeEach(() => {
|
||||
cy.loginWithCySession();
|
||||
cy.visit("/policies/manage");
|
||||
managePoliciesPage.visitManagePoliciesPage();
|
||||
});
|
||||
const platforms = ["macOS", "Windows", "Linux"];
|
||||
|
||||
|
|
@ -209,7 +205,6 @@ describe("Policies flow (empty)", () => {
|
|||
};
|
||||
|
||||
it("checks sql statement for platform compatibility", () => {
|
||||
cy.visit("/policies/manage");
|
||||
cy.getAttached(".manage-policies-page__header-wrap").within(() => {
|
||||
cy.findByText(/add a policy/i).click();
|
||||
});
|
||||
|
|
@ -375,7 +370,7 @@ describe("Policies flow (empty)", () => {
|
|||
cy.findByText(/policy created/i).should("exist");
|
||||
|
||||
// confirm that new policy was saved with user-selected platforms
|
||||
cy.visit("policies/manage");
|
||||
managePoliciesPage.visitManagePoliciesPage();
|
||||
cy.getAttached("tbody").within(() => {
|
||||
cy.getAttached(".name__cell .button--text-link")
|
||||
.contains("Automatic login disabled (macOS)")
|
||||
|
|
@ -401,7 +396,7 @@ describe("Policies flow (empty)", () => {
|
|||
cy.findByText(/policy created/i).should("exist");
|
||||
|
||||
// edit platform selections for policy
|
||||
cy.visit("policies/manage");
|
||||
managePoliciesPage.visitManagePoliciesPage();
|
||||
cy.getAttached("tbody").within(() => {
|
||||
cy.getAttached(".name__cell .button--text-link")
|
||||
.contains("Antivirus healthy (macOS)")
|
||||
|
|
@ -429,7 +424,7 @@ describe("Policies flow (empty)", () => {
|
|||
cy.findByText(/policy updated/i).should("exist");
|
||||
|
||||
// confirm that policy was saved with new selection
|
||||
cy.visit("policies/manage");
|
||||
managePoliciesPage.visitManagePoliciesPage();
|
||||
cy.getAttached("tbody").within(() => {
|
||||
cy.getAttached(".name__cell .button--text-link")
|
||||
.contains("Antivirus healthy (macOS)")
|
||||
|
|
@ -459,7 +454,7 @@ describe("Policies flow (seeded)", () => {
|
|||
describe("Manage policies page", () => {
|
||||
beforeEach(() => {
|
||||
cy.loginWithCySession();
|
||||
cy.visit("/policies/manage");
|
||||
managePoliciesPage.visitManagePoliciesPage();
|
||||
});
|
||||
it("links to manage host page filtered by policy", () => {
|
||||
// Move internal clock forward 2 hours so that policies report host results
|
||||
|
|
@ -495,20 +490,8 @@ describe("Policies flow (seeded)", () => {
|
|||
});
|
||||
|
||||
it("deletes an existing policy", () => {
|
||||
cy.getAttached("tbody").within(() => {
|
||||
cy.getAttached("tr")
|
||||
.first()
|
||||
.within(() => {
|
||||
cy.getAttached(".fleet-checkbox__input").check({ force: true });
|
||||
});
|
||||
});
|
||||
cy.findByRole("button", { name: /delete/i }).click();
|
||||
cy.getAttached(".delete-policy-modal").within(() => {
|
||||
cy.findByRole("button", { name: /cancel/i }).should("exist");
|
||||
cy.findByRole("button", { name: /delete/i }).click();
|
||||
});
|
||||
cy.findByText(/deleted policy/i).should("exist");
|
||||
cy.findByText(/backup/i).should("not.exist");
|
||||
managePoliciesPage.allowsDeletePolicy();
|
||||
managePoliciesPage.verifiesDeletedPolicy();
|
||||
});
|
||||
it("creates a failing policies webhook", () => {
|
||||
cy.getAttached(".button-wrap").within(() => {
|
||||
|
|
@ -563,7 +546,7 @@ describe("Policies flow (seeded)", () => {
|
|||
"/api/latest/fleet/config",
|
||||
CONFIG_INTEGRATIONS_AUTOMATIONS
|
||||
).as("getIntegrations");
|
||||
cy.visit("/policies/manage");
|
||||
managePoliciesPage.visitManagePoliciesPage();
|
||||
cy.wait("@getIntegrations").then((configStub) => {
|
||||
console.log(JSON.stringify(configStub));
|
||||
});
|
||||
|
|
@ -602,7 +585,7 @@ describe("Policies flow (seeded)", () => {
|
|||
"/api/latest/fleet/config",
|
||||
enableJiraPoliciesIntegration
|
||||
).as("getIntegrations");
|
||||
cy.visit("/policies/manage");
|
||||
managePoliciesPage.visitManagePoliciesPage();
|
||||
cy.wait("@getIntegrations").then((configStub) => {
|
||||
console.log(JSON.stringify(configStub));
|
||||
});
|
||||
|
|
@ -650,7 +633,7 @@ describe("Policies flow (seeded)", () => {
|
|||
"/api/latest/fleet/config",
|
||||
enableZendeskPoliciesIntegration
|
||||
).as("getIntegrations");
|
||||
cy.visit("/policies/manage");
|
||||
managePoliciesPage.visitManagePoliciesPage();
|
||||
cy.wait("@getIntegrations").then((configStub) => {
|
||||
console.log(JSON.stringify(configStub));
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import * as path from "path";
|
||||
import { format } from "date-fns";
|
||||
import manageQueriesPage from "../../pages/manageQueriesPage";
|
||||
import manageSchedulePage from "../../pages/manageSchedulePage";
|
||||
|
||||
describe("Query flow (empty)", () => {
|
||||
before(() => {
|
||||
|
|
@ -14,25 +14,11 @@ describe("Query flow (empty)", () => {
|
|||
describe("Manage queries page", () => {
|
||||
beforeEach(() => {
|
||||
cy.loginWithCySession();
|
||||
cy.visit("/queries/manage");
|
||||
manageQueriesPage.visitManageQueriesPage();
|
||||
});
|
||||
it("creates a new query", () => {
|
||||
cy.getAttached(".queries-table__create-button").click();
|
||||
cy.getAttached(".ace_scroller")
|
||||
.click({ force: true })
|
||||
.type("{selectall}SELECT * FROM windows_crashes;");
|
||||
cy.findByRole("button", { name: /save/i }).click();
|
||||
cy.getAttached(".query-form__query-save-modal-name")
|
||||
.click()
|
||||
.type("Query all window crashes");
|
||||
cy.getAttached(".query-form__query-save-modal-description")
|
||||
.click()
|
||||
.type("See all window crashes");
|
||||
cy.findByRole("button", { name: /save query/i }).click();
|
||||
cy.findByText(/query created/i).should("exist");
|
||||
cy.getAttached(".query-form__query-name").within(() => {
|
||||
cy.findByText(/query all window crashes/i).should("exist");
|
||||
});
|
||||
manageQueriesPage.allowsCreateNewQuery();
|
||||
manageQueriesPage.verifiesCreatedNewQuery();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
@ -51,112 +37,37 @@ describe("Query flow (seeded)", () => {
|
|||
describe("Manage queries page", () => {
|
||||
beforeEach(() => {
|
||||
cy.loginWithCySession();
|
||||
cy.visit("/queries/manage");
|
||||
manageQueriesPage.visitManageQueriesPage();
|
||||
});
|
||||
it("runs a live query", () => {
|
||||
it("runs a live query and allows exporting results", () => {
|
||||
cy.addDockerHost();
|
||||
cy.getAttached(".name__cell .button--text-link").first().click();
|
||||
cy.findByText(/run query/i).click();
|
||||
cy.findByText(/all hosts/i).click();
|
||||
cy.findByText(/host targeted/i).should("exist");
|
||||
cy.findByText(/run/i).click();
|
||||
// Ensures live query runs
|
||||
cy.wait(10000); // eslint-disable-line cypress/no-unnecessary-waiting
|
||||
cy.getAttached(".table-container").within(() => {
|
||||
cy.findByText(/show query/i).click();
|
||||
});
|
||||
cy.getAttached(".show-query-modal").within(() => {
|
||||
cy.findByText(/done/i).click();
|
||||
});
|
||||
cy.getAttached(".table-container").within(() => {
|
||||
const formattedTime = format(new Date(), "MM-dd-yy hh-mm-ss");
|
||||
cy.findByText(/export results/i).click();
|
||||
const filename = `Query Results (${formattedTime}).csv`;
|
||||
cy.readFile(path.join(Cypress.config("downloadsFolder"), filename), {
|
||||
timeout: 5000,
|
||||
});
|
||||
});
|
||||
manageQueriesPage.allowsRunQuery();
|
||||
manageQueriesPage.verifiesRanQuery();
|
||||
manageQueriesPage.allowsViewRanQuery();
|
||||
manageQueriesPage.allowsExportQueryResults();
|
||||
cy.stopDockerHost();
|
||||
});
|
||||
it("edits an existing query", () => {
|
||||
cy.getAttached(".name__cell .button--text-link").first().click();
|
||||
cy.findByText(/run query/i).should("exist");
|
||||
cy.getAttached(".ace_scroller")
|
||||
.click()
|
||||
.type("{selectall}SELECT datetime, username FROM windows_crashes;");
|
||||
cy.findByRole("button", { name: "Save" }).click();
|
||||
cy.findByText(/query updated/i).should("be.visible");
|
||||
manageQueriesPage.allowsEditExistingQuery();
|
||||
manageQueriesPage.verifiesEditedExistingQuery();
|
||||
});
|
||||
it("saves an existing query as new query", () => {
|
||||
cy.getAttached(".name__cell .button--text-link")
|
||||
.eq(1)
|
||||
.within(() => {
|
||||
cy.findByText(/get authorized/i).click();
|
||||
});
|
||||
cy.findByText(/run query/i).should("exist");
|
||||
cy.getAttached(".ace_scroller")
|
||||
.click()
|
||||
.type("{selectall}SELECT datetime, username FROM windows_crashes;");
|
||||
cy.findByRole("button", { name: /save as new/i }).click();
|
||||
cy.findByText(/copy of/i).should("be.visible");
|
||||
manageQueriesPage.allowsSaveAsNewQuery();
|
||||
manageQueriesPage.verifiesSavedAsNewQuery();
|
||||
});
|
||||
it("deletes an existing query", () => {
|
||||
cy.findByText(/detect presence of authorized ssh keys/i)
|
||||
.parent()
|
||||
.parent()
|
||||
.parent()
|
||||
.within(() => {
|
||||
cy.getAttached(".fleet-checkbox__input").check({
|
||||
force: true,
|
||||
});
|
||||
});
|
||||
cy.findByRole("button", { name: /delete/i }).click();
|
||||
cy.getAttached(".delete-query-modal .modal-cta-wrap").within(() => {
|
||||
cy.findByRole("button", { name: /delete/i }).click();
|
||||
});
|
||||
cy.findByText(/successfully deleted query/i).should("be.visible");
|
||||
cy.findByText(/detect presence of authorized ssh keys/i).should(
|
||||
"not.exist"
|
||||
);
|
||||
manageQueriesPage.allowsDeleteExistingQuery();
|
||||
manageQueriesPage.verifiesDeletedExistingQuery();
|
||||
});
|
||||
});
|
||||
describe("Manage schedules page", () => {
|
||||
beforeEach(() => {
|
||||
cy.loginWithCySession();
|
||||
cy.visit("/schedule/manage");
|
||||
manageSchedulePage.visitManageSchedulePage();
|
||||
});
|
||||
it("creates a new scheduled query", () => {
|
||||
cy.getAttached(".no-schedule__schedule-button").click();
|
||||
cy.getAttached(".schedule-editor-modal__form").within(() => {
|
||||
cy.findByText(/select query/i).click();
|
||||
cy.findByText(/get local/i).click();
|
||||
cy.findByText(/every day/i).click();
|
||||
cy.findByText(/every 6 hours/i).click();
|
||||
cy.findByText(/show advanced options/i).click();
|
||||
cy.findByText(/snapshot/i).click();
|
||||
cy.findByText(/ignore removals/i).click();
|
||||
cy.getAttached(".schedule-editor-modal__form-field--platform").within(
|
||||
() => {
|
||||
cy.findByText(/all/i).click();
|
||||
cy.findByText(/linux/i).click();
|
||||
}
|
||||
);
|
||||
cy.getAttached(
|
||||
".schedule-editor-modal__form-field--osquer-vers"
|
||||
).within(() => {
|
||||
cy.findByText(/all/i).click();
|
||||
cy.findByText(/4.6.0/i).click();
|
||||
});
|
||||
cy.getAttached(".schedule-editor-modal__form-field--shard").within(
|
||||
() => {
|
||||
cy.getAttached(".input-field").click().type("50");
|
||||
}
|
||||
);
|
||||
cy.getAttached(".modal-cta-wrap").within(() => {
|
||||
cy.findByRole("button", { name: /schedule/i }).click();
|
||||
});
|
||||
});
|
||||
cy.findByText(/successfully added/i).should("be.visible");
|
||||
manageSchedulePage.allowsAddSchedule();
|
||||
manageSchedulePage.verifiesAddedSchedule();
|
||||
});
|
||||
|
||||
it("shows sql of a scheduled query successfully", () => {
|
||||
|
|
@ -168,44 +79,20 @@ describe("Query flow (seeded)", () => {
|
|||
});
|
||||
cy.getAttached(".show-query-modal").within(() => {
|
||||
cy.getAttached(".ace_content").within(() => {
|
||||
cy.findByText(/select/i).should("exist");
|
||||
cy.findByText(/datetime/i).should("exist");
|
||||
cy.contains(/select/i).should("exist");
|
||||
cy.contains(/cypress/i).should("exist");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it("edit a scheduled query successfully", () => {
|
||||
cy.getAttached("tbody>tr")
|
||||
.should("have.length", 1)
|
||||
.within(() => {
|
||||
cy.findByText(/action/i).click();
|
||||
cy.findByText(/edit/i).click();
|
||||
});
|
||||
cy.getAttached(".schedule-editor-modal__form").within(() => {
|
||||
cy.findByText(/every 6 hours/i).click();
|
||||
cy.findByText(/every day/i).click();
|
||||
|
||||
cy.getAttached(".modal-cta-wrap").within(() => {
|
||||
cy.findByRole("button", { name: /schedule/i }).click();
|
||||
});
|
||||
});
|
||||
cy.findByText(/successfully updated/i).should("be.visible");
|
||||
manageSchedulePage.allowsEditSchedule();
|
||||
manageSchedulePage.verifiesEditedSchedule();
|
||||
});
|
||||
|
||||
it("remove a scheduled query successfully", () => {
|
||||
cy.getAttached("tbody>tr")
|
||||
.should("have.length", 1)
|
||||
.within(() => {
|
||||
cy.findByText(/1 day/i).should("exist");
|
||||
cy.findByText(/action/i).click();
|
||||
cy.findByText(/remove/i).click();
|
||||
});
|
||||
cy.getAttached(".remove-scheduled-query-modal .modal-cta-wrap").within(
|
||||
() => {
|
||||
cy.findByRole("button", { name: /remove/i }).click();
|
||||
}
|
||||
);
|
||||
cy.findByText(/successfully removed/i).should("be.visible");
|
||||
manageSchedulePage.allowsRemoveSchedule();
|
||||
manageSchedulePage.verifiesRemovedSchedule();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import CONSTANTS from "../../../support/constants";
|
||||
import manageSoftwarePage from "../../pages/manageSoftwarePage";
|
||||
|
||||
const {
|
||||
CONFIG_INTEGRATIONS_AUTOMATIONS,
|
||||
|
|
@ -196,12 +197,11 @@ describe("Software", () => {
|
|||
cy.logout();
|
||||
});
|
||||
|
||||
// TODO: Software list and details test coverage (Issue #3954)
|
||||
// describe("Manage software page", () => {
|
||||
// beforeEach(() => {
|
||||
// cy.loginWithCySession();
|
||||
// cy.viewport(1600, 900);
|
||||
// cy.visit("/software/manage");
|
||||
// manageSoftwarePage.visitManageSoftwarePage();
|
||||
// });
|
||||
// it("renders and searches the host's software, links to filter hosts by software", () => {
|
||||
// // cy.getAttached(".manage-software-page__count").within(() => {
|
||||
|
|
@ -245,7 +245,7 @@ describe("Software", () => {
|
|||
"/api/latest/fleet/config",
|
||||
CONFIG_INTEGRATIONS_AUTOMATIONS
|
||||
).as("getIntegrations");
|
||||
cy.visit("/software/manage");
|
||||
manageSoftwarePage.visitManageSoftwarePage();
|
||||
cy.wait("@getIntegrations").then((configStub) => {
|
||||
console.log(JSON.stringify(configStub));
|
||||
});
|
||||
|
|
@ -319,7 +319,7 @@ describe("Software", () => {
|
|||
"/api/latest/fleet/config",
|
||||
enableJiraSoftwareIntegration
|
||||
).as("getIntegrations");
|
||||
cy.visit("/software/manage");
|
||||
manageSoftwarePage.visitManageSoftwarePage();
|
||||
cy.wait("@getIntegrations").then((configStub) => {
|
||||
console.log(JSON.stringify(configStub));
|
||||
});
|
||||
|
|
@ -367,7 +367,7 @@ describe("Software", () => {
|
|||
"/api/latest/fleet/config",
|
||||
enableZendeskSoftwareIntegration
|
||||
).as("getIntegrations");
|
||||
cy.visit("/software/manage");
|
||||
manageSoftwarePage.visitManageSoftwarePage();
|
||||
cy.wait("@getIntegrations").then((configStub) => {
|
||||
console.log(JSON.stringify(configStub));
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import CONSTANTS from "../../../support/constants";
|
||||
import manageHostsPage from "../../pages/manageHostsPage";
|
||||
|
||||
const { GOOD_PASSWORD } = CONSTANTS;
|
||||
|
||||
|
|
@ -31,7 +32,7 @@ describe("Sessions", () => {
|
|||
cy.contains("Authentication failed");
|
||||
});
|
||||
it("fails to access authenticated resource", () => {
|
||||
cy.visit("/hosts/manage");
|
||||
manageHostsPage.visitsManageHostsPage();
|
||||
cy.url().should("match", /\/login$/);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,4 +1,11 @@
|
|||
import CONSTANTS from "../../support/constants";
|
||||
import dashboardPage from "../pages/dashboardPage";
|
||||
import hostDetailsPage from "../pages/hostDetailsPage";
|
||||
import managePoliciesPage from "../pages/managePoliciesPage";
|
||||
import manageHostsPage from "../pages/manageHostsPage";
|
||||
import manageQueriesPage from "../pages/manageQueriesPage";
|
||||
import manageSoftwarePage from "../pages/manageSoftwarePage";
|
||||
import userProfilePage from "../pages/userProfilePage";
|
||||
|
||||
const { GOOD_PASSWORD } = CONSTANTS;
|
||||
|
||||
|
|
@ -25,7 +32,7 @@ describe(
|
|||
describe("Navigation", () => {
|
||||
beforeEach(() => {
|
||||
cy.loginWithCySession("anna@organization.com", GOOD_PASSWORD);
|
||||
cy.visit("/dashboard");
|
||||
dashboardPage.visitsDashboardPage();
|
||||
});
|
||||
it("displays intended admin top navigation", () => {
|
||||
cy.getAttached(".site-nav-container").within(() => {
|
||||
|
|
@ -52,144 +59,62 @@ describe(
|
|||
describe("Dashboard", () => {
|
||||
beforeEach(() => {
|
||||
cy.loginWithCySession("anna@organization.com", GOOD_PASSWORD);
|
||||
cy.visit("/dashboard");
|
||||
dashboardPage.visitsDashboardPage();
|
||||
});
|
||||
it("displays cards for all platforms", () => {
|
||||
cy.getAttached(".homepage__wrapper").within(() => {
|
||||
cy.findByText(/fleet test/i).should("exist");
|
||||
cy.getAttached(".hosts-summary").should("exist");
|
||||
cy.getAttached(".hosts-status").should("exist");
|
||||
cy.getAttached(".home-software").should("exist");
|
||||
cy.getAttached(".activity-feed").should("exist");
|
||||
});
|
||||
it("displays cards for all platforms and does not filter host platform", () => {
|
||||
dashboardPage.displaysCards("All");
|
||||
dashboardPage.verifiesFilteredHostByPlatform("none");
|
||||
});
|
||||
it("displays cards for windows only", () => {
|
||||
cy.getAttached(".homepage__platforms").within(() => {
|
||||
cy.getAttached(".Select-control").click();
|
||||
cy.findByText(/windows/i).click();
|
||||
});
|
||||
cy.getAttached(".homepage__wrapper").within(() => {
|
||||
cy.findByText(/fleet test/i).should("exist");
|
||||
cy.getAttached(".hosts-summary").should("exist");
|
||||
cy.getAttached(".hosts-status").should("exist");
|
||||
// "get" because we expect it not to exist
|
||||
cy.get(".home-software").should("not.exist");
|
||||
cy.get(".activity-feed").should("not.exist");
|
||||
});
|
||||
it("displays cards for windows only and filters hosts by Windows platform", () => {
|
||||
dashboardPage.switchesPlatform("Windows");
|
||||
dashboardPage.displaysCards("Windows");
|
||||
dashboardPage.verifiesFilteredHostByPlatform("Windows");
|
||||
});
|
||||
it("displays cards for linux only", () => {
|
||||
cy.getAttached(".homepage__platforms").within(() => {
|
||||
cy.getAttached(".Select-control").click();
|
||||
cy.findByText(/linux/i).click();
|
||||
});
|
||||
cy.getAttached(".homepage__wrapper").within(() => {
|
||||
cy.findByText(/fleet test/i).should("exist");
|
||||
cy.getAttached(".hosts-summary").should("exist");
|
||||
cy.getAttached(".hosts-status").should("exist");
|
||||
// "get" because we expect it not to exist
|
||||
cy.get(".home-software").should("not.exist");
|
||||
cy.get(".activity-feed").should("not.exist");
|
||||
});
|
||||
it("displays cards for linux only and filters hosts by Linux platform", () => {
|
||||
dashboardPage.switchesPlatform("Linux");
|
||||
dashboardPage.displaysCards("Linux");
|
||||
dashboardPage.verifiesFilteredHostByPlatform("Linux");
|
||||
});
|
||||
it("displays cards for macOS only", () => {
|
||||
cy.getAttached(".homepage__platforms").within(() => {
|
||||
cy.getAttached(".Select-control").click();
|
||||
cy.findByText(/macos/i).click();
|
||||
});
|
||||
cy.getAttached(".homepage__wrapper").within(() => {
|
||||
cy.findByText(/fleet test/i).should("exist");
|
||||
cy.getAttached(".hosts-summary").should("exist");
|
||||
cy.getAttached(".hosts-status").should("exist");
|
||||
cy.getAttached(".home-mdm").should("exist");
|
||||
// "get" because we expect it not to exist
|
||||
cy.get(".home-software").should("not.exist");
|
||||
cy.get(".activity-feed").should("not.exist");
|
||||
});
|
||||
});
|
||||
it("views all hosts for all platforms", () => {
|
||||
cy.findByText(/view all hosts/i).click();
|
||||
cy.findByRole("status", { name: /hosts filtered by/i }).should(
|
||||
"not.exist"
|
||||
);
|
||||
});
|
||||
it("views all hosts for windows only", () => {
|
||||
cy.getAttached(".homepage__platforms").within(() => {
|
||||
cy.getAttached(".Select-control").click();
|
||||
cy.findByText(/windows/i).click();
|
||||
});
|
||||
cy.findByText(/view all hosts/i).click();
|
||||
cy.findByRole("status", { name: /hosts filtered by Windows/i }).should(
|
||||
"exist"
|
||||
);
|
||||
});
|
||||
it("views all hosts for linux only", () => {
|
||||
cy.getAttached(".homepage__platforms").within(() => {
|
||||
cy.getAttached(".Select-control").click();
|
||||
cy.findByText(/linux/i).click();
|
||||
});
|
||||
cy.findByText(/view all hosts/i).click();
|
||||
cy.findByRole("status", { name: /hosts filtered by Linux/i }).should(
|
||||
"exist"
|
||||
);
|
||||
});
|
||||
it("views all hosts for macOS only", () => {
|
||||
cy.getAttached(".homepage__platforms").within(() => {
|
||||
cy.getAttached(".Select-control").click();
|
||||
cy.findByText(/macos/i).click();
|
||||
});
|
||||
cy.findByText(/view all hosts/i).click();
|
||||
cy.findByRole("status", { name: /hosts filtered by macOS/i }).should(
|
||||
"exist"
|
||||
);
|
||||
it("displays cards for macOS only and filters hosts by macOS platform", () => {
|
||||
dashboardPage.switchesPlatform("macOS");
|
||||
dashboardPage.displaysCards("macOS");
|
||||
dashboardPage.verifiesFilteredHostByPlatform("macOS");
|
||||
});
|
||||
});
|
||||
describe("Manage hosts page", () => {
|
||||
beforeEach(() => {
|
||||
cy.loginWithCySession("anna@organization.com", GOOD_PASSWORD);
|
||||
cy.visit("/hosts/manage");
|
||||
manageHostsPage.visitsManageHostsPage();
|
||||
});
|
||||
it("verifies teams is disabled on Manage Host page", () => {
|
||||
cy.contains(/team/i).should("not.exist");
|
||||
it("verifies teams is disabled on Manage hosts page", () => {
|
||||
manageHostsPage.verifiesTeamsIsDisabled();
|
||||
});
|
||||
it("allows admin to see and click the 'Add hosts' button", () => {
|
||||
cy.findByRole("button", { name: /add hosts/i }).click();
|
||||
cy.contains("button", /done/i).click();
|
||||
});
|
||||
it("allows admin to manage and add enroll secret", () => {
|
||||
cy.contains("button", /manage enroll secret/i).click();
|
||||
cy.contains("button", /add secret/i).click();
|
||||
cy.contains("button", /save/i).click();
|
||||
cy.contains("button", /done/i).click();
|
||||
it("allows admin to see and click CTA buttons", () => {
|
||||
manageHostsPage.allowsAddLabelForm();
|
||||
manageHostsPage.allowsAddHosts();
|
||||
manageHostsPage.allowsManageAndAddSecrets();
|
||||
});
|
||||
});
|
||||
describe("Host details tests", () => {
|
||||
describe("Host details page", () => {
|
||||
beforeEach(() => {
|
||||
cy.loginWithCySession("anna@organization.com", GOOD_PASSWORD);
|
||||
cy.visit("/hosts/1");
|
||||
hostDetailsPage.visitsHostDetailsPage(1);
|
||||
});
|
||||
it("verifies teams is disabled on Host Details page", () => {
|
||||
cy.findByText(/team/i).should("not.exist");
|
||||
cy.contains("button", /transfer/i).should("not.exist");
|
||||
hostDetailsPage.verifiesTeamsisDisabled();
|
||||
hostDetailsPage.hidesButton("Transfer");
|
||||
});
|
||||
it("allows admin to delete a query", () => {
|
||||
cy.findByRole("button", { name: /delete/i }).click();
|
||||
cy.findByText(/delete host/i).should("exist");
|
||||
cy.findByRole("button", { name: /cancel/i }).click();
|
||||
it("allows admin to delete the host", () => {
|
||||
hostDetailsPage.allowsDeleteHost();
|
||||
});
|
||||
it("allows admin to create a new query", () => {
|
||||
cy.findByRole("button", { name: /query/i }).click();
|
||||
cy.findByRole("button", { name: /create custom query/i }).should(
|
||||
"exist"
|
||||
);
|
||||
cy.getAttached(".modal__ex").within(() => {
|
||||
cy.findByRole("button").click();
|
||||
});
|
||||
it("allows admin to custom query the host", () => {
|
||||
hostDetailsPage.allowsCustomQueryHost();
|
||||
});
|
||||
});
|
||||
describe("Manage software page", () => {
|
||||
beforeEach(() => {
|
||||
cy.loginWithCySession("anna@organization.com", GOOD_PASSWORD);
|
||||
cy.visit("/software/manage");
|
||||
manageSoftwarePage.visitManageSoftwarePage();
|
||||
});
|
||||
// it(`displays "Vulnerabilities" column`, () => {
|
||||
// cy.getAttached("thead").within(() => {
|
||||
|
|
@ -198,99 +123,45 @@ describe(
|
|||
// });
|
||||
// });
|
||||
it("allows admin to click 'Manage automations' button", () => {
|
||||
cy.findByRole("button", { name: /manage automations/i }).click();
|
||||
cy.findByRole("button", { name: /cancel/i }).click();
|
||||
manageSoftwarePage.allowsManageAutomations();
|
||||
});
|
||||
});
|
||||
describe("Query pages", () => {
|
||||
beforeEach(() => {
|
||||
cy.loginWithCySession("anna@organization.com", GOOD_PASSWORD);
|
||||
cy.visit("/queries/manage");
|
||||
manageQueriesPage.visitManageQueriesPage();
|
||||
});
|
||||
it("allows admin add a new query", () => {
|
||||
cy.findByRole("button", { name: /new query/i }).click();
|
||||
cy.getAttached(".ace_text-input")
|
||||
.click({ force: true })
|
||||
.clear({ force: true })
|
||||
.type("SELECT * FROM cypress;", {
|
||||
force: true,
|
||||
});
|
||||
cy.findByRole("button", { name: /save/i }).click();
|
||||
cy.getAttached(".modal__background").within(() => {
|
||||
cy.getAttached(".modal__modal_container").within(() => {
|
||||
cy.getAttached(".modal__content").within(() => {
|
||||
cy.getAttached("form").within(() => {
|
||||
cy.findByLabelText(/name/i).click().type("Cypress test query");
|
||||
cy.findByLabelText(/description/i)
|
||||
.click()
|
||||
.type("Cypress test of create new query flow.");
|
||||
cy.findByLabelText(/observers can run/i).click({ force: true });
|
||||
cy.findByRole("button", { name: /save query/i }).click();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
cy.findByText(/query created/i).should("exist");
|
||||
manageQueriesPage.allowsCreateNewQuery();
|
||||
manageQueriesPage.verifiesCreatedNewQuery();
|
||||
});
|
||||
it("allows admin to edit a query", () => {
|
||||
cy.findByText(/cypress test query/i).click({ force: true });
|
||||
cy.getAttached(".ace_text-input")
|
||||
.click({ force: true })
|
||||
.clear({ force: true })
|
||||
.type("SELECT 1 FROM cypress;", {
|
||||
force: true,
|
||||
});
|
||||
cy.findByText("Save").click(); // we have 'save as new' also
|
||||
cy.findByText(/query updated/i).should("exist");
|
||||
manageQueriesPage.allowsEditExistingQuery();
|
||||
manageQueriesPage.verifiesEditedExistingQuery();
|
||||
});
|
||||
it("allows admin to run a query", () => {
|
||||
cy.findByText(/cypress test query/i).click({ force: true });
|
||||
cy.findByText(/run query/i).click({ force: true });
|
||||
cy.findByText(/select targets/i).should("exist");
|
||||
cy.findByText(/all hosts/i).click();
|
||||
cy.findByText(/host targeted/i).should("exist"); // target count
|
||||
cy.findByText(/run/i).click();
|
||||
cy.findByText(/querying selected host/i).should("exist"); // target count
|
||||
manageQueriesPage.allowsRunQuery();
|
||||
manageQueriesPage.verifiesRanQuery();
|
||||
});
|
||||
});
|
||||
describe("Manage policies page", () => {
|
||||
beforeEach(() => {
|
||||
cy.loginWithCySession("anna@organization.com", GOOD_PASSWORD);
|
||||
cy.visit("/policies/manage");
|
||||
managePoliciesPage.visitManagePoliciesPage();
|
||||
});
|
||||
it("allows admin to click 'Manage automations' button", () => {
|
||||
cy.findByRole("button", { name: /manage automations/i }).click();
|
||||
cy.findByRole("button", { name: /cancel/i }).click();
|
||||
managePoliciesPage.allowsAutomatePolicy();
|
||||
managePoliciesPage.verifiesAutomatedPolicy();
|
||||
});
|
||||
it("allows admin to add a new policy", () => {
|
||||
cy.findByRole("button", { name: /add a policy/i }).click();
|
||||
cy.getAttached(".modal__ex").within(() => {
|
||||
cy.findByRole("button").click();
|
||||
});
|
||||
managePoliciesPage.allowsAddDefaultPolicy();
|
||||
managePoliciesPage.verifiesAddedDefaultPolicy();
|
||||
});
|
||||
it("allows admin to delete a policy", () => {
|
||||
// select checkmark on table
|
||||
cy.getAttached("tbody").within(() => {
|
||||
cy.getAttached("tr")
|
||||
.first()
|
||||
.within(() => {
|
||||
cy.getAttached(".fleet-checkbox__input").check({ force: true });
|
||||
});
|
||||
});
|
||||
cy.findByRole("button", { name: /delete/i }).click();
|
||||
cy.getAttached(".delete-policy-modal").within(() => {
|
||||
cy.findByRole("button", { name: /delete/i }).should("exist");
|
||||
cy.findByRole("button", { name: /cancel/i }).click();
|
||||
});
|
||||
managePoliciesPage.allowsDeletePolicy();
|
||||
});
|
||||
it("allows admin to select a policy and see CTAs to run and save", () => {
|
||||
cy.getAttached(".data-table__table").within(() => {
|
||||
cy.findByRole("button", { name: /filevault enabled/i }).click();
|
||||
});
|
||||
cy.getAttached(".policy-form__button-wrap").within(() => {
|
||||
cy.findByRole("button", { name: /run/i }).should("exist");
|
||||
cy.findByRole("button", { name: /save/i }).should("exist");
|
||||
});
|
||||
managePoliciesPage.allowsSelectRunSavePolicy();
|
||||
});
|
||||
});
|
||||
describe("Admin settings page", () => {
|
||||
|
|
@ -355,17 +226,10 @@ describe(
|
|||
describe("User profile page", () => {
|
||||
beforeEach(() => {
|
||||
cy.loginWithCySession("anna@organization.com", GOOD_PASSWORD);
|
||||
cy.visit("/profile");
|
||||
userProfilePage.visitUserProfilePage();
|
||||
});
|
||||
it("verifies teams is disabled for the Profile page", () => {
|
||||
cy.getAttached(".user-side-panel").within(() => {
|
||||
cy.findByText(/teams/i).should("not.exist");
|
||||
});
|
||||
});
|
||||
it("renders elements according to role-based access controls", () => {
|
||||
cy.getAttached(".user-side-panel").within(() => {
|
||||
cy.findByText("Role").next().contains(/admin/i);
|
||||
});
|
||||
it("verifies admin role and team", () => {
|
||||
userProfilePage.showRole("Admin");
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,12 @@
|
|||
import CONSTANTS from "../../support/constants";
|
||||
import dashboardPage from "../pages/dashboardPage";
|
||||
import hostDetailsPage from "../pages/hostDetailsPage";
|
||||
import manageHostsPage from "../pages/manageHostsPage";
|
||||
import manageQueriesPage from "../pages/manageQueriesPage";
|
||||
import managePacksPage from "../pages/managePacksPage";
|
||||
import managePoliciesPage from "../pages/managePoliciesPage";
|
||||
import manageSoftwarePage from "../pages/manageSoftwarePage";
|
||||
import userProfilePage from "../pages/userProfilePage";
|
||||
|
||||
const { GOOD_PASSWORD } = CONSTANTS;
|
||||
|
||||
|
|
@ -26,7 +34,7 @@ describe(
|
|||
describe("Navigation", () => {
|
||||
beforeEach(() => {
|
||||
cy.loginWithCySession("mary@organization.com", GOOD_PASSWORD);
|
||||
cy.visit("/dashboard");
|
||||
dashboardPage.visitsDashboardPage();
|
||||
});
|
||||
it("displays intended global maintainer top navigation", () => {
|
||||
cy.getAttached(".site-nav-container").within(() => {
|
||||
|
|
@ -44,324 +52,144 @@ describe(
|
|||
describe("Dashboard", () => {
|
||||
beforeEach(() => {
|
||||
cy.loginWithCySession("mary@organization.com", GOOD_PASSWORD);
|
||||
cy.visit("/dashboard");
|
||||
dashboardPage.visitsDashboardPage();
|
||||
});
|
||||
it("displays cards for all platforms", () => {
|
||||
cy.getAttached(".homepage__wrapper").within(() => {
|
||||
cy.findByText(/fleet test/i).should("exist");
|
||||
cy.getAttached(".hosts-summary").should("exist");
|
||||
cy.getAttached(".hosts-status").should("exist");
|
||||
cy.getAttached(".home-software").should("exist");
|
||||
cy.getAttached(".activity-feed").should("exist");
|
||||
});
|
||||
it("displays cards for all platforms and does not filter host platform", () => {
|
||||
dashboardPage.displaysCards("All");
|
||||
dashboardPage.verifiesFilteredHostByPlatform("none");
|
||||
});
|
||||
it("displays cards for windows only", () => {
|
||||
cy.getAttached(".homepage__platforms").within(() => {
|
||||
cy.getAttached(".Select-control").click();
|
||||
cy.findByText(/windows/i).click();
|
||||
});
|
||||
cy.getAttached(".homepage__wrapper").within(() => {
|
||||
cy.findByText(/fleet test/i).should("exist");
|
||||
cy.getAttached(".hosts-summary").should("exist");
|
||||
cy.getAttached(".hosts-status").should("exist");
|
||||
// "get" because we expect it not to exist
|
||||
cy.get(".home-software").should("not.exist");
|
||||
cy.get(".activity-feed").should("not.exist");
|
||||
});
|
||||
it("displays cards for windows only and filters hosts by Windows platform", () => {
|
||||
dashboardPage.switchesPlatform("Windows");
|
||||
dashboardPage.displaysCards("Windows");
|
||||
dashboardPage.verifiesFilteredHostByPlatform("Windows");
|
||||
});
|
||||
it("displays cards for linux only", () => {
|
||||
cy.getAttached(".homepage__platforms").within(() => {
|
||||
cy.getAttached(".Select-control").click();
|
||||
cy.findByText(/linux/i).click();
|
||||
});
|
||||
cy.getAttached(".homepage__wrapper").within(() => {
|
||||
cy.findByText(/fleet test/i).should("exist");
|
||||
cy.getAttached(".hosts-summary").should("exist");
|
||||
cy.getAttached(".hosts-status").should("exist");
|
||||
// "get" because we expect it not to exist
|
||||
cy.get(".home-software").should("not.exist");
|
||||
cy.get(".activity-feed").should("not.exist");
|
||||
});
|
||||
it("displays cards for linux only and filters hosts by Linux platform", () => {
|
||||
dashboardPage.switchesPlatform("Linux");
|
||||
dashboardPage.displaysCards("Linux");
|
||||
dashboardPage.verifiesFilteredHostByPlatform("Linux");
|
||||
});
|
||||
it("displays cards for macOS only", () => {
|
||||
cy.getAttached(".homepage__platforms").within(() => {
|
||||
cy.getAttached(".Select-control").click();
|
||||
cy.findByText(/macos/i).click();
|
||||
});
|
||||
cy.getAttached(".homepage__wrapper").within(() => {
|
||||
cy.findByText(/fleet test/i).should("exist");
|
||||
cy.getAttached(".hosts-summary").should("exist");
|
||||
cy.getAttached(".hosts-status").should("exist");
|
||||
cy.getAttached(".home-mdm").should("exist");
|
||||
// "get" because we expect it not to exist
|
||||
cy.get(".home-software").should("not.exist");
|
||||
cy.get(".activity-feed").should("not.exist");
|
||||
});
|
||||
});
|
||||
it("views all hosts for all platforms", () => {
|
||||
cy.findByText(/view all hosts/i).click();
|
||||
cy.findByRole("status", { name: /hosts filtered by/i }).should(
|
||||
"not.exist"
|
||||
);
|
||||
});
|
||||
it("views all hosts for windows only", () => {
|
||||
cy.getAttached(".homepage__platforms").within(() => {
|
||||
cy.getAttached(".Select-control").click();
|
||||
cy.findByText(/windows/i).click();
|
||||
});
|
||||
cy.findByText(/view all hosts/i).click();
|
||||
cy.findByRole("status", { name: /hosts filtered by Windows/i }).should(
|
||||
"exist"
|
||||
);
|
||||
});
|
||||
it("views all hosts for linux only", () => {
|
||||
cy.getAttached(".homepage__platforms").within(() => {
|
||||
cy.getAttached(".Select-control").click();
|
||||
cy.findByText(/linux/i).click();
|
||||
});
|
||||
cy.findByText(/view all hosts/i).click();
|
||||
cy.findByRole("status", { name: /hosts filtered by Linux/i }).should(
|
||||
"exist"
|
||||
);
|
||||
});
|
||||
it("views all hosts for macOS only", () => {
|
||||
cy.getAttached(".homepage__platforms").within(() => {
|
||||
cy.getAttached(".Select-control").click();
|
||||
cy.findByText(/macos/i).click();
|
||||
});
|
||||
cy.findByText(/view all hosts/i).click();
|
||||
cy.findByRole("status", { name: /hosts filtered by macOS/i }).should(
|
||||
"exist"
|
||||
);
|
||||
it("displays cards for macOS only and filters hosts by macOS platform", () => {
|
||||
dashboardPage.switchesPlatform("macOS");
|
||||
dashboardPage.displaysCards("macOS");
|
||||
dashboardPage.verifiesFilteredHostByPlatform("macOS");
|
||||
});
|
||||
});
|
||||
describe("Manage hosts page", () => {
|
||||
beforeEach(() => {
|
||||
cy.loginWithCySession("mary@organization.com", GOOD_PASSWORD);
|
||||
cy.visit("/hosts/manage");
|
||||
});
|
||||
it("verifies maintainer is on the Manage Hosts page", () => {
|
||||
cy.getAttached(".manage-hosts").within(() => {
|
||||
cy.findByText(/edit columns/i).should("exist");
|
||||
});
|
||||
manageHostsPage.visitsManageHostsPage();
|
||||
});
|
||||
it("verifies teams is disabled", () => {
|
||||
cy.contains(/team/i).should("not.exist");
|
||||
manageHostsPage.verifiesTeamsIsDisabled();
|
||||
});
|
||||
it("allows maintainer to see and click the 'Add hosts' button", () => {
|
||||
cy.findByRole("button", { name: /add hosts/i }).click();
|
||||
cy.contains("button", /done/i).click();
|
||||
});
|
||||
it("allows maintainer to manage the enroll secret", () => {
|
||||
cy.contains("button", /manage enroll secret/i).click();
|
||||
cy.contains("button", /done/i).click();
|
||||
});
|
||||
it("allows maintainer to open the 'Add label' form", () => {
|
||||
cy.getAttached(".label-filter-select__control").click();
|
||||
cy.findByRole("button", { name: /add label/i }).click();
|
||||
cy.findByText(/New Label/i).should("exist");
|
||||
it("allows maintainer to see and click 'Add label', 'Add hosts', and 'Manage enroll secrets' buttons", () => {
|
||||
manageHostsPage.allowsAddHosts();
|
||||
manageHostsPage.allowsManageAndAddSecrets();
|
||||
manageHostsPage.allowsAddHosts();
|
||||
});
|
||||
});
|
||||
describe("Host details tests", () => {
|
||||
describe("Host details page", () => {
|
||||
beforeEach(() => {
|
||||
cy.loginWithCySession("mary@organization.com", GOOD_PASSWORD);
|
||||
cy.visit("/hosts/1");
|
||||
hostDetailsPage.visitsHostDetailsPage(1);
|
||||
});
|
||||
it("verifies teams is disabled", () => {
|
||||
cy.findByText(/team/i).should("not.exist");
|
||||
cy.contains("button", /transfer/i).should("not.exist");
|
||||
hostDetailsPage.verifiesTeamsisDisabled();
|
||||
hostDetailsPage.hidesButton("Transfer");
|
||||
});
|
||||
it("allows maintainer to delete a host", () => {
|
||||
cy.findByRole("button", { name: /delete/i }).click();
|
||||
cy.findByText(/delete host/i).should("exist");
|
||||
cy.findByRole("button", { name: /cancel/i }).click();
|
||||
it("allows maintainer to create an operating system policy", () => {
|
||||
hostDetailsPage.allowsCreateOsPolicy();
|
||||
});
|
||||
it("allows maintainer to create a new query on a host", () => {
|
||||
cy.findByRole("button", { name: /query/i }).click();
|
||||
cy.findByRole("button", { name: /create custom query/i }).should(
|
||||
"exist"
|
||||
);
|
||||
cy.getAttached(".modal__ex").within(() => {
|
||||
cy.findByRole("button").click();
|
||||
});
|
||||
it("allows maintainer to custom query the host", () => {
|
||||
hostDetailsPage.allowsCustomQueryHost();
|
||||
});
|
||||
it("allows maintainer to delete the host", () => {
|
||||
hostDetailsPage.allowsDeleteHost();
|
||||
});
|
||||
});
|
||||
describe("Manage software page", () => {
|
||||
beforeEach(() => cy.visit("/software/manage"));
|
||||
it("should restrict global maintainer from 'Manage automations' button", () => {
|
||||
cy.findByText(/manage automations/).should("not.exist");
|
||||
beforeEach(() => manageSoftwarePage.visitManageSoftwarePage());
|
||||
it("hides 'Manage automations' button from global maintainer", () => {
|
||||
manageSoftwarePage.hidesButton("Manage automations");
|
||||
});
|
||||
});
|
||||
describe("Query pages", () => {
|
||||
beforeEach(() => {
|
||||
cy.loginWithCySession("mary@organization.com", GOOD_PASSWORD);
|
||||
cy.visit("/queries/manage");
|
||||
manageQueriesPage.visitManageQueriesPage();
|
||||
});
|
||||
it("allows maintainer to add a new query", () => {
|
||||
cy.findByRole("button", { name: /new query/i }).click();
|
||||
cy.getAttached(".ace_text-input")
|
||||
.click({ force: true })
|
||||
.clear({ force: true })
|
||||
.type("SELECT * FROM cypress;", {
|
||||
force: true,
|
||||
});
|
||||
cy.findByRole("button", { name: /save/i }).click();
|
||||
cy.getAttached(".modal__background").within(() => {
|
||||
cy.getAttached(".modal__modal_container").within(() => {
|
||||
cy.getAttached(".modal__content").within(() => {
|
||||
cy.getAttached("form").within(() => {
|
||||
cy.findByLabelText(/name/i).click().type("Cypress test query");
|
||||
cy.findByLabelText(/description/i)
|
||||
.click()
|
||||
.type("Cypress test of create new query flow.");
|
||||
cy.findByLabelText(/observers can run/i).click({
|
||||
force: true,
|
||||
});
|
||||
cy.findByRole("button", { name: /save query/i }).click();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
cy.findByText(/query created/i).should("exist");
|
||||
manageQueriesPage.allowsCreateNewQuery();
|
||||
manageQueriesPage.verifiesCreatedNewQuery();
|
||||
});
|
||||
it("allows maintainer to edit a query", () => {
|
||||
cy.findByText(/cypress test query/i).click({ force: true });
|
||||
cy.getAttached(".ace_text-input")
|
||||
.click({ force: true })
|
||||
.clear({ force: true })
|
||||
.type("SELECT * FROM cypress;", {
|
||||
force: true,
|
||||
});
|
||||
cy.findByText("Save").click(); // we have 'save as new' also
|
||||
cy.findByText(/query updated/i).should("exist");
|
||||
manageQueriesPage.allowsEditExistingQuery();
|
||||
manageQueriesPage.verifiesEditedExistingQuery();
|
||||
});
|
||||
it("allows maintainer to run a query", () => {
|
||||
cy.findByText(/cypress test query/i).click({ force: true });
|
||||
cy.findByText(/run query/i).click({ force: true });
|
||||
cy.findByText(/select targets/i).should("exist");
|
||||
cy.findByText(/all hosts/i).click();
|
||||
cy.findByText(/host targeted/i).should("exist"); // target count
|
||||
cy.findByText(/run/i).click();
|
||||
cy.findByText(/querying selected host/i).should("exist"); // target count
|
||||
manageQueriesPage.allowsRunQuery();
|
||||
manageQueriesPage.verifiesRanQuery();
|
||||
});
|
||||
});
|
||||
describe("Manage policies page", () => {
|
||||
beforeEach(() => {
|
||||
cy.loginWithCySession("mary@organization.com", GOOD_PASSWORD);
|
||||
cy.visit("/policies/manage");
|
||||
managePoliciesPage.visitManagePoliciesPage();
|
||||
});
|
||||
it("hides manage automations from maintainer", () => {
|
||||
cy.getAttached(".button-wrap").within(() => {
|
||||
cy.findByRole("button", { name: /add a policy/i }).should("exist");
|
||||
cy.findByRole("button", { name: /manage automations/i }).should(
|
||||
"not.exist"
|
||||
);
|
||||
});
|
||||
managePoliciesPage.hidesButton("Manage automations");
|
||||
});
|
||||
it("allows maintainer to add a policy", () => {
|
||||
cy.findByRole("button", { name: /add a policy/i }).click();
|
||||
cy.getAttached(".modal__ex").within(() => {
|
||||
cy.findByRole("button").click();
|
||||
});
|
||||
managePoliciesPage.allowsAddDefaultPolicy();
|
||||
managePoliciesPage.verifiesAddedDefaultPolicy();
|
||||
});
|
||||
it("allows maintainer to delete a policy", () => {
|
||||
// select checkmark on table
|
||||
cy.getAttached("tbody").within(() => {
|
||||
cy.getAttached("tr")
|
||||
.first()
|
||||
.within(() => {
|
||||
cy.getAttached(".fleet-checkbox__input").check({ force: true });
|
||||
});
|
||||
});
|
||||
cy.findByRole("button", { name: /delete/i }).click();
|
||||
cy.getAttached(".delete-policy-modal").within(() => {
|
||||
cy.findByRole("button", { name: /delete/i }).should("exist");
|
||||
cy.findByRole("button", { name: /cancel/i }).click();
|
||||
});
|
||||
managePoliciesPage.allowsDeletePolicy();
|
||||
});
|
||||
it("allows maintainer to select a policy and see CTAs to run and save", () => {
|
||||
cy.getAttached(".data-table__table").within(() => {
|
||||
cy.getAttached("tbody").within(() => {
|
||||
cy.getAttached("tr")
|
||||
.first()
|
||||
.within(() => {
|
||||
cy.findByRole("button", {
|
||||
name: /filevault enabled/i,
|
||||
}).click();
|
||||
});
|
||||
});
|
||||
});
|
||||
cy.getAttached(".policy-form__button-wrap").within(() => {
|
||||
cy.findByRole("button", { name: /run/i }).should("exist");
|
||||
cy.findByRole("button", { name: /save/i }).should("exist");
|
||||
});
|
||||
managePoliciesPage.allowsRunSavePolicy();
|
||||
});
|
||||
});
|
||||
describe("Manage packs page", () => {
|
||||
beforeEach(() => {
|
||||
cy.loginWithCySession("mary@organization.com", GOOD_PASSWORD);
|
||||
cy.visit("/packs/manage");
|
||||
managePacksPage.visitsManagePacksPage();
|
||||
});
|
||||
it("allows maintainer to create a pack", () => {
|
||||
cy.findByRole("button", { name: /create new pack/i }).click();
|
||||
cy.findByLabelText(/name/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();
|
||||
managePacksPage.allowsCreatePack();
|
||||
managePacksPage.verifiesCreatedPack();
|
||||
});
|
||||
it("allows maintainer to delete a pack", () => {
|
||||
// select checkmark on table
|
||||
cy.getAttached("tbody").within(() => {
|
||||
cy.getAttached("tr")
|
||||
.first()
|
||||
.within(() => {
|
||||
cy.getAttached(".fleet-checkbox__input").check({ force: true });
|
||||
});
|
||||
managePacksPage.allowsDeletePack();
|
||||
managePacksPage.verifiesDeletedPack();
|
||||
});
|
||||
describe("User profile page", () => {
|
||||
beforeEach(() => {
|
||||
cy.loginWithCySession("mary@organization.com", GOOD_PASSWORD);
|
||||
userProfilePage.visitUserProfilePage();
|
||||
});
|
||||
cy.findByRole("button", { name: /delete/i }).click();
|
||||
cy.get(".remove-pack-modal .modal-cta-wrap")
|
||||
.contains("button", /delete/i)
|
||||
.click();
|
||||
cy.findByText(/successfully deleted/i).should("be.visible");
|
||||
cy.findByText(/server errors/i).should("not.exist");
|
||||
});
|
||||
});
|
||||
describe("User profile page", () => {
|
||||
beforeEach(() => {
|
||||
cy.loginWithCySession("mary@organization.com", GOOD_PASSWORD);
|
||||
cy.visit("/profile");
|
||||
});
|
||||
it("verifies teams is disabled for the Profile page", () => {
|
||||
cy.getAttached(".user-side-panel").within(() => {
|
||||
cy.findByText(/teams/i).should("not.exist");
|
||||
it("verifies maintainer role and teams is disabled", () => {
|
||||
userProfilePage.showRole("Maintainer");
|
||||
});
|
||||
});
|
||||
it("renders elements according to role-based access controls", () => {
|
||||
cy.getAttached(".user-side-panel").within(() => {
|
||||
cy.findByText("Role")
|
||||
.next()
|
||||
.contains(/maintainer/i);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// nav restrictions are at the end because we expect to see a
|
||||
// 403 error overlay which will hide the nav and make the test fail
|
||||
describe("Nav restrictions", () => {
|
||||
// cypress tends to fail on uncaught exceptions. since we have
|
||||
// our own error handling, it's suggested to use this block to
|
||||
// suppress so the tests will keep running
|
||||
Cypress.on("uncaught:exception", () => {
|
||||
return false;
|
||||
});
|
||||
beforeEach(() => {
|
||||
cy.loginWithCySession("mary@organization.com", GOOD_PASSWORD);
|
||||
});
|
||||
it("verifies maintainer does not have access to settings", () => {
|
||||
cy.findByText(/settings/i).should("not.exist");
|
||||
cy.visit("/settings/organization");
|
||||
cy.findByText(/you do not have permissions/i).should("exist");
|
||||
// nav restrictions are at the end because we expect to see a
|
||||
// 403 error overlay which will hide the nav and make the test fail
|
||||
describe("Nav restrictions", () => {
|
||||
// cypress tends to fail on uncaught exceptions. since we have
|
||||
// our own error handling, it's suggested to use this block to
|
||||
// suppress so the tests will keep running
|
||||
Cypress.on("uncaught:exception", () => {
|
||||
return false;
|
||||
});
|
||||
beforeEach(() => {
|
||||
cy.loginWithCySession("mary@organization.com", GOOD_PASSWORD);
|
||||
});
|
||||
it("verifies maintainer does not have access to settings", () => {
|
||||
cy.findByText(/settings/i).should("not.exist");
|
||||
cy.visit("/settings/organization");
|
||||
cy.findByText(/you do not have permissions/i).should("exist");
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,13 @@
|
|||
import CONSTANTS from "../../support/constants";
|
||||
import dashboardPage from "../pages/dashboardPage";
|
||||
import hostDetailsPage from "../pages/hostDetailsPage";
|
||||
import manageHostsPage from "../pages/manageHostsPage";
|
||||
import managePacksPage from "../pages/managePacksPage";
|
||||
import managePoliciesPage from "../pages/managePoliciesPage";
|
||||
import manageQueriesPage from "../pages/manageQueriesPage";
|
||||
import manageSchedulePage from "../pages/manageSchedulePage";
|
||||
import manageSoftwarePage from "../pages/manageSoftwarePage";
|
||||
import userProfilePage from "../pages/userProfilePage";
|
||||
|
||||
const { GOOD_PASSWORD } = CONSTANTS;
|
||||
|
||||
|
|
@ -21,7 +30,7 @@ describe("Free tier - Observer user", () => {
|
|||
describe("Navigation", () => {
|
||||
beforeEach(() => {
|
||||
cy.loginWithCySession("oliver@organization.com", GOOD_PASSWORD);
|
||||
cy.visit("/dashboard");
|
||||
dashboardPage.visitsDashboardPage();
|
||||
});
|
||||
it("displays intended global observer top navigation", () => {
|
||||
cy.getAttached(".site-nav-container").within(() => {
|
||||
|
|
@ -39,155 +48,73 @@ describe("Free tier - Observer user", () => {
|
|||
describe("Dashboard", () => {
|
||||
beforeEach(() => {
|
||||
cy.loginWithCySession("oliver@organization.com", GOOD_PASSWORD);
|
||||
cy.visit("/dashboard");
|
||||
dashboardPage.visitsDashboardPage();
|
||||
});
|
||||
it("displays cards for all platforms", () => {
|
||||
cy.getAttached(".homepage__wrapper").within(() => {
|
||||
cy.findByText(/fleet test/i).should("exist");
|
||||
cy.getAttached(".hosts-summary").should("exist");
|
||||
cy.getAttached(".hosts-status").should("exist");
|
||||
cy.getAttached(".home-software").should("exist");
|
||||
cy.getAttached(".activity-feed").should("exist");
|
||||
});
|
||||
it("displays cards for all platforms and does not filter host platform", () => {
|
||||
dashboardPage.displaysCards("All");
|
||||
dashboardPage.verifiesFilteredHostByPlatform("none");
|
||||
});
|
||||
it("displays cards for windows only", () => {
|
||||
cy.getAttached(".homepage__platforms").within(() => {
|
||||
cy.getAttached(".Select-control").click();
|
||||
cy.findByText(/windows/i).click();
|
||||
});
|
||||
cy.getAttached(".homepage__wrapper").within(() => {
|
||||
cy.findByText(/fleet test/i).should("exist");
|
||||
cy.getAttached(".hosts-summary").should("exist");
|
||||
cy.getAttached(".hosts-status").should("exist");
|
||||
// "get" because we expect it not to exist
|
||||
cy.get(".home-software").should("not.exist");
|
||||
cy.get(".activity-feed").should("not.exist");
|
||||
});
|
||||
it("displays cards for windows only and filters hosts by Windows platform", () => {
|
||||
dashboardPage.switchesPlatform("Windows");
|
||||
dashboardPage.displaysCards("Windows");
|
||||
dashboardPage.verifiesFilteredHostByPlatform("Windows");
|
||||
});
|
||||
it("displays cards for linux only", () => {
|
||||
cy.getAttached(".homepage__platforms").within(() => {
|
||||
cy.getAttached(".Select-control").click();
|
||||
cy.findByText(/linux/i).click();
|
||||
});
|
||||
cy.getAttached(".homepage__wrapper").within(() => {
|
||||
cy.findByText(/fleet test/i).should("exist");
|
||||
cy.getAttached(".hosts-summary").should("exist");
|
||||
cy.getAttached(".hosts-status").should("exist");
|
||||
// "get" because we expect it not to exist
|
||||
cy.get(".home-software").should("not.exist");
|
||||
cy.get(".activity-feed").should("not.exist");
|
||||
});
|
||||
it("displays cards for linux only and filters hosts by Linux platform", () => {
|
||||
dashboardPage.switchesPlatform("Linux");
|
||||
dashboardPage.displaysCards("Linux");
|
||||
dashboardPage.verifiesFilteredHostByPlatform("Linux");
|
||||
});
|
||||
it("displays cards for macOS only", () => {
|
||||
cy.getAttached(".homepage__platforms").within(() => {
|
||||
cy.getAttached(".Select-control").click();
|
||||
cy.findByText(/macos/i).click();
|
||||
});
|
||||
cy.getAttached(".homepage__wrapper").within(() => {
|
||||
cy.findByText(/fleet test/i).should("exist");
|
||||
cy.getAttached(".hosts-summary").should("exist");
|
||||
cy.getAttached(".hosts-status").should("exist");
|
||||
cy.getAttached(".home-mdm").should("exist");
|
||||
// "get" because we expect it not to exist
|
||||
cy.get(".home-software").should("not.exist");
|
||||
cy.get(".activity-feed").should("not.exist");
|
||||
});
|
||||
});
|
||||
it("views all hosts for all platforms", () => {
|
||||
cy.findByText(/view all hosts/i).click();
|
||||
cy.findByRole("status", { name: /hosts filtered by/i }).should(
|
||||
"not.exist"
|
||||
);
|
||||
});
|
||||
it("views all hosts for windows only", () => {
|
||||
cy.getAttached(".homepage__platforms").within(() => {
|
||||
cy.getAttached(".Select-control").click();
|
||||
cy.findByText(/windows/i).click();
|
||||
});
|
||||
cy.findByText(/view all hosts/i).click();
|
||||
cy.findByRole("status", { name: /hosts filtered by Windows/i }).should(
|
||||
"exist"
|
||||
);
|
||||
});
|
||||
it("views all hosts for linux only", () => {
|
||||
cy.getAttached(".homepage__platforms").within(() => {
|
||||
cy.getAttached(".Select-control").click();
|
||||
cy.findByText(/linux/i).click();
|
||||
});
|
||||
cy.findByText(/view all hosts/i).click();
|
||||
cy.findByRole("status", { name: /hosts filtered by linux/i }).should(
|
||||
"exist"
|
||||
);
|
||||
});
|
||||
it("views all hosts for macOS only", () => {
|
||||
cy.getAttached(".homepage__platforms").within(() => {
|
||||
cy.getAttached(".Select-control").click();
|
||||
cy.findByText(/macos/i).click();
|
||||
});
|
||||
cy.findByText(/view all hosts/i).click();
|
||||
cy.findByRole("status", { name: /hosts filtered by macOS/i }).should(
|
||||
"exist"
|
||||
);
|
||||
it("displays cards for macOS only and filters hosts by macOS platform", () => {
|
||||
dashboardPage.switchesPlatform("macOS");
|
||||
dashboardPage.displaysCards("macOS");
|
||||
dashboardPage.verifiesFilteredHostByPlatform("macOS");
|
||||
});
|
||||
});
|
||||
describe("Manage hosts page", () => {
|
||||
beforeEach(() => {
|
||||
cy.loginWithCySession("oliver@organization.com", GOOD_PASSWORD);
|
||||
cy.visit("/hosts/manage");
|
||||
manageHostsPage.visitsManageHostsPage();
|
||||
});
|
||||
it("verifies teams is disabled on Manage Host page", () => {
|
||||
cy.findByText(/teams/i).should("not.exist");
|
||||
it("verifies teams is disabled", () => {
|
||||
manageHostsPage.verifiesTeamsIsDisabled();
|
||||
});
|
||||
it("hides 'Add hosts' button", () => {
|
||||
cy.contains("button", /add hosts/i).should("not.exist");
|
||||
});
|
||||
it("hides add a label button", () => {
|
||||
cy.contains("button", /add label/i).should("not.exist");
|
||||
});
|
||||
it("hides manage enroll secrets button", () => {
|
||||
cy.contains("button", /manage enroll secret/i).should("not.exist");
|
||||
it("hides 'Add hosts', 'Add label', and 'Manage enroll secrets' buttons", () => {
|
||||
manageHostsPage.hidesButton("Add label");
|
||||
manageHostsPage.hidesButton("Add hosts");
|
||||
manageHostsPage.hidesButton("Manage enroll secret");
|
||||
});
|
||||
});
|
||||
describe("Host details page", () => {
|
||||
beforeEach(() => {
|
||||
cy.loginWithCySession("oliver@organization.com", GOOD_PASSWORD);
|
||||
cy.visit("/hosts/1");
|
||||
hostDetailsPage.visitsHostDetailsPage(1);
|
||||
});
|
||||
it("verifies teams is disabled on Host Details page", () => {
|
||||
cy.findByText(/team/i).should("not.exist");
|
||||
hostDetailsPage.verifiesTeamsisDisabled();
|
||||
});
|
||||
it("hides transfer host button", () => {
|
||||
cy.contains("button", /transfer/i).should("not.exist");
|
||||
});
|
||||
it("hides delete host button", () => {
|
||||
cy.contains("button", /delete/i).should("not.exist");
|
||||
});
|
||||
it("hides query host button", () => {
|
||||
cy.contains("button", /query/i).click();
|
||||
it("hides all cta buttons", () => {
|
||||
hostDetailsPage.hidesButton("Transfer");
|
||||
hostDetailsPage.hidesButton("Query");
|
||||
hostDetailsPage.hidesButton("Delete");
|
||||
hostDetailsPage.hidesCreateOSPolicy();
|
||||
});
|
||||
});
|
||||
describe("Manage software page", () => {
|
||||
beforeEach(() => {
|
||||
cy.loginWithCySession("oliver@organization.com", GOOD_PASSWORD);
|
||||
cy.visit("/software/manage");
|
||||
manageSoftwarePage.visitManageSoftwarePage();
|
||||
});
|
||||
it("hides manage automations button", () => {
|
||||
cy.getAttached(".manage-software-page__header-wrap").within(() => {
|
||||
cy.findByRole("button", { name: /manage automations/i }).should(
|
||||
"not.exist"
|
||||
);
|
||||
});
|
||||
manageSoftwarePage.hidesButton("Manage automations");
|
||||
});
|
||||
});
|
||||
describe("Query page", () => {
|
||||
beforeEach(() => {
|
||||
cy.loginWithCySession("oliver@organization.com", GOOD_PASSWORD);
|
||||
cy.visit("/queries/manage");
|
||||
manageQueriesPage.visitManageQueriesPage();
|
||||
});
|
||||
it("hides create a query button", () => {
|
||||
cy.findByRole("button", { name: /create new query/i }).should(
|
||||
"not.exist"
|
||||
);
|
||||
it("hides 'Create a query' button", () => {
|
||||
manageQueriesPage.hidesButton("Create new query");
|
||||
});
|
||||
it("verifies observer can select a query and only run it", () => {
|
||||
cy.getAttached(".data-table__table").within(() => {
|
||||
|
|
@ -205,49 +132,25 @@ describe("Free tier - Observer user", () => {
|
|||
describe("Manage policies page", () => {
|
||||
beforeEach(() => {
|
||||
cy.loginWithCySession("oliver@organization.com", GOOD_PASSWORD);
|
||||
cy.visit("/policies/manage");
|
||||
managePoliciesPage.visitManagePoliciesPage();
|
||||
});
|
||||
it("hides manage automations button", () => {
|
||||
cy.findByText(/manage automations/i).should("not.exist");
|
||||
managePoliciesPage.hidesButton("Manage automations");
|
||||
});
|
||||
it("hides add a policy button", () => {
|
||||
cy.findByText(/add a policy/).should("not.exist");
|
||||
it("hides 'Add a policy' button", () => {
|
||||
managePoliciesPage.hidesButton("Add a policy");
|
||||
});
|
||||
it("hides run, edit, or delete a policy", () => {
|
||||
cy.getAttached("tbody").within(() => {
|
||||
cy.getAttached("tr")
|
||||
.first()
|
||||
.within(() => {
|
||||
cy.get(".fleet-checkbox__input").should("not.exist");
|
||||
});
|
||||
});
|
||||
cy.getAttached(".data-table__table").within(() => {
|
||||
cy.findByRole("button", {
|
||||
name: /filevault enabled/i,
|
||||
}).click();
|
||||
});
|
||||
cy.getAttached(".policy-form__wrapper").within(() => {
|
||||
cy.findByRole("button", { name: /run/i }).should("not.exist");
|
||||
cy.findByRole("button", { name: /save/i }).should("not.exist");
|
||||
});
|
||||
it("hides 'Run', 'Edit', and 'Delete' a policy", () => {
|
||||
managePoliciesPage.allowsViewPolicyOnly();
|
||||
});
|
||||
});
|
||||
describe("User profile page", () => {
|
||||
beforeEach(() => {
|
||||
cy.loginWithCySession("oliver@organization.com", GOOD_PASSWORD);
|
||||
cy.visit("/profile");
|
||||
userProfilePage.visitUserProfilePage();
|
||||
});
|
||||
it("verifies teams is disabled for the Profile page", () => {
|
||||
cy.getAttached(".user-side-panel").within(() => {
|
||||
cy.findByText(/teams/i).should("not.exist");
|
||||
});
|
||||
});
|
||||
it("renders elements according to role-based access controls", () => {
|
||||
cy.getAttached(".user-side-panel").within(() => {
|
||||
cy.findByText("Role")
|
||||
.next()
|
||||
.contains(/observer/i);
|
||||
});
|
||||
it("verifies user role and teams is disabled", () => {
|
||||
userProfilePage.showRole("Observer");
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -268,9 +171,9 @@ describe("Free tier - Observer user", () => {
|
|||
cy.findByText(/schedule/i).should("not.exist");
|
||||
cy.visit("/settings/organization");
|
||||
cy.findByText(/you do not have permissions/i).should("exist");
|
||||
cy.visit("/packs/manage");
|
||||
managePacksPage.visitsManagePacksPage();
|
||||
cy.findByText(/you do not have permissions/i).should("exist");
|
||||
cy.visit("/schedule/manage");
|
||||
manageSchedulePage.visitManageSchedulePage();
|
||||
cy.findByText(/you do not have permissions/i).should("exist");
|
||||
});
|
||||
});
|
||||
|
|
|
|||
85
cypress/integration/pages/dashboardPage.ts
Normal file
85
cypress/integration/pages/dashboardPage.ts
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
const dashboardPage = {
|
||||
visitsDashboardPage: () => {
|
||||
cy.visit("/dashboard");
|
||||
},
|
||||
|
||||
switchesPlatform: (platform = "") => {
|
||||
cy.getAttached(".homepage__platform_dropdown").click();
|
||||
cy.getAttached(".Select-menu-outer").within(() => {
|
||||
cy.findAllByText(platform).click();
|
||||
});
|
||||
},
|
||||
|
||||
displaysCards: (platform = "") => {
|
||||
switch (platform) {
|
||||
case "macOS":
|
||||
cy.getAttached(".homepage__wrapper").within(() => {
|
||||
cy.findByText(/platform/i).should("exist");
|
||||
cy.getAttached(".hosts-summary").should("exist");
|
||||
cy.getAttached(".hosts-status").should("exist");
|
||||
cy.getAttached(".home-mdm").should("exist");
|
||||
cy.getAttached(".operating-systems").should("exist");
|
||||
// "get" because we expect it not to exist
|
||||
cy.get(".home-software").should("not.exist");
|
||||
cy.get(".activity-feed").should("not.exist");
|
||||
});
|
||||
break;
|
||||
case "Windows":
|
||||
cy.getAttached(".homepage__wrapper").within(() => {
|
||||
cy.findByText(/platform/i).should("exist");
|
||||
cy.getAttached(".hosts-summary").should("exist");
|
||||
cy.getAttached(".hosts-status").should("exist");
|
||||
cy.getAttached(".operating-systems").should("exist");
|
||||
// "get" because we expect it not to exist
|
||||
cy.get(".home-software").should("not.exist");
|
||||
cy.get(".activity-feed").should("not.exist");
|
||||
});
|
||||
break;
|
||||
case "Linux":
|
||||
cy.getAttached(".homepage__wrapper").within(() => {
|
||||
cy.findByText(/platform/i).should("exist");
|
||||
cy.getAttached(".hosts-summary").should("exist");
|
||||
cy.getAttached(".hosts-status").should("exist");
|
||||
// "get" because we expect it not to exist
|
||||
cy.get(".home-software").should("not.exist");
|
||||
cy.get(".activity-feed").should("not.exist");
|
||||
});
|
||||
break;
|
||||
case "All":
|
||||
cy.getAttached(".homepage__wrapper").within(() => {
|
||||
cy.findByText(/platform/i).should("exist");
|
||||
cy.getAttached(".hosts-summary").should("exist");
|
||||
cy.getAttached(".hosts-status").should("exist");
|
||||
cy.getAttached(".home-software").should("exist");
|
||||
cy.getAttached(".activity-feed").should("exist");
|
||||
});
|
||||
break;
|
||||
default:
|
||||
// no activity feed on team page
|
||||
cy.getAttached(".homepage__wrapper").within(() => {
|
||||
cy.findByText(/platform/i).should("exist");
|
||||
cy.getAttached(".hosts-summary").should("exist");
|
||||
cy.getAttached(".hosts-status").should("exist");
|
||||
cy.getAttached(".home-software").should("exist");
|
||||
cy.get(".activity-feed").should("not.exist");
|
||||
});
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
verifiesFilteredHostByPlatform: (platform: string) => {
|
||||
if (platform === "none") {
|
||||
cy.findByText(/view all hosts/i).click();
|
||||
cy.findByRole("status", { name: /hosts filtered by/i }).should(
|
||||
"not.exist"
|
||||
);
|
||||
} else {
|
||||
cy.findByText(/view all hosts/i).click();
|
||||
cy.findByRole("status", {
|
||||
name: `hosts filtered by ${platform}`,
|
||||
}).should("exist");
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export default dashboardPage;
|
||||
108
cypress/integration/pages/hostDetailsPage.ts
Normal file
108
cypress/integration/pages/hostDetailsPage.ts
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
const hostDetailsPage = {
|
||||
visitsHostDetailsPage: (hostId: number) => {
|
||||
cy.visit(`/hosts/${hostId}`);
|
||||
},
|
||||
|
||||
verifiesTeamsisDisabled: () => {
|
||||
cy.findByText(/team/i).should("not.exist");
|
||||
},
|
||||
|
||||
verifiesTeam: (teamName: string) => {
|
||||
cy.getAttached(".info-flex").within(() => {
|
||||
// Team is shown for host
|
||||
cy.findByText(teamName).should("exist");
|
||||
});
|
||||
},
|
||||
|
||||
hidesButton: (text: string) => {
|
||||
cy.contains("button", text).should("not.exist");
|
||||
},
|
||||
|
||||
allowsDeleteHost: () => {
|
||||
cy.findByRole("button", { name: /delete/i }).click();
|
||||
cy.getAttached(".modal__modal_container").within(() => {
|
||||
cy.findByRole("button", { name: /delete/i }).should("be.enabled");
|
||||
});
|
||||
},
|
||||
|
||||
verifiesDeletedHost: (hostname: string) => {
|
||||
cy.getAttached(".modal__modal_container")
|
||||
.within(() => {
|
||||
cy.findByRole("button", { name: /delete/i }).click();
|
||||
})
|
||||
.then(() => {
|
||||
cy.findByText(/add your devices to fleet/i).should("exist");
|
||||
cy.findByText(/add hosts/i).should("exist");
|
||||
cy.findByText(/about this host/i).should("not.exist");
|
||||
cy.findByText(hostname).should("not.exist");
|
||||
});
|
||||
},
|
||||
|
||||
allowsTransferHost: (create: boolean) => {
|
||||
cy.findByRole("button", { name: /transfer/i }).click();
|
||||
if (create) {
|
||||
cy.findByText(/create a team/i).should("exist");
|
||||
} else {
|
||||
cy.findByText(/create a team/i).should("not.exist");
|
||||
}
|
||||
cy.getAttached(".Select-control").click();
|
||||
cy.getAttached(".Select-menu").within(() => {
|
||||
cy.findByText(/no team/i).should("exist");
|
||||
cy.findByText(/oranges/i).should("exist");
|
||||
cy.findByText(/apples/i).click();
|
||||
});
|
||||
cy.getAttached(".transfer-host-modal .modal-cta-wrap")
|
||||
.contains("button", /transfer/i)
|
||||
.should("be.enabled");
|
||||
},
|
||||
|
||||
verifiesTransferredHost: () => {
|
||||
cy.getAttached(".transfer-host-modal .modal-cta-wrap")
|
||||
.contains("button", /transfer/i)
|
||||
.click();
|
||||
cy.findByText(/transferred to apples/i).should("exist");
|
||||
cy.findByText(/team/i).next().contains("Apples");
|
||||
},
|
||||
|
||||
allowsCustomQueryHost: () => {
|
||||
cy.findByRole("button", { name: /query/i }).click();
|
||||
cy.findByRole("button", { name: /create custom query/i }).should(
|
||||
"be.enabled"
|
||||
);
|
||||
cy.getAttached(".modal__ex").within(() => {
|
||||
cy.findByRole("button").click();
|
||||
});
|
||||
},
|
||||
|
||||
hidesCustomQueryHost: () => {
|
||||
cy.findByRole("button", { name: /query/i }).click();
|
||||
cy.contains("button", /create custom query/i).should("not.exist");
|
||||
cy.getAttached(".modal__ex").click();
|
||||
},
|
||||
|
||||
allowsCreateOsPolicy: () => {
|
||||
cy.getAttached(".info-flex").within(() => {
|
||||
cy.findByText(/ubuntu/i).should("exist");
|
||||
cy.getAttached(".host-summary__os-policy-button").click();
|
||||
});
|
||||
cy.getAttached(".modal__content")
|
||||
.findByRole("button", { name: /create new policy/i })
|
||||
.should("be.enabled");
|
||||
},
|
||||
|
||||
hidesCreateOSPolicy: () => {
|
||||
cy.getAttached(".info-flex").within(() => {
|
||||
cy.findByText("Operating system")
|
||||
.next()
|
||||
.findByText(/ubuntu/i)
|
||||
.should("exist");
|
||||
|
||||
cy.findByText("Operating system")
|
||||
.next()
|
||||
.findByRole("button")
|
||||
.should("not.exist");
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
export default hostDetailsPage;
|
||||
55
cypress/integration/pages/manageHostsPage.ts
Normal file
55
cypress/integration/pages/manageHostsPage.ts
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
const manageHostsPage = {
|
||||
visitsManageHostsPage: () => {
|
||||
cy.visit("/hosts/manage");
|
||||
},
|
||||
|
||||
allowsManageAndAddSecrets: () => {
|
||||
cy.getAttached(".button-wrap")
|
||||
.contains("button", /manage enroll secret/i)
|
||||
.click();
|
||||
cy.contains("button", /add secret/i).click();
|
||||
cy.contains("button", /save/i).click();
|
||||
cy.contains("button", /done/i).click();
|
||||
},
|
||||
|
||||
allowsAddHosts: () => {
|
||||
cy.getAttached(".button-wrap")
|
||||
.contains("button", /add hosts/i)
|
||||
.click();
|
||||
cy.getAttached(".modal__content").contains("button", /done/i).click();
|
||||
},
|
||||
|
||||
allowsAddLabelForm: () => {
|
||||
cy.getAttached(".label-filter-select__control").click();
|
||||
cy.findByRole("button", { name: /add label/i }).click();
|
||||
cy.findByText(/new label/i).should("exist");
|
||||
cy.getAttached(".label-form__button-wrap")
|
||||
.contains("button", /cancel/i)
|
||||
.click();
|
||||
},
|
||||
|
||||
hidesButton: (text: string) => {
|
||||
if (text === "Add label") {
|
||||
cy.getAttached(".label-filter-select__control").click();
|
||||
cy.contains("button", /add label/i).should("not.exist");
|
||||
} else {
|
||||
cy.contains("button", text).should("not.exist");
|
||||
}
|
||||
},
|
||||
|
||||
includesTeamColumn: () => {
|
||||
cy.getAttached("thead").within(() => {
|
||||
cy.findByText(/team/i).should("exist");
|
||||
});
|
||||
},
|
||||
|
||||
includesTeamDropdown: (teamName = "All teams") => {
|
||||
cy.getAttached(".Select-value-label").contains(teamName);
|
||||
},
|
||||
|
||||
verifiesTeamsIsDisabled: () => {
|
||||
cy.findByText(/teams/i).should("not.exist");
|
||||
},
|
||||
};
|
||||
|
||||
export default manageHostsPage;
|
||||
61
cypress/integration/pages/managePacksPage.ts
Normal file
61
cypress/integration/pages/managePacksPage.ts
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
const managePacksPage = {
|
||||
visitsManagePacksPage: () => {
|
||||
cy.visit("/packs/manage");
|
||||
},
|
||||
|
||||
hidesButton: (text: string) => {
|
||||
cy.contains("button", text).should("not.exist");
|
||||
},
|
||||
|
||||
allowsCreatePack: () => {
|
||||
cy.findByRole("button", { name: /create new pack/i }).click();
|
||||
cy.findByLabelText(/name/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 }).should("be.enabled");
|
||||
},
|
||||
|
||||
verifiesCreatedPack: () => {
|
||||
cy.findByRole("button", { name: /save query pack/i }).click();
|
||||
},
|
||||
|
||||
allowsEditPack: () => {
|
||||
cy.findByLabelText(/name/i).clear().type("Server errors");
|
||||
cy.findByLabelText(/description/i)
|
||||
.clear()
|
||||
.type("See all server errors.");
|
||||
cy.findByRole("button", { name: /save/i }).should("be.enabled");
|
||||
},
|
||||
|
||||
verifiesEditedPack: () => {
|
||||
cy.findByRole("button", { name: /save/i }).click();
|
||||
},
|
||||
|
||||
allowsDeletePack: () => {
|
||||
cy.getAttached("tbody").within(() => {
|
||||
cy.getAttached("tr")
|
||||
.first()
|
||||
.within(() => {
|
||||
cy.getAttached(".fleet-checkbox__input").check({ force: true });
|
||||
});
|
||||
});
|
||||
cy.findByRole("button", { name: /delete/i }).click();
|
||||
cy.getAttached(".remove-pack-modal .modal-cta-wrap > .button--alert")
|
||||
.contains("button", /delete/i)
|
||||
.should("be.enabled");
|
||||
},
|
||||
|
||||
verifiesDeletedPack: () => {
|
||||
cy.getAttached(".remove-pack-modal .modal-cta-wrap > .button--alert")
|
||||
.contains("button", /delete/i)
|
||||
.click({ force: true });
|
||||
cy.findByText(/successfully deleted/i).should("be.visible");
|
||||
managePacksPage.visitsManagePacksPage();
|
||||
cy.getAttached(".table-container").within(() => {
|
||||
cy.findByText(/windows starter pack/i).should("not.exist");
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
export default managePacksPage;
|
||||
115
cypress/integration/pages/managePoliciesPage.ts
Normal file
115
cypress/integration/pages/managePoliciesPage.ts
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
const managePoliciesPage = {
|
||||
visitManagePoliciesPage: () => {
|
||||
cy.visit("/policies/manage");
|
||||
},
|
||||
|
||||
hidesButton: (text: string) => {
|
||||
cy.contains("button", text).should("not.exist");
|
||||
},
|
||||
|
||||
allowsAddDefaultPolicy: () => {
|
||||
cy.findByRole("button", { name: /add a policy/i }).click();
|
||||
// Add a default policy
|
||||
cy.findByText(/gatekeeper enabled/i).click();
|
||||
cy.getAttached(".policy-form__button-wrap").within(() => {
|
||||
cy.findByRole("button", { name: /run/i }).should("exist");
|
||||
cy.findByRole("button", { name: /save/i }).click();
|
||||
});
|
||||
},
|
||||
|
||||
verifiesAddedDefaultPolicy: () => {
|
||||
cy.getAttached(".modal-cta-wrap").within(() => {
|
||||
cy.findByRole("button", { name: /save policy/i }).click();
|
||||
});
|
||||
cy.findByText(/policy created/i).should("exist");
|
||||
cy.findByText(/gatekeeper enabled/i).should("exist");
|
||||
},
|
||||
|
||||
allowsAutomatePolicy: () => {
|
||||
cy.getAttached(".button-wrap")
|
||||
.findByRole("button", { name: /manage automations/i })
|
||||
.click();
|
||||
|
||||
cy.getAttached(".manage-automations-modal").within(() => {
|
||||
cy.getAttached(".fleet-slider").click();
|
||||
cy.getAttached(".fleet-checkbox__input").check({ force: true });
|
||||
cy.getAttached("#webhook-url").clear().type("https://example.com/admin");
|
||||
});
|
||||
},
|
||||
|
||||
verifiesAutomatedPolicy: () => {
|
||||
cy.getAttached(".manage-automations-modal").within(() => {
|
||||
cy.findByRole("button", { name: /save/i }).click();
|
||||
});
|
||||
cy.findByText(/successfully updated policy automations/i).should("exist");
|
||||
},
|
||||
|
||||
allowsDeletePolicy: () => {
|
||||
cy.getAttached("tbody").within(() => {
|
||||
cy.getAttached("tr")
|
||||
.first()
|
||||
.within(() => {
|
||||
cy.getAttached(".fleet-checkbox__input").check({
|
||||
force: true,
|
||||
});
|
||||
});
|
||||
});
|
||||
cy.findByRole("button", { name: /delete/i }).click();
|
||||
cy.getAttached(".delete-policy-modal").within(() => {
|
||||
cy.findByRole("button", { name: /delete/i }).should("be.enabled");
|
||||
});
|
||||
},
|
||||
|
||||
verifiesDeletedPolicy: () => {
|
||||
cy.getAttached(".delete-policy-modal").within(() => {
|
||||
cy.findByRole("button", { name: /delete/i }).click();
|
||||
});
|
||||
cy.findByText(/deleted policy/i).should("exist");
|
||||
cy.findByText(/backup/i).should("not.exist");
|
||||
},
|
||||
|
||||
allowsSelectRunSavePolicy: (name = "gatekeeper") => {
|
||||
cy.getAttached(".data-table__table").within(() => {
|
||||
cy.findByRole("button", { name: RegExp(name, "i") }).click();
|
||||
});
|
||||
cy.getAttached(".policy-form__button-wrap").within(() => {
|
||||
cy.findByRole("button", { name: /run/i }).should("exist");
|
||||
cy.findByRole("button", { name: /save/i }).should("exist");
|
||||
});
|
||||
},
|
||||
|
||||
allowsViewPolicyOnly: () => {
|
||||
cy.getAttached("tbody").within(() => {
|
||||
cy.getAttached("tr")
|
||||
.first()
|
||||
.within(() => {
|
||||
cy.contains(".fleet-checkbox__input").should("not.exist");
|
||||
cy.findByRole("button", { name: /filevault/i }).click();
|
||||
});
|
||||
});
|
||||
cy.getAttached(".policy-form__wrapper").within(() => {
|
||||
cy.findByRole("button", { name: /run/i }).should("not.exist");
|
||||
cy.findByRole("button", { name: /save/i }).should("not.exist");
|
||||
});
|
||||
},
|
||||
|
||||
allowsRunSavePolicy: () => {
|
||||
cy.getAttached(".data-table__table").within(() => {
|
||||
cy.getAttached("tbody").within(() => {
|
||||
cy.getAttached("tr")
|
||||
.first()
|
||||
.within(() => {
|
||||
cy.findByRole("button", {
|
||||
name: /gatekeeper/i,
|
||||
}).click();
|
||||
});
|
||||
});
|
||||
});
|
||||
cy.getAttached(".policy-form__button-wrap").within(() => {
|
||||
cy.findByRole("button", { name: /run/i }).should("exist");
|
||||
cy.findByRole("button", { name: /save/i }).should("exist");
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
export default managePoliciesPage;
|
||||
162
cypress/integration/pages/manageQueriesPage.ts
Normal file
162
cypress/integration/pages/manageQueriesPage.ts
Normal file
|
|
@ -0,0 +1,162 @@
|
|||
import * as path from "path";
|
||||
import { format } from "date-fns";
|
||||
|
||||
const manageQueriesPage = {
|
||||
visitManageQueriesPage: () => {
|
||||
cy.visit("/queries/manage");
|
||||
},
|
||||
|
||||
hidesButton: (text: string) => {
|
||||
cy.contains("button", text).should("not.exist");
|
||||
},
|
||||
|
||||
allowsCreateNewQuery: () => {
|
||||
cy.findByRole("button", { name: /new query/i }).click();
|
||||
cy.getAttached(".ace_scroller")
|
||||
.click({ force: true })
|
||||
.type("{selectall}SELECT * FROM windows_crashes;");
|
||||
cy.findByRole("button", { name: /save/i }).click();
|
||||
cy.getAttached(".modal__background").within(() => {
|
||||
cy.getAttached(".modal__modal_container").within(() => {
|
||||
cy.getAttached(".modal__content").within(() => {
|
||||
cy.getAttached("form").within(() => {
|
||||
cy.findByLabelText(/name/i).click().type("Cypress test query");
|
||||
cy.findByLabelText(/description/i)
|
||||
.click()
|
||||
.type("Cypress test of create new query flow.");
|
||||
cy.findByLabelText(/observers can run/i).click({ force: true });
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
verifiesCreatedNewQuery: () => {
|
||||
cy.getAttached(".modal__background").within(() => {
|
||||
cy.getAttached(".modal__modal_container").within(() => {
|
||||
cy.getAttached(".modal__content").within(() => {
|
||||
cy.getAttached("form").within(() => {
|
||||
cy.findByRole("button", { name: /save query/i }).click();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
cy.findByText(/query created/i).should("exist");
|
||||
cy.getAttached(".query-form__query-name").within(() => {
|
||||
cy.findByText(/cypress test query/i).should("exist");
|
||||
});
|
||||
},
|
||||
|
||||
allowsEditExistingQuery: () => {
|
||||
cy.getAttached(".name__cell .button--text-link")
|
||||
.first()
|
||||
.click({ force: true });
|
||||
cy.getAttached(".ace_text-input")
|
||||
.click({ force: true })
|
||||
.clear({ force: true })
|
||||
.type("SELECT 1 FROM cypress;", {
|
||||
force: true,
|
||||
});
|
||||
},
|
||||
|
||||
verifiesEditedExistingQuery: () => {
|
||||
cy.findByRole("button", { name: "Save" }).click(); // we have 'save as new' also
|
||||
cy.findByText(/query updated/i).should("be.visible");
|
||||
},
|
||||
|
||||
allowsSaveAsNewQuery: () => {
|
||||
cy.getAttached(".name__cell .button--text-link")
|
||||
.eq(1)
|
||||
.within(() => {
|
||||
cy.findByText(/get authorized/i).click();
|
||||
});
|
||||
cy.findByRole("button", { name: /run query/i }).should("exist");
|
||||
cy.getAttached(".ace_scroller")
|
||||
.click()
|
||||
.type("{selectall}SELECT datetime, username FROM windows_crashes;");
|
||||
cy.findByRole("button", { name: /save as new/i }).should("be.enabled");
|
||||
},
|
||||
|
||||
verifiesSavedAsNewQuery: () => {
|
||||
cy.findByRole("button", { name: /save as new/i }).click();
|
||||
cy.findByText(/successfully added query/i).should("be.visible");
|
||||
cy.findByText(/copy of/i).should("be.visible");
|
||||
},
|
||||
|
||||
allowsDeleteExistingQuery: () => {
|
||||
cy.findByText(/detect presence of authorized ssh keys/i)
|
||||
.parent()
|
||||
.parent()
|
||||
.parent()
|
||||
.within(() => {
|
||||
cy.getAttached(".fleet-checkbox__input").check({
|
||||
force: true,
|
||||
});
|
||||
});
|
||||
cy.findByRole("button", { name: /delete/i }).click();
|
||||
cy.getAttached(".delete-query-modal .modal-cta-wrap").within(() => {
|
||||
cy.findByRole("button", { name: /delete/i }).should("exist");
|
||||
});
|
||||
},
|
||||
|
||||
verifiesDeletedExistingQuery: () => {
|
||||
cy.getAttached(".delete-query-modal .modal-cta-wrap").within(() => {
|
||||
cy.findByRole("button", { name: /delete/i }).click();
|
||||
});
|
||||
cy.findByText(/successfully deleted query/i).should("be.visible");
|
||||
cy.findByText(/detect presence of authorized ssh keys/i).should(
|
||||
"not.exist"
|
||||
);
|
||||
},
|
||||
|
||||
// TODO: Allows delete of self authored query only (Team Admin, team maintainer)
|
||||
|
||||
allowsSelectTeamTargets: () => {
|
||||
cy.getAttached("tbody").within(() => {
|
||||
cy.findAllByText(/detect presence/i).click();
|
||||
});
|
||||
|
||||
cy.getAttached(".query-form__button-wrap").within(() => {
|
||||
cy.findByRole("button", { name: /run/i }).click();
|
||||
});
|
||||
cy.contains("h3", /teams/i).should("exist");
|
||||
cy.contains(".selector-name", /apples/i).should("exist");
|
||||
},
|
||||
|
||||
allowsRunQuery: () => {
|
||||
cy.getAttached(".name__cell .button--text-link").first().click();
|
||||
cy.findByRole("button", { name: /run query/i }).click();
|
||||
cy.findByText(/select targets/i).should("exist");
|
||||
cy.findByText(/all hosts/i).click();
|
||||
cy.findByText(/host targeted/i).should("exist"); // target count
|
||||
},
|
||||
|
||||
verifiesRanQuery: () => {
|
||||
cy.findByRole("button", { name: /run/i }).click();
|
||||
cy.findByText(/querying selected host/i).should("exist"); // target count
|
||||
},
|
||||
|
||||
allowsViewRanQuery: () => {
|
||||
// Ensures live query runs
|
||||
cy.wait(10000); // eslint-disable-line cypress/no-unnecessary-waiting
|
||||
cy.getAttached(".table-container").within(() => {
|
||||
cy.findByRole("button", { name: /show query/i }).click();
|
||||
});
|
||||
cy.getAttached(".show-query-modal").within(() => {
|
||||
cy.findByRole("button", { name: /done/i }).click();
|
||||
});
|
||||
},
|
||||
|
||||
allowsExportQueryResults: () => {
|
||||
cy.getAttached(".table-container").within(() => {
|
||||
cy.findByRole("button", { name: /export results/i }).click();
|
||||
const formattedTime = format(new Date(), "MM-dd-yy hh-mm-ss");
|
||||
const filename = `Query Results (${formattedTime}).csv`;
|
||||
cy.readFile(path.join(Cypress.config("downloadsFolder"), filename), {
|
||||
timeout: 5000,
|
||||
});
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
export default manageQueriesPage;
|
||||
124
cypress/integration/pages/manageSchedulePage.ts
Normal file
124
cypress/integration/pages/manageSchedulePage.ts
Normal file
|
|
@ -0,0 +1,124 @@
|
|||
const manageSchedulePage = {
|
||||
visitManageSchedulePage: () => {
|
||||
cy.visit("/schedule/manage");
|
||||
},
|
||||
|
||||
hidesButton: (text: string) => {
|
||||
if (text === "Advanced") {
|
||||
cy.getAttached(".no-schedule__cta-buttons").within(() => {
|
||||
cy.contains("button", text).should("not.exist");
|
||||
});
|
||||
} else cy.contains("button", text).should("not.exist");
|
||||
},
|
||||
|
||||
changesTeam: (team1: string, team2: string) => {
|
||||
cy.getAttached(".manage-schedule-page__header").within(() => {
|
||||
cy.contains(team1).click({ force: true });
|
||||
cy.contains(team2).click({ force: true });
|
||||
});
|
||||
},
|
||||
|
||||
confirmsTeam: (team: string) => {
|
||||
cy.getAttached(".manage-schedule-page__header-wrap").within(() => {
|
||||
cy.findByText(team).should("exist");
|
||||
});
|
||||
},
|
||||
|
||||
allowsAddSchedule: () => {
|
||||
cy.getAttached(".no-schedule__cta-buttons").within(() => {
|
||||
cy.findByRole("button", { name: /schedule a query/i }).click({
|
||||
force: true,
|
||||
});
|
||||
});
|
||||
cy.getAttached(".schedule-editor-modal__form").within(() => {
|
||||
cy.findByText(/select query/i).click();
|
||||
cy.findByText(/get local/i).click();
|
||||
cy.findByText(/every day/i).click();
|
||||
cy.findByText(/every 6 hours/i).click();
|
||||
cy.findByText(/show advanced options/i).click();
|
||||
cy.findByText(/snapshot/i).click();
|
||||
cy.findByText(/ignore removals/i).click();
|
||||
cy.getAttached(".schedule-editor-modal__form-field--platform").within(
|
||||
() => {
|
||||
cy.findByText(/all/i).click();
|
||||
cy.findByText(/linux/i).click();
|
||||
}
|
||||
);
|
||||
cy.getAttached(".schedule-editor-modal__form-field--osquer-vers").within(
|
||||
() => {
|
||||
cy.findByText(/all/i).click();
|
||||
cy.findByText(/4.6.0/i).click();
|
||||
}
|
||||
);
|
||||
cy.getAttached(".schedule-editor-modal__form-field--shard").within(() => {
|
||||
cy.getAttached(".input-field").click().type("50");
|
||||
});
|
||||
cy.getAttached(".modal-cta-wrap").within(() => {
|
||||
cy.findByRole("button", { name: /schedule/i }).should("be.enabled");
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
verifiesAddedSchedule: () => {
|
||||
cy.getAttached(".modal-cta-wrap").within(() => {
|
||||
cy.findByRole("button", { name: /schedule/i }).click();
|
||||
});
|
||||
cy.findByText(/successfully added/i).should("be.visible");
|
||||
cy.getAttached("tbody>tr").should("have.length", 1);
|
||||
},
|
||||
|
||||
allowsEditSchedule: () => {
|
||||
cy.getAttached(".manage-schedule-page");
|
||||
cy.getAttached("tbody>tr")
|
||||
.should("have.length", 1)
|
||||
.within(() => {
|
||||
cy.findByText(/action/i).click();
|
||||
cy.findByText(/edit/i).click();
|
||||
});
|
||||
cy.getAttached(".schedule-editor-modal__form").within(() => {
|
||||
cy.findByText(/every 6 hours/i).click();
|
||||
cy.findByText(/every day/i).click();
|
||||
|
||||
cy.getAttached(".modal-cta-wrap").within(() => {
|
||||
cy.findByRole("button", { name: /schedule/i }).should("be.enabled");
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
verifiesEditedSchedule: () => {
|
||||
cy.getAttached(".modal-cta-wrap").within(() => {
|
||||
cy.findByRole("button", { name: /schedule/i }).click();
|
||||
});
|
||||
cy.findByText(/successfully updated/i).should("be.visible");
|
||||
},
|
||||
|
||||
allowsRemoveSchedule: () => {
|
||||
cy.getAttached(".manage-schedule-page");
|
||||
cy.getAttached("tbody>tr")
|
||||
.should("have.length", 1)
|
||||
.within(() => {
|
||||
cy.getAttached(".Select-placeholder").within(() => {
|
||||
cy.findByText(/action/i).click();
|
||||
});
|
||||
cy.getAttached(".Select-menu").within(() => {
|
||||
cy.findByText(/remove/i).click();
|
||||
});
|
||||
});
|
||||
cy.getAttached(".remove-scheduled-query-modal .modal-cta-wrap").within(
|
||||
() => {
|
||||
cy.findByRole("button", { name: /remove/i }).should("be.enabled");
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
verifiesRemovedSchedule: () => {
|
||||
cy.getAttached(".remove-scheduled-query-modal .modal-cta-wrap").within(
|
||||
() => {
|
||||
cy.findByRole("button", { name: /remove/i }).click();
|
||||
}
|
||||
);
|
||||
cy.findByText(/successfully removed/i).should("be.visible");
|
||||
},
|
||||
};
|
||||
|
||||
export default manageSchedulePage;
|
||||
16
cypress/integration/pages/manageSoftwarePage.ts
Normal file
16
cypress/integration/pages/manageSoftwarePage.ts
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
const manageSoftwarePage = {
|
||||
visitManageSoftwarePage: () => {
|
||||
cy.visit("/software/manage");
|
||||
},
|
||||
|
||||
hidesButton: (text: string) => {
|
||||
cy.contains("button", text).should("not.exist");
|
||||
},
|
||||
|
||||
allowsManageAutomations: () => {
|
||||
cy.findByRole("button", { name: /manage automations/i }).click();
|
||||
cy.findByRole("button", { name: /cancel/i }).click();
|
||||
},
|
||||
};
|
||||
|
||||
export default manageSoftwarePage;
|
||||
10
cypress/integration/pages/teamsDropdown.ts
Normal file
10
cypress/integration/pages/teamsDropdown.ts
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
const teamsDropdown = {
|
||||
switchTeams: (team1: string, team2: string) => {
|
||||
cy.getAttached(".component__team-dropdown").within(() => {
|
||||
cy.findByText(team1).click({ force: true });
|
||||
});
|
||||
cy.getAttached(".Select-menu").contains(team2).click({ force: true });
|
||||
},
|
||||
};
|
||||
|
||||
export default teamsDropdown;
|
||||
21
cypress/integration/pages/userProfilePage.ts
Normal file
21
cypress/integration/pages/userProfilePage.ts
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
const userProfilePage = {
|
||||
visitUserProfilePage: () => {
|
||||
cy.visit("/profile");
|
||||
},
|
||||
|
||||
showRole: (role: string, team?: string) => {
|
||||
cy.getAttached(".user-side-panel").within(() => {
|
||||
if (team) {
|
||||
cy.getAttached(".user-side-panel__header")
|
||||
.contains(/team/i)
|
||||
.next()
|
||||
.contains(team);
|
||||
} else {
|
||||
cy.findByText(/teams/i).should("not.exist");
|
||||
}
|
||||
cy.findByText("Role").next().contains(role);
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
export default userProfilePage;
|
||||
|
|
@ -1,4 +1,11 @@
|
|||
import CONSTANTS from "../../support/constants";
|
||||
import hostDetailsPage from "../pages/hostDetailsPage";
|
||||
import managePoliciesPage from "../pages/managePoliciesPage";
|
||||
import manageHostsPage from "../pages/manageHostsPage";
|
||||
import manageQueriesPage from "../pages/manageQueriesPage";
|
||||
import manageSoftwarePage from "../pages/manageSoftwarePage";
|
||||
import teamsDropdown from "../pages/teamsDropdown";
|
||||
import userProfilePage from "../pages/userProfilePage";
|
||||
|
||||
const { GOOD_PASSWORD, CONFIG_INTEGRATIONS_AUTOMATIONS } = CONSTANTS;
|
||||
|
||||
|
|
@ -354,36 +361,35 @@ describe("Premium tier - Global Admin user", () => {
|
|||
// Global Admin dashboard tested in integration/free/admin.spec.ts
|
||||
// Team Admin dashboard tested below in integration/premium/admin.spec.ts
|
||||
describe("Manage hosts page", () => {
|
||||
beforeEach(() => cy.visit("/hosts/manage"));
|
||||
it("displays team column in hosts table", () => {
|
||||
cy.getAttached(".data-table__table th")
|
||||
.contains("Team")
|
||||
.should("be.visible");
|
||||
beforeEach(() => manageHostsPage.visitsManageHostsPage());
|
||||
it("verifies teams is enabled on Manage host page", () => {
|
||||
manageHostsPage.includesTeamColumn();
|
||||
});
|
||||
it("allows global admin to see and click 'Add hosts'", () => {
|
||||
cy.getAttached(".button-wrap")
|
||||
.contains("button", /add hosts/i)
|
||||
.click();
|
||||
cy.getAttached(".modal__content").contains("button", /done/i).click();
|
||||
it("allows global admin to see and click all CTA buttons", () => {
|
||||
manageHostsPage.allowsAddHosts();
|
||||
manageHostsPage.allowsManageAndAddSecrets();
|
||||
manageHostsPage.allowsAddLabelForm();
|
||||
});
|
||||
it("allows global admin to add new enroll secret", () => {
|
||||
cy.getAttached(".button-wrap")
|
||||
.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 .modal-cta-wrap")
|
||||
.contains("button", /save/i)
|
||||
.click();
|
||||
cy.getAttached(".enroll-secret-modal .modal-cta-wrap")
|
||||
.contains("button", /done/i)
|
||||
.click();
|
||||
});
|
||||
describe("Host details page", () => {
|
||||
beforeEach(() => hostDetailsPage.visitsHostDetailsPage(1));
|
||||
it("allows global admin to transfer host to an existing team", () => {
|
||||
hostDetailsPage.allowsTransferHost("andCreate");
|
||||
hostDetailsPage.verifiesTransferredHost();
|
||||
});
|
||||
it("allows global admin to create an operating system policy", () => {
|
||||
hostDetailsPage.allowsCreateOsPolicy();
|
||||
});
|
||||
it("allows global admin to custom query a host", () => {
|
||||
hostDetailsPage.allowsCustomQueryHost();
|
||||
});
|
||||
it("allows global admin to delete a host", () => {
|
||||
hostDetailsPage.allowsDeleteHost();
|
||||
});
|
||||
});
|
||||
describe("Manage software page", () => {
|
||||
beforeEach(() => {
|
||||
cy.visit("/software/manage");
|
||||
manageSoftwarePage.visitManageSoftwarePage();
|
||||
});
|
||||
// it(`displays "Probability of exploit" column`, () => {
|
||||
// cy.getAttached("thead").within(() => {
|
||||
|
|
@ -392,177 +398,50 @@ describe("Premium tier - Global Admin user", () => {
|
|||
// });
|
||||
// });
|
||||
it("allows admin to click 'Manage automations' button", () => {
|
||||
cy.findByRole("button", { name: /manage automations/i }).click();
|
||||
cy.findByRole("button", { name: /cancel/i }).click();
|
||||
manageSoftwarePage.allowsManageAutomations();
|
||||
});
|
||||
it("hides manage automations button since all teams not selected", () => {
|
||||
cy.getAttached(".manage-software-page__header-wrap").within(() => {
|
||||
cy.getAttached(".Select").within(() => {
|
||||
cy.findByText(/all teams/i).click();
|
||||
cy.findByText(/apples/i).click();
|
||||
});
|
||||
cy.findByText(/manage automations/i).should("not.exist");
|
||||
teamsDropdown.switchTeams("All teams", "Apples");
|
||||
manageSoftwarePage.hidesButton("Manage automations");
|
||||
});
|
||||
});
|
||||
});
|
||||
describe("Host details page", () => {
|
||||
beforeEach(() => cy.visit("hosts/2"));
|
||||
it("allows global admin to transfer host to an existing team", () => {
|
||||
cy.getAttached(".host-details__transfer-button").click();
|
||||
cy.findByText(/create a team/i).should("exist");
|
||||
cy.getAttached(".Select-control").click();
|
||||
cy.getAttached(".Select-menu").within(() => {
|
||||
cy.findByText(/no team/i).should("exist");
|
||||
cy.findByText(/oranges/i).should("exist");
|
||||
cy.findByText(/apples/i).click();
|
||||
});
|
||||
cy.getAttached(".transfer-host-modal .modal-cta-wrap")
|
||||
.contains("button", /transfer/i)
|
||||
.click();
|
||||
cy.findByText(/transferred to apples/i).should("exist");
|
||||
cy.findByText(/team/i).next().contains("Apples");
|
||||
});
|
||||
it("allows global admin to create an operating system policy", () => {
|
||||
cy.getAttached(".info-flex").within(() => {
|
||||
cy.findByText(/ubuntu/i).should("exist");
|
||||
cy.getAttached(".host-summary__os-policy-button").click();
|
||||
});
|
||||
cy.getAttached(".modal__content")
|
||||
.findByRole("button", { name: /create new policy/i })
|
||||
.should("exist");
|
||||
});
|
||||
it("allows global admin to create a custom query", () => {
|
||||
cy.getAttached(".host-details__query-button").click();
|
||||
cy.contains("button", /create custom query/i).should("exist");
|
||||
cy.getAttached(".modal__ex").click();
|
||||
});
|
||||
it("allows global admin to delete a host", () => {
|
||||
cy.getAttached(".host-details__action-button-container")
|
||||
.contains("button", /delete/i)
|
||||
.click();
|
||||
cy.getAttached(".delete-host-modal__modal").within(() => {
|
||||
cy.findByText(/delete host/i).should("exist");
|
||||
cy.contains("button", /delete/i).should("exist");
|
||||
cy.getAttached(".modal__ex").click();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("Query pages", () => {
|
||||
beforeEach(() => cy.visit("/queries/manage"));
|
||||
beforeEach(() => manageQueriesPage.visitManageQueriesPage());
|
||||
it("allows global admin to select teams targets for query", () => {
|
||||
cy.getAttached("tbody").within(() => {
|
||||
cy.getAttached("tr")
|
||||
.first()
|
||||
.within(() => {
|
||||
cy.getAttached(".fleet-checkbox__input").check({ force: true });
|
||||
});
|
||||
cy.findAllByText(/detect presence/i).click();
|
||||
});
|
||||
|
||||
cy.getAttached(".query-form__button-wrap").within(() => {
|
||||
cy.findByRole("button", { name: /run/i }).click();
|
||||
});
|
||||
cy.contains("h3", /teams/i).should("exist");
|
||||
cy.contains(".selector-name", /apples/i).should("exist");
|
||||
manageQueriesPage.allowsSelectTeamTargets();
|
||||
});
|
||||
// TODO: Allowed to delete self-authored query only
|
||||
});
|
||||
// Global Admin schedule tested in integration/free/admin.spec.ts
|
||||
// Team Admin team schedule tested below in integration/premium/admin.spec.ts
|
||||
describe("Manage policies page", () => {
|
||||
beforeEach(() => cy.visit("/policies/manage"));
|
||||
beforeEach(() => managePoliciesPage.visitManagePoliciesPage());
|
||||
it("allows global admin to add a new policy", () => {
|
||||
cy.getAttached(".policies-table__action-button-container")
|
||||
.findByRole("button", { name: /add a policy/i })
|
||||
.click();
|
||||
// Add a default policy
|
||||
cy.findByText(/gatekeeper enabled/i).click();
|
||||
cy.getAttached(".policy-form__button-wrap").within(() => {
|
||||
cy.findByRole("button", { name: /run/i }).should("exist");
|
||||
cy.findByRole("button", { name: /save/i }).click();
|
||||
});
|
||||
cy.getAttached(".modal-cta-wrap").within(() => {
|
||||
cy.findByRole("button", { name: /save policy/i }).click();
|
||||
});
|
||||
cy.findByText(/policy created/i).should("exist");
|
||||
cy.findByText(/gatekeeper enabled/i).should("exist");
|
||||
managePoliciesPage.allowsAddDefaultPolicy();
|
||||
managePoliciesPage.verifiesAddedDefaultPolicy();
|
||||
});
|
||||
it("allows global admin to automate a global policy", () => {
|
||||
cy.getAttached(".button-wrap")
|
||||
.findByRole("button", { name: /manage automations/i })
|
||||
.click();
|
||||
cy.getAttached(".manage-automations-modal").within(() => {
|
||||
cy.getAttached(".fleet-slider").click();
|
||||
cy.getAttached(".fleet-checkbox__input").check({ force: true });
|
||||
cy.getAttached("#webhook-url")
|
||||
.clear()
|
||||
.type("https://example.com/global_admin");
|
||||
cy.findByText(/save/i).click();
|
||||
});
|
||||
cy.findByText(/successfully updated policy automations/i).should("exist");
|
||||
managePoliciesPage.allowsAutomatePolicy();
|
||||
managePoliciesPage.verifiesAutomatedPolicy();
|
||||
});
|
||||
it("allows global admin to automate a team policy webhook", () => {
|
||||
managePoliciesPage.visitManagePoliciesPage();
|
||||
teamsDropdown.switchTeams("All teams", "Apples");
|
||||
managePoliciesPage.allowsAutomatePolicy();
|
||||
managePoliciesPage.verifiesAutomatedPolicy();
|
||||
});
|
||||
|
||||
it("allows global admin to delete a team policy", () => {
|
||||
cy.visit("/policies/manage");
|
||||
cy.getAttached(".Select-control").within(() => {
|
||||
cy.findByText(/all teams/i).click();
|
||||
});
|
||||
cy.getAttached(".Select-menu")
|
||||
.contains(/apples/i)
|
||||
.click();
|
||||
cy.getAttached(".button-wrap")
|
||||
.findByRole("button", { name: /manage automations/i })
|
||||
.click();
|
||||
cy.getAttached(".manage-automations-modal").within(() => {
|
||||
cy.getAttached(".fleet-slider").click();
|
||||
cy.getAttached(".fleet-checkbox__input").check({ force: true });
|
||||
cy.getAttached("#webhook-url")
|
||||
.clear()
|
||||
.type("https://example.com/global_admin");
|
||||
cy.findByText(/save/i).click();
|
||||
});
|
||||
cy.findByText(/successfully updated policy automations/i).should("exist");
|
||||
teamsDropdown.switchTeams("All teams", "Apples");
|
||||
managePoliciesPage.allowsDeletePolicy();
|
||||
});
|
||||
});
|
||||
it("allows global admin to delete a team policy", () => {
|
||||
cy.visit("/policies/manage");
|
||||
cy.getAttached(".Select-control").within(() => {
|
||||
cy.findByText(/all teams/i).click();
|
||||
});
|
||||
cy.getAttached(".Select-menu")
|
||||
.contains(/apples/i)
|
||||
.click();
|
||||
cy.getAttached("tbody").within(() => {
|
||||
cy.getAttached("tr")
|
||||
.first()
|
||||
.within(() => {
|
||||
cy.getAttached(".fleet-checkbox__input").check({
|
||||
force: true,
|
||||
});
|
||||
});
|
||||
});
|
||||
cy.findByRole("button", { name: /delete/i }).click();
|
||||
cy.getAttached(".delete-policy-modal").within(() => {
|
||||
cy.findByRole("button", { name: /delete/i }).should("exist");
|
||||
cy.findByRole("button", { name: /cancel/i }).click();
|
||||
});
|
||||
});
|
||||
it("allows global admin to edit a team policy", () => {
|
||||
cy.visit("policies/manage");
|
||||
cy.findByText(/all teams/i).click();
|
||||
cy.findByText(/apples/i).click();
|
||||
cy.getAttached("tbody").within(() => {
|
||||
cy.getAttached("tr")
|
||||
.first()
|
||||
.within(() => {
|
||||
cy.getAttached(".fleet-checkbox__input").check({
|
||||
force: true,
|
||||
});
|
||||
});
|
||||
});
|
||||
cy.findByText(/filevault enabled/i).click();
|
||||
cy.getAttached(".policy-form__button-wrap").within(() => {
|
||||
cy.findByRole("button", { name: /run/i }).should("exist");
|
||||
cy.findByRole("button", { name: /save/i }).should("exist");
|
||||
it("allows global admin to edit a team policy", () => {
|
||||
managePoliciesPage.visitManagePoliciesPage();
|
||||
teamsDropdown.switchTeams("All teams", "Apples");
|
||||
managePoliciesPage.allowsSelectRunSavePolicy("filevault");
|
||||
});
|
||||
});
|
||||
describe("Manage policies page (mock integrations)", () => {
|
||||
|
|
@ -572,42 +451,18 @@ describe("Premium tier - Global Admin user", () => {
|
|||
"/api/latest/fleet/config",
|
||||
CONFIG_INTEGRATIONS_AUTOMATIONS
|
||||
).as("getIntegrations");
|
||||
cy.visit("/policies/manage");
|
||||
managePoliciesPage.visitManagePoliciesPage();
|
||||
cy.wait("@getIntegrations").then((configStub) => {
|
||||
console.log(JSON.stringify(configStub));
|
||||
});
|
||||
});
|
||||
it("allows global admin to delete team policy", () => {
|
||||
cy.visit("/policies/manage");
|
||||
cy.getAttached(".Select-control").within(() => {
|
||||
cy.findByText(/all teams/i).click();
|
||||
});
|
||||
cy.getAttached(".Select-menu")
|
||||
.contains(/apples/i)
|
||||
.click();
|
||||
cy.getAttached("tbody").within(() => {
|
||||
cy.getAttached("tr")
|
||||
.first()
|
||||
.within(() => {
|
||||
cy.getAttached(".fleet-checkbox__input").check({
|
||||
force: true,
|
||||
});
|
||||
});
|
||||
});
|
||||
cy.findByRole("button", { name: /delete/i }).click();
|
||||
cy.getAttached(".delete-policy-modal").within(() => {
|
||||
cy.findByRole("button", { name: /delete/i }).should("exist");
|
||||
cy.findByRole("button", { name: /cancel/i }).click();
|
||||
});
|
||||
teamsDropdown.switchTeams("All teams", "Apples");
|
||||
managePoliciesPage.allowsDeletePolicy();
|
||||
});
|
||||
it("allows global admin to automate a team policy jira integration", () => {
|
||||
cy.visit("/policies/manage");
|
||||
cy.getAttached(".Select-control").within(() => {
|
||||
cy.findByText(/all teams/i).click();
|
||||
});
|
||||
cy.getAttached(".Select-menu")
|
||||
.contains(/apples/i)
|
||||
.click();
|
||||
managePoliciesPage.visitManagePoliciesPage;
|
||||
teamsDropdown.switchTeams("All teams", "Apples");
|
||||
cy.getAttached(".button-wrap")
|
||||
.findByRole("button", { name: /manage automations/i })
|
||||
.click();
|
||||
|
|
@ -634,13 +489,8 @@ describe("Premium tier - Global Admin user", () => {
|
|||
});
|
||||
|
||||
it("allows global admin to automate a team policy zendesk integration", () => {
|
||||
cy.visit("/policies/manage");
|
||||
cy.getAttached(".Select-control").within(() => {
|
||||
cy.findByText(/all teams/i).click();
|
||||
});
|
||||
cy.getAttached(".Select-menu")
|
||||
.contains(/apples/i)
|
||||
.click();
|
||||
managePoliciesPage.visitManagePoliciesPage();
|
||||
teamsDropdown.switchTeams("All teams", "Apples");
|
||||
cy.getAttached(".button-wrap")
|
||||
.findByRole("button", { name: /manage automations/i })
|
||||
.click();
|
||||
|
|
@ -735,14 +585,9 @@ describe("Premium tier - Global Admin user", () => {
|
|||
});
|
||||
});
|
||||
describe("User profile page", () => {
|
||||
it("renders elements according to role-based access controls", () => {
|
||||
cy.visit("/profile");
|
||||
cy.getAttached(".user-side-panel").within(() => {
|
||||
cy.findByText(/team/i)
|
||||
.next()
|
||||
.contains(/global/i);
|
||||
cy.findByText("Role").next().contains(/admin/i);
|
||||
});
|
||||
it("verifies admin user role and global access", () => {
|
||||
userProfilePage.visitUserProfilePage();
|
||||
userProfilePage.showRole("Admin", "Global");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,4 +1,12 @@
|
|||
import CONSTANTS from "../../support/constants";
|
||||
import hostDetailsPage from "../pages/hostDetailsPage";
|
||||
import managePoliciesPage from "../pages/managePoliciesPage";
|
||||
import manageHostsPage from "../pages/manageHostsPage";
|
||||
import manageQueriesPage from "../pages/manageQueriesPage";
|
||||
import manageSoftwarePage from "../pages/manageSoftwarePage";
|
||||
import teamsDropdown from "../pages/teamsDropdown";
|
||||
import userProfilePage from "../pages/userProfilePage";
|
||||
import dashboardPage from "../pages/dashboardPage";
|
||||
|
||||
const { GOOD_PASSWORD } = CONSTANTS;
|
||||
|
||||
|
|
@ -37,266 +45,92 @@ describe("Premium tier - Maintainer user", () => {
|
|||
});
|
||||
});
|
||||
describe("Dashboard", () => {
|
||||
beforeEach(() => cy.visit("/dashboard"));
|
||||
it("displays cards for all platforms", () => {
|
||||
cy.getAttached(".homepage__wrapper").within(() => {
|
||||
cy.findByText(/all teams/i).should("exist");
|
||||
cy.getAttached(".hosts-summary").should("exist");
|
||||
cy.getAttached(".hosts-status").should("exist");
|
||||
cy.getAttached(".home-software").should("exist");
|
||||
cy.getAttached(".activity-feed").should("exist");
|
||||
});
|
||||
beforeEach(() => dashboardPage.visitsDashboardPage());
|
||||
it("displays cards for all platforms and does not filter host platform", () => {
|
||||
dashboardPage.displaysCards("All");
|
||||
dashboardPage.verifiesFilteredHostByPlatform("none");
|
||||
});
|
||||
it("displays cards for windows only", () => {
|
||||
cy.getAttached(".homepage__platforms").within(() => {
|
||||
cy.getAttached(".Select-control").click();
|
||||
cy.findByText(/windows/i).click();
|
||||
});
|
||||
cy.getAttached(".homepage__wrapper").within(() => {
|
||||
cy.findByText(/all teams/i).should("exist");
|
||||
cy.getAttached(".hosts-summary").should("exist");
|
||||
cy.getAttached(".hosts-status").should("exist");
|
||||
// "get" because we expect it not to exist
|
||||
cy.get(".home-software").should("not.exist");
|
||||
cy.get(".activity-feed").should("not.exist");
|
||||
});
|
||||
it("displays cards for windows only and filters hosts by Windows platform", () => {
|
||||
dashboardPage.switchesPlatform("Windows");
|
||||
dashboardPage.displaysCards("Windows");
|
||||
dashboardPage.verifiesFilteredHostByPlatform("Windows");
|
||||
});
|
||||
it("displays cards for linux only", () => {
|
||||
cy.getAttached(".homepage__platforms").within(() => {
|
||||
cy.getAttached(".Select-control").click();
|
||||
cy.findByText(/linux/i).click();
|
||||
});
|
||||
cy.getAttached(".homepage__wrapper").within(() => {
|
||||
cy.findByText(/all teams/i).should("exist");
|
||||
cy.getAttached(".hosts-summary").should("exist");
|
||||
cy.getAttached(".hosts-status").should("exist");
|
||||
// "get" because we expect it not to exist
|
||||
cy.get(".home-software").should("not.exist");
|
||||
cy.get(".activity-feed").should("not.exist");
|
||||
});
|
||||
it("displays cards for linux only and filters hosts by Linux platform", () => {
|
||||
dashboardPage.switchesPlatform("Linux");
|
||||
dashboardPage.displaysCards("Linux");
|
||||
dashboardPage.verifiesFilteredHostByPlatform("Linux");
|
||||
});
|
||||
it("displays cards for macOS only", () => {
|
||||
cy.getAttached(".homepage__platforms").within(() => {
|
||||
cy.getAttached(".Select-control").click();
|
||||
cy.findByText(/macos/i).click();
|
||||
});
|
||||
cy.getAttached(".homepage__wrapper").within(() => {
|
||||
cy.findByText(/all teams/i).should("exist");
|
||||
cy.getAttached(".hosts-summary").should("exist");
|
||||
cy.getAttached(".hosts-status").should("exist");
|
||||
cy.getAttached(".home-mdm").should("exist");
|
||||
// "get" because we expect it not to exist
|
||||
cy.get(".home-software").should("not.exist");
|
||||
cy.get(".activity-feed").should("not.exist");
|
||||
});
|
||||
});
|
||||
it("views all hosts for all platforms", () => {
|
||||
cy.findByText(/view all hosts/i).click();
|
||||
cy.findByRole("status", { name: /hosts filtered by/i }).should(
|
||||
"not.exist"
|
||||
);
|
||||
});
|
||||
it("views all hosts for windows only", () => {
|
||||
cy.getAttached(".homepage__platforms").within(() => {
|
||||
cy.getAttached(".Select-control").click();
|
||||
cy.findByText(/Windows/i).click();
|
||||
});
|
||||
cy.findByText(/view all hosts/i).click();
|
||||
cy.findByRole("status", { name: /hosts filtered by Windows/i }).should(
|
||||
"exist"
|
||||
);
|
||||
});
|
||||
it("views all hosts for linux only", () => {
|
||||
cy.getAttached(".homepage__platforms").within(() => {
|
||||
cy.getAttached(".Select-control").click();
|
||||
cy.findByText(/linux/i).click();
|
||||
});
|
||||
cy.findByText(/view all hosts/i).click();
|
||||
cy.findByRole("status", { name: /hosts filtered by Linux/i }).should(
|
||||
"exist"
|
||||
);
|
||||
});
|
||||
it("views all hosts for macOS only", () => {
|
||||
cy.get(".homepage__platforms").within(() => {
|
||||
cy.getAttached(".Select-control").click();
|
||||
cy.findByText(/macos/i).click();
|
||||
});
|
||||
cy.findByText(/view all hosts/i).click();
|
||||
cy.findByRole("status", { name: /hosts filtered by macOS/i }).should(
|
||||
"exist"
|
||||
);
|
||||
it("displays cards for macOS only and filters hosts by macOS platform", () => {
|
||||
dashboardPage.switchesPlatform("macOS");
|
||||
dashboardPage.displaysCards("macOS");
|
||||
dashboardPage.verifiesFilteredHostByPlatform("macOS");
|
||||
});
|
||||
});
|
||||
describe("Manage hosts page", () => {
|
||||
it("renders elements according to role-based access controls", () => {
|
||||
cy.visit("/hosts/manage");
|
||||
// Hosts table includes teams column
|
||||
cy.getAttached(".data-table__table th")
|
||||
.contains("Team")
|
||||
.should("be.visible");
|
||||
cy.getAttached(".button-wrap")
|
||||
.contains("button", /add hosts/i)
|
||||
.click();
|
||||
cy.getAttached(".modal__content").contains("button", /done/i).click();
|
||||
|
||||
cy.getAttached(".button-wrap")
|
||||
.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 .modal-cta-wrap")
|
||||
.contains("button", /save/i)
|
||||
.click();
|
||||
cy.getAttached(".enroll-secret-modal .modal-cta-wrap")
|
||||
.contains("button", /done/i)
|
||||
.click();
|
||||
beforeEach(() => manageHostsPage.visitsManageHostsPage());
|
||||
it("renders team elements", () => {
|
||||
manageHostsPage.includesTeamDropdown();
|
||||
manageHostsPage.includesTeamColumn();
|
||||
});
|
||||
it("renders 'Add hosts', 'Add label', and 'Manage enroll secrets' buttons", () => {
|
||||
manageHostsPage.allowsAddLabelForm();
|
||||
manageHostsPage.allowsAddHosts();
|
||||
manageHostsPage.allowsManageAndAddSecrets();
|
||||
});
|
||||
});
|
||||
describe("Host details page", () => {
|
||||
beforeEach(() => {
|
||||
cy.visit("/hosts/manage");
|
||||
cy.getAttached(".hostname__cell").first().click();
|
||||
hostDetailsPage.visitsHostDetailsPage(1);
|
||||
});
|
||||
it("allows global maintainer to transfer host to an existing team", () => {
|
||||
cy.getAttached(".host-details__transfer-button").click();
|
||||
cy.findByText(/create a team/i).should("not.exist");
|
||||
cy.getAttached(".Select-control").click();
|
||||
cy.getAttached(".Select-menu").within(() => {
|
||||
cy.findByText(/no team/i).should("exist");
|
||||
cy.findByText(/apples/i).should("exist");
|
||||
cy.findByText(/oranges/i).click();
|
||||
});
|
||||
cy.getAttached(".transfer-host-modal .modal-cta-wrap")
|
||||
.contains("button", /transfer/i)
|
||||
.click();
|
||||
cy.findByText(/transferred to oranges/i).should("exist");
|
||||
cy.findByText(/team/i).next().contains("Oranges");
|
||||
hostDetailsPage.allowsTransferHost();
|
||||
hostDetailsPage.verifiesTransferredHost();
|
||||
});
|
||||
it("allows global maintainer to create an operating system policy", () => {
|
||||
cy.getAttached(".info-flex").within(() => {
|
||||
cy.findByText(/ubuntu/i).should("exist");
|
||||
cy.getAttached(".host-summary__os-policy-button").click();
|
||||
});
|
||||
cy.getAttached(".modal__content")
|
||||
.findByRole("button", { name: /create new policy/i })
|
||||
.should("exist");
|
||||
hostDetailsPage.allowsCreateOsPolicy();
|
||||
});
|
||||
it("allows global maintainer to create a custom query", () => {
|
||||
cy.getAttached(".host-details__query-button").click();
|
||||
cy.contains("button", /create custom query/i).should("exist");
|
||||
cy.getAttached(".modal__ex").click();
|
||||
it("allows global maintainer to custom query a host", () => {
|
||||
hostDetailsPage.allowsCustomQueryHost();
|
||||
});
|
||||
it("allows global maintainer to delete a host", () => {
|
||||
cy.getAttached(".host-details__action-button-container")
|
||||
.contains("button", /delete/i)
|
||||
.click();
|
||||
cy.getAttached(".delete-host-modal__modal").within(() => {
|
||||
cy.findByText(/delete host/i).should("exist");
|
||||
cy.contains("button", /delete/i).should("exist");
|
||||
cy.getAttached(".modal__ex").click();
|
||||
});
|
||||
hostDetailsPage.allowsDeleteHost();
|
||||
});
|
||||
});
|
||||
describe("Manage software page", () => {
|
||||
beforeEach(() => cy.visit("/software/manage"));
|
||||
beforeEach(() => manageSoftwarePage.visitManageSoftwarePage());
|
||||
it("hides 'Manage automations' button from global maintainer", () => {
|
||||
cy.findByText(/manage automations/i).should("not.exist");
|
||||
manageSoftwarePage.hidesButton("Manage automations");
|
||||
});
|
||||
});
|
||||
describe("Query pages", () => {
|
||||
beforeEach(() => cy.visit("/queries/manage"));
|
||||
beforeEach(() => manageQueriesPage.visitManageQueriesPage());
|
||||
it("allows global maintainer to select teams targets for query", () => {
|
||||
cy.getAttached("tbody").within(() => {
|
||||
cy.getAttached("tr")
|
||||
.first()
|
||||
.within(() => {
|
||||
cy.getAttached(".fleet-checkbox__input").check({ force: true });
|
||||
});
|
||||
cy.findAllByText(/detect presence/i).click();
|
||||
});
|
||||
|
||||
cy.getAttached(".query-form__button-wrap").within(() => {
|
||||
cy.findByRole("button", { name: /run/i }).click();
|
||||
});
|
||||
cy.contains("h3", /teams/i).should("exist");
|
||||
cy.contains(".selector-name", /apples/i).should("exist");
|
||||
manageQueriesPage.allowsSelectTeamTargets();
|
||||
});
|
||||
// TODO: Allowed to delete self-authored query only
|
||||
});
|
||||
describe("Manage policies page", () => {
|
||||
beforeEach(() => cy.visit("/policies/manage"));
|
||||
beforeEach(() => managePoliciesPage.visitManagePoliciesPage());
|
||||
it("hides manage automations button", () => {
|
||||
cy.findByText(/manage hosts/i).should("not.exist");
|
||||
managePoliciesPage.hidesButton("Manage automations");
|
||||
});
|
||||
it("allows global maintainer to add a new policy", () => {
|
||||
cy.getAttached(".policies-table__action-button-container")
|
||||
.findByRole("button", { name: /add a policy/i })
|
||||
.click();
|
||||
// Add a default policy
|
||||
cy.findByText(/gatekeeper enabled/i).click();
|
||||
cy.getAttached(".policy-form__button-wrap").within(() => {
|
||||
cy.findByRole("button", { name: /run/i }).should("exist");
|
||||
cy.findByRole("button", { name: /save/i }).click();
|
||||
});
|
||||
cy.getAttached(".modal-cta-wrap").within(() => {
|
||||
cy.findByRole("button", { name: /save policy/i }).click();
|
||||
});
|
||||
cy.findByText(/policy created/i).should("exist");
|
||||
managePoliciesPage.allowsAddDefaultPolicy();
|
||||
managePoliciesPage.verifiesAddedDefaultPolicy();
|
||||
});
|
||||
it("allows global maintainer to delete a team policy", () => {
|
||||
cy.visit("/policies/manage");
|
||||
cy.getAttached(".Select-control").within(() => {
|
||||
cy.findByText(/all teams/i).click();
|
||||
});
|
||||
cy.getAttached(".Select-menu")
|
||||
.contains(/apples/i)
|
||||
.click();
|
||||
cy.getAttached("tbody").within(() => {
|
||||
cy.getAttached("tr")
|
||||
.first()
|
||||
.within(() => {
|
||||
cy.getAttached(".fleet-checkbox__input").check({
|
||||
force: true,
|
||||
});
|
||||
});
|
||||
});
|
||||
cy.findByRole("button", { name: /delete/i }).click();
|
||||
cy.getAttached(".delete-policy-modal").within(() => {
|
||||
cy.findByRole("button", { name: /delete/i }).should("exist");
|
||||
cy.findByRole("button", { name: /cancel/i }).click();
|
||||
});
|
||||
teamsDropdown.switchTeams("All teams", "Apples");
|
||||
managePoliciesPage.allowsDeletePolicy();
|
||||
});
|
||||
it("allows global maintainer to edit a team policy", () => {
|
||||
cy.visit("policies/manage");
|
||||
cy.findByText(/all teams/i).click();
|
||||
cy.findByText(/apples/i).click();
|
||||
cy.getAttached("tbody").within(() => {
|
||||
cy.getAttached("tr")
|
||||
.first()
|
||||
.within(() => {
|
||||
cy.getAttached(".fleet-checkbox__input").check({
|
||||
force: true,
|
||||
});
|
||||
});
|
||||
});
|
||||
cy.findByText(/filevault enabled/i).click();
|
||||
cy.getAttached(".policy-form__button-wrap").within(() => {
|
||||
cy.findByRole("button", { name: /run/i }).should("exist");
|
||||
cy.findByRole("button", { name: /save/i }).should("exist");
|
||||
});
|
||||
teamsDropdown.switchTeams("All teams", "Apples");
|
||||
managePoliciesPage.allowsSelectRunSavePolicy("filevault");
|
||||
});
|
||||
});
|
||||
describe("User profile page", () => {
|
||||
it("renders elements according to role-based access controls", () => {
|
||||
cy.visit("/profile");
|
||||
cy.getAttached(".user-side-panel").within(() => {
|
||||
cy.findByText(/team/i)
|
||||
.next()
|
||||
.contains(/global/i);
|
||||
cy.findByText("Role")
|
||||
.next()
|
||||
.contains(/maintainer/i);
|
||||
});
|
||||
it("verifies user role and global access", () => {
|
||||
userProfilePage.visitUserProfilePage();
|
||||
userProfilePage.showRole("Maintainer", "Global");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,4 +1,14 @@
|
|||
import CONSTANTS from "../../support/constants";
|
||||
import dashboardPage from "../pages/dashboardPage";
|
||||
import hostDetailsPage from "../pages/hostDetailsPage";
|
||||
import manageHostsPage from "../pages/manageHostsPage";
|
||||
import managePacksPage from "../pages/managePacksPage";
|
||||
import managePoliciesPage from "../pages/managePoliciesPage";
|
||||
import manageQueriesPage from "../pages/manageQueriesPage";
|
||||
import manageSchedulePage from "../pages/manageSchedulePage";
|
||||
import manageSoftwarePage from "../pages/manageSoftwarePage";
|
||||
import teamsDropdown from "../pages/teamsDropdown";
|
||||
import userProfilePage from "../pages/userProfilePage";
|
||||
|
||||
const { GOOD_PASSWORD } = CONSTANTS;
|
||||
|
||||
|
|
@ -38,202 +48,76 @@ describe("Premium tier - Observer user", () => {
|
|||
});
|
||||
});
|
||||
describe("Dashboard", () => {
|
||||
beforeEach(() => cy.visit("/dashboard"));
|
||||
it("displays cards for all platforms", () => {
|
||||
cy.getAttached(".homepage__wrapper").within(() => {
|
||||
cy.findByText(/all teams/i).should("exist");
|
||||
cy.getAttached(".hosts-summary").should("exist");
|
||||
cy.getAttached(".hosts-status").should("exist");
|
||||
cy.getAttached(".home-software").should("exist");
|
||||
cy.getAttached(".activity-feed").should("exist");
|
||||
});
|
||||
beforeEach(() => dashboardPage.visitsDashboardPage());
|
||||
it("displays cards for all platforms and does not filter host platform", () => {
|
||||
dashboardPage.displaysCards("All");
|
||||
dashboardPage.verifiesFilteredHostByPlatform("none");
|
||||
});
|
||||
it("displays cards for windows only", () => {
|
||||
cy.getAttached(".homepage__platforms").within(() => {
|
||||
cy.getAttached(".Select-control").click();
|
||||
cy.findByText(/windows/i).click();
|
||||
});
|
||||
cy.getAttached(".homepage__wrapper").within(() => {
|
||||
cy.findByText(/all teams/i).should("exist");
|
||||
cy.getAttached(".hosts-summary").should("exist");
|
||||
cy.getAttached(".hosts-status").should("exist");
|
||||
// "get" because we expect it not to exist
|
||||
cy.get(".home-software").should("not.exist");
|
||||
cy.get(".activity-feed").should("not.exist");
|
||||
});
|
||||
it("displays cards for windows only and filters hosts by Windows platform", () => {
|
||||
dashboardPage.switchesPlatform("Windows");
|
||||
dashboardPage.displaysCards("Windows");
|
||||
dashboardPage.verifiesFilteredHostByPlatform("Windows");
|
||||
});
|
||||
it("displays cards for linux only", () => {
|
||||
cy.getAttached(".homepage__platforms").within(() => {
|
||||
cy.getAttached(".Select-control").click();
|
||||
cy.findByText(/linux/i).click();
|
||||
});
|
||||
cy.getAttached(".homepage__wrapper").within(() => {
|
||||
cy.findByText(/all teams/i).should("exist");
|
||||
cy.getAttached(".hosts-summary").should("exist");
|
||||
cy.getAttached(".hosts-status").should("exist");
|
||||
// "get" because we expect it not to exist
|
||||
cy.get(".home-software").should("not.exist");
|
||||
cy.get(".activity-feed").should("not.exist");
|
||||
});
|
||||
it("displays cards for linux only and filters hosts by Linux platform", () => {
|
||||
dashboardPage.switchesPlatform("Linux");
|
||||
dashboardPage.displaysCards("Linux");
|
||||
dashboardPage.verifiesFilteredHostByPlatform("Linux");
|
||||
});
|
||||
it("displays cards for macOS only", () => {
|
||||
cy.getAttached(".homepage__platforms").within(() => {
|
||||
cy.getAttached(".Select-control").click();
|
||||
cy.findByText(/macos/i).click();
|
||||
});
|
||||
cy.getAttached(".homepage__wrapper").within(() => {
|
||||
cy.findByText(/all teams/i).should("exist");
|
||||
cy.getAttached(".hosts-summary").should("exist");
|
||||
cy.getAttached(".hosts-status").should("exist");
|
||||
cy.getAttached(".home-mdm").should("exist");
|
||||
// "get" because we expect it not to exist
|
||||
cy.get(".home-software").should("not.exist");
|
||||
cy.get(".activity-feed").should("not.exist");
|
||||
});
|
||||
});
|
||||
it("views all hosts for all platforms", () => {
|
||||
cy.findByText(/view all hosts/i).click();
|
||||
cy.findByRole("status", { name: /hosts filtered by/i }).should(
|
||||
"not.exist"
|
||||
);
|
||||
});
|
||||
it("views all hosts for windows only", () => {
|
||||
cy.getAttached(".homepage__platforms").within(() => {
|
||||
cy.getAttached(".Select-control").click();
|
||||
cy.findByText(/windows/i).click();
|
||||
});
|
||||
cy.findByText(/view all hosts/i).click();
|
||||
cy.findByRole("status", { name: /hosts filtered by Windows/i }).should(
|
||||
"exist"
|
||||
);
|
||||
});
|
||||
it("views all hosts for linux only", () => {
|
||||
cy.getAttached(".homepage__platforms").within(() => {
|
||||
cy.getAttached(".Select-control").click();
|
||||
cy.findByText(/linux/i).click();
|
||||
});
|
||||
cy.findByText(/view all hosts/i).click();
|
||||
cy.findByRole("status", { name: /hosts filtered by Linux/i }).should(
|
||||
"exist"
|
||||
);
|
||||
});
|
||||
it("views all hosts for macOS only", () => {
|
||||
cy.getAttached(".homepage__platforms").within(() => {
|
||||
cy.getAttached(".Select-control").click();
|
||||
cy.findByText(/macos/i).click();
|
||||
});
|
||||
cy.findByText(/view all hosts/i).click();
|
||||
cy.findByRole("status", { name: /hosts filtered by macOS/i }).should(
|
||||
"exist"
|
||||
);
|
||||
it("displays cards for macOS only and filters hosts by macOS platform", () => {
|
||||
dashboardPage.switchesPlatform("macOS");
|
||||
dashboardPage.displaysCards("macOS");
|
||||
dashboardPage.verifiesFilteredHostByPlatform("macOS");
|
||||
});
|
||||
});
|
||||
describe("Manage hosts page", () => {
|
||||
beforeEach(() => cy.visit("/hosts/manage"));
|
||||
it("should render elements according to role-based access controls", () => {
|
||||
// Ensure page is loaded with teams dropdown
|
||||
cy.getAttached(".Select-value-label").contains("All teams");
|
||||
// Not see the "Manage enroll secret” or "Add hosts" button
|
||||
cy.contains("button", /manage enroll secret/i).should("not.exist");
|
||||
cy.contains("button", /add hosts/i).should("not.exist");
|
||||
// Hosts table includes teams column
|
||||
cy.getAttached("thead").within(() => {
|
||||
cy.findByText(/team/i).should("exist");
|
||||
});
|
||||
beforeEach(() => manageHostsPage.visitsManageHostsPage());
|
||||
it("renders team elements", () => {
|
||||
manageHostsPage.includesTeamDropdown();
|
||||
manageHostsPage.includesTeamColumn();
|
||||
});
|
||||
it("hides 'Add hosts', 'Add label', and 'Manage enroll secrets' buttons", () => {
|
||||
manageHostsPage.hidesButton("Add label");
|
||||
manageHostsPage.hidesButton("Add hosts");
|
||||
manageHostsPage.hidesButton("Manage enroll secret");
|
||||
});
|
||||
});
|
||||
describe("Host details page", () => {
|
||||
beforeEach(() => cy.visit("/hosts/manage"));
|
||||
beforeEach(() => hostDetailsPage.visitsHostDetailsPage(1));
|
||||
it("should render elements according to role-based access controls", () => {
|
||||
// Navigate to host details page for first host
|
||||
cy.getAttached(".hostname__cell").first().click();
|
||||
|
||||
// Click query button and confirm observer cannot create custom query
|
||||
cy.getAttached(".host-details__query-button").click();
|
||||
cy.contains("button", /create custom query/i).should("not.exist");
|
||||
cy.getAttached(".modal__ex").click();
|
||||
|
||||
// Confirm other actions are not available to observer
|
||||
cy.getAttached(".host-details__action-button-container").within(() => {
|
||||
cy.contains("button", /transfer/i).should("not.exist");
|
||||
cy.contains("button", /delete/i).should("not.exist");
|
||||
});
|
||||
|
||||
// Confirm additional host details for observer
|
||||
cy.getAttached(".info-flex").within(() => {
|
||||
// Team is shown for host
|
||||
cy.findByText(/apples/i).should("exist");
|
||||
// OS is shown for host
|
||||
cy.findByText(/ubuntu/i).should("exist");
|
||||
// Observer cannot create a new OS policy
|
||||
cy.findByRole("button").should("not.exist");
|
||||
});
|
||||
hostDetailsPage.verifiesTeam("Apples");
|
||||
hostDetailsPage.hidesButton("Transfer");
|
||||
hostDetailsPage.hidesButton("Delete");
|
||||
hostDetailsPage.hidesCustomQueryHost();
|
||||
hostDetailsPage.hidesCreateOSPolicy();
|
||||
});
|
||||
});
|
||||
describe("Manage software page", () => {
|
||||
beforeEach(() => cy.visit("/software/manage"));
|
||||
beforeEach(() => manageSoftwarePage.visitManageSoftwarePage());
|
||||
it("hides manage automations button", () => {
|
||||
cy.getAttached(".manage-software-page__header-wrap").within(() => {
|
||||
cy.findByRole("button", { name: /manage automations/i }).should(
|
||||
"not.exist"
|
||||
);
|
||||
});
|
||||
manageSoftwarePage.hidesButton("Manage automations");
|
||||
});
|
||||
});
|
||||
describe("Query pages", () => {
|
||||
beforeEach(() => cy.visit("/queries/manage"));
|
||||
it("should render elements according to role-based access controls", () => {
|
||||
// Navigate to query detail page for first query on manage queries page
|
||||
cy.getAttached("tbody").within(() => {
|
||||
cy.getAttached("tr")
|
||||
.first()
|
||||
.within(() => {
|
||||
cy.contains(".fleet-checkbox__input").should("not.exist");
|
||||
cy.findByText(/detect presence/i).click();
|
||||
});
|
||||
});
|
||||
cy.getAttached(".query-form__button-wrap").within(() => {
|
||||
cy.findByRole("button", { name: /run/i }).click();
|
||||
});
|
||||
cy.contains("h3", /teams/i).should("exist");
|
||||
cy.contains(".selector-name", /apples/i).should("exist");
|
||||
beforeEach(() => manageQueriesPage.visitManageQueriesPage());
|
||||
it("allows global observer to select teams targets for query", () => {
|
||||
manageQueriesPage.allowsSelectTeamTargets();
|
||||
});
|
||||
});
|
||||
describe("Policies pages", () => {
|
||||
beforeEach(() => cy.visit("/policies/manage"));
|
||||
beforeEach(() => managePoliciesPage.visitManagePoliciesPage());
|
||||
it("should render elements according to role-based access controls", () => {
|
||||
// No global policies seeded, placeholder displayed
|
||||
cy.findByText(/ask yes or no questions/i).should("exist");
|
||||
cy.findByText(/all your hosts/i).should("exist");
|
||||
|
||||
// Cannot see "Manage automations" button
|
||||
cy.findByRole("button", { name: /manage automations/i }).should(
|
||||
"not.exist"
|
||||
);
|
||||
// Cannot see "Add a policy" button
|
||||
cy.findByRole("button", { name: /add a policy/i }).should("not.exist");
|
||||
managePoliciesPage.hidesButton("Manage automations");
|
||||
managePoliciesPage.hidesButton("Add a policy");
|
||||
|
||||
// Switch to team policies
|
||||
cy.getAttached(".Select-control").within(() => {
|
||||
cy.findByText(/all teams/i).click();
|
||||
});
|
||||
cy.getAttached(".Select-menu")
|
||||
.contains(/apples/i)
|
||||
.click();
|
||||
cy.findByRole("button", { name: /add a policy/i }).should("not.exist");
|
||||
teamsDropdown.switchTeams("All teams", "Apples");
|
||||
managePoliciesPage.hidesButton("Manage automations");
|
||||
managePoliciesPage.hidesButton("Add a policy");
|
||||
|
||||
cy.getAttached("tbody").within(() => {
|
||||
cy.getAttached("tr")
|
||||
.first()
|
||||
.within(() => {
|
||||
cy.contains(".fleet-checkbox__input").should("not.exist");
|
||||
cy.findByText(/filevault enabled/i).click();
|
||||
});
|
||||
});
|
||||
cy.getAttached(".policy-form__wrapper").within(() => {
|
||||
cy.findByRole("button", { name: /run/i }).should("not.exist");
|
||||
cy.findByRole("button", { name: /save/i }).should("not.exist");
|
||||
});
|
||||
managePoliciesPage.allowsViewPolicyOnly();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
@ -254,61 +138,38 @@ describe("Premium tier - Observer user", () => {
|
|||
cy.findByText(/schedule/i).should("not.exist");
|
||||
cy.visit("/settings/organization");
|
||||
cy.findByText(/you do not have permissions/i).should("exist");
|
||||
cy.visit("/packs/manage");
|
||||
managePacksPage.visitsManagePacksPage();
|
||||
cy.findByText(/you do not have permissions/i).should("exist");
|
||||
cy.visit("/schedule/manage");
|
||||
manageSchedulePage.visitManageSchedulePage();
|
||||
cy.findByText(/you do not have permissions/i).should("exist");
|
||||
});
|
||||
});
|
||||
describe("Manage hosts page", () => {
|
||||
it("should render elements according to role-based access controls", () => {
|
||||
cy.visit("/hosts/manage");
|
||||
// Hosts table includes teams column
|
||||
cy.getAttached(".data-table__table th")
|
||||
.contains("Team")
|
||||
.should("be.visible");
|
||||
manageHostsPage.visitsManageHostsPage();
|
||||
manageHostsPage.includesTeamColumn();
|
||||
manageHostsPage.hidesButton("Add hosts");
|
||||
manageHostsPage.hidesButton("Manage enroll secret");
|
||||
manageHostsPage.hidesButton("Add label");
|
||||
});
|
||||
});
|
||||
describe("Manage policies page", () => {
|
||||
it("should render elements according to role-based access controls", () => {
|
||||
cy.visit("/policies/manage");
|
||||
cy.findByRole("button", { name: /add a policy/i }).should("not.exist");
|
||||
it("hides 'Add a policy'", () => {
|
||||
managePoliciesPage.visitManagePoliciesPage();
|
||||
managePoliciesPage.hidesButton("Add a policy");
|
||||
cy.findByText(/all teams/i).should("not.exist");
|
||||
});
|
||||
});
|
||||
describe("Policy detail page", () => {
|
||||
it("should render elements according to role-based access controls", () => {
|
||||
cy.visit("/policies/manage");
|
||||
// Navigate to policy detail page for first policy in manage policies table
|
||||
cy.getAttached("tbody").within(() => {
|
||||
cy.getAttached("tr")
|
||||
.first()
|
||||
.within(() => {
|
||||
cy.contains(".fleet-checkbox__input").should("not.exist");
|
||||
});
|
||||
});
|
||||
cy.getAttached(".data-table__table").within(() => {
|
||||
cy.findByRole("button", {
|
||||
name: /filevault enabled/i,
|
||||
}).click();
|
||||
});
|
||||
cy.getAttached(".policy-form__wrapper").within(() => {
|
||||
cy.findByRole("button", { name: /run/i }).should("not.exist");
|
||||
cy.findByRole("button", { name: /save/i }).should("not.exist");
|
||||
});
|
||||
it("allows viewing policies only", () => {
|
||||
managePoliciesPage.visitManagePoliciesPage();
|
||||
managePoliciesPage.allowsViewPolicyOnly();
|
||||
});
|
||||
});
|
||||
describe("User profile page", () => {
|
||||
it("should render elements according to role-based access controls", () => {
|
||||
cy.visit("/profile");
|
||||
cy.getAttached(".user-side-panel").within(() => {
|
||||
cy.findByText(/team/i)
|
||||
.next()
|
||||
.contains(/apples/i);
|
||||
cy.findByText("Role")
|
||||
.next()
|
||||
.contains(/observer/i);
|
||||
});
|
||||
it("verifies observer role and team", () => {
|
||||
userProfilePage.visitUserProfilePage();
|
||||
userProfilePage.showRole("Observer", "Apples");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,4 +1,12 @@
|
|||
import CONSTANTS from "../../support/constants";
|
||||
import dashboardPage from "../pages/dashboardPage";
|
||||
import hostDetailsPage from "../pages/hostDetailsPage";
|
||||
import manageHostsPage from "../pages/manageHostsPage";
|
||||
import managePoliciesPage from "../pages/managePoliciesPage";
|
||||
import manageQueriesPage from "../pages/manageQueriesPage";
|
||||
import manageSchedulePage from "../pages/manageSchedulePage";
|
||||
import manageSoftwarePage from "../pages/manageSoftwarePage";
|
||||
import userProfilePage from "../pages/userProfilePage";
|
||||
|
||||
const { GOOD_PASSWORD } = CONSTANTS;
|
||||
|
||||
|
|
@ -44,174 +52,58 @@ describe("Premium tier - Team Admin user", () => {
|
|||
});
|
||||
describe("Dashboard", () => {
|
||||
beforeEach(() => cy.visit("/dashboard"));
|
||||
it("displays cards for all platforms", () => {
|
||||
cy.getAttached(".homepage__wrapper").within(() => {
|
||||
cy.findByText(/apples/i).should("exist");
|
||||
cy.getAttached(".hosts-summary").should("exist");
|
||||
cy.getAttached(".hosts-status").should("exist");
|
||||
cy.getAttached(".home-software").should("exist");
|
||||
cy.get(".activity-feed").should("not.exist");
|
||||
});
|
||||
it("displays cards for team only, no activity card, and does not filter host platform", () => {
|
||||
dashboardPage.displaysCards();
|
||||
dashboardPage.verifiesFilteredHostByPlatform("none");
|
||||
});
|
||||
it("displays cards for windows only", () => {
|
||||
cy.getAttached(".homepage__platforms").within(() => {
|
||||
cy.getAttached(".Select-control").click();
|
||||
cy.findByText(/windows/i).click();
|
||||
});
|
||||
cy.getAttached(".homepage__wrapper").within(() => {
|
||||
cy.findByText(/apples/i).should("exist");
|
||||
cy.getAttached(".hosts-summary").should("exist");
|
||||
cy.getAttached(".hosts-status").should("exist");
|
||||
// "get" because we expect it not to exist
|
||||
cy.get(".home-software").should("not.exist");
|
||||
cy.get(".activity-feed").should("not.exist");
|
||||
});
|
||||
it("displays cards for windows only and filters hosts by Windows platform", () => {
|
||||
dashboardPage.switchesPlatform("Windows");
|
||||
dashboardPage.displaysCards("Windows");
|
||||
dashboardPage.verifiesFilteredHostByPlatform("Windows");
|
||||
});
|
||||
it("displays cards for linux only", () => {
|
||||
cy.getAttached(".homepage__platforms").within(() => {
|
||||
cy.getAttached(".Select-control").click();
|
||||
cy.findByText(/linux/i).click();
|
||||
});
|
||||
cy.getAttached(".homepage__wrapper").within(() => {
|
||||
cy.findByText(/apples/i).should("exist");
|
||||
cy.getAttached(".hosts-summary").should("exist");
|
||||
cy.getAttached(".hosts-status").should("exist");
|
||||
// "get" because we expect it not to exist
|
||||
cy.get(".home-software").should("not.exist");
|
||||
cy.get(".activity-feed").should("not.exist");
|
||||
});
|
||||
it("displays cards for linux only and filters hosts by Linux platform", () => {
|
||||
dashboardPage.switchesPlatform("Linux");
|
||||
dashboardPage.displaysCards("Linux");
|
||||
dashboardPage.verifiesFilteredHostByPlatform("Linux");
|
||||
});
|
||||
it("displays cards for macOS only", () => {
|
||||
cy.getAttached(".homepage__platforms").within(() => {
|
||||
cy.getAttached(".Select-control").click();
|
||||
cy.findByText(/macos/i).click();
|
||||
});
|
||||
cy.getAttached(".homepage__wrapper").within(() => {
|
||||
cy.findByText(/apples/i).should("exist");
|
||||
cy.getAttached(".hosts-summary").should("exist");
|
||||
cy.getAttached(".hosts-status").should("exist");
|
||||
cy.getAttached(".home-mdm").should("exist");
|
||||
// "get" because we expect it not to exist
|
||||
cy.get(".home-software").should("not.exist");
|
||||
cy.get(".activity-feed").should("not.exist");
|
||||
});
|
||||
});
|
||||
it("views all hosts for all platforms", () => {
|
||||
cy.findByText(/view all hosts/i).click();
|
||||
cy.findByRole("status", { name: /hosts filtered by/i }).should(
|
||||
"not.exist"
|
||||
);
|
||||
});
|
||||
it("views all hosts for windows only", () => {
|
||||
cy.getAttached(".homepage__platforms").within(() => {
|
||||
cy.getAttached(".Select-control").click();
|
||||
cy.findByText(/windows/i).click();
|
||||
});
|
||||
cy.findByText(/view all hosts/i).click();
|
||||
cy.findByRole("status", { name: /hosts filtered by Windows/i }).should(
|
||||
"exist"
|
||||
);
|
||||
});
|
||||
it("views all hosts for linux only", () => {
|
||||
cy.getAttached(".homepage__platforms").within(() => {
|
||||
cy.getAttached(".Select-control").click();
|
||||
cy.findByText(/linux/i).click();
|
||||
});
|
||||
cy.findByText(/view all hosts/i).click();
|
||||
cy.findByRole("status", { name: /hosts filtered by Linux/i }).should(
|
||||
"exist"
|
||||
);
|
||||
});
|
||||
it("views all hosts for macOS only", () => {
|
||||
cy.getAttached(".homepage__platforms").within(() => {
|
||||
cy.getAttached(".Select-control").click();
|
||||
cy.findByText(/macos/i).click();
|
||||
});
|
||||
cy.findByText(/view all hosts/i).click();
|
||||
cy.findByRole("status", { name: /hosts filtered by macOS/i }).should(
|
||||
"exist"
|
||||
);
|
||||
it("displays cards for macOS only and filters hosts by macOS platform", () => {
|
||||
dashboardPage.switchesPlatform("macOS");
|
||||
dashboardPage.displaysCards("macOS");
|
||||
dashboardPage.verifiesFilteredHostByPlatform("macOS");
|
||||
});
|
||||
});
|
||||
describe("Manage hosts page", () => {
|
||||
beforeEach(() => {
|
||||
cy.visit("/hosts/manage");
|
||||
manageHostsPage.visitsManageHostsPage();
|
||||
});
|
||||
it("displays team column in hosts table", () => {
|
||||
cy.getAttached(".data-table__table th")
|
||||
.contains("Team")
|
||||
.should("be.visible");
|
||||
});
|
||||
it("allows team admin to see and click 'Add hosts'", () => {
|
||||
cy.getAttached(".button-wrap")
|
||||
.contains("button", /add hosts/i)
|
||||
.click();
|
||||
cy.getAttached(".modal__content").contains("button", /done/i).click();
|
||||
});
|
||||
it("allows team admin to add new enroll secret", () => {
|
||||
cy.getAttached(".button-wrap")
|
||||
.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 .modal-cta-wrap")
|
||||
.contains("button", /save/i)
|
||||
.click();
|
||||
cy.getAttached(".enroll-secret-modal .modal-cta-wrap")
|
||||
.contains("button", /done/i)
|
||||
.click();
|
||||
it("should render elements according to role-based access controls", () => {
|
||||
manageHostsPage.includesTeamColumn();
|
||||
manageHostsPage.allowsAddHosts();
|
||||
manageHostsPage.allowsManageAndAddSecrets();
|
||||
});
|
||||
});
|
||||
describe("Host details page", () => {
|
||||
beforeEach(() => cy.visit("hosts/1"));
|
||||
beforeEach(() => hostDetailsPage.visitsHostDetailsPage(1));
|
||||
it("allows team admin to create an operating system policy", () => {
|
||||
cy.getAttached(".info-flex").within(() => {
|
||||
cy.findByText(/ubuntu/i).should("exist");
|
||||
cy.getAttached(".host-summary__os-policy-button").click();
|
||||
});
|
||||
cy.getAttached(".modal__content")
|
||||
.findByRole("button", { name: /create new policy/i })
|
||||
.should("exist");
|
||||
hostDetailsPage.allowsCreateOsPolicy();
|
||||
});
|
||||
it("allows team admin to query host but not transfer host", () => {
|
||||
cy.getAttached(".host-details__query-button").should("exist");
|
||||
cy.findByText(/transfer/i).should("not.exist");
|
||||
});
|
||||
it("allows team admin to delete a host", () => {
|
||||
cy.getAttached(".host-details__action-button-container")
|
||||
.contains("button", /delete/i)
|
||||
.click();
|
||||
cy.getAttached(".delete-host-modal__modal").within(() => {
|
||||
cy.findByText(/delete host/i).should("exist");
|
||||
cy.contains("button", /delete/i).should("exist");
|
||||
cy.getAttached(".modal__ex").click();
|
||||
});
|
||||
it("allows team admin to query host, delete host but not transfer host", () => {
|
||||
hostDetailsPage.allowsCustomQueryHost();
|
||||
hostDetailsPage.allowsDeleteHost();
|
||||
hostDetailsPage.verifiesDeletedHost;
|
||||
hostDetailsPage.hidesButton("Transfer");
|
||||
});
|
||||
});
|
||||
describe("Manage software page", () => {
|
||||
beforeEach(() => cy.visit("/software/manage"));
|
||||
beforeEach(() => manageSoftwarePage.visitManageSoftwarePage());
|
||||
it("hides manage automations button", () => {
|
||||
cy.findByText(/manage automations/i).should("not.exist");
|
||||
manageSoftwarePage.hidesButton("Manage automations");
|
||||
});
|
||||
});
|
||||
describe("Query pages", () => {
|
||||
beforeEach(() => cy.visit("/queries/manage"));
|
||||
beforeEach(() => manageQueriesPage.visitManageQueriesPage());
|
||||
it("allows team admin to select teams targets for query", () => {
|
||||
cy.getAttached("tbody").within(() => {
|
||||
cy.getAttached("tr")
|
||||
.first()
|
||||
.within(() => {
|
||||
cy.getAttached(".fleet-checkbox__input").check({ force: true });
|
||||
});
|
||||
cy.findAllByText(/detect presence/i).click();
|
||||
});
|
||||
|
||||
cy.getAttached(".query-form__button-wrap").within(() => {
|
||||
cy.findByRole("button", { name: /run/i }).click();
|
||||
});
|
||||
cy.contains("h3", /teams/i).should("exist");
|
||||
cy.contains(".selector-name", /apples/i).should("exist");
|
||||
manageQueriesPage.allowsSelectTeamTargets();
|
||||
});
|
||||
it("disables team admin from deleting or editing a query not authored by them", () => {
|
||||
cy.getAttached("tbody").within(() => {
|
||||
|
|
@ -227,129 +119,41 @@ describe("Premium tier - Team Admin user", () => {
|
|||
});
|
||||
describe("Manage schedules page", () => {
|
||||
beforeEach(() => {
|
||||
cy.visit("/schedule/manage");
|
||||
manageSchedulePage.visitManageSchedulePage();
|
||||
});
|
||||
it("hides advanced button when team admin", () => {
|
||||
cy.getAttached(".manage-schedule-page__header-wrap").within(() => {
|
||||
cy.findByText(/apples/i).should("exist");
|
||||
});
|
||||
cy.findByText(/advanced/i).should("not.exist");
|
||||
manageSchedulePage.confirmsTeam("Apples");
|
||||
manageSchedulePage.hidesButton("Advanced");
|
||||
});
|
||||
it("creates a new team scheduled query", () => {
|
||||
cy.getAttached(".no-schedule__cta-buttons").should("exist");
|
||||
cy.getAttached(".no-schedule__schedule-button").click();
|
||||
cy.getAttached(".schedule-editor-modal__form").within(() => {
|
||||
cy.findByText(/select query/i).click();
|
||||
cy.findByText(/detect presence/i).click();
|
||||
cy.getAttached(".modal-cta-wrap").within(() => {
|
||||
cy.findByRole("button", { name: /schedule/i }).click();
|
||||
});
|
||||
});
|
||||
cy.findByText(/successfully added/i).should("be.visible");
|
||||
manageSchedulePage.allowsAddSchedule();
|
||||
manageSchedulePage.verifiesAddedSchedule();
|
||||
});
|
||||
it("edit a team's scheduled query successfully", () => {
|
||||
cy.getAttached(".manage-schedule-page");
|
||||
cy.getAttached("tbody>tr")
|
||||
.should("have.length", 1)
|
||||
.within(() => {
|
||||
cy.findByText(/action/i).click();
|
||||
cy.findByText(/edit/i).click();
|
||||
});
|
||||
cy.getAttached(".schedule-editor-modal__form").within(() => {
|
||||
cy.findByText(/every day/i).click();
|
||||
cy.findByText(/every 6 hours/i).click();
|
||||
|
||||
cy.getAttached(".modal-cta-wrap").within(() => {
|
||||
cy.findByRole("button", { name: /schedule/i }).click();
|
||||
});
|
||||
});
|
||||
cy.findByText(/successfully updated/i).should("be.visible");
|
||||
manageSchedulePage.allowsEditSchedule();
|
||||
manageSchedulePage.verifiesEditedSchedule();
|
||||
});
|
||||
it("remove a team's scheduled query successfully", () => {
|
||||
cy.getAttached(".manage-schedule-page");
|
||||
cy.getAttached("tbody>tr")
|
||||
.should("have.length", 1)
|
||||
.within(() => {
|
||||
cy.findByText(/6 hours/i).should("exist");
|
||||
cy.getAttached(".Select-placeholder").within(() => {
|
||||
cy.findByText(/action/i).click();
|
||||
});
|
||||
cy.getAttached(".Select-menu").within(() => {
|
||||
cy.findByText(/remove/i).click();
|
||||
});
|
||||
});
|
||||
cy.getAttached(".remove-scheduled-query-modal .modal-cta-wrap").within(
|
||||
() => {
|
||||
cy.findByRole("button", { name: /remove/i }).click();
|
||||
}
|
||||
);
|
||||
cy.findByText(/successfully removed/i).should("be.visible");
|
||||
manageSchedulePage.allowsRemoveSchedule();
|
||||
manageSchedulePage.verifiesRemovedSchedule();
|
||||
});
|
||||
});
|
||||
describe("Manage policies page", () => {
|
||||
beforeEach(() => cy.visit("/policies/manage"));
|
||||
beforeEach(() => managePoliciesPage.visitManagePoliciesPage());
|
||||
it("allows team admin to add a new policy", () => {
|
||||
cy.getAttached(".button-wrap")
|
||||
.findByRole("button", { name: /add a policy/i })
|
||||
.click();
|
||||
// Add a default policy
|
||||
cy.findByText(/gatekeeper enabled/i).click();
|
||||
cy.getAttached(".policy-form__button-wrap").within(() => {
|
||||
cy.findByRole("button", { name: /run/i }).should("exist");
|
||||
cy.findByRole("button", { name: /save/i }).click();
|
||||
});
|
||||
cy.getAttached(".modal-cta-wrap").within(() => {
|
||||
cy.findByRole("button", { name: /save policy/i }).click();
|
||||
});
|
||||
cy.findByText(/policy created/i).should("exist");
|
||||
managePoliciesPage.allowsAddDefaultPolicy();
|
||||
managePoliciesPage.verifiesAddedDefaultPolicy();
|
||||
});
|
||||
it("allows team admin to edit a team policy", () => {
|
||||
cy.visit("policies/manage");
|
||||
cy.getAttached("tbody").within(() => {
|
||||
cy.getAttached("tr")
|
||||
.first()
|
||||
.within(() => {
|
||||
cy.getAttached(".fleet-checkbox__input").check({
|
||||
force: true,
|
||||
});
|
||||
});
|
||||
});
|
||||
cy.findByText(/filevault enabled/i).click();
|
||||
cy.getAttached(".policy-form__button-wrap").within(() => {
|
||||
cy.findByRole("button", { name: /run/i }).should("exist");
|
||||
cy.findByRole("button", { name: /save/i }).should("exist");
|
||||
});
|
||||
managePoliciesPage.visitManagePoliciesPage();
|
||||
managePoliciesPage.allowsSelectRunSavePolicy();
|
||||
});
|
||||
it("allows team admin to automate a team policy", () => {
|
||||
cy.getAttached(".button-wrap")
|
||||
.findByRole("button", { name: /manage automations/i })
|
||||
.click();
|
||||
cy.getAttached(".manage-automations-modal").within(() => {
|
||||
cy.getAttached(".fleet-slider").click();
|
||||
cy.getAttached(".fleet-checkbox__input").check({ force: true });
|
||||
cy.getAttached("#webhook-url")
|
||||
.clear()
|
||||
.type("https://example.com/team_admin");
|
||||
cy.findByText(/save/i).click();
|
||||
});
|
||||
cy.findByText(/successfully updated policy automations/i).should("exist");
|
||||
managePoliciesPage.allowsAutomatePolicy();
|
||||
managePoliciesPage.verifiesAutomatedPolicy();
|
||||
});
|
||||
it("allows team admin to delete a team policy", () => {
|
||||
cy.visit("/policies/manage");
|
||||
cy.getAttached("tbody").within(() => {
|
||||
cy.getAttached("tr")
|
||||
.first()
|
||||
.within(() => {
|
||||
cy.getAttached(".fleet-checkbox__input").check({
|
||||
force: true,
|
||||
});
|
||||
});
|
||||
});
|
||||
cy.findByRole("button", { name: /delete/i }).click();
|
||||
cy.getAttached(".delete-policy-modal").within(() => {
|
||||
cy.findByRole("button", { name: /delete/i }).should("exist");
|
||||
cy.findByRole("button", { name: /cancel/i }).click();
|
||||
});
|
||||
managePoliciesPage.allowsDeletePolicy();
|
||||
});
|
||||
});
|
||||
describe("Team admin settings page", () => {
|
||||
|
|
@ -399,13 +203,8 @@ describe("Premium tier - Team Admin user", () => {
|
|||
});
|
||||
describe("User profile page", () => {
|
||||
it("should render elements according to role-based access controls", () => {
|
||||
cy.visit("/profile");
|
||||
cy.getAttached(".user-side-panel").within(() => {
|
||||
cy.findByText(/team/i)
|
||||
.next()
|
||||
.contains(/mystic/i); // Updated team name
|
||||
cy.findByText("Role").next().contains(/admin/i);
|
||||
});
|
||||
userProfilePage.visitUserProfilePage();
|
||||
userProfilePage.showRole("Admin", "Mystic");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,4 +1,12 @@
|
|||
import CONSTANTS from "../../support/constants";
|
||||
import dashboardPage from "../pages/dashboardPage";
|
||||
import manageHostsPage from "../pages/manageHostsPage";
|
||||
import managePacksPage from "../pages/managePacksPage";
|
||||
import managePoliciesPage from "../pages/managePoliciesPage";
|
||||
import manageSchedulePage from "../pages/manageSchedulePage";
|
||||
import manageSoftwarePage from "../pages/manageSoftwarePage";
|
||||
import teamsDropdown from "../pages/teamsDropdown";
|
||||
import userProfilePage from "../pages/userProfilePage";
|
||||
|
||||
const { GOOD_PASSWORD } = CONSTANTS;
|
||||
|
||||
|
|
@ -37,7 +45,7 @@ describe("Premium tier - Team observer/maintainer user", () => {
|
|||
});
|
||||
});
|
||||
describe("Dashboard", () => {
|
||||
beforeEach(() => cy.visit("/dashboard"));
|
||||
beforeEach(() => dashboardPage.visitsDashboardPage());
|
||||
it("displays cards for all platforms", () => {
|
||||
cy.getAttached(".homepage__wrapper").within(() => {
|
||||
cy.findByText(/apples/i).should("exist");
|
||||
|
|
@ -49,47 +57,16 @@ describe("Premium tier - Team observer/maintainer user", () => {
|
|||
});
|
||||
});
|
||||
it("displays cards for windows only", () => {
|
||||
cy.getAttached(".homepage__platforms").within(() => {
|
||||
cy.getAttached(".Select-control").click();
|
||||
cy.findByText(/windows/i).click();
|
||||
});
|
||||
cy.getAttached(".homepage__wrapper").within(() => {
|
||||
cy.findByText(/apples/i).should("exist");
|
||||
cy.getAttached(".hosts-summary").should("exist");
|
||||
cy.getAttached(".hosts-status").should("exist");
|
||||
// "get" because we expect it not to exist
|
||||
cy.get(".home-software").should("not.exist");
|
||||
cy.get(".activity-feed").should("not.exist");
|
||||
});
|
||||
dashboardPage.switchesPlatform("Windows");
|
||||
dashboardPage.displaysCards("Windows");
|
||||
});
|
||||
it("displays cards for linux only", () => {
|
||||
cy.getAttached(".homepage__platforms").within(() => {
|
||||
cy.getAttached(".Select-control").click();
|
||||
cy.findByText(/linux/i).click();
|
||||
});
|
||||
cy.getAttached(".homepage__wrapper").within(() => {
|
||||
cy.findByText(/apples/i).should("exist");
|
||||
cy.getAttached(".hosts-summary").should("exist");
|
||||
cy.getAttached(".hosts-status").should("exist");
|
||||
// "get" because we expect it not to exist
|
||||
cy.get(".home-software").should("not.exist");
|
||||
cy.get(".activity-feed").should("not.exist");
|
||||
});
|
||||
dashboardPage.switchesPlatform("Linux");
|
||||
dashboardPage.displaysCards("Linux");
|
||||
});
|
||||
it("displays cards for macOS only", () => {
|
||||
cy.getAttached(".homepage__platforms").within(() => {
|
||||
cy.getAttached(".Select-control").click();
|
||||
cy.findByText(/macos/i).click();
|
||||
});
|
||||
cy.getAttached(".homepage__wrapper").within(() => {
|
||||
cy.findByText(/apples/i).should("exist");
|
||||
cy.getAttached(".hosts-summary").should("exist");
|
||||
cy.getAttached(".hosts-status").should("exist");
|
||||
cy.getAttached(".home-mdm").should("exist");
|
||||
// "get" because we expect it not to exist
|
||||
cy.get(".home-software").should("not.exist");
|
||||
cy.get(".activity-feed").should("not.exist");
|
||||
});
|
||||
dashboardPage.switchesPlatform("macOS");
|
||||
dashboardPage.displaysCards("macOS");
|
||||
});
|
||||
it("views all hosts for all platforms", () => {
|
||||
cy.findByText(/view all hosts/i).click();
|
||||
|
|
@ -135,56 +112,41 @@ describe("Premium tier - Team observer/maintainer user", () => {
|
|||
});
|
||||
describe("Manage hosts page", () => {
|
||||
it("should render elements according to role-based access controls", () => {
|
||||
cy.visit("/hosts/manage");
|
||||
// Hosts table includes teams column
|
||||
cy.getAttached(".data-table__table th")
|
||||
.contains("Team")
|
||||
.should("be.visible");
|
||||
cy.findByText(/add label/i).should("not.exist");
|
||||
manageHostsPage.visitsManageHostsPage();
|
||||
|
||||
// On observing team, not see the "add hosts" and "Manage enroll secret" buttons
|
||||
cy.contains(/apples/i).should("exist");
|
||||
cy.contains("button", /add hosts/i).should("not.exist");
|
||||
cy.contains("button", /manage enroll secret/i).should("not.exist");
|
||||
manageHostsPage.includesTeamColumn();
|
||||
|
||||
manageHostsPage.hidesButton("Add label");
|
||||
manageHostsPage.hidesButton("Add hosts");
|
||||
manageHostsPage.hidesButton("Manage enroll secrets");
|
||||
});
|
||||
});
|
||||
describe("Manage policies page", () => {
|
||||
it("should render elements according to role-based access controls", () => {
|
||||
cy.visit("/policies/manage");
|
||||
// On observing team, not see the "Add a policy" and "Manage automations" button
|
||||
cy.findByText(/apples/i).should("exist");
|
||||
cy.findByText(/manage automations/i).should("not.exist");
|
||||
cy.findByText(/add a policy/i).should("not.exist");
|
||||
it("hides 'Manage automation' and 'Add a policy' buttons", () => {
|
||||
managePoliciesPage.visitManagePoliciesPage();
|
||||
cy.contains(/apples/i).should("exist");
|
||||
|
||||
managePoliciesPage.hidesButton("Manage automations");
|
||||
managePoliciesPage.hidesButton("Add a policy");
|
||||
});
|
||||
});
|
||||
describe("Policy detail page", () => {
|
||||
it("should render elements according to role-based access controls", () => {
|
||||
cy.visit("/policies/manage");
|
||||
// Navigate to policy detail page for first policy in manage policies table
|
||||
cy.getAttached("tbody").within(() => {
|
||||
cy.getAttached("tr")
|
||||
.first()
|
||||
.within(() => {
|
||||
cy.contains(".fleet-checkbox__input").should("not.exist");
|
||||
cy.findByText(/filevault enabled/i).click();
|
||||
});
|
||||
});
|
||||
cy.getAttached(".policy-form__wrapper").within(() => {
|
||||
cy.findByRole("button", { name: /run/i }).should("not.exist");
|
||||
cy.findByRole("button", { name: /save/i }).should("not.exist");
|
||||
});
|
||||
it("allows view policy only", () => {
|
||||
managePoliciesPage.visitManagePoliciesPage();
|
||||
managePoliciesPage.allowsViewPolicyOnly();
|
||||
});
|
||||
});
|
||||
// nav restrictions are at the end because we expect to see a
|
||||
// 403 error overlay which will hide the nav and make the test fail
|
||||
describe("Nav restrictions", () => {
|
||||
it("should restrict navigation according to role-based access controls", () => {
|
||||
cy.visit("/dashboard");
|
||||
dashboardPage.visitsDashboardPage();
|
||||
cy.findByText(/settings/i).should("not.exist");
|
||||
cy.findByText(/schedule/i).should("exist");
|
||||
cy.visit("/settings/organization");
|
||||
cy.findByText(/you do not have permissions/i).should("exist");
|
||||
cy.visit("/packs/manage");
|
||||
managePacksPage.visitsManagePacksPage();
|
||||
cy.findByText(/you do not have permissions/i).should("exist");
|
||||
});
|
||||
});
|
||||
|
|
@ -200,122 +162,56 @@ describe("Premium tier - Team observer/maintainer user", () => {
|
|||
|
||||
beforeEach(() => {
|
||||
cy.loginWithCySession("marco@organization.com", GOOD_PASSWORD);
|
||||
cy.visit("/hosts/manage");
|
||||
manageHostsPage.visitsManageHostsPage();
|
||||
});
|
||||
describe("Manage hosts page", () => {
|
||||
it("should render elements according to role-based access controls", () => {
|
||||
// Hosts table includes teams column
|
||||
cy.getAttached(".data-table__table th")
|
||||
.contains("Team")
|
||||
.should("be.visible");
|
||||
cy.findByText(/add label/i).should("not.exist");
|
||||
manageHostsPage.includesTeamColumn();
|
||||
manageHostsPage.hidesButton("Add label");
|
||||
|
||||
// On maintaining team, see the "add hosts" and "Manage enroll secret" buttons
|
||||
cy.getAttached(".manage-hosts__header").within(() => {
|
||||
cy.contains("Apples").click({ force: true });
|
||||
cy.contains("Oranges").click({ force: true });
|
||||
});
|
||||
cy.getAttached(".team_name__cell").within(() => {
|
||||
cy.findByText(/oranges/i).should("exist");
|
||||
});
|
||||
cy.getAttached(".button-wrap")
|
||||
.contains("button", /add hosts/i)
|
||||
.click();
|
||||
cy.getAttached(".modal__content").contains("button", /done/i).click();
|
||||
|
||||
// On maintaining team, add new enroll secret
|
||||
cy.getAttached(".button-wrap")
|
||||
.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 .modal-cta-wrap")
|
||||
.contains("button", /save/i)
|
||||
.click();
|
||||
cy.getAttached(".enroll-secret-modal .modal-cta-wrap")
|
||||
.contains("button", /done/i)
|
||||
.click();
|
||||
teamsDropdown.switchTeams("Apples", "Oranges");
|
||||
manageHostsPage.includesTeamDropdown("Oranges");
|
||||
manageHostsPage.allowsAddHosts();
|
||||
manageHostsPage.allowsManageAndAddSecrets();
|
||||
});
|
||||
});
|
||||
describe("Manage software page", () => {
|
||||
beforeEach(() => cy.visit("/software/manage"));
|
||||
beforeEach(() => manageSoftwarePage.visitManageSoftwarePage());
|
||||
it("hides manage automations button", () => {
|
||||
cy.getAttached(".manage-software-page__header-wrap").within(() => {
|
||||
cy.findByRole("button", { name: /manage automations/i }).should(
|
||||
"not.exist"
|
||||
);
|
||||
});
|
||||
manageSoftwarePage.hidesButton("Manage automations");
|
||||
});
|
||||
});
|
||||
describe("Manage schedule page", () => {
|
||||
it("should render elements according to role-based access controls", () => {
|
||||
cy.visit("/schedule/manage");
|
||||
cy.contains(/oranges/i).should("exist");
|
||||
cy.getAttached(".no-schedule__cta-buttons").within(() => {
|
||||
cy.contains(/advanced/i).should("not.exist");
|
||||
});
|
||||
cy.getAttached(".no-schedule__schedule-button").click();
|
||||
// Schedule a query on maintaining team
|
||||
cy.getAttached(".schedule-editor-modal__form").within(() => {
|
||||
cy.findByText(/select query/i).click();
|
||||
cy.findByText(/detect presence/i).click();
|
||||
cy.findByText(/every day/i).click();
|
||||
cy.findByText(/every 6 hours/i).click();
|
||||
cy.getAttached(".modal-cta-wrap").within(() => {
|
||||
cy.findByRole("button", { name: /schedule/i }).click();
|
||||
});
|
||||
});
|
||||
cy.findByText(/successfully added/i).should("be.visible");
|
||||
cy.getAttached("tbody>tr").should("have.length", 1);
|
||||
manageSchedulePage.visitManageSchedulePage();
|
||||
manageSchedulePage.confirmsTeam("Oranges");
|
||||
manageSchedulePage.hidesButton("Advanced");
|
||||
manageSchedulePage.allowsAddSchedule();
|
||||
manageSchedulePage.verifiesAddedSchedule();
|
||||
});
|
||||
});
|
||||
describe("Manage policies page", () => {
|
||||
it("should render elements according to role-based access controls", () => {
|
||||
cy.visit("/policies/manage");
|
||||
// Switch to from team apples to team oranges
|
||||
cy.findByText(/apples/i).click();
|
||||
cy.findByText(/oranges/i).click();
|
||||
it("allows team maintainer to add, edit a policy, but not manage automation", () => {
|
||||
managePoliciesPage.visitManagePoliciesPage();
|
||||
teamsDropdown.switchTeams("Apples", "Oranges");
|
||||
|
||||
// On maintaining team, should not see the "Manage automations" button
|
||||
cy.findByText(/manage automations/i).should("not.exist");
|
||||
// On maintaining team, should see "add a policy" and "save" a policy
|
||||
cy.findByText(/add a policy/i).click();
|
||||
|
||||
// Add a default policy
|
||||
cy.findByText(/gatekeeper enabled/i).click();
|
||||
cy.findByRole("button", { name: /save/i }).click();
|
||||
cy.getAttached(".modal-cta-wrap").within(() => {
|
||||
cy.findByRole("button", { name: /save policy/i }).click();
|
||||
});
|
||||
cy.findByText(/policy created/i).should("exist");
|
||||
|
||||
// On maintaining team, should see "save" and "run" for a new policy
|
||||
cy.getAttached(".policy-form__button-wrap").within(() => {
|
||||
cy.findByRole("button", { name: /run/i }).should("exist");
|
||||
cy.findByRole("button", { name: /save/i }).should("exist");
|
||||
});
|
||||
managePoliciesPage.hidesButton("Manage automations");
|
||||
managePoliciesPage.allowsAddDefaultPolicy();
|
||||
managePoliciesPage.verifiesAddedDefaultPolicy();
|
||||
});
|
||||
});
|
||||
describe("User profile page", () => {
|
||||
it("should render elements according to role-based access controls", () => {
|
||||
cy.visit("/profile");
|
||||
// See 2 Teams in the Team section and Various in the Role section
|
||||
cy.getAttached(".user-side-panel").within(() => {
|
||||
cy.findByText("Teams")
|
||||
.next()
|
||||
.contains(/2 teams/i);
|
||||
cy.findByText("Role")
|
||||
.next()
|
||||
.contains(/various/i);
|
||||
});
|
||||
it("verifies user role and team", () => {
|
||||
userProfilePage.visitUserProfilePage();
|
||||
userProfilePage.showRole("Various", "2 teams");
|
||||
});
|
||||
});
|
||||
// nav restrictions are at the end because we expect to see a
|
||||
// 403 error overlay which will hide the nav and make the test fail
|
||||
describe("Nav restrictions", () => {
|
||||
it("should restrict navigation according to role-based access controls", () => {
|
||||
cy.visit("/dashboard");
|
||||
dashboardPage.visitsDashboardPage();
|
||||
|
||||
cy.contains("h2", "Hosts").should("exist");
|
||||
cy.getAttached("nav").within(() => {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
import manageSchedulePage from "../pages/manageSchedulePage";
|
||||
|
||||
describe("Teams flow (empty)", () => {
|
||||
before(() => {
|
||||
Cypress.session.clearAllSavedSessions();
|
||||
|
|
@ -91,45 +93,12 @@ describe("Teams flow (seeded)", () => {
|
|||
describe("Manage schedules page", () => {
|
||||
beforeEach(() => {
|
||||
cy.loginWithCySession();
|
||||
cy.visit("/schedule/manage");
|
||||
manageSchedulePage.visitManageSchedulePage();
|
||||
});
|
||||
it("adds a query to team schedule", () => {
|
||||
cy.getAttached(".manage-schedule-page__header").within(() => {
|
||||
cy.contains("All teams").click({ force: true });
|
||||
cy.contains("Oranges").click({ force: true });
|
||||
});
|
||||
cy.getAttached(".no-schedule__schedule-button").click();
|
||||
cy.getAttached(".schedule-editor-modal__form").within(() => {
|
||||
cy.findByText(/select query/i).click();
|
||||
cy.findByText(/detect presence/i).click();
|
||||
cy.findByText(/every day/i).click();
|
||||
cy.findByText(/every 6 hours/i).click();
|
||||
cy.findByText(/show advanced options/i).click();
|
||||
cy.findByText(/snapshot/i).click();
|
||||
cy.findByText(/ignore removals/i).click();
|
||||
cy.getAttached(".schedule-editor-modal__form-field--platform").within(
|
||||
() => {
|
||||
cy.findByText(/all/i).click();
|
||||
cy.findByText(/linux/i).click();
|
||||
}
|
||||
);
|
||||
cy.getAttached(
|
||||
".schedule-editor-modal__form-field--osquer-vers"
|
||||
).within(() => {
|
||||
cy.findByText(/all/i).click();
|
||||
cy.findByText(/4.6.0/i).click();
|
||||
});
|
||||
cy.getAttached(".schedule-editor-modal__form-field--shard").within(
|
||||
() => {
|
||||
cy.getAttached(".input-field").click().type("50");
|
||||
}
|
||||
);
|
||||
cy.getAttached(".modal-cta-wrap").within(() => {
|
||||
cy.findByRole("button", { name: /schedule/i }).click();
|
||||
});
|
||||
});
|
||||
cy.findByText(/successfully added/i).should("be.visible");
|
||||
cy.getAttached("tbody>tr").should("have.length", 1);
|
||||
manageSchedulePage.changesTeam("All teams", "Oranges");
|
||||
manageSchedulePage.allowsAddSchedule();
|
||||
manageSchedulePage.verifiesAddedSchedule();
|
||||
});
|
||||
});
|
||||
describe("Team details page", () => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue