diff --git a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/utils.js b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/utils.js index 9fcf4bfb0db09..d6926950dce7d 100644 --- a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/utils.js +++ b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/utils.js @@ -232,8 +232,7 @@ export async function cloneJob(jobId) { values: { jobId, dataViewTitle }, } ); - getToastNotifications().addDanger({ - title: warningText, + getToastNotificationService().displayDangerToast(warningText, { 'data-test-subj': 'mlCloneJobNoDataViewExistsWarningToast', }); return; diff --git a/x-pack/test/functional/apps/ml/anomaly_detection/single_metric_job.ts b/x-pack/test/functional/apps/ml/anomaly_detection/single_metric_job.ts index 15648086178db..3c3d27ebd5244 100644 --- a/x-pack/test/functional/apps/ml/anomaly_detection/single_metric_job.ts +++ b/x-pack/test/functional/apps/ml/anomaly_detection/single_metric_job.ts @@ -210,7 +210,7 @@ export default function ({ getService }: FtrProviderContext) { await browser.refresh(); await ml.testExecution.logTestStep( - 'job cloning clicks the clone action and loads the single metric wizard' + 'job cloning clicks the clone action and displays an error toast' ); await ml.jobTable.clickCloneJobActionWhenNoDataViewExists(jobId); }); diff --git a/x-pack/test/functional/services/ml/job_table.ts b/x-pack/test/functional/services/ml/job_table.ts index 353016afe9ffe..e2d50c52c55ba 100644 --- a/x-pack/test/functional/services/ml/job_table.ts +++ b/x-pack/test/functional/services/ml/job_table.ts @@ -380,10 +380,7 @@ export function MachineLearningJobTableProvider( } public async assertNoDataViewForCloneJobWarningToastExist() { - await retry.tryForTime(5000, async () => { - const toast = await testSubjects.find('mlCloneJobNoDataViewExistsWarningToast'); - expect(toast).not.to.be(undefined); - }); + await testSubjects.existOrFail('mlCloneJobNoDataViewExistsWarningToast', { timeout: 5000 }); } public async clickEditJobAction(jobId: string) {