From efdcc0c682f5714a8e8a51dfba9c131a1d1cb003 Mon Sep 17 00:00:00 2001 From: Paul Tavares Date: Mon, 8 Jun 2020 17:08:27 -0400 Subject: [PATCH] More efficient `clickOnEuiCheckbox` utility + fix policy details test --- .../apps/endpoint/policy_details.ts | 22 ++++++----- .../page_objects/page_utils.ts | 37 ++++--------------- .../services/endpoint_policy.ts | 11 ++++-- 3 files changed, 27 insertions(+), 43 deletions(-) diff --git a/x-pack/test/functional_endpoint/apps/endpoint/policy_details.ts b/x-pack/test/functional_endpoint/apps/endpoint/policy_details.ts index e0f84dc6a969d..25fb477b5a99a 100644 --- a/x-pack/test/functional_endpoint/apps/endpoint/policy_details.ts +++ b/x-pack/test/functional_endpoint/apps/endpoint/policy_details.ts @@ -83,11 +83,13 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { ); }); it('should have updated policy data in overall agent configuration', async () => { - // Turn off file events. + // This test ensures that updates made to the Endpoint Policy are carried all the way through + // to the generated Agent Configuration that is dispatch down to the Elastic Agent. + await Promise.all([ pageObjects.endpointPageUtils.clickOnEuiCheckbox('policyWindowsEvent_file'), pageObjects.endpointPageUtils.clickOnEuiCheckbox('policyLinuxEvent_file'), - pageObjects.endpointPageUtils.clickOnEuiCheckbox('policyMaxEvent_file'), + pageObjects.endpointPageUtils.clickOnEuiCheckbox('policyMacEvent_file'), ]); await pageObjects.policy.confirmAndSave(); await testSubjects.existOrFail('policyDetailsSuccessMessage'); @@ -100,7 +102,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { datasources: [ { enabled: true, - id: 'e5cfd120-a9b8-11ea-8cdc-f3228a168e40', + id: policyInfo.datasource.id, inputs: [ { enabled: true, @@ -120,7 +122,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { }, }, events: { - file: true, + file: false, network: true, process: true, }, @@ -144,7 +146,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { }, }, events: { - file: true, + file: false, network: true, process: true, }, @@ -172,8 +174,8 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { }, events: { dll_and_driver_load: true, - dns: false, - file: true, + dns: true, + file: false, network: true, process: true, registry: true, @@ -196,19 +198,19 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { namespace: 'default', package: { name: 'endpoint', - version: '0.2.0', + version: policyInfo.packageInfo.version, }, use_output: 'default', }, ], - id: 'e59252f0-a9b8-11ea-8cdc-f3228a168e40', + id: policyInfo.agentConfig.id, outputs: { default: { hosts: ['http://localhost:9200'], type: 'elasticsearch', }, }, - revision: 5, + revision: 3, settings: { monitoring: { enabled: false, diff --git a/x-pack/test/functional_endpoint/page_objects/page_utils.ts b/x-pack/test/functional_endpoint/page_objects/page_utils.ts index 0b310a7cdd84b..daf66464f7e1e 100644 --- a/x-pack/test/functional_endpoint/page_objects/page_utils.ts +++ b/x-pack/test/functional_endpoint/page_objects/page_utils.ts @@ -4,12 +4,10 @@ * you may not use this file except in compliance with the Elastic License. */ -import { WebElementWrapper } from '../../../../test/functional/services/lib/web_element_wrapper'; import { FtrProviderContext } from '../ftr_provider_context'; export function EndpointPageUtils({ getService }: FtrProviderContext) { const find = getService('find'); - const log = getService('log'); return { /** @@ -18,34 +16,15 @@ export function EndpointPageUtils({ getService }: FtrProviderContext) { * @param euiCheckBoxTestId */ async clickOnEuiCheckbox(euiCheckBoxTestId: string) { - // FIXME: this method is extreemly slow - fix it - const checkboxes = await find.allByCssSelector('.euiCheckbox'); - const silentCatch = () => {}; + // This utility is needed because EuiCheckbox forwards the test subject on to + // the actual `` which is not actually visible/accessible on the page. + // In order to actually cause the state of the checkbox to change, the `