[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:
Dima Arnautov 2022-08-10 12:55:41 +02:00 committed by GitHub
parent a0cb2608fb
commit 6d9d1b92af
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 37 additions and 0 deletions

View file

@ -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);
});
}
});
});

View file

@ -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);
});
},
};
}

View file

@ -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(