mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[Security Solution][Endpoint] Un-skip Jest tests for artifact list page delete modal (#138672)
* Add an `waitFor` before selecting dialog buttons * increase `beforeEach()` timeout to 10s
This commit is contained in:
parent
cb0ca889a9
commit
af9e2d9569
1 changed files with 33 additions and 19 deletions
|
@ -13,8 +13,7 @@ import { act, waitFor } from '@testing-library/react';
|
|||
import userEvent from '@testing-library/user-event';
|
||||
import { getDeferred } from '../../mocks';
|
||||
|
||||
// FLAKY: https://github.com/elastic/kibana/issues/137590
|
||||
describe.skip('When displaying the Delete artfifact modal in the Artifact List Page', () => {
|
||||
describe('When displaying the Delete artifact modal in the Artifact List Page', () => {
|
||||
let renderResult: ReturnType<AppContextTestRender['render']>;
|
||||
let history: AppContextTestRender['history'];
|
||||
let coreStart: AppContextTestRender['coreStart'];
|
||||
|
@ -38,30 +37,45 @@ describe.skip('When displaying the Delete artfifact modal in the Artifact List P
|
|||
});
|
||||
};
|
||||
|
||||
beforeEach(async () => {
|
||||
const renderSetup = getArtifactListPageRenderingSetup();
|
||||
beforeEach(
|
||||
async () => {
|
||||
const renderSetup = getArtifactListPageRenderingSetup();
|
||||
|
||||
({ history, coreStart, mockedApi, getFirstCard } = renderSetup);
|
||||
({ history, coreStart, mockedApi, getFirstCard } = renderSetup);
|
||||
|
||||
history.push('somepage?show=create');
|
||||
history.push('somepage?show=create');
|
||||
|
||||
renderResult = renderSetup.renderArtifactListPage();
|
||||
renderResult = renderSetup.renderArtifactListPage();
|
||||
|
||||
await act(async () => {
|
||||
await waitFor(() => {
|
||||
expect(renderResult.getByTestId('testPage-list')).toBeTruthy();
|
||||
await act(async () => {
|
||||
await waitFor(() => {
|
||||
expect(renderResult.getByTestId('testPage-list')).toBeTruthy();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
await clickCardAction('delete');
|
||||
await clickCardAction('delete');
|
||||
|
||||
cancelButton = renderResult.getByTestId(
|
||||
'testPage-deleteModal-cancelButton'
|
||||
) as HTMLButtonElement;
|
||||
submitButton = renderResult.getByTestId(
|
||||
'testPage-deleteModal-submitButton'
|
||||
) as HTMLButtonElement;
|
||||
});
|
||||
// Wait for the dialog to be present
|
||||
await act(async () => {
|
||||
await waitFor(() => {
|
||||
expect(renderResult.getByTestId('testPage-deleteModal')).not.toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
cancelButton = renderResult.getByTestId(
|
||||
'testPage-deleteModal-cancelButton'
|
||||
) as HTMLButtonElement;
|
||||
|
||||
submitButton = renderResult.getByTestId(
|
||||
'testPage-deleteModal-submitButton'
|
||||
) as HTMLButtonElement;
|
||||
},
|
||||
// Timeout set to 10s
|
||||
// In some cases, whose causes are unknown, a test will timeout and will point
|
||||
// to this setup as the culprid. It rarely happens, but in order to avoid it,
|
||||
// the timeout below is being set to 10s
|
||||
10000
|
||||
);
|
||||
|
||||
it('should show Cancel and Delete buttons enabled', async () => {
|
||||
expect(cancelButton).toBeEnabled();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue