Skip to content

Commit

Permalink
[Fleet] Enable EPM failing suite (elastic#153928)
Browse files Browse the repository at this point in the history
Closes elastic#150607

## Summary
Re-enable flaky test suit in
`x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/index.test.tsx`.

The flaky runner doesn't work with Jest tests, so I tested it locally
several times on my local.


### Checklist
- [ ] [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

---------

Co-authored-by: kibanamachine <[email protected]>
  • Loading branch information
2 people authored and jgowdyelastic committed Mar 30, 2023
1 parent 8dfd515 commit 9f7aab2
Showing 1 changed file with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import type {
GetPackagePoliciesResponse,
GetStatsResponse,
GetSettingsResponse,
GetVerificationKeyIdResponse,
} from '../../../../../../../common/types/rest_spec';
import type {
DetailViewPanelName,
Expand All @@ -39,8 +40,7 @@ import { ExperimentalFeaturesService } from '../../../../services';
ExperimentalFeaturesService.init({});
import { Detail } from '.';

// FLAKY: https://github.com/elastic/kibana/issues/150607
describe.skip('when on integration detail', () => {
describe('when on integration detail', () => {
const pkgkey = 'nginx-0.3.7';
const detailPageUrlPath = pagePathGetters.integration_details_overview({ pkgkey })[1];
let testRenderer: TestRenderer;
Expand Down Expand Up @@ -138,6 +138,16 @@ describe.skip('when on integration detail', () => {
await render();
});

it('should NOT display agent policy usage count', async () => {
await mockedApi.waitForApi();
expect(renderResult.queryByTestId('agentPolicyCount')).toBeNull();
});

it('should NOT display the Policies tab', async () => {
await mockedApi.waitForApi();
expect(renderResult.queryByTestId('tab-policies')).toBeNull();
});

it('should display version text and no callout if prerelease setting disabled', async () => {
await mockedApi.waitForApi();
expect((renderResult.queryByTestId('versionText') as any)?.textContent).toEqual('1.0.0');
Expand Down Expand Up @@ -324,6 +334,7 @@ interface EpmPackageDetailsResponseProvidersMock {
agentPolicyList: jest.MockedFunction<() => GetAgentPoliciesResponse>;
appCheckPermissions: jest.MockedFunction<() => CheckPermissionsResponse>;
getSettings: jest.MockedFunction<() => GetSettingsResponse>;
getVerificationKeyId: jest.MockedFunction<() => GetVerificationKeyIdResponse>;
}

const mockApiCalls = (
Expand Down Expand Up @@ -805,6 +816,8 @@ On Windows, the module was tested with Nginx installed from the Chocolatey repos

const getSettingsResponse = { item: { prerelease_integrations_enabled: true } };

const getVerificationKeyIdResponse = { id: 'test-verification-key' };

const mockedApiInterface: MockedApi<EpmPackageDetailsResponseProvidersMock> = {
waitForApi() {
return new Promise((resolve) => {
Expand All @@ -824,6 +837,7 @@ On Windows, the module was tested with Nginx installed from the Chocolatey repos
agentPolicyList: jest.fn().mockReturnValue(agentPoliciesResponse),
appCheckPermissions: jest.fn().mockReturnValue(appCheckPermissionsResponse),
getSettings: jest.fn().mockReturnValue(getSettingsResponse),
getVerificationKeyId: jest.fn().mockReturnValue(getVerificationKeyIdResponse),
},
};

Expand Down Expand Up @@ -880,6 +894,9 @@ On Windows, the module was tested with Nginx installed from the Chocolatey repos
if (path === '/api/fleet/settings') {
return mockedApiInterface.responseProvider.getSettings();
}
if (path === '/api/fleet/epm/verification_key_id') {
return mockedApiInterface.responseProvider.getVerificationKeyId();
}

const err = new Error(`API [GET ${path}] is not MOCKED!`);
// eslint-disable-next-line no-console
Expand Down

0 comments on commit 9f7aab2

Please sign in to comment.