Skip to content

Commit

Permalink
fix and reenable policy list integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
gergoabraham committed Nov 22, 2024
1 parent a3311ad commit 8e10847
Showing 1 changed file with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,22 @@ 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');

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<AppContextTestRender['render']>;
let renderResult: ReturnType<typeof render>;
let history: AppContextTestRender['history'];
let coreStart: AppContextTestRender['coreStart'];
let mockedContext: AppContextTestRender;

beforeEach(() => {
Expand All @@ -38,7 +42,7 @@ describe.skip('When on the policy list page', () => {
});

mockedContext = createAppRootMockRenderer();
({ history } = mockedContext);
({ history, coreStart } = mockedContext);
render = () => (renderResult = mockedContext.render(<PolicyList />));
});

Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 8e10847

Please sign in to comment.