From 8e108477bd12112aff56d24278904ac53379381f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C5=91=20=C3=81brah=C3=A1m?= Date: Fri, 22 Nov 2024 17:54:24 +0100 Subject: [PATCH] fix and reenable policy list integration test closes #169133 --- .../view/integration_tests/policy_list.test.tsx | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/integration_tests/policy_list.test.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/integration_tests/policy_list.test.tsx index b140134a0e6ac..73c69f934b9a9 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/view/integration_tests/policy_list.test.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/integration_tests/policy_list.test.tsx @@ -18,6 +18,10 @@ import { APP_UI_ID } from '../../../../../../common/constants'; import { useUserPrivileges } from '../../../../../common/components/user_privileges'; import userEvent from '@testing-library/user-event'; import { waitForEuiPopoverOpen } from '@elastic/eui/lib/test/rtl'; +import { + mockEndpointResultList, + setEndpointListApiMockImplementation, +} from '../../../endpoint_hosts/store/mock_endpoint_result_list'; jest.mock('../../../../services/policies/policies'); jest.mock('../../../../../common/components/user_privileges'); @@ -25,11 +29,11 @@ jest.mock('../../../../../common/components/user_privileges'); const getPackagePolicies = sendGetEndpointSpecificPackagePolicies as jest.Mock; const useUserPrivilegesMock = useUserPrivileges as jest.Mock; -// Failing: See https://github.com/elastic/kibana/issues/169133 -describe.skip('When on the policy list page', () => { +describe('When on the policy list page', () => { let render: () => ReturnType; let renderResult: ReturnType; let history: AppContextTestRender['history']; + let coreStart: AppContextTestRender['coreStart']; let mockedContext: AppContextTestRender; beforeEach(() => { @@ -38,7 +42,7 @@ describe.skip('When on the policy list page', () => { }); mockedContext = createAppRootMockRenderer(); - ({ history } = mockedContext); + ({ history, coreStart } = mockedContext); render = () => (renderResult = mockedContext.render()); }); @@ -88,7 +92,7 @@ describe.skip('When on the policy list page', () => { await waitFor(() => { expect( renderResult.getByText( - 'From this page, you’ll be able to view and manage the Elastic Defend Integration policies in your environment running Elastic Defend.' + 'From this page, you can view and manage the Elastic Defend integration policies in your environment running Elastic Defend.' ) ).toBeTruthy(); @@ -158,6 +162,10 @@ describe.skip('When on the policy list page', () => { href: '/app/security/administration/policy', }, }; + setEndpointListApiMockImplementation(coreStart.http, { + endpointsResults: mockEndpointResultList().data, + }); + const endpointCount = renderResult.getAllByTestId('policyEndpointCountLink')[0]; await userEvent.click(endpointCount);