Skip to content

Commit

Permalink
Added Close Index Component Integration Test For Index Management (#1…
Browse files Browse the repository at this point in the history
…14020) (#121722)

* Added close index test.

* Fixed linting issues.

* Fixed linting issues.

* Abstracted out the index action option selection method and cleaned up test.

* Merged Yulia's changes into this PR and updated the test to consume the new data test subjects.

* Adjusted assertion to check for second to last request since there is a refresh done after the close index call.

* Fixed linting issue.

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
John Dorlus and kibanamachine authored Dec 21, 2021
1 parent 4912267 commit 2a17702
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export type TestSubjects =
| 'ilmPolicyLink'
| 'includeStatsSwitch'
| 'includeManagedSwitch'
| 'indexActionsContextMenuButton'
| 'indexContextMenu'
| 'indexManagementHeaderContent'
| 'indexTable'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ export const setup = async (overridingDependencies: any = {}): Promise<IndicesTe
/**
* User Actions
*/

const clickContextMenuOption = async (optionDataTestSubject: string) => {
const { find, component } = testBed;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,22 @@ describe('<IndexManagementHome />', () => {
httpRequestsMockHelpers.setReloadIndicesResponse({ indexNames: [indexName] });

testBed = await setup();
const { find, component } = testBed;
const { component, find } = testBed;

component.update();

find('indexTableIndexNameLink').at(0).simulate('click');
});
test('should be able to close an open index', async () => {
const { actions } = testBed;

await actions.clickManageContextMenuButton();
await actions.clickContextMenuOption('closeIndexMenuButton');

// A refresh call was added after closing an index so we need to check the second to last request.
const latestRequest = server.requests[server.requests.length - 2];
expect(latestRequest.url).toBe(`${API_BASE_PATH}/indices/close`);
});

test('should be able to flush index', async () => {
const { actions } = testBed;
Expand Down

0 comments on commit 2a17702

Please sign in to comment.