From 35cfb3368eeaabff95fb4d2824cbdcb7127155f5 Mon Sep 17 00:00:00 2001 From: Kevin Logan <56395104+kevinlog@users.noreply.github.com> Date: Tue, 30 Aug 2022 15:01:31 -0400 Subject: [PATCH] [Security Solution] Fix flaky policy tests (#139660) --- .../apps/endpoint/policy_details.ts | 39 ++----------------- 1 file changed, 3 insertions(+), 36 deletions(-) diff --git a/x-pack/test/security_solution_endpoint/apps/endpoint/policy_details.ts b/x-pack/test/security_solution_endpoint/apps/endpoint/policy_details.ts index 6a6f7f2973740..12ea3e7452500 100644 --- a/x-pack/test/security_solution_endpoint/apps/endpoint/policy_details.ts +++ b/x-pack/test/security_solution_endpoint/apps/endpoint/policy_details.ts @@ -13,7 +13,6 @@ import { PolicyTestResourceInfo } from '../../services/endpoint_policy'; export default function ({ getPageObjects, getService }: FtrProviderContext) { const browser = getService('browser'); - const retryService = getService('retry'); const pageObjects = getPageObjects([ 'common', 'endpoint', @@ -30,8 +29,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { let indexedData: IndexedHostsAndAlertsResponse; before(async () => { - const endpointPackage = await policyTestResources.getEndpointPackage(); - await endpointTestResources.setMetadataTransformFrequency('1s', endpointPackage.version); indexedData = await endpointTestResources.loadEndpointData(); await browser.refresh(); }); @@ -127,8 +124,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { }); }); - // FLAKY: https://github.com/elastic/kibana/issues/92567 - describe.skip('and the save button is clicked', () => { + describe('and the save button is clicked', () => { let policyInfo: PolicyTestResourceInfo; beforeEach(async () => { @@ -185,7 +181,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await pageObjects.policy.confirmAndSave(); await testSubjects.existOrFail('policyDetailsSuccessMessage'); - await testSubjects.waitForHidden('toastCloseButton'); + await testSubjects.waitForDeleted('toastCloseButton'); const agentFullPolicy = await policyTestResources.getFullAgentPolicy( policyInfo.agentPolicy.id @@ -224,7 +220,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await advancedPolicyField.clearValueWithKeyboard(); // Make sure the toast button closes so the save button on the sticky footer is visible - await testSubjects.waitForHidden('toastCloseButton'); + await testSubjects.waitForDeleted('toastCloseButton'); await pageObjects.policy.confirmAndSave(); await testSubjects.existOrFail('policyDetailsSuccessMessage'); @@ -270,35 +266,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await pageObjects.policy.waitForCheckboxSelectionChange('policyWindowsEvent_dns', false); }); - // Failing: See https://github.com/elastic/kibana/issues/100236 - it.skip('should preserve updates done from the Fleet form', async () => { - // Fleet has its own form inputs, like description. When those are updated, the changes - // are also dispatched to the embedded endpoint Policy form. Update to the Endpoint Policy - // form after that should preserve the changes done on the Fleet form - // NOTE: A few delays were added below due to sporadic failures of this test case (see #100236) - const sleep = (ms = 100) => new Promise((resolve) => setTimeout(resolve, ms)); - - // Wait for the endpoint form to load and then update the policy description - await testSubjects.existOrFail('endpointIntegrationPolicyForm'); - await sleep(); // Allow forms to sync - await pageObjects.ingestManagerCreatePackagePolicy.setPackagePolicyDescription( - 'protect everything' - ); - await sleep(); // Allow forms to sync - - const winDnsEventingCheckbox = await testSubjects.find('policyWindowsEvent_dns'); - await pageObjects.ingestManagerCreatePackagePolicy.scrollToCenterOfWindow( - winDnsEventingCheckbox - ); - await pageObjects.endpointPageUtils.clickOnEuiCheckbox('policyWindowsEvent_dns'); - - await retryService.try(async () => { - expect( - await pageObjects.ingestManagerCreatePackagePolicy.getPackagePolicyDescriptionValue() - ).to.be('protect everything'); - }); - }); - it('should include updated endpoint data when saved', async () => { await pageObjects.ingestManagerCreatePackagePolicy.scrollToCenterOfWindow( await testSubjects.find('policyWindowsEvent_dns')