mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
[ML] Functional tests for deleting 3rd party models (#138425)
* tests for delete action * revert the original delete action for dfa models
This commit is contained in:
parent
a0cb2608fb
commit
6d9d1b92af
3 changed files with 37 additions and 0 deletions
|
@ -197,6 +197,10 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
it(`stops deployment of the imported model ${model.id}`, async () => {
|
||||
await ml.trainedModelsTable.stopDeployment(model.id);
|
||||
});
|
||||
|
||||
it(`deletes the imported model ${model.id}`, async () => {
|
||||
await ml.trainedModelsTable.deleteModel(model.id);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -388,5 +388,27 @@ export function MachineLearningCommonUIProvider({
|
|||
});
|
||||
await toasts.dismissAllToasts();
|
||||
},
|
||||
|
||||
async ensureAllMenuPopoversClosed() {
|
||||
await retry.tryForTime(5000, async () => {
|
||||
await browser.pressKeys(browser.keys.ESCAPE);
|
||||
const popoverExists = await find.existsByCssSelector('euiContextMenuPanel');
|
||||
expect(popoverExists).to.eql(false, 'All popovers should be closed');
|
||||
});
|
||||
},
|
||||
|
||||
async invokeTableRowAction(rowSelector: string, actionTestSubject: string) {
|
||||
await retry.tryForTime(30 * 1000, async () => {
|
||||
await this.ensureAllMenuPopoversClosed();
|
||||
await testSubjects.click(`${rowSelector} > euiCollapsedItemActionsButton`);
|
||||
await find.existsByCssSelector('euiContextMenuPanel');
|
||||
|
||||
const isEnabled = await testSubjects.isEnabled(actionTestSubject);
|
||||
|
||||
expect(isEnabled).to.eql(true, `Expected action "${actionTestSubject}" to be enabled.`);
|
||||
|
||||
await testSubjects.click(actionTestSubject);
|
||||
});
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
|
@ -180,6 +180,17 @@ export function TrainedModelsTableProvider(
|
|||
);
|
||||
}
|
||||
|
||||
public async deleteModel(modelId: string) {
|
||||
await mlCommonUI.invokeTableRowAction(
|
||||
this.rowSelector(modelId),
|
||||
'mlModelsTableRowDeleteAction'
|
||||
);
|
||||
await this.assertDeleteModalExists();
|
||||
await this.confirmDeleteModel();
|
||||
await mlCommonUI.waitForRefreshButtonEnabled();
|
||||
await this.assertModelDisplayedInTable(modelId, false);
|
||||
}
|
||||
|
||||
public async assertModelDeleteActionButtonEnabled(modelId: string, expectedValue: boolean) {
|
||||
await this.assertModelDeleteActionButtonExists(modelId, true);
|
||||
const isEnabled = await testSubjects.isEnabled(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue