[Security Solution][Endpoint] Fix and unskip flaky test (#149841)

> **Note**
> **Merge after elastic/kibana/pull/149839**

## Summary

Fixes flaky test elastic/kibana/issues/145204

flaky test runners 
-
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/1817
x 50 (failed on a single [unrelated
](92cb000a2f/x-pack/test/security_solution_endpoint/apps/endpoint/artifact_entries_list.ts (L75))flaky
test)
-
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/1826
x 150 (failed on a single run for an
[unrelated](92cb000a2f/x-pack/test/security_solution_endpoint/apps/endpoint/artifact_entries_list.ts (L87))
flaky test)
-
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/1834
x 200 (successful on all runs)
-
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/1847
x 100 (successful on all runs)

### Checklist
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
This commit is contained in:
Ashokaditya 2023-02-01 15:57:05 +01:00 committed by GitHub
parent 0d6c113ab1
commit 9b85acb49e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -13,7 +13,6 @@ import type { AppContextTestRender } from '../../../common/mock/endpoint';
import { createAppRootMockRenderer } from '../../../common/mock/endpoint';
import { useUserPrivileges } from '../../../common/components/user_privileges';
import { endpointPageHttpMock } from '../endpoint_hosts/mocks';
import { getUserPrivilegesMockDefaultValue } from '../../../common/components/user_privileges/__mocks__';
jest.mock('../../../common/components/user_privileges');
@ -30,7 +29,7 @@ describe('when in the Administration tab', () => {
});
afterEach(() => {
useUserPrivilegesMock.mockImplementation(getUserPrivilegesMockDefaultValue);
useUserPrivilegesMock.mockReset();
});
describe('when the user has no permissions', () => {
@ -97,8 +96,7 @@ describe('when in the Administration tab', () => {
});
});
// FLAKY: https://github.com/elastic/kibana/issues/145204
describe.skip('when the user has permissions', () => {
describe('when the user has permissions', () => {
it('should display the Management view if user has privileges', async () => {
useUserPrivilegesMock.mockReturnValue({
endpointPrivileges: { loading: false, canReadEndpointList: true, canAccessFleet: true },