Fix flaky e2e policies (#4190)

This commit is contained in:
RachelElysia 2022-02-14 16:09:55 -06:00 committed by GitHub
parent 381d3b4206
commit 439d6f0623
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 12 deletions

View File

@ -110,7 +110,9 @@ describe("Policies flow (seeded)", () => {
cy.findByText(/backup/i).should("not.exist");
});
it("creates a failing policies webhook", () => {
cy.findByRole("button", { name: /manage automations/i }).click();
cy.getAttached(".button-wrap").within(() => {
cy.findByRole("button", { name: /manage automations/i }).click();
});
cy.getAttached(".manage-automations-modal").within(() => {
cy.getAttached(".fleet-checkbox__input").check({ force: true });
});
@ -118,7 +120,9 @@ describe("Policies flow (seeded)", () => {
cy.findByRole("button", { name: /^Save$/ }).click();
// Confirm failing policies webhook was added successfully
cy.findByText(/updated policy automations/i).should("exist");
cy.findByRole("button", { name: /manage automations/i }).click();
cy.getAttached(".button-wrap").within(() => {
cy.findByRole("button", { name: /manage automations/i }).click();
});
cy.getAttached(".manage-automations-modal").within(() => {
cy.getAttached(".fleet-checkbox__input").should("be.checked");
});

View File

@ -362,15 +362,18 @@ const ManagePolicyPage = ({
</div>
</div>
<div className={`${baseClass} button-wrap`}>
{canAddOrRemovePolicy && teamId === 0 && (
<Button
onClick={() => onManageAutomationsClick()}
className={`${baseClass}__manage-automations button`}
variant="inverse"
>
<span>Manage automations</span>
</Button>
)}
{canAddOrRemovePolicy &&
teamId === 0 &&
!isLoadingFailingPoliciesWebhook &&
!isLoadingGlobalPolicies && (
<Button
onClick={() => onManageAutomationsClick()}
className={`${baseClass}__manage-automations button`}
variant="inverse"
>
<span>Manage automations</span>
</Button>
)}
{canAddOrRemovePolicy && (
<div className={`${baseClass}__action-button-container`}>
<Button
@ -450,7 +453,7 @@ const ManagePolicyPage = ({
/>
))}
</div>
{showInheritedPoliciesButton && (
{showInheritedPoliciesButton && globalPolicies && (
<span>
<Button
variant="unstyled"