mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
Added Component Integration Test for Flush Action in Index Management (#114401)
* Aded some data test subjects for the test. * Added flush indices test. * Fixed linting issue. * Merged test subject PR in and updated tests. Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
47ce4a80a6
commit
98acb5d8a8
3 changed files with 50 additions and 0 deletions
|
@ -25,6 +25,8 @@ export type TestSubjects =
|
|||
| 'ilmPolicyLink'
|
||||
| 'includeStatsSwitch'
|
||||
| 'includeManagedSwitch'
|
||||
| 'indexActionsContextMenuButton'
|
||||
| 'indexContextMenu'
|
||||
| 'indexManagementHeaderContent'
|
||||
| 'indexTable'
|
||||
| 'indexTableIncludeHiddenIndicesToggle'
|
||||
|
|
|
@ -28,6 +28,8 @@ export interface IndicesTestBed extends TestBed<TestSubjects> {
|
|||
getIncludeHiddenIndicesToggleStatus: () => boolean;
|
||||
clickIncludeHiddenIndicesToggle: () => void;
|
||||
clickDataStreamAt: (index: number) => void;
|
||||
clickManageContextMenuButton: () => void;
|
||||
clickContextMenuOption: (optionDataTestSubject: string) => void;
|
||||
};
|
||||
findDataStreamDetailPanel: () => ReactWrapper;
|
||||
findDataStreamDetailPanelTitle: () => string;
|
||||
|
@ -44,11 +46,22 @@ export const setup = async (overridingDependencies: any = {}): Promise<IndicesTe
|
|||
* User Actions
|
||||
*/
|
||||
|
||||
const clickContextMenuOption = async (optionDataTestSubject: string) => {
|
||||
const { find } = testBed;
|
||||
const contextMenu = find('indexContextMenu');
|
||||
contextMenu.find(`button[data-test-subj="${optionDataTestSubject}"]`).simulate('click');
|
||||
};
|
||||
|
||||
const clickIncludeHiddenIndicesToggle = () => {
|
||||
const { find } = testBed;
|
||||
find('indexTableIncludeHiddenIndicesToggle').simulate('click');
|
||||
};
|
||||
|
||||
const clickManageContextMenuButton = () => {
|
||||
const { find } = testBed;
|
||||
find('indexActionsContextMenuButton').simulate('click');
|
||||
};
|
||||
|
||||
const getIncludeHiddenIndicesToggleStatus = () => {
|
||||
const { find } = testBed;
|
||||
const props = find('indexTableIncludeHiddenIndicesToggle').props();
|
||||
|
@ -95,6 +108,8 @@ export const setup = async (overridingDependencies: any = {}): Promise<IndicesTe
|
|||
getIncludeHiddenIndicesToggleStatus,
|
||||
clickIncludeHiddenIndicesToggle,
|
||||
clickDataStreamAt,
|
||||
clickManageContextMenuButton,
|
||||
clickContextMenuOption,
|
||||
},
|
||||
findDataStreamDetailPanel,
|
||||
findDataStreamDetailPanelTitle,
|
||||
|
|
|
@ -161,4 +161,37 @@ describe('<IndexManagementHome />', () => {
|
|||
expect(latestRequest.url).toBe(`${API_BASE_PATH}/settings/${encodeURIComponent(indexName)}`);
|
||||
});
|
||||
});
|
||||
|
||||
describe('index actions', () => {
|
||||
const indexName = 'testIndex';
|
||||
beforeEach(async () => {
|
||||
const index = {
|
||||
health: 'green',
|
||||
status: 'open',
|
||||
primary: 1,
|
||||
replica: 1,
|
||||
documents: 10000,
|
||||
documents_deleted: 100,
|
||||
size: '156kb',
|
||||
primary_size: '156kb',
|
||||
name: indexName,
|
||||
};
|
||||
|
||||
httpRequestsMockHelpers.setLoadIndicesResponse([index]);
|
||||
testBed = await setup();
|
||||
const { find, component } = testBed;
|
||||
component.update();
|
||||
|
||||
find('indexTableIndexNameLink').at(0).simulate('click');
|
||||
});
|
||||
|
||||
test('should be able to flush index', async () => {
|
||||
const { actions } = testBed;
|
||||
await actions.clickManageContextMenuButton();
|
||||
await actions.clickContextMenuOption('flushIndexMenuButton');
|
||||
|
||||
const latestRequest = server.requests[server.requests.length - 1];
|
||||
expect(latestRequest.url).toBe(`${API_BASE_PATH}/indices/flush`);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue