From bb0c99e22eb65672fb8ed93613c9b3b5a50521a1 Mon Sep 17 00:00:00 2001 From: Greg Thompson Date: Thu, 5 Nov 2020 08:00:38 -0700 Subject: [PATCH 1/6] eui to v30.2.0 --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 44a0c833eae27..e4931aaeb64d2 100644 --- a/package.json +++ b/package.json @@ -105,7 +105,7 @@ "@elastic/datemath": "link:packages/elastic-datemath", "@elastic/elasticsearch": "7.10.0-rc.1", "@elastic/ems-client": "7.10.0", - "@elastic/eui": "30.1.1", + "@elastic/eui": "30.2.0", "@elastic/filesaver": "1.1.2", "@elastic/good": "8.1.1-kibana2", "@elastic/node-crypto": "1.2.1", diff --git a/yarn.lock b/yarn.lock index 6ba53d0e4dd43..bb59d93ba5255 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1433,10 +1433,10 @@ resolved "https://registry.yarnpkg.com/@elastic/eslint-plugin-eui/-/eslint-plugin-eui-0.0.2.tgz#56b9ef03984a05cc213772ae3713ea8ef47b0314" integrity sha512-IoxURM5zraoQ7C8f+mJb9HYSENiZGgRVcG4tLQxE61yHNNRDXtGDWTZh8N1KIHcsqN1CEPETjuzBXkJYF/fDiQ== -"@elastic/eui@30.1.1": - version "30.1.1" - resolved "https://registry.yarnpkg.com/@elastic/eui/-/eui-30.1.1.tgz#7d3a4e8241cca2e27078f9fa6a0138b26acd3db3" - integrity sha512-nsqrOFJfPIGS+TTd4W4viesWdPEDCxazfrPc+DZQ4kosRXLKoJ4lLKDuJKbg90HshCeamKSFgEiqWlqKAlyV+A== +"@elastic/eui@30.2.0": + version "30.2.0" + resolved "https://registry.yarnpkg.com/@elastic/eui/-/eui-30.2.0.tgz#17bc630eb1a03e05d453b9934568cfbf3a82b736" + integrity sha512-VUmy7Qz49kN8a3f58bilfMwBo9zCJvHyBOUdDA1O77jFYv3+Hg7e/+uGb7Q1k6kSmCfv4r99eZWrcxVroYU4nQ== dependencies: "@types/chroma-js" "^2.0.0" "@types/lodash" "^4.14.160" From c69b015041f644cad41c6937fefdff03f4864b87 Mon Sep 17 00:00:00 2001 From: Greg Thompson Date: Thu, 5 Nov 2020 08:01:24 -0700 Subject: [PATCH 2/6] src snapshot updates --- .../__snapshots__/dashboard_empty_screen.test.tsx.snap | 4 ++-- .../data/components/__snapshots__/data_view.test.tsx.snap | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/dashboard/public/application/__snapshots__/dashboard_empty_screen.test.tsx.snap b/src/plugins/dashboard/public/application/__snapshots__/dashboard_empty_screen.test.tsx.snap index 31ef011835917..dac84c87faf97 100644 --- a/src/plugins/dashboard/public/application/__snapshots__/dashboard_empty_screen.test.tsx.snap +++ b/src/plugins/dashboard/public/application/__snapshots__/dashboard_empty_screen.test.tsx.snap @@ -297,7 +297,7 @@ exports[`DashboardEmptyScreen renders correctly with readonly mode 1`] = ` paddingSize="none" >
Date: Thu, 5 Nov 2020 08:05:59 -0700 Subject: [PATCH 3/6] x-pack euipanel snapshot updates --- .../__snapshots__/asset.stories.storyshot | 4 +- .../asset_manager.stories.storyshot | 6 +- .../custom_element_modal.stories.storyshot | 8 +-- .../element_card.stories.storyshot | 8 +-- .../element_grid.stories.storyshot | 6 +- .../saved_elements_modal.stories.storyshot | 8 +-- .../shape_picker_popover.stories.storyshot | 6 +- .../__snapshots__/settings.test.tsx.snap | 10 ++-- .../__snapshots__/policy_table.test.tsx.snap | 2 +- .../__snapshots__/add_license.test.js.snap | 4 +- .../request_trial_extension.test.js.snap | 8 +-- .../revert_to_basic.test.js.snap | 6 +- .../__snapshots__/start_trial.test.js.snap | 8 +-- .../upload_license.test.tsx.snap | 10 ++-- .../upgrade_failure.test.js.snap | 6 +- .../__snapshots__/no_data.test.js.snap | 4 +- .../__snapshots__/page_loading.test.js.snap | 2 +- .../roles_grid_page.test.tsx.snap | 2 +- .../reset_session_page.test.tsx.snap | 2 +- .../__snapshots__/index.test.tsx.snap | 10 ++++ .../__snapshots__/index.test.tsx.snap | 60 +++++++++---------- .../__snapshots__/index.test.tsx.snap | 2 +- .../note_card_body.test.tsx.snap | 10 ++++ .../__snapshots__/empty_state.test.tsx.snap | 8 +-- .../__snapshots__/monitor_list.test.tsx.snap | 2 +- 25 files changed, 111 insertions(+), 91 deletions(-) diff --git a/x-pack/plugins/canvas/public/components/asset_manager/__stories__/__snapshots__/asset.stories.storyshot b/x-pack/plugins/canvas/public/components/asset_manager/__stories__/__snapshots__/asset.stories.storyshot index e62785272a5ec..05339ca558562 100644 --- a/x-pack/plugins/canvas/public/components/asset_manager/__stories__/__snapshots__/asset.stories.storyshot +++ b/x-pack/plugins/canvas/public/components/asset_manager/__stories__/__snapshots__/asset.stories.storyshot @@ -12,7 +12,7 @@ exports[`Storyshots components/Assets/Asset airplane 1`] = ` className="euiFlexItem" >
Hide Toolbar
Hide the toolbar when the mouse is not within the Canvas?
"`; +exports[` can navigate Toolbar Settings, closes when activated 3`] = `"
Settings
Hide Toolbar
Hide the toolbar when the mouse is not within the Canvas?
"`; diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/components/__snapshots__/policy_table.test.tsx.snap b/x-pack/plugins/index_lifecycle_management/__jest__/components/__snapshots__/policy_table.test.tsx.snap index 06cd77558b443..ba2ec28bf6bc1 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/components/__snapshots__/policy_table.test.tsx.snap +++ b/x-pack/plugins/index_lifecycle_management/__jest__/components/__snapshots__/policy_table.test.tsx.snap @@ -50,7 +50,7 @@ exports[`policy table should show empty state when there are not any policies 1` class="euiPageBody" >
Update your license

If you already have a new license, upload it now.

"`; +exports[`AddLicense component when license is active should display correct verbiage 1`] = `"
Update your license

If you already have a new license, upload it now.

"`; -exports[`AddLicense component when license is expired should display with correct verbiage 1`] = `"
Update your license

If you already have a new license, upload it now.

"`; +exports[`AddLicense component when license is expired should display with correct verbiage 1`] = `"
Update your license

If you already have a new license, upload it now.

"`; diff --git a/x-pack/plugins/license_management/__jest__/__snapshots__/request_trial_extension.test.js.snap b/x-pack/plugins/license_management/__jest__/__snapshots__/request_trial_extension.test.js.snap index db37bc6cb98c4..719fce35a2a68 100644 --- a/x-pack/plugins/license_management/__jest__/__snapshots__/request_trial_extension.test.js.snap +++ b/x-pack/plugins/license_management/__jest__/__snapshots__/request_trial_extension.test.js.snap @@ -1,9 +1,9 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`RequestTrialExtension component should display when enterprise license is not active and trial has been used 1`] = `"
Extend your trial

If you’d like to continue using machine learning, advanced security, and our other awesome subscription features, request an extension now.

"`; +exports[`RequestTrialExtension component should display when enterprise license is not active and trial has been used 1`] = `"
Extend your trial

If you’d like to continue using machine learning, advanced security, and our other awesome subscription features(opens in a new tab or window), request an extension now.

"`; -exports[`RequestTrialExtension component should display when license is active and trial has been used 1`] = `"
Extend your trial

If you’d like to continue using machine learning, advanced security, and our other awesome subscription features, request an extension now.

"`; +exports[`RequestTrialExtension component should display when license is active and trial has been used 1`] = `"
Extend your trial

If you’d like to continue using machine learning, advanced security, and our other awesome subscription features(opens in a new tab or window), request an extension now.

"`; -exports[`RequestTrialExtension component should display when license is not active and trial has been used 1`] = `"
Extend your trial

If you’d like to continue using machine learning, advanced security, and our other awesome subscription features, request an extension now.

"`; +exports[`RequestTrialExtension component should display when license is not active and trial has been used 1`] = `"
Extend your trial

If you’d like to continue using machine learning, advanced security, and our other awesome subscription features(opens in a new tab or window), request an extension now.

"`; -exports[`RequestTrialExtension component should display when platinum license is not active and trial has been used 1`] = `"
Extend your trial

If you’d like to continue using machine learning, advanced security, and our other awesome subscription features, request an extension now.

"`; +exports[`RequestTrialExtension component should display when platinum license is not active and trial has been used 1`] = `"
Extend your trial

If you’d like to continue using machine learning, advanced security, and our other awesome subscription features(opens in a new tab or window), request an extension now.

"`; diff --git a/x-pack/plugins/license_management/__jest__/__snapshots__/revert_to_basic.test.js.snap b/x-pack/plugins/license_management/__jest__/__snapshots__/revert_to_basic.test.js.snap index 24598635b28e3..a0f3948785a80 100644 --- a/x-pack/plugins/license_management/__jest__/__snapshots__/revert_to_basic.test.js.snap +++ b/x-pack/plugins/license_management/__jest__/__snapshots__/revert_to_basic.test.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`RevertToBasic component should display when license is about to expire 1`] = `"
Revert to Basic license

You’ll revert to our free features and lose access to machine learning, advanced security, and other subscription features.

"`; +exports[`RevertToBasic component should display when license is about to expire 1`] = `"
Revert to Basic license

You’ll revert to our free features and lose access to machine learning, advanced security, and other subscription features(opens in a new tab or window).

"`; -exports[`RevertToBasic component should display when license is expired 1`] = `"
Revert to Basic license

You’ll revert to our free features and lose access to machine learning, advanced security, and other subscription features.

"`; +exports[`RevertToBasic component should display when license is expired 1`] = `"
Revert to Basic license

You’ll revert to our free features and lose access to machine learning, advanced security, and other subscription features(opens in a new tab or window).

"`; -exports[`RevertToBasic component should display when trial is active 1`] = `"
Revert to Basic license

You’ll revert to our free features and lose access to machine learning, advanced security, and other subscription features.

"`; +exports[`RevertToBasic component should display when trial is active 1`] = `"
Revert to Basic license

You’ll revert to our free features and lose access to machine learning, advanced security, and other subscription features(opens in a new tab or window).

"`; diff --git a/x-pack/plugins/license_management/__jest__/__snapshots__/start_trial.test.js.snap b/x-pack/plugins/license_management/__jest__/__snapshots__/start_trial.test.js.snap index 24872a888b090..52a2da596c10e 100644 --- a/x-pack/plugins/license_management/__jest__/__snapshots__/start_trial.test.js.snap +++ b/x-pack/plugins/license_management/__jest__/__snapshots__/start_trial.test.js.snap @@ -1,9 +1,9 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`StartTrial component when trial is allowed display for basic license 1`] = `"
Start a 30-day trial

Experience what machine learning, advanced security, and all our other subscription features have to offer.

"`; +exports[`StartTrial component when trial is allowed display for basic license 1`] = `"
Start a 30-day trial

Experience what machine learning, advanced security, and all our other subscription features(opens in a new tab or window) have to offer.

"`; -exports[`StartTrial component when trial is allowed should display for expired enterprise license 1`] = `"
Start a 30-day trial

Experience what machine learning, advanced security, and all our other subscription features have to offer.

"`; +exports[`StartTrial component when trial is allowed should display for expired enterprise license 1`] = `"
Start a 30-day trial

Experience what machine learning, advanced security, and all our other subscription features(opens in a new tab or window) have to offer.

"`; -exports[`StartTrial component when trial is allowed should display for expired platinum license 1`] = `"
Start a 30-day trial

Experience what machine learning, advanced security, and all our other subscription features have to offer.

"`; +exports[`StartTrial component when trial is allowed should display for expired platinum license 1`] = `"
Start a 30-day trial

Experience what machine learning, advanced security, and all our other subscription features(opens in a new tab or window) have to offer.

"`; -exports[`StartTrial component when trial is allowed should display for gold license 1`] = `"
Start a 30-day trial

Experience what machine learning, advanced security, and all our other subscription features have to offer.

"`; +exports[`StartTrial component when trial is allowed should display for gold license 1`] = `"
Start a 30-day trial

Experience what machine learning, advanced security, and all our other subscription features(opens in a new tab or window) have to offer.

"`; diff --git a/x-pack/plugins/license_management/__jest__/__snapshots__/upload_license.test.tsx.snap b/x-pack/plugins/license_management/__jest__/__snapshots__/upload_license.test.tsx.snap index 72c04992566bd..cc41a3a4b4e22 100644 --- a/x-pack/plugins/license_management/__jest__/__snapshots__/upload_license.test.tsx.snap +++ b/x-pack/plugins/license_management/__jest__/__snapshots__/upload_license.test.tsx.snap @@ -270,7 +270,7 @@ exports[`UploadLicense should display a modal when license requires acknowledgem paddingSize="l" >
renders permission denied if required 1`] = ` paddingSize="l" >
MockedFonts

You do not have permission to access the requested page

Either go back to the previous page or log in as a different user.

"`; +exports[`ResetSessionPage renders as expected 1`] = `"MockedFonts

You do not have permission to access the requested page

Either go back to the previous page or log in as a different user.

"`; diff --git a/x-pack/plugins/security_solution/public/common/components/paginated_table/__snapshots__/index.test.tsx.snap b/x-pack/plugins/security_solution/public/common/components/paginated_table/__snapshots__/index.test.tsx.snap index 6331a2e02b219..6d114258224d1 100644 --- a/x-pack/plugins/security_solution/public/common/components/paginated_table/__snapshots__/index.test.tsx.snap +++ b/x-pack/plugins/security_solution/public/common/components/paginated_table/__snapshots__/index.test.tsx.snap @@ -39,6 +39,7 @@ exports[`Paginated Table Component rendering it renders the default load more ta "euiBorderColor": "#343741", "euiBorderEditable": "2px dotted #343741", "euiBorderRadius": "4px", + "euiBorderRadiusSmall": "2px", "euiBorderThick": "2px solid #343741", "euiBorderThin": "1px solid #343741", "euiBorderWidthThick": "2px", @@ -375,6 +376,15 @@ exports[`Paginated Table Component rendering it renders the default load more ta }, }, "euiPaletteColorBlindKeys": "'euiColorVis0', 'euiColorVis1', 'euiColorVis2', 'euiColorVis3', 'euiColorVis4', 'euiColorVis5', 'euiColorVis6', 'euiColorVis7', 'euiColorVis8', 'euiColorVis9'", + "euiPanelBackgroundColorModifiers": Object { + "plain": "#1d1e24", + "subdued": "#25262e", + "transparent": "rgba(0, 0, 0, 0)", + }, + "euiPanelBorderRadiusModifiers": Object { + "borderRadiusMedium": "4px", + "borderRadiusNone": 0, + }, "euiPanelPaddingModifiers": Object { "paddingLarge": "24px", "paddingMedium": "16px", diff --git a/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/components/trusted_apps_grid/__snapshots__/index.test.tsx.snap b/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/components/trusted_apps_grid/__snapshots__/index.test.tsx.snap index c82b9cac8ab1f..25c255806a7a2 100644 --- a/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/components/trusted_apps_grid/__snapshots__/index.test.tsx.snap +++ b/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/components/trusted_apps_grid/__snapshots__/index.test.tsx.snap @@ -121,7 +121,7 @@ exports[`TrustedAppsGrid renders correctly when loaded data 1`] = ` class="euiFlexItem euiFlexItem--flexGrowZero" >
Date: Thu, 5 Nov 2020 08:08:44 -0700 Subject: [PATCH 4/6] x-pack external link updates --- .../CustomLinkFlyout/link_preview.test.tsx | 13 ++++-- .../__snapshots__/exporters.test.js.snap | 20 +++++++++ .../__snapshots__/reason_found.test.js.snap | 20 +++++++++ .../api_keys_grid_page.test.tsx.snap | 27 ++++++++++- .../common/components/links/index.test.tsx | 11 ++--- .../markdown_editor/renderer.test.tsx | 7 +-- .../network/components/port/index.test.tsx | 5 ++- .../source_destination/index.test.tsx | 15 ++++--- .../source_destination_ip.test.tsx | 25 +++++++---- .../certificate_fingerprint/index.test.tsx | 9 ++-- .../components/ja3_fingerprint/index.test.tsx | 7 +-- .../components/netflow/index.test.tsx | 45 +++++++++++-------- .../body/renderers/get_row_renderer.test.tsx | 7 +-- .../suricata/suricata_details.test.tsx | 3 +- .../suricata/suricata_row_renderer.test.tsx | 3 +- .../system/generic_row_renderer.test.tsx | 15 ++++--- .../body/renderers/zeek/zeek_details.test.tsx | 11 ++--- .../renderers/zeek/zeek_row_renderer.test.tsx | 3 +- .../renderers/zeek/zeek_signature.test.tsx | 3 +- .../components/health_check.test.tsx | 14 +++--- .../__snapshots__/expanded_row.test.tsx.snap | 10 +++++ .../monitor_status.bar.test.tsx.snap | 10 +++++ x-pack/test_utils/lib/index.ts | 2 +- x-pack/test_utils/lib/utils.ts | 3 ++ 24 files changed, 210 insertions(+), 78 deletions(-) diff --git a/x-pack/plugins/apm/public/components/app/Settings/CustomizeUI/CustomLink/CustomLinkFlyout/link_preview.test.tsx b/x-pack/plugins/apm/public/components/app/Settings/CustomizeUI/CustomLink/CustomLinkFlyout/link_preview.test.tsx index 4ccfc5b3013e9..c5f25a697a0c9 100644 --- a/x-pack/plugins/apm/public/components/app/Settings/CustomizeUI/CustomLink/CustomLinkFlyout/link_preview.test.tsx +++ b/x-pack/plugins/apm/public/components/app/Settings/CustomizeUI/CustomLink/CustomLinkFlyout/link_preview.test.tsx @@ -12,6 +12,7 @@ import { act, waitFor, } from '@testing-library/react'; +import { removeExternalLinkText } from '../../../../../../../../../test_utils'; import * as apmApi from '../../../../../../services/rest/createCallApmApi'; describe('LinkPreview', () => { @@ -53,7 +54,9 @@ describe('LinkPreview', () => { ); expect(getElementValue(container, 'preview-label')).toEqual('foo'); expect( - (getByTestId(container, 'preview-link') as HTMLAnchorElement).text + removeExternalLinkText( + (getByTestId(container, 'preview-link') as HTMLAnchorElement).text + ) ).toEqual('https://baz.co'); }); }); @@ -69,7 +72,9 @@ describe('LinkPreview', () => { ); expect(getElementValue(container, 'preview-label')).toEqual('foo'); expect( - (getByTestId(container, 'preview-link') as HTMLAnchorElement).text + removeExternalLinkText( + (getByTestId(container, 'preview-link') as HTMLAnchorElement).text + ) ).toEqual('https://baz.co?service.name={{invalid}'); expect(getByTestId(container, 'preview-warning')).toBeInTheDocument(); }); @@ -85,7 +90,9 @@ describe('LinkPreview', () => { await waitFor(() => expect(callApmApiSpy).toHaveBeenCalled()); expect(getElementValue(container, 'preview-label')).toEqual('foo'); expect( - (getByTestId(container, 'preview-link') as HTMLAnchorElement).text + removeExternalLinkText( + (getByTestId(container, 'preview-link') as HTMLAnchorElement).text + ) ).toEqual('https://baz.co?transaction=foo'); }); }); diff --git a/x-pack/plugins/monitoring/public/components/no_data/explanations/exporters/__tests__/__snapshots__/exporters.test.js.snap b/x-pack/plugins/monitoring/public/components/no_data/explanations/exporters/__tests__/__snapshots__/exporters.test.js.snap index fb06ff2d866bb..ed45933fa9471 100644 --- a/x-pack/plugins/monitoring/public/components/no_data/explanations/exporters/__tests__/__snapshots__/exporters.test.js.snap +++ b/x-pack/plugins/monitoring/public/components/no_data/explanations/exporters/__tests__/__snapshots__/exporters.test.js.snap @@ -110,6 +110,16 @@ Array [ target="_blank" > cloud dashboard. + + + (opens in a new tab or window) + For more information on Monitoring in Elastic Cloud, please see the documentation. + + + (opens in a new tab or window) +

diff --git a/x-pack/plugins/monitoring/public/components/no_data/reasons/__tests__/__snapshots__/reason_found.test.js.snap b/x-pack/plugins/monitoring/public/components/no_data/reasons/__tests__/__snapshots__/reason_found.test.js.snap index e7b88e23c5f68..9e3b7c0e25d5d 100644 --- a/x-pack/plugins/monitoring/public/components/no_data/reasons/__tests__/__snapshots__/reason_found.test.js.snap +++ b/x-pack/plugins/monitoring/public/components/no_data/reasons/__tests__/__snapshots__/reason_found.test.js.snap @@ -185,6 +185,16 @@ Array [ target="_blank" > cloud dashboard. + + + (opens in a new tab or window) + For more information on Monitoring in Elastic Cloud, please see the documentation. + + + (opens in a new tab or window) +

diff --git a/x-pack/plugins/security/public/management/api_keys/api_keys_grid/__snapshots__/api_keys_grid_page.test.tsx.snap b/x-pack/plugins/security/public/management/api_keys/api_keys_grid/__snapshots__/api_keys_grid_page.test.tsx.snap index b316182f3b80d..8966acee95c5d 100644 --- a/x-pack/plugins/security/public/management/api_keys/api_keys_grid/__snapshots__/api_keys_grid_page.test.tsx.snap +++ b/x-pack/plugins/security/public/management/api_keys/api_keys_grid/__snapshots__/api_keys_grid_page.test.tsx.snap @@ -92,6 +92,31 @@ exports[`APIKeysGridPage renders a callout when API keys are not enabled 1`] = ` > docs + + + + + + + (opens in a new tab or window) + + + to enable API keys. @@ -119,7 +144,7 @@ exports[`APIKeysGridPage renders permission denied if user does not have require paddingSize="l" >
{ const wrapper = mountWithIntl( {'Example Link'} ); - expect(wrapper.text()).toEqual('Example Link'); + expect(removeExternalLinkText(wrapper.text())).toEqual('Example Link'); }); test('it renders props passed in as link', () => { @@ -448,7 +449,7 @@ describe('Custom Links', () => { describe('WhoisLink', () => { test('it renders ip passed in as domain', () => { const wrapper = mountWithIntl({'Example Link'}); - expect(wrapper.text()).toEqual('Example Link'); + expect(removeExternalLinkText(wrapper.text())).toEqual('Example Link'); }); test('it renders correct href', () => { @@ -473,7 +474,7 @@ describe('Custom Links', () => { {'Example Link'} ); - expect(wrapper.text()).toEqual('Example Link'); + expect(removeExternalLinkText(wrapper.text())).toEqual('Example Link'); }); test('it renders correct href', () => { @@ -504,7 +505,7 @@ describe('Custom Links', () => { const wrapper = mountWithIntl( {'Example Link'} ); - expect(wrapper.text()).toEqual('Example Link'); + expect(removeExternalLinkText(wrapper.text())).toEqual('Example Link'); }); test('it renders correct href', () => { @@ -533,7 +534,7 @@ describe('Custom Links', () => { const wrapper = mountWithIntl( {'Example Link'} ); - expect(wrapper.text()).toEqual('Example Link'); + expect(removeExternalLinkText(wrapper.text())).toEqual('Example Link'); }); test('it renders correct href when port is a number', () => { diff --git a/x-pack/plugins/security_solution/public/common/components/markdown_editor/renderer.test.tsx b/x-pack/plugins/security_solution/public/common/components/markdown_editor/renderer.test.tsx index e6a38863d7e5f..2ef924117d896 100644 --- a/x-pack/plugins/security_solution/public/common/components/markdown_editor/renderer.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/markdown_editor/renderer.test.tsx @@ -7,6 +7,7 @@ import React from 'react'; import { mount } from 'enzyme'; +import { removeExternalLinkText } from '../../../../../../test_utils'; import { MarkdownRenderer } from './renderer'; describe('Markdown', () => { @@ -16,9 +17,9 @@ describe('Markdown', () => { test('it renders the expected link text', () => { const wrapper = mount({markdownWithLink}); - expect(wrapper.find('[data-test-subj="markdown-link"]').first().text()).toEqual( - 'External Site' - ); + expect( + removeExternalLinkText(wrapper.find('[data-test-subj="markdown-link"]').first().text()) + ).toEqual('External Site'); }); test('it renders the expected href', () => { diff --git a/x-pack/plugins/security_solution/public/network/components/port/index.test.tsx b/x-pack/plugins/security_solution/public/network/components/port/index.test.tsx index c0317e42598c9..fdece2be9f785 100644 --- a/x-pack/plugins/security_solution/public/network/components/port/index.test.tsx +++ b/x-pack/plugins/security_solution/public/network/components/port/index.test.tsx @@ -7,6 +7,7 @@ import { shallow } from 'enzyme'; import React from 'react'; +import { removeExternalLinkText } from '../../../../../../test_utils'; import '../../../common/mock/match_media'; import { TestProviders } from '../../../common/mock/test_providers'; import { useMountAppended } from '../../../common/utils/use_mount_appended'; @@ -30,7 +31,9 @@ describe('Port', () => { ); - expect(wrapper.find('[data-test-subj="port"]').first().text()).toEqual('443'); + expect(removeExternalLinkText(wrapper.find('[data-test-subj="port"]').first().text())).toEqual( + '443' + ); }); test('it hyperlinks links destination.port to an external service that describes the purpose of the port', () => { diff --git a/x-pack/plugins/security_solution/public/network/components/source_destination/index.test.tsx b/x-pack/plugins/security_solution/public/network/components/source_destination/index.test.tsx index 2ba5cd868c2b8..8fbb7692b2ff8 100644 --- a/x-pack/plugins/security_solution/public/network/components/source_destination/index.test.tsx +++ b/x-pack/plugins/security_solution/public/network/components/source_destination/index.test.tsx @@ -9,6 +9,7 @@ import { shallow } from 'enzyme'; import { get } from 'lodash/fp'; import React from 'react'; +import { removeExternalLinkText } from '../../../../../../test_utils'; import { asArrayIfExists } from '../../../common/lib/helpers'; import { getMockNetflowData } from '../../../common/mock'; import '../../../common/mock/match_media'; @@ -189,9 +190,11 @@ describe('SourceDestination', () => { test('it renders the destination ip and port, separated with a colon', () => { const wrapper = mount({getSourceDestinationInstance()}); - expect(wrapper.find('[data-test-subj="destination-ip-and-port"]').first().text()).toEqual( - '10.1.2.3:80' - ); + expect( + removeExternalLinkText( + wrapper.find('[data-test-subj="destination-ip-and-port"]').first().text() + ) + ).toEqual('10.1.2.3:80'); }); test('it renders destination.packets', () => { @@ -313,9 +316,9 @@ describe('SourceDestination', () => { test('it renders the source ip and port, separated with a colon', () => { const wrapper = mount({getSourceDestinationInstance()}); - expect(wrapper.find('[data-test-subj="source-ip-and-port"]').first().text()).toEqual( - '192.168.1.2:9987' - ); + expect( + removeExternalLinkText(wrapper.find('[data-test-subj="source-ip-and-port"]').first().text()) + ).toEqual('192.168.1.2:9987'); }); test('it renders source.packets', () => { diff --git a/x-pack/plugins/security_solution/public/network/components/source_destination/source_destination_ip.test.tsx b/x-pack/plugins/security_solution/public/network/components/source_destination/source_destination_ip.test.tsx index 890add4222503..ee6345bd7f372 100644 --- a/x-pack/plugins/security_solution/public/network/components/source_destination/source_destination_ip.test.tsx +++ b/x-pack/plugins/security_solution/public/network/components/source_destination/source_destination_ip.test.tsx @@ -7,6 +7,7 @@ import { get } from 'lodash/fp'; import React from 'react'; +import { removeExternalLinkText } from '../../../../../../test_utils'; import { asArrayIfExists } from '../../../common/lib/helpers'; import { getMockNetflowData } from '../../../common/mock'; import '../../../common/mock/match_media'; @@ -976,9 +977,11 @@ describe('SourceDestinationIp', () => { ); - expect(wrapper.find('[data-test-subj="draggable-content-source.port"]').first().text()).toEqual( - '9987' - ); + expect( + removeExternalLinkText( + wrapper.find('[data-test-subj="draggable-content-source.port"]').first().text() + ) + ).toEqual('9987'); }); test('it renders the expected destination port when type is `destination`, and both destinationIp and destinationPort are populated', () => { @@ -1028,7 +1031,9 @@ describe('SourceDestinationIp', () => { ); expect( - wrapper.find('[data-test-subj="draggable-content-destination.port"]').first().text() + removeExternalLinkText( + wrapper.find('[data-test-subj="draggable-content-destination.port"]').first().text() + ) ).toEqual('80'); }); @@ -1078,9 +1083,11 @@ describe('SourceDestinationIp', () => { ); - expect(wrapper.find('[data-test-subj="draggable-content-source.port"]').first().text()).toEqual( - '9987' - ); + expect( + removeExternalLinkText( + wrapper.find('[data-test-subj="draggable-content-source.port"]').first().text() + ) + ).toEqual('9987'); }); test('it renders the expected destination port when type is `destination`, and only destinationPort is populated', () => { @@ -1131,7 +1138,9 @@ describe('SourceDestinationIp', () => { ); expect( - wrapper.find('[data-test-subj="draggable-content-destination.port"]').first().text() + removeExternalLinkText( + wrapper.find('[data-test-subj="draggable-content-destination.port"]').first().text() + ) ).toEqual('80'); }); diff --git a/x-pack/plugins/security_solution/public/timelines/components/certificate_fingerprint/index.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/certificate_fingerprint/index.test.tsx index b31094b07a829..720018faded76 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/certificate_fingerprint/index.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/certificate_fingerprint/index.test.tsx @@ -6,6 +6,7 @@ import React from 'react'; +import { removeExternalLinkText } from '../../../../../../test_utils'; import { TestProviders } from '../../../common/mock'; import '../../../common/mock/match_media'; import { useMountAppended } from '../../../common/utils/use_mount_appended'; @@ -43,9 +44,11 @@ describe('CertificateFingerprint', () => { /> ); - expect(wrapper.find('[data-test-subj="certificate-fingerprint-link"]').first().text()).toEqual( - '3f4c57934e089f02ae7511200aee2d7e7aabd272' - ); + expect( + removeExternalLinkText( + wrapper.find('[data-test-subj="certificate-fingerprint-link"]').first().text() + ) + ).toEqual('3f4c57934e089f02ae7511200aee2d7e7aabd272'); }); test('it renders a hyperlink to an external site to compare the fingerprint against a known set of signatures', () => { diff --git a/x-pack/plugins/security_solution/public/timelines/components/ja3_fingerprint/index.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/ja3_fingerprint/index.test.tsx index 899a6d7486f94..620775f7d84d6 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/ja3_fingerprint/index.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/ja3_fingerprint/index.test.tsx @@ -6,6 +6,7 @@ import React from 'react'; +import { removeExternalLinkText } from '../../../../../../test_utils'; import { TestProviders } from '../../../common/mock'; import '../../../common/mock/match_media'; import { useMountAppended } from '../../../common/utils/use_mount_appended'; @@ -42,9 +43,9 @@ describe('Ja3Fingerprint', () => { ); - expect(wrapper.find('[data-test-subj="ja3-fingerprint-link"]').first().text()).toEqual( - 'fff799d91b7c01ae3fe6787cfc895552' - ); + expect( + removeExternalLinkText(wrapper.find('[data-test-subj="ja3-fingerprint-link"]').first().text()) + ).toEqual('fff799d91b7c01ae3fe6787cfc895552'); }); test('it renders a hyperlink to an external site to compare the fingerprint against a known set of signatures', () => { diff --git a/x-pack/plugins/security_solution/public/timelines/components/netflow/index.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/netflow/index.test.tsx index c2026a71ac6ff..412343fa8dc06 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/netflow/index.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/netflow/index.test.tsx @@ -8,6 +8,7 @@ import { get } from 'lodash/fp'; import React from 'react'; import { shallow } from 'enzyme'; +import { removeExternalLinkText } from '../../../../../../test_utils'; import { asArrayIfExists } from '../../../common/lib/helpers'; import { getMockNetflowData } from '../../../common/mock'; import '../../../common/mock/match_media'; @@ -188,9 +189,11 @@ describe('Netflow', () => { test('it renders the destination ip and port, separated with a colon', () => { const wrapper = mount({getNetflowInstance()}); - expect(wrapper.find('[data-test-subj="destination-ip-and-port"]').first().text()).toEqual( - '10.1.2.3:80' - ); + expect( + removeExternalLinkText( + wrapper.find('[data-test-subj="destination-ip-and-port"]').first().text() + ) + ).toEqual('10.1.2.3:80'); }); test('it renders destination.packets', () => { @@ -324,9 +327,9 @@ describe('Netflow', () => { test('it renders the source ip and port, separated with a colon', () => { const wrapper = mount({getNetflowInstance()}); - expect(wrapper.find('[data-test-subj="source-ip-and-port"]').first().text()).toEqual( - '192.168.1.2:9987' - ); + expect( + removeExternalLinkText(wrapper.find('[data-test-subj="source-ip-and-port"]').first().text()) + ).toEqual('192.168.1.2:9987'); }); test('it renders source.packets', () => { @@ -353,11 +356,13 @@ describe('Netflow', () => { const wrapper = mount({getNetflowInstance()}); expect( - wrapper - .find('[data-test-subj="client-certificate-fingerprint"]') - .find('[data-test-subj="certificate-fingerprint-link"]') - .first() - .text() + removeExternalLinkText( + wrapper + .find('[data-test-subj="client-certificate-fingerprint"]') + .find('[data-test-subj="certificate-fingerprint-link"]') + .first() + .text() + ) ).toEqual('tls.client_certificate.fingerprint.sha1-value'); }); @@ -372,9 +377,9 @@ describe('Netflow', () => { test('renders tls.fingerprints.ja3.hash text', () => { const wrapper = mount({getNetflowInstance()}); - expect(wrapper.find('[data-test-subj="ja3-fingerprint-link"]').first().text()).toEqual( - 'tls.fingerprints.ja3.hash-value' - ); + expect( + removeExternalLinkText(wrapper.find('[data-test-subj="ja3-fingerprint-link"]').first().text()) + ).toEqual('tls.fingerprints.ja3.hash-value'); }); test('it hyperlinks tls.server_certificate.fingerprint.sha1 site to compare the fingerprint against a known set of signatures', () => { @@ -395,11 +400,13 @@ describe('Netflow', () => { const wrapper = mount({getNetflowInstance()}); expect( - wrapper - .find('[data-test-subj="server-certificate-fingerprint"]') - .find('[data-test-subj="certificate-fingerprint-link"]') - .first() - .text() + removeExternalLinkText( + wrapper + .find('[data-test-subj="server-certificate-fingerprint"]') + .find('[data-test-subj="certificate-fingerprint-link"]') + .first() + .text() + ) ).toEqual('tls.server_certificate.fingerprint.sha1-value'); }); diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/get_row_renderer.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/get_row_renderer.test.tsx index 52b9b9a31fc99..ccabd952f4922 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/get_row_renderer.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/get_row_renderer.test.tsx @@ -8,6 +8,7 @@ import { shallow } from 'enzyme'; import { cloneDeep } from 'lodash'; import React from 'react'; +import { removeExternalLinkText } from '../../../../../../../../test_utils'; import '../../../../../common/mock/match_media'; import { mockBrowserFields } from '../../../../../common/containers/source/mock'; import { Ecs } from '../../../../../../common/ecs'; @@ -75,7 +76,7 @@ describe('get_column_renderer', () => { {row} ); - expect(wrapper.text()).toContain( + expect(removeExternalLinkText(wrapper.text())).toContain( '4ETEXPLOITNETGEARWNR2000v5 hidden_lang_avi Stack Overflow (CVE-2016-10174)Source192.168.0.3:53Destination192.168.0.3:6343' ); }); @@ -93,7 +94,7 @@ describe('get_column_renderer', () => { {row} ); - expect(wrapper.text()).toContain( + expect(removeExternalLinkText(wrapper.text())).toContain( '4ETEXPLOITNETGEARWNR2000v5 hidden_lang_avi Stack Overflow (CVE-2016-10174)Source192.168.0.3:53Destination192.168.0.3:6343' ); }); @@ -111,7 +112,7 @@ describe('get_column_renderer', () => { {row} ); - expect(wrapper.text()).toContain( + expect(removeExternalLinkText(wrapper.text())).toContain( 'C8DRTq362Fios6hw16connectionREJSrConnection attempt rejectedtcpSource185.176.26.101:44059Destination207.154.238.205:11568' ); }); diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/suricata/suricata_details.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/suricata/suricata_details.test.tsx index 3b9752224e2c1..3ae74bc5534c8 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/suricata/suricata_details.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/suricata/suricata_details.test.tsx @@ -7,6 +7,7 @@ import { shallow } from 'enzyme'; import React from 'react'; +import { removeExternalLinkText } from '../../../../../../../../../test_utils'; import { mockBrowserFields } from '../../../../../../common/containers/source/mock'; import { mockTimelineData } from '../../../../../../common/mock'; import '../../../../../../common/mock/match_media'; @@ -41,7 +42,7 @@ describe('SuricataDetails', () => { /> ); - expect(wrapper.text()).toEqual( + expect(removeExternalLinkText(wrapper.text())).toEqual( '4ETEXPLOITNETGEARWNR2000v5 hidden_lang_avi Stack Overflow (CVE-2016-10174)Source192.168.0.3:53Destination192.168.0.3:6343' ); }); diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/suricata/suricata_row_renderer.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/suricata/suricata_row_renderer.test.tsx index bed2171715380..24ea252448645 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/suricata/suricata_row_renderer.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/suricata/suricata_row_renderer.test.tsx @@ -8,6 +8,7 @@ import { shallow } from 'enzyme'; import { cloneDeep } from 'lodash/fp'; import React from 'react'; +import { removeExternalLinkText } from '../../../../../../../../../test_utils'; import { mockBrowserFields } from '../../../../../../common/containers/source/mock'; import { Ecs } from '../../../../../../../common/ecs'; import { mockTimelineData } from '../../../../../../common/mock'; @@ -58,7 +59,7 @@ describe('suricata_row_renderer', () => { {children} ); - expect(wrapper.text()).toContain( + expect(removeExternalLinkText(wrapper.text())).toContain( '4ETEXPLOITNETGEARWNR2000v5 hidden_lang_avi Stack Overflow (CVE-2016-10174)Source192.168.0.3:53Destination192.168.0.3:6343' ); }); diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/system/generic_row_renderer.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/system/generic_row_renderer.test.tsx index 6c2e9ad7535a1..2abd14e48e988 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/system/generic_row_renderer.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/system/generic_row_renderer.test.tsx @@ -8,6 +8,7 @@ import { shallow } from 'enzyme'; import { cloneDeep } from 'lodash/fp'; import React from 'react'; +import { removeExternalLinkText } from '../../../../../../../../../test_utils'; import { BrowserFields } from '../../../../../../common/containers/source'; import { mockBrowserFields } from '../../../../../../common/containers/source/mock'; import { Ecs } from '../../../../../../../common/ecs'; @@ -541,7 +542,7 @@ describe('GenericRowRenderer', () => { ); - expect(wrapper.text()).toEqual( + expect(removeExternalLinkText(wrapper.text())).toEqual( 'SYSTEM\\NT AUTHORITY@HD-gqf-0af7b4feaccepted a connection viaAmSvc.exe(1084)tcp1:network-community_idSource127.0.0.1:49306Destination127.0.0.1:49305' ); }); @@ -569,7 +570,7 @@ describe('GenericRowRenderer', () => { ); - expect(wrapper.text()).toEqual( + expect(removeExternalLinkText(wrapper.text())).toEqual( 'SYSTEM\\NT AUTHORITY@HD-55b-3ec87f66accepted a connection via(4)tcp1:network-community_idSource::1:51324Destination::1:5357' ); }); @@ -597,7 +598,7 @@ describe('GenericRowRenderer', () => { ); - expect(wrapper.text()).toEqual( + expect(removeExternalLinkText(wrapper.text())).toEqual( 'Arun\\Anvi-Acer@HD-obe-8bf77f54disconnected viachrome.exe(11620)8.1KBtcp1:LxYHJJv98b2O0fNccXu6HheXmwk=Source192.168.0.6:59356(25.78%)2.1KB(74.22%)6KBDestination10.156.162.53:443' ); }); @@ -625,7 +626,7 @@ describe('GenericRowRenderer', () => { ); - expect(wrapper.text()).toEqual( + expect(removeExternalLinkText(wrapper.text())).toEqual( 'SYSTEM\\NT AUTHORITY@HD-55b-3ec87f66disconnected via(4)7.9KBtcp1:ZylzQhsB1dcptA2t4DY8S6l9o8E=Source::1:51338(96.92%)7.7KB(3.08%)249BDestination::1:2869' ); }); @@ -653,7 +654,7 @@ describe('GenericRowRenderer', () => { ); - expect(wrapper.text()).toEqual( + expect(removeExternalLinkText(wrapper.text())).toEqual( 'root@foohostopened a socket withgoogle_accounts(2166)Outbound socket (10.4.20.1:59554 -> 10.1.2.3:80) Ooutboundtcp1:network-community_idSource10.4.20.1:59554Destination10.1.2.3:80' ); }); @@ -681,7 +682,7 @@ describe('GenericRowRenderer', () => { ); - expect(wrapper.text()).toEqual( + expect(removeExternalLinkText(wrapper.text())).toEqual( 'root@foohostclosed a socket withgoogle_accounts(2166)Outbound socket (10.4.20.1:59508 -> 10.1.2.3:80) Coutboundtcp1:network-community_idSource10.4.20.1:59508Destination10.1.2.3:80' ); }); @@ -875,7 +876,7 @@ describe('GenericRowRenderer', () => { ); - expect(wrapper.text()).toEqual( + expect(removeExternalLinkText(wrapper.text())).toEqual( 'iot.example.comasked forlookup.example.comwith question typeA, which resolved to10.1.2.3(response code:NOERROR)viaan unknown process6.937500msOct 8, 2019 @ 10:05:23.241Oct 8, 2019 @ 10:05:23.248outbounddns177Budp1:network-community_idSource10.9.9.9:58732(22.60%)40B(77.40%)137BDestination10.1.1.1:53OceaniaAustralia🇦🇺AU' ); }); diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/zeek/zeek_details.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/zeek/zeek_details.test.tsx index 434be7b23aeee..2efda5c3bf612 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/zeek/zeek_details.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/zeek/zeek_details.test.tsx @@ -6,6 +6,7 @@ import React from 'react'; +import { removeExternalLinkText } from '../../../../../../../../../test_utils'; import '../../../../../../common/mock/match_media'; import { mockBrowserFields } from '../../../../../../common/containers/source/mock'; import { mockTimelineData, TestProviders } from '../../../../../../common/mock'; @@ -41,7 +42,7 @@ describe('ZeekDetails', () => { /> ); - expect(wrapper.text()).toEqual( + expect(removeExternalLinkText(wrapper.text())).toEqual( 'C8DRTq362Fios6hw16connectionREJSrConnection attempt rejectedtcpSource185.176.26.101:44059Destination207.154.238.205:11568' ); }); @@ -56,7 +57,7 @@ describe('ZeekDetails', () => { /> ); - expect(wrapper.text()).toEqual( + expect(removeExternalLinkText(wrapper.text())).toEqual( 'CyIrMA1L1JtLqdIuoldnsudpSource206.189.35.240:57475Destination67.207.67.3:53' ); }); @@ -71,7 +72,7 @@ describe('ZeekDetails', () => { /> ); - expect(wrapper.text()).toEqual( + expect(removeExternalLinkText(wrapper.text())).toEqual( 'CZLkpC22NquQJOpkwehttp302Source206.189.35.240:36220Destination192.241.164.26:80' ); }); @@ -86,7 +87,7 @@ describe('ZeekDetails', () => { /> ); - expect(wrapper.text()).toEqual( + expect(removeExternalLinkText(wrapper.text())).toEqual( 'noticeDropped:falseScan::Port_Scan8.42.77.171 scanned at least 15 unique ports of host 207.154.238.205 in 0m0sSource8.42.77.171' ); }); @@ -101,7 +102,7 @@ describe('ZeekDetails', () => { /> ); - expect(wrapper.text()).toEqual( + expect(removeExternalLinkText(wrapper.text())).toEqual( 'CmTxzt2OVXZLkGDaResslTLSv12TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256Source188.166.66.184:34514Destination91.189.95.15:443' ); }); diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/zeek/zeek_row_renderer.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/zeek/zeek_row_renderer.test.tsx index 9c08fbacafcdc..6795796111fd3 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/zeek/zeek_row_renderer.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/zeek/zeek_row_renderer.test.tsx @@ -8,6 +8,7 @@ import { shallow } from 'enzyme'; import { cloneDeep } from 'lodash/fp'; import React from 'react'; +import { removeExternalLinkText } from '../../../../../../../../../test_utils'; import { mockBrowserFields } from '../../../../../../common/containers/source/mock'; import { Ecs } from '../../../../../../../common/ecs'; import { mockTimelineData, TestProviders } from '../../../../../../common/mock'; @@ -57,7 +58,7 @@ describe('zeek_row_renderer', () => { {children} ); - expect(wrapper.text()).toContain( + expect(removeExternalLinkText(wrapper.text())).toContain( 'C8DRTq362Fios6hw16connectionREJSrConnection attempt rejectedtcpSource185.176.26.101:44059Destination207.154.238.205:11568' ); }); diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/zeek/zeek_signature.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/zeek/zeek_signature.test.tsx index efa22cb2c5617..3bcd5a5b27402 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/zeek/zeek_signature.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/zeek/zeek_signature.test.tsx @@ -8,6 +8,7 @@ import { shallow } from 'enzyme'; import { cloneDeep } from 'lodash/fp'; import React from 'react'; +import { removeExternalLinkText } from '../../../../../../../../../test_utils'; import '../../../../../../common/mock/match_media'; import { Ecs } from '../../../../../../../common/ecs'; import { mockTimelineData, TestProviders } from '../../../../../../common/mock'; @@ -89,7 +90,7 @@ describe('ZeekSignature', () => { test('should render value', () => { const wrapper = mount(); - expect(wrapper.text()).toEqual('abc'); + expect(removeExternalLinkText(wrapper.text())).toEqual('abc'); }); test('should render value and link', () => { diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/health_check.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/health_check.test.tsx index a7de73c9aab29..a51765fc3a720 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/health_check.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/health_check.test.tsx @@ -89,10 +89,12 @@ describe('health check', () => { const [description, action] = queryAllByText(/TLS/i); expect(description.textContent).toMatchInlineSnapshot( - `"Alerting relies on API keys, which require TLS between Elasticsearch and Kibana. Learn how to enable TLS."` + `"Alerting relies on API keys, which require TLS between Elasticsearch and Kibana. Learn how to enable TLS.(opens in a new tab or window)"` ); - expect(action.textContent).toMatchInlineSnapshot(`"Learn how to enable TLS."`); + expect(action.textContent).toMatchInlineSnapshot( + `"Learn how to enable TLS.(opens in a new tab or window)"` + ); expect(action.getAttribute('href')).toMatchInlineSnapshot( `"elastic.co/guide/en/kibana/current/configuring-tls.html"` @@ -118,11 +120,11 @@ describe('health check', () => { const description = queryByRole(/banner/i); expect(description!.textContent).toMatchInlineSnapshot( - `"To create an alert, set a value for xpack.encryptedSavedObjects.encryptionKey in your kibana.yml file. Learn how."` + `"To create an alert, set a value for xpack.encryptedSavedObjects.encryptionKey in your kibana.yml file. Learn how.(opens in a new tab or window)"` ); const action = queryByText(/Learn/i); - expect(action!.textContent).toMatchInlineSnapshot(`"Learn how."`); + expect(action!.textContent).toMatchInlineSnapshot(`"Learn how.(opens in a new tab or window)"`); expect(action!.getAttribute('href')).toMatchInlineSnapshot( `"elastic.co/guide/en/kibana/current/alert-action-settings-kb.html#general-alert-action-settings"` ); @@ -148,11 +150,11 @@ describe('health check', () => { const description = queryByText(/Transport Layer Security/i); expect(description!.textContent).toMatchInlineSnapshot( - `"You must enable Transport Layer Security between Kibana and Elasticsearch and configure an encryption key in your kibana.yml file. Learn how"` + `"You must enable Transport Layer Security between Kibana and Elasticsearch and configure an encryption key in your kibana.yml file. Learn how(opens in a new tab or window)"` ); const action = queryByText(/Learn/i); - expect(action!.textContent).toMatchInlineSnapshot(`"Learn how"`); + expect(action!.textContent).toMatchInlineSnapshot(`"Learn how(opens in a new tab or window)"`); expect(action!.getAttribute('href')).toMatchInlineSnapshot( `"elastic.co/guide/en/kibana/current/alerting-getting-started.html#alerting-setup-prerequisites"` ); diff --git a/x-pack/plugins/uptime/public/components/monitor/ping_list/__tests__/__snapshots__/expanded_row.test.tsx.snap b/x-pack/plugins/uptime/public/components/monitor/ping_list/__tests__/__snapshots__/expanded_row.test.tsx.snap index 137d11d3f3b09..8ace0445d0eb7 100644 --- a/x-pack/plugins/uptime/public/components/monitor/ping_list/__tests__/__snapshots__/expanded_row.test.tsx.snap +++ b/x-pack/plugins/uptime/public/components/monitor/ping_list/__tests__/__snapshots__/expanded_row.test.tsx.snap @@ -178,6 +178,16 @@ exports[`PingListExpandedRow renders link to docs if body is not recorded but it + + + (opens in a new tab or window) + for more information on recording response bodies.
diff --git a/x-pack/plugins/uptime/public/components/monitor/status_details/__test__/__snapshots__/monitor_status.bar.test.tsx.snap b/x-pack/plugins/uptime/public/components/monitor/status_details/__test__/__snapshots__/monitor_status.bar.test.tsx.snap index 69c6bf3fadb1d..7cc96a42411d2 100644 --- a/x-pack/plugins/uptime/public/components/monitor/status_details/__test__/__snapshots__/monitor_status.bar.test.tsx.snap +++ b/x-pack/plugins/uptime/public/components/monitor/status_details/__test__/__snapshots__/monitor_status.bar.test.tsx.snap @@ -55,6 +55,16 @@ Array [ + + + (opens in a new tab or window) +
`${chance.string({ pool: CHARS_POOL, ...options })}-${Date.now()}`; + +export const removeExternalLinkText = (str: string) => + str.replace(/\(opens in a new tab or window\)/g, ''); From f9b130267820847e24bf15f6dfc6903bc6c6ae41 Mon Sep 17 00:00:00 2001 From: Greg Thompson Date: Thu, 5 Nov 2020 16:56:47 -0700 Subject: [PATCH 5/6] security_solution_cypress external link text --- .../integration/alerts_detection_rules_custom.spec.ts | 9 +++++++-- .../integration/alerts_detection_rules_eql.spec.ts | 9 +++++++-- .../integration/alerts_detection_rules_ml.spec.ts | 11 ++++++++--- .../alerts_detection_rules_override.spec.ts | 9 +++++++-- .../alerts_detection_rules_threshold.spec.ts | 9 +++++++-- .../security_solution/cypress/screens/rule_details.ts | 3 +++ 6 files changed, 39 insertions(+), 11 deletions(-) diff --git a/x-pack/plugins/security_solution/cypress/integration/alerts_detection_rules_custom.spec.ts b/x-pack/plugins/security_solution/cypress/integration/alerts_detection_rules_custom.spec.ts index 783f8be840b7f..fb1f2920aaceb 100644 --- a/x-pack/plugins/security_solution/cypress/integration/alerts_detection_rules_custom.spec.ts +++ b/x-pack/plugins/security_solution/cypress/integration/alerts_detection_rules_custom.spec.ts @@ -49,6 +49,7 @@ import { DEFINITION_DETAILS, FALSE_POSITIVES_DETAILS, getDetails, + removeExternalLinkText, INDEX_PATTERNS_DETAILS, INVESTIGATION_NOTES_MARKDOWN, INVESTIGATION_NOTES_TOGGLE, @@ -174,9 +175,13 @@ describe('Custom detection rules creation', () => { cy.get(ABOUT_DETAILS).within(() => { getDetails(SEVERITY_DETAILS).should('have.text', newRule.severity); getDetails(RISK_SCORE_DETAILS).should('have.text', newRule.riskScore); - getDetails(REFERENCE_URLS_DETAILS).should('have.text', expectedUrls); + getDetails(REFERENCE_URLS_DETAILS).should((details) => { + expect(removeExternalLinkText(details.text())).equal(expectedUrls); + }); getDetails(FALSE_POSITIVES_DETAILS).should('have.text', expectedFalsePositives); - getDetails(MITRE_ATTACK_DETAILS).should('have.text', expectedMitre); + getDetails(MITRE_ATTACK_DETAILS).should((mitre) => { + expect(removeExternalLinkText(mitre.text())).equal(expectedMitre); + }); getDetails(TAGS_DETAILS).should('have.text', expectedTags); }); cy.get(INVESTIGATION_NOTES_TOGGLE).click({ force: true }); diff --git a/x-pack/plugins/security_solution/cypress/integration/alerts_detection_rules_eql.spec.ts b/x-pack/plugins/security_solution/cypress/integration/alerts_detection_rules_eql.spec.ts index 3d4aaca8bb78f..22d2a144932bf 100644 --- a/x-pack/plugins/security_solution/cypress/integration/alerts_detection_rules_eql.spec.ts +++ b/x-pack/plugins/security_solution/cypress/integration/alerts_detection_rules_eql.spec.ts @@ -32,6 +32,7 @@ import { DEFINITION_DETAILS, FALSE_POSITIVES_DETAILS, getDetails, + removeExternalLinkText, INDEX_PATTERNS_DETAILS, INVESTIGATION_NOTES_MARKDOWN, INVESTIGATION_NOTES_TOGGLE, @@ -136,9 +137,13 @@ describe('Detection rules, EQL', () => { cy.get(ABOUT_DETAILS).within(() => { getDetails(SEVERITY_DETAILS).should('have.text', eqlRule.severity); getDetails(RISK_SCORE_DETAILS).should('have.text', eqlRule.riskScore); - getDetails(REFERENCE_URLS_DETAILS).should('have.text', expectedUrls); + getDetails(REFERENCE_URLS_DETAILS).should((details) => { + expect(removeExternalLinkText(details.text())).equal(expectedUrls); + }); getDetails(FALSE_POSITIVES_DETAILS).should('have.text', expectedFalsePositives); - getDetails(MITRE_ATTACK_DETAILS).should('have.text', expectedMitre); + getDetails(MITRE_ATTACK_DETAILS).should((mitre) => { + expect(removeExternalLinkText(mitre.text())).equal(expectedMitre); + }); getDetails(TAGS_DETAILS).should('have.text', expectedTags); }); cy.get(INVESTIGATION_NOTES_TOGGLE).click({ force: true }); diff --git a/x-pack/plugins/security_solution/cypress/integration/alerts_detection_rules_ml.spec.ts b/x-pack/plugins/security_solution/cypress/integration/alerts_detection_rules_ml.spec.ts index 153c55fae59fe..f27e169e02437 100644 --- a/x-pack/plugins/security_solution/cypress/integration/alerts_detection_rules_ml.spec.ts +++ b/x-pack/plugins/security_solution/cypress/integration/alerts_detection_rules_ml.spec.ts @@ -23,6 +23,7 @@ import { DEFINITION_DETAILS, FALSE_POSITIVES_DETAILS, getDetails, + removeExternalLinkText, MACHINE_LEARNING_JOB_ID, MACHINE_LEARNING_JOB_STATUS, MITRE_ATTACK_DETAILS, @@ -121,10 +122,14 @@ describe('Detection rules, machine learning', () => { cy.get(ABOUT_RULE_DESCRIPTION).should('have.text', machineLearningRule.description); cy.get(ABOUT_DETAILS).within(() => { getDetails(SEVERITY_DETAILS).should('have.text', machineLearningRule.severity); - getDetails(RISK_SCORE_DETAILS).should('have.text', machineLearningRule.riskScore); - getDetails(REFERENCE_URLS_DETAILS).should('have.text', expectedUrls); + getDetails(RISK_SCORE_DETAILS).should('equal', machineLearningRule.riskScore); + getDetails(REFERENCE_URLS_DETAILS).should((details) => { + expect(removeExternalLinkText(details.text())).equal(expectedUrls); + }); getDetails(FALSE_POSITIVES_DETAILS).should('have.text', expectedFalsePositives); - getDetails(MITRE_ATTACK_DETAILS).should('have.text', expectedMitre); + getDetails(MITRE_ATTACK_DETAILS).should((mitre) => { + expect(removeExternalLinkText(mitre.text())).equal(expectedMitre); + }); getDetails(TAGS_DETAILS).should('have.text', expectedTags); }); cy.get(DEFINITION_DETAILS).within(() => { diff --git a/x-pack/plugins/security_solution/cypress/integration/alerts_detection_rules_override.spec.ts b/x-pack/plugins/security_solution/cypress/integration/alerts_detection_rules_override.spec.ts index e905365d1bbb3..b1ccca5e4f13c 100644 --- a/x-pack/plugins/security_solution/cypress/integration/alerts_detection_rules_override.spec.ts +++ b/x-pack/plugins/security_solution/cypress/integration/alerts_detection_rules_override.spec.ts @@ -34,6 +34,7 @@ import { DETAILS_TITLE, FALSE_POSITIVES_DETAILS, getDetails, + removeExternalLinkText, INDEX_PATTERNS_DETAILS, INVESTIGATION_NOTES_MARKDOWN, INVESTIGATION_NOTES_TOGGLE, @@ -141,9 +142,13 @@ describe('Detection rules, override', () => { `${newOverrideRule.riskOverride}signal.rule.risk_score` ); getDetails(RULE_NAME_OVERRIDE_DETAILS).should('have.text', newOverrideRule.nameOverride); - getDetails(REFERENCE_URLS_DETAILS).should('have.text', expectedUrls); + getDetails(REFERENCE_URLS_DETAILS).should((details) => { + expect(removeExternalLinkText(details.text())).equal(expectedUrls); + }); getDetails(FALSE_POSITIVES_DETAILS).should('have.text', expectedFalsePositives); - getDetails(MITRE_ATTACK_DETAILS).should('have.text', expectedMitre); + getDetails(MITRE_ATTACK_DETAILS).should((mitre) => { + expect(removeExternalLinkText(mitre.text())).equal(expectedMitre); + }); getDetails(TAGS_DETAILS).should('have.text', expectedTags); getDetails(TIMESTAMP_OVERRIDE_DETAILS).should('have.text', newOverrideRule.timestampOverride); cy.contains(DETAILS_TITLE, 'Severity override') diff --git a/x-pack/plugins/security_solution/cypress/integration/alerts_detection_rules_threshold.spec.ts b/x-pack/plugins/security_solution/cypress/integration/alerts_detection_rules_threshold.spec.ts index a9b43d82bb7fd..c3e7892d63279 100644 --- a/x-pack/plugins/security_solution/cypress/integration/alerts_detection_rules_threshold.spec.ts +++ b/x-pack/plugins/security_solution/cypress/integration/alerts_detection_rules_threshold.spec.ts @@ -32,6 +32,7 @@ import { FALSE_POSITIVES_DETAILS, DEFINITION_DETAILS, getDetails, + removeExternalLinkText, INDEX_PATTERNS_DETAILS, INVESTIGATION_NOTES_MARKDOWN, INVESTIGATION_NOTES_TOGGLE, @@ -135,9 +136,13 @@ describe('Detection rules, threshold', () => { cy.get(ABOUT_DETAILS).within(() => { getDetails(SEVERITY_DETAILS).should('have.text', newThresholdRule.severity); getDetails(RISK_SCORE_DETAILS).should('have.text', newThresholdRule.riskScore); - getDetails(REFERENCE_URLS_DETAILS).should('have.text', expectedUrls); + getDetails(REFERENCE_URLS_DETAILS).should((details) => { + expect(removeExternalLinkText(details.text())).equal(expectedUrls); + }); getDetails(FALSE_POSITIVES_DETAILS).should('have.text', expectedFalsePositives); - getDetails(MITRE_ATTACK_DETAILS).should('have.text', expectedMitre); + getDetails(MITRE_ATTACK_DETAILS).should((mitre) => { + expect(removeExternalLinkText(mitre.text())).equal(expectedMitre); + }); getDetails(TAGS_DETAILS).should('have.text', expectedTags); }); cy.get(INVESTIGATION_NOTES_TOGGLE).click({ force: true }); diff --git a/x-pack/plugins/security_solution/cypress/screens/rule_details.ts b/x-pack/plugins/security_solution/cypress/screens/rule_details.ts index d72210dd3e083..8cf0dfb5f6661 100644 --- a/x-pack/plugins/security_solution/cypress/screens/rule_details.ts +++ b/x-pack/plugins/security_solution/cypress/screens/rule_details.ts @@ -75,3 +75,6 @@ export const TIMESTAMP_OVERRIDE_DETAILS = 'Timestamp override'; export const getDetails = (title: string) => cy.get(DETAILS_TITLE).contains(title).next(DETAILS_DESCRIPTION); + +export const removeExternalLinkText = (str: string) => + str.replace(/\(opens in a new tab or window\)/g, ''); From 2a8160865143871fc715e1daa321a21dfb21991b Mon Sep 17 00:00:00 2001 From: Greg Thompson Date: Fri, 6 Nov 2020 08:31:51 -0700 Subject: [PATCH 6/6] clean up --- .../cypress/integration/alerts_detection_rules_ml.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugins/security_solution/cypress/integration/alerts_detection_rules_ml.spec.ts b/x-pack/plugins/security_solution/cypress/integration/alerts_detection_rules_ml.spec.ts index f27e169e02437..061b66faca054 100644 --- a/x-pack/plugins/security_solution/cypress/integration/alerts_detection_rules_ml.spec.ts +++ b/x-pack/plugins/security_solution/cypress/integration/alerts_detection_rules_ml.spec.ts @@ -122,7 +122,7 @@ describe('Detection rules, machine learning', () => { cy.get(ABOUT_RULE_DESCRIPTION).should('have.text', machineLearningRule.description); cy.get(ABOUT_DETAILS).within(() => { getDetails(SEVERITY_DETAILS).should('have.text', machineLearningRule.severity); - getDetails(RISK_SCORE_DETAILS).should('equal', machineLearningRule.riskScore); + getDetails(RISK_SCORE_DETAILS).should('have.text', machineLearningRule.riskScore); getDetails(REFERENCE_URLS_DETAILS).should((details) => { expect(removeExternalLinkText(details.text())).equal(expectedUrls); });