mirror of
https://github.com/empayre/fleet.git
synced 2024-11-06 08:55:24 +00:00
Premium rbac e2e schedules (#3936)
This commit is contained in:
parent
ea8f17488f
commit
d2c33b8602
@ -80,46 +80,36 @@ describe("Query flow (seeded)", () => {
|
||||
cy.visit("/schedule/manage");
|
||||
});
|
||||
it("creates a new scheduled query", () => {
|
||||
cy.getAttached(".no-schedule__cta-buttons").within(() => {
|
||||
cy.getAttached(".no-schedule__schedule-button").click();
|
||||
});
|
||||
|
||||
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(".schedule-editor-modal__btn-wrap").within(() => {
|
||||
cy.findByRole("button", { name: /schedule/i }).click();
|
||||
});
|
||||
});
|
||||
|
||||
cy.findByText(/successfully added/i).should("be.visible");
|
||||
});
|
||||
|
||||
@ -130,7 +120,6 @@ describe("Query flow (seeded)", () => {
|
||||
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();
|
||||
@ -139,7 +128,6 @@ describe("Query flow (seeded)", () => {
|
||||
cy.findByRole("button", { name: /schedule/i }).click();
|
||||
});
|
||||
});
|
||||
|
||||
cy.findByText(/successfully updated/i).should("be.visible");
|
||||
});
|
||||
|
||||
@ -151,11 +139,9 @@ describe("Query flow (seeded)", () => {
|
||||
cy.findByText(/action/i).click();
|
||||
cy.findByText(/remove/i).click();
|
||||
});
|
||||
|
||||
cy.getAttached(".remove-scheduled-query-modal__btn-wrap").within(() => {
|
||||
cy.findByRole("button", { name: /remove/i }).click();
|
||||
});
|
||||
|
||||
cy.findByText(/successfully removed/i).should("be.visible");
|
||||
});
|
||||
});
|
||||
|
@ -85,10 +85,10 @@ describe("Premium tier - Team observer/maintainer user", () => {
|
||||
|
||||
beforeEach(() => {
|
||||
cy.loginWithCySession("marco@organization.com", "user123#");
|
||||
cy.visit("/hosts/manage");
|
||||
});
|
||||
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")
|
||||
@ -96,7 +96,10 @@ describe("Premium tier - Team observer/maintainer user", () => {
|
||||
cy.findByText(/add label/i).should("not.exist");
|
||||
|
||||
// On maintaining team, see the "Generate installer" and "Manage enroll secret" buttons
|
||||
cy.visit("/hosts/manage/?team_id=2");
|
||||
cy.getAttached(".manage-hosts__header").within(() => {
|
||||
cy.contains("Apples").click({ force: true });
|
||||
cy.contains("Oranges").click({ force: true });
|
||||
});
|
||||
cy.contains(/oranges/i);
|
||||
cy.getAttached(".button-wrap")
|
||||
.contains("button", /generate installer/i)
|
||||
@ -123,7 +126,19 @@ describe("Premium tier - Team observer/maintainer user", () => {
|
||||
cy.visit("/schedule/manage");
|
||||
cy.contains(/oranges/i).should("exist");
|
||||
cy.contains(/advanced/i).should("not.exist");
|
||||
cy.findByRole("button", { name: /schedule a query/i }).should("exist");
|
||||
cy.findByRole("button", { name: /schedule a query/i }).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(".schedule-editor-modal__btn-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);
|
||||
});
|
||||
});
|
||||
describe("Manage policies page", () => {
|
||||
|
@ -83,16 +83,51 @@ describe("Teams flow (seeded)", () => {
|
||||
cy.findByText(/bananas/i).should("not.exist");
|
||||
});
|
||||
});
|
||||
// describe("Manage schedules page", () => {
|
||||
// beforeEach(() => {
|
||||
// cy.loginWithCySession();
|
||||
// cy.visit("/schedule/manage");
|
||||
// });
|
||||
// it("adds a query to team schedule", () => {
|
||||
// cy.getAttached(".no-schedule__schedule-button").click();
|
||||
// // TODO: Unable to add tests because "Schedule a query" button detattaches even when using `getAttached`
|
||||
// });
|
||||
// });
|
||||
describe("Manage schedules page", () => {
|
||||
beforeEach(() => {
|
||||
cy.loginWithCySession();
|
||||
cy.visit("/schedule/manage");
|
||||
cy.seedQueries();
|
||||
});
|
||||
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(".schedule-editor-modal__btn-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);
|
||||
});
|
||||
});
|
||||
describe("Team details page", () => {
|
||||
beforeEach(() => {
|
||||
cy.loginWithCySession();
|
||||
|
Loading…
Reference in New Issue
Block a user