From 4307a9f538abc7ba76a7a0bb2ae994639f0ffb85 Mon Sep 17 00:00:00 2001 From: kevinlog Date: Wed, 25 Nov 2020 14:59:12 -0500 Subject: [PATCH 1/9] delete advanced fields when they are empty --- .../pages/policy/view/policy_advanced.tsx | 35 ++++++++++++++++--- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_advanced.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_advanced.tsx index e4e03e9453f7a..bf5a5c1543d47 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_advanced.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_advanced.tsx @@ -15,13 +15,38 @@ import { AdvancedPolicySchema } from '../models/advanced_policy_schema'; function setValue(obj: Record, value: string, path: string[]) { let newPolicyConfig = obj; - for (let i = 0; i < path.length - 1; i++) { - if (!newPolicyConfig[path[i]]) { - newPolicyConfig[path[i]] = {} as Record; + + if (value === '' || value === undefined) { + for (let k = path.length; k >= 0; k--) { + const nextPath = path.slice(0, k); + for (let i = 0; i < nextPath.length - 1; i++) { + newPolicyConfig = newPolicyConfig[nextPath[i]] as Record; + } + if ( + newPolicyConfig[nextPath[nextPath.length - 1]] === undefined || + newPolicyConfig[nextPath[nextPath.length - 1]] === '' || + Object.keys(newPolicyConfig[nextPath[nextPath.length - 1]]).length === 0 || + k === path.length + ) { + if (nextPath[nextPath.length - 1] === 'advanced') { + newPolicyConfig[nextPath[nextPath.length - 1]] = undefined; + } else { + delete newPolicyConfig[nextPath[nextPath.length - 1]]; + } + newPolicyConfig = obj; + } else { + break; + } + } + } else { + for (let i = 0; i < path.length - 1; i++) { + if (!newPolicyConfig[path[i]]) { + newPolicyConfig[path[i]] = {} as Record; + } + newPolicyConfig = newPolicyConfig[path[i]] as Record; } - newPolicyConfig = newPolicyConfig[path[i]] as Record; + newPolicyConfig[path[path.length - 1]] = value; } - newPolicyConfig[path[path.length - 1]] = value; } function getValue(obj: Record, path: string[]) { From d56f0e3e3d57e7ce4ad6cd9c6679493dd5500d2c Mon Sep 17 00:00:00 2001 From: kevinlog Date: Mon, 30 Nov 2020 08:39:00 -0500 Subject: [PATCH 2/9] fix types --- .../public/management/pages/policy/view/policy_advanced.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_advanced.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_advanced.tsx index bf5a5c1543d47..7e500c8ccd1c1 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_advanced.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_advanced.tsx @@ -16,20 +16,24 @@ import { AdvancedPolicySchema } from '../models/advanced_policy_schema'; function setValue(obj: Record, value: string, path: string[]) { let newPolicyConfig = obj; + // If the user is deleting the value, then we need to ensure we clean up the config. + // We delete any sections are the empty, whether that be an empty string, empty object, or undefined. if (value === '' || value === undefined) { for (let k = path.length; k >= 0; k--) { const nextPath = path.slice(0, k); for (let i = 0; i < nextPath.length - 1; i++) { + // Traverse and find the next section newPolicyConfig = newPolicyConfig[nextPath[i]] as Record; } if ( newPolicyConfig[nextPath[nextPath.length - 1]] === undefined || newPolicyConfig[nextPath[nextPath.length - 1]] === '' || - Object.keys(newPolicyConfig[nextPath[nextPath.length - 1]]).length === 0 || + Object.keys(newPolicyConfig[nextPath[nextPath.length - 1]] as object).length === 0 || k === path.length ) { if (nextPath[nextPath.length - 1] === 'advanced') { newPolicyConfig[nextPath[nextPath.length - 1]] = undefined; + break; // We reached the top of the advanced section and can now break. } else { delete newPolicyConfig[nextPath[nextPath.length - 1]]; } From e982777f706ee889a6188ad888d3cb9f107b1307 Mon Sep 17 00:00:00 2001 From: kevinlog Date: Mon, 30 Nov 2020 09:04:24 -0500 Subject: [PATCH 3/9] clean up logic --- .../pages/policy/view/policy_advanced.tsx | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_advanced.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_advanced.tsx index 7e500c8ccd1c1..5384c2250168e 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_advanced.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_advanced.tsx @@ -16,9 +16,19 @@ import { AdvancedPolicySchema } from '../models/advanced_policy_schema'; function setValue(obj: Record, value: string, path: string[]) { let newPolicyConfig = obj; - // If the user is deleting the value, then we need to ensure we clean up the config. + // First set the value. + for (let i = 0; i < path.length - 1; i++) { + if (!newPolicyConfig[path[i]]) { + newPolicyConfig[path[i]] = {} as Record; + } + newPolicyConfig = newPolicyConfig[path[i]] as Record; + } + newPolicyConfig[path[path.length - 1]] = value; + + // Then, if the user is deleting the value, then we need to ensure we clean up the config. // We delete any sections are the empty, whether that be an empty string, empty object, or undefined. if (value === '' || value === undefined) { + newPolicyConfig = obj; for (let k = path.length; k >= 0; k--) { const nextPath = path.slice(0, k); for (let i = 0; i < nextPath.length - 1; i++) { @@ -28,8 +38,7 @@ function setValue(obj: Record, value: string, path: string[]) { if ( newPolicyConfig[nextPath[nextPath.length - 1]] === undefined || newPolicyConfig[nextPath[nextPath.length - 1]] === '' || - Object.keys(newPolicyConfig[nextPath[nextPath.length - 1]] as object).length === 0 || - k === path.length + Object.keys(newPolicyConfig[nextPath[nextPath.length - 1]] as object).length === 0 ) { if (nextPath[nextPath.length - 1] === 'advanced') { newPolicyConfig[nextPath[nextPath.length - 1]] = undefined; @@ -39,17 +48,9 @@ function setValue(obj: Record, value: string, path: string[]) { } newPolicyConfig = obj; } else { - break; - } - } - } else { - for (let i = 0; i < path.length - 1; i++) { - if (!newPolicyConfig[path[i]]) { - newPolicyConfig[path[i]] = {} as Record; + break; // We are looking at a non-empty section, so we can terminate. } - newPolicyConfig = newPolicyConfig[path[i]] as Record; } - newPolicyConfig[path[path.length - 1]] = value; } } From 9ac26da999c1c71bb73817255f4ae6451987860e Mon Sep 17 00:00:00 2001 From: kevinlog Date: Mon, 30 Nov 2020 09:06:51 -0500 Subject: [PATCH 4/9] clean up --- .../public/management/pages/policy/view/policy_advanced.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_advanced.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_advanced.tsx index 5384c2250168e..83b1d96f4b060 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_advanced.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_advanced.tsx @@ -42,7 +42,6 @@ function setValue(obj: Record, value: string, path: string[]) { ) { if (nextPath[nextPath.length - 1] === 'advanced') { newPolicyConfig[nextPath[nextPath.length - 1]] = undefined; - break; // We reached the top of the advanced section and can now break. } else { delete newPolicyConfig[nextPath[nextPath.length - 1]]; } From b620c6e2d4eec0124e699d43cc92e85a687ba2db Mon Sep 17 00:00:00 2001 From: kevinlog Date: Tue, 1 Dec 2020 07:57:05 -0500 Subject: [PATCH 5/9] more comments and test --- .../pages/policy/view/policy_advanced.tsx | 7 +- .../apps/endpoint/policy_details.ts | 143 ++++++++++++++++++ 2 files changed, 148 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_advanced.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_advanced.tsx index 83b1d96f4b060..c6b677110315a 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_advanced.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_advanced.tsx @@ -25,8 +25,8 @@ function setValue(obj: Record, value: string, path: string[]) { } newPolicyConfig[path[path.length - 1]] = value; - // Then, if the user is deleting the value, then we need to ensure we clean up the config. - // We delete any sections are the empty, whether that be an empty string, empty object, or undefined. + // Then, if the user is deleting the value, we need to ensure we clean up the config. + // We delete any sections that are empty, whether that be an empty string, empty object, or undefined. if (value === '' || value === undefined) { newPolicyConfig = obj; for (let k = path.length; k >= 0; k--) { @@ -40,8 +40,11 @@ function setValue(obj: Record, value: string, path: string[]) { newPolicyConfig[nextPath[nextPath.length - 1]] === '' || Object.keys(newPolicyConfig[nextPath[nextPath.length - 1]] as object).length === 0 ) { + // If we're looking at the `advanced` field, we leave it undefined as opposed to deleting it. + // This is because the UI looks for this field to begin rendering. if (nextPath[nextPath.length - 1] === 'advanced') { newPolicyConfig[nextPath[nextPath.length - 1]] = undefined; + // In all other cases, if field is empty, we'll delete it to clean up. } else { delete newPolicyConfig[nextPath[nextPath.length - 1]]; } 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 b3c130ea1e5dc..06330b97b7a8c 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 @@ -255,6 +255,149 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { }, ]); }); + + it('should have cleared the advanced section when the user deletes the value', async () => { + const advancedPolicyButton = await pageObjects.policy.findAdvancedPolicyButton(); + await advancedPolicyButton.click(); + + const advancedPolicyField = await pageObjects.policy.findAdvancedPolicyField(); + await advancedPolicyField.clearValue(); + + await pageObjects.policy.confirmAndSave(); + + await testSubjects.existOrFail('policyDetailsSuccessMessage'); + + const agentFullPolicy = await policyTestResources.getFullAgentPolicy( + policyInfo.agentPolicy.id + ); + + expect(agentFullPolicy.inputs).to.eql([ + { + id: policyInfo.packagePolicy.id, + revision: 2, + data_stream: { namespace: 'default' }, + name: 'Protect East Coast', + meta: { + package: { + name: 'endpoint', + version: policyInfo.packageInfo.version, + }, + }, + artifact_manifest: { + artifacts: { + 'endpoint-exceptionlist-macos-v1': { + compression_algorithm: 'zlib', + decoded_sha256: + 'd801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', + decoded_size: 14, + encoded_sha256: + 'f8e6afa1d5662f5b37f83337af774b5785b5b7f1daee08b7b00c2d6813874cda', + encoded_size: 22, + encryption_algorithm: 'none', + relative_url: + '/api/endpoint/artifacts/download/endpoint-exceptionlist-macos-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', + }, + 'endpoint-exceptionlist-windows-v1': { + compression_algorithm: 'zlib', + decoded_sha256: + 'd801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', + decoded_size: 14, + encoded_sha256: + 'f8e6afa1d5662f5b37f83337af774b5785b5b7f1daee08b7b00c2d6813874cda', + encoded_size: 22, + encryption_algorithm: 'none', + relative_url: + '/api/endpoint/artifacts/download/endpoint-exceptionlist-windows-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', + }, + 'endpoint-trustlist-linux-v1': { + compression_algorithm: 'zlib', + decoded_sha256: + 'd801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', + decoded_size: 14, + encoded_sha256: + 'f8e6afa1d5662f5b37f83337af774b5785b5b7f1daee08b7b00c2d6813874cda', + encoded_size: 22, + encryption_algorithm: 'none', + relative_url: + '/api/endpoint/artifacts/download/endpoint-trustlist-linux-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', + }, + 'endpoint-trustlist-macos-v1': { + compression_algorithm: 'zlib', + decoded_sha256: + 'd801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', + decoded_size: 14, + encoded_sha256: + 'f8e6afa1d5662f5b37f83337af774b5785b5b7f1daee08b7b00c2d6813874cda', + encoded_size: 22, + encryption_algorithm: 'none', + relative_url: + '/api/endpoint/artifacts/download/endpoint-trustlist-macos-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', + }, + 'endpoint-trustlist-windows-v1': { + compression_algorithm: 'zlib', + decoded_sha256: + 'd801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', + decoded_size: 14, + encoded_sha256: + 'f8e6afa1d5662f5b37f83337af774b5785b5b7f1daee08b7b00c2d6813874cda', + encoded_size: 22, + encryption_algorithm: 'none', + relative_url: + '/api/endpoint/artifacts/download/endpoint-trustlist-windows-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', + }, + }, + // The manifest version could have changed when the Policy was updated because the + // policy details page ensures that a save action applies the udpated policy on top + // of the latest Package Policy. So we just ignore the check against this value by + // forcing it to be the same as the value returned in the full agent policy. + manifest_version: agentFullPolicy.inputs[0].artifact_manifest.manifest_version, + schema_version: 'v1', + }, + policy: { + linux: { + events: { file: false, network: true, process: true }, + logging: { file: 'info' }, + }, + mac: { + events: { file: false, network: true, process: true }, + logging: { file: 'info' }, + malware: { mode: 'prevent' }, + popup: { + malware: { + enabled: true, + message: 'Elastic Security { action } { filename }', + }, + }, + }, + windows: { + events: { + dll_and_driver_load: true, + dns: true, + file: false, + network: true, + process: true, + registry: true, + security: true, + }, + logging: { file: 'info' }, + malware: { mode: 'prevent' }, + popup: { + malware: { + enabled: true, + message: 'Elastic Security { action } { filename }', + }, + }, + antivirus_registration: { + enabled: false, + }, + }, + }, + streams: [], + type: 'endpoint', + use_output: 'default', + }, + ]); + }); }); describe('when on Ingest Policy Edit Package Policy page', async () => { From c746fc85bb76a75c03a6ecb68847c2116ea2a9f8 Mon Sep 17 00:00:00 2001 From: kevinlog Date: Tue, 1 Dec 2020 11:33:27 -0500 Subject: [PATCH 6/9] fix test --- .../apps/endpoint/policy_details.ts | 146 +++++++++++++++++- 1 file changed, 143 insertions(+), 3 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 316cc271eb2b5..5cfa727b7540c 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 @@ -262,6 +262,8 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { const advancedPolicyField = await pageObjects.policy.findAdvancedPolicyField(); await advancedPolicyField.clearValue(); + await pageObjects.policy.confirmAndSave(); + await advancedPolicyField.type('true'); await pageObjects.policy.confirmAndSave(); await testSubjects.existOrFail('policyDetailsSuccessMessage'); @@ -354,11 +356,12 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { }, policy: { linux: { - events: { file: false, network: true, process: true }, + events: { file: true, network: true, process: true }, logging: { file: 'info' }, + advanced: { agent: { connection_delay: 'true' } }, }, mac: { - events: { file: false, network: true, process: true }, + events: { file: true, network: true, process: true }, logging: { file: 'info' }, malware: { mode: 'prevent' }, popup: { @@ -372,7 +375,144 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { events: { dll_and_driver_load: true, dns: true, - file: false, + file: true, + network: true, + process: true, + registry: true, + security: true, + }, + logging: { file: 'info' }, + malware: { mode: 'prevent' }, + popup: { + malware: { + enabled: true, + message: 'Elastic Security { action } { filename }', + }, + }, + antivirus_registration: { + enabled: false, + }, + }, + }, + streams: [], + type: 'endpoint', + use_output: 'default', + }, + ]); + + // Clear the value + await advancedPolicyField.clearValue(); + await pageObjects.policy.confirmAndSave(); + + await testSubjects.existOrFail('policyDetailsSuccessMessage'); + + const agentFullPolicyUpdated = await policyTestResources.getFullAgentPolicy( + policyInfo.agentPolicy.id + ); + + expect(agentFullPolicyUpdated.inputs).to.eql([ + { + id: policyInfo.packagePolicy.id, + revision: 3, + data_stream: { namespace: 'default' }, + name: 'Protect East Coast', + meta: { + package: { + name: 'endpoint', + version: policyInfo.packageInfo.version, + }, + }, + artifact_manifest: { + artifacts: { + 'endpoint-exceptionlist-macos-v1': { + compression_algorithm: 'zlib', + decoded_sha256: + 'd801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', + decoded_size: 14, + encoded_sha256: + 'f8e6afa1d5662f5b37f83337af774b5785b5b7f1daee08b7b00c2d6813874cda', + encoded_size: 22, + encryption_algorithm: 'none', + relative_url: + '/api/endpoint/artifacts/download/endpoint-exceptionlist-macos-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', + }, + 'endpoint-exceptionlist-windows-v1': { + compression_algorithm: 'zlib', + decoded_sha256: + 'd801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', + decoded_size: 14, + encoded_sha256: + 'f8e6afa1d5662f5b37f83337af774b5785b5b7f1daee08b7b00c2d6813874cda', + encoded_size: 22, + encryption_algorithm: 'none', + relative_url: + '/api/endpoint/artifacts/download/endpoint-exceptionlist-windows-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', + }, + 'endpoint-trustlist-linux-v1': { + compression_algorithm: 'zlib', + decoded_sha256: + 'd801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', + decoded_size: 14, + encoded_sha256: + 'f8e6afa1d5662f5b37f83337af774b5785b5b7f1daee08b7b00c2d6813874cda', + encoded_size: 22, + encryption_algorithm: 'none', + relative_url: + '/api/endpoint/artifacts/download/endpoint-trustlist-linux-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', + }, + 'endpoint-trustlist-macos-v1': { + compression_algorithm: 'zlib', + decoded_sha256: + 'd801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', + decoded_size: 14, + encoded_sha256: + 'f8e6afa1d5662f5b37f83337af774b5785b5b7f1daee08b7b00c2d6813874cda', + encoded_size: 22, + encryption_algorithm: 'none', + relative_url: + '/api/endpoint/artifacts/download/endpoint-trustlist-macos-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', + }, + 'endpoint-trustlist-windows-v1': { + compression_algorithm: 'zlib', + decoded_sha256: + 'd801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', + decoded_size: 14, + encoded_sha256: + 'f8e6afa1d5662f5b37f83337af774b5785b5b7f1daee08b7b00c2d6813874cda', + encoded_size: 22, + encryption_algorithm: 'none', + relative_url: + '/api/endpoint/artifacts/download/endpoint-trustlist-windows-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658', + }, + }, + // The manifest version could have changed when the Policy was updated because the + // policy details page ensures that a save action applies the udpated policy on top + // of the latest Package Policy. So we just ignore the check against this value by + // forcing it to be the same as the value returned in the full agent policy. + manifest_version: agentFullPolicy.inputs[0].artifact_manifest.manifest_version, + schema_version: 'v1', + }, + policy: { + linux: { + events: { file: true, network: true, process: true }, + logging: { file: 'info' }, + }, + mac: { + events: { file: true, network: true, process: true }, + logging: { file: 'info' }, + malware: { mode: 'prevent' }, + popup: { + malware: { + enabled: true, + message: 'Elastic Security { action } { filename }', + }, + }, + }, + windows: { + events: { + dll_and_driver_load: true, + dns: true, + file: true, network: true, process: true, registry: true, From fd115dd589ab6468833594422f829e49aef7ad0a Mon Sep 17 00:00:00 2001 From: kevinlog Date: Tue, 1 Dec 2020 13:36:06 -0500 Subject: [PATCH 7/9] adjust test --- .../security_solution_endpoint/apps/endpoint/policy_details.ts | 2 -- 1 file changed, 2 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 5cfa727b7540c..669191242dca2 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 @@ -394,7 +394,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { }, }, }, - streams: [], type: 'endpoint', use_output: 'default', }, @@ -531,7 +530,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { }, }, }, - streams: [], type: 'endpoint', use_output: 'default', }, From 58ee34b94ef48ba1d86cfed15840fade4532981a Mon Sep 17 00:00:00 2001 From: kevinlog Date: Tue, 1 Dec 2020 17:04:46 -0500 Subject: [PATCH 8/9] fix test --- .../apps/endpoint/policy_details.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 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 669191242dca2..4a65958812344 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 @@ -130,7 +130,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { expect(agentFullPolicy.inputs).to.eql([ { id: policyInfo.packagePolicy.id, - revision: 2, + revision: 3, data_stream: { namespace: 'default' }, name: 'Protect East Coast', meta: { @@ -261,8 +261,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { const advancedPolicyField = await pageObjects.policy.findAdvancedPolicyField(); await advancedPolicyField.clearValue(); - - await pageObjects.policy.confirmAndSave(); + await advancedPolicyField.click(); await advancedPolicyField.type('true'); await pageObjects.policy.confirmAndSave(); @@ -400,7 +399,8 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { ]); // Clear the value - await advancedPolicyField.clearValue(); + await advancedPolicyField.click(); + await advancedPolicyField.clearValueWithKeyboard(); await pageObjects.policy.confirmAndSave(); await testSubjects.existOrFail('policyDetailsSuccessMessage'); From 1b3d631c9ebd5a3110709d0039d1c753df37ac6f Mon Sep 17 00:00:00 2001 From: kevinlog Date: Wed, 2 Dec 2020 07:27:30 -0500 Subject: [PATCH 9/9] fix typo --- .../security_solution_endpoint/apps/endpoint/policy_details.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 4a65958812344..1a7933ce64abd 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 @@ -130,7 +130,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { expect(agentFullPolicy.inputs).to.eql([ { id: policyInfo.packagePolicy.id, - revision: 3, + revision: 2, data_stream: { namespace: 'default' }, name: 'Protect East Coast', meta: {