diff --git a/x-pack/test/functional/apps/machine_learning/data_frame_analytics/classification_creation.ts b/x-pack/test/functional/apps/machine_learning/data_frame_analytics/classification_creation.ts index 1bcdeef394c00..a7c92cac2072f 100644 --- a/x-pack/test/functional/apps/machine_learning/data_frame_analytics/classification_creation.ts +++ b/x-pack/test/functional/apps/machine_learning/data_frame_analytics/classification_creation.ts @@ -111,7 +111,7 @@ export default function({ getService }: FtrProviderContext) { it('creates the analytics job', async () => { await ml.dataFrameAnalyticsCreation.assertCreateButtonExists(); - await ml.dataFrameAnalyticsCreation.createAnalyticsJob(); + await ml.dataFrameAnalyticsCreation.createAnalyticsJob(testData.jobId); }); it('starts the analytics job', async () => { diff --git a/x-pack/test/functional/apps/machine_learning/data_frame_analytics/cloning.ts b/x-pack/test/functional/apps/machine_learning/data_frame_analytics/cloning.ts index 51155fccc358d..caf382b532273 100644 --- a/x-pack/test/functional/apps/machine_learning/data_frame_analytics/cloning.ts +++ b/x-pack/test/functional/apps/machine_learning/data_frame_analytics/cloning.ts @@ -13,8 +13,7 @@ export default function({ getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); const ml = getService('ml'); - // failing test, see https://github.com/elastic/kibana/issues/60389 - describe.skip('jobs cloning supported by UI form', function() { + describe('jobs cloning supported by UI form', function() { this.tags(['smoke']); const testDataList: Array<{ @@ -173,7 +172,7 @@ export default function({ getService }: FtrProviderContext) { }); it('should create a clone job', async () => { - await ml.dataFrameAnalyticsCreation.createAnalyticsJob(); + await ml.dataFrameAnalyticsCreation.createAnalyticsJob(cloneJobId); }); it('should start the clone analytics job', async () => { @@ -186,6 +185,10 @@ export default function({ getService }: FtrProviderContext) { await ml.dataFrameAnalyticsCreation.closeCreateAnalyticsJobFlyout(); }); + it('finishes analytics processing', async () => { + await ml.dataFrameAnalytics.waitForAnalyticsCompletion(cloneJobId); + }); + it('displays the created job in the analytics table', async () => { await ml.dataFrameAnalyticsTable.refreshAnalyticsTable(); await ml.dataFrameAnalyticsTable.filterWithSearchString(cloneJobId); diff --git a/x-pack/test/functional/apps/machine_learning/data_frame_analytics/outlier_detection_creation.ts b/x-pack/test/functional/apps/machine_learning/data_frame_analytics/outlier_detection_creation.ts index 173430706f7e7..5481977351d8b 100644 --- a/x-pack/test/functional/apps/machine_learning/data_frame_analytics/outlier_detection_creation.ts +++ b/x-pack/test/functional/apps/machine_learning/data_frame_analytics/outlier_detection_creation.ts @@ -107,7 +107,7 @@ export default function({ getService }: FtrProviderContext) { it('creates the analytics job', async () => { await ml.dataFrameAnalyticsCreation.assertCreateButtonExists(); - await ml.dataFrameAnalyticsCreation.createAnalyticsJob(); + await ml.dataFrameAnalyticsCreation.createAnalyticsJob(testData.jobId); }); it('starts the analytics job', async () => { diff --git a/x-pack/test/functional/apps/machine_learning/data_frame_analytics/regression_creation.ts b/x-pack/test/functional/apps/machine_learning/data_frame_analytics/regression_creation.ts index 3bc524a88f787..aa1a133c81187 100644 --- a/x-pack/test/functional/apps/machine_learning/data_frame_analytics/regression_creation.ts +++ b/x-pack/test/functional/apps/machine_learning/data_frame_analytics/regression_creation.ts @@ -111,7 +111,7 @@ export default function({ getService }: FtrProviderContext) { it('creates the analytics job', async () => { await ml.dataFrameAnalyticsCreation.assertCreateButtonExists(); - await ml.dataFrameAnalyticsCreation.createAnalyticsJob(); + await ml.dataFrameAnalyticsCreation.createAnalyticsJob(testData.jobId); }); it('starts the analytics job', async () => { diff --git a/x-pack/test/functional/services/machine_learning/api.ts b/x-pack/test/functional/services/machine_learning/api.ts index e305d23c1a124..74dc5912df36f 100644 --- a/x-pack/test/functional/services/machine_learning/api.ts +++ b/x-pack/test/functional/services/machine_learning/api.ts @@ -358,9 +358,20 @@ export function MachineLearningAPIProvider({ getService }: FtrProviderContext) { }, async getDataFrameAnalyticsJob(analyticsId: string) { + log.debug(`Fetching data frame analytics job '${analyticsId}'...`); return await esSupertest.get(`/_ml/data_frame/analytics/${analyticsId}`).expect(200); }, + async waitForDataFrameAnalyticsJobToExist(analyticsId: string) { + await retry.waitForWithTimeout(`'${analyticsId}' to exist`, 5 * 1000, async () => { + if (await this.getDataFrameAnalyticsJob(analyticsId)) { + return true; + } else { + throw new Error(`expected data frame analytics job '${analyticsId}' to exist`); + } + }); + }, + async createDataFrameAnalyticsJob(jobConfig: DataFrameAnalyticsConfig) { const { id: analyticsId, ...analyticsConfig } = jobConfig; log.debug(`Creating data frame analytic job with id '${analyticsId}'...`); @@ -369,13 +380,7 @@ export function MachineLearningAPIProvider({ getService }: FtrProviderContext) { .send(analyticsConfig) .expect(200); - await retry.waitForWithTimeout(`'${analyticsId}' to be created`, 5 * 1000, async () => { - if (await this.getDataFrameAnalyticsJob(analyticsId)) { - return true; - } else { - throw new Error(`expected data frame analytics job '${analyticsId}' to be created`); - } - }); + await this.waitForDataFrameAnalyticsJobToExist(analyticsId); }, }; } diff --git a/x-pack/test/functional/services/machine_learning/data_frame_analytics_creation.ts b/x-pack/test/functional/services/machine_learning/data_frame_analytics_creation.ts index 9d5f5753e8b04..49f9b01c96895 100644 --- a/x-pack/test/functional/services/machine_learning/data_frame_analytics_creation.ts +++ b/x-pack/test/functional/services/machine_learning/data_frame_analytics_creation.ts @@ -12,6 +12,7 @@ import { import { FtrProviderContext } from '../../ftr_provider_context'; import { MlCommon } from './common'; +import { MlApi } from './api'; enum ANALYSIS_CONFIG_TYPE { OUTLIER_DETECTION = 'outlier_detection', @@ -31,7 +32,8 @@ const isClassificationAnalysis = (arg: any): arg is ClassificationAnalysis => { export function MachineLearningDataFrameAnalyticsCreationProvider( { getService }: FtrProviderContext, - mlCommon: MlCommon + mlCommon: MlCommon, + mlApi: MlApi ) { const testSubjects = getService('testSubjects'); const comboBox = getService('comboBox'); @@ -333,12 +335,13 @@ export function MachineLearningDataFrameAnalyticsCreationProvider( return !isEnabled; }, - async createAnalyticsJob() { + async createAnalyticsJob(analyticsId: string) { await testSubjects.click('mlAnalyticsCreateJobFlyoutCreateButton'); await retry.tryForTime(5000, async () => { await this.assertCreateButtonMissing(); await this.assertStartButtonExists(); }); + await mlApi.waitForDataFrameAnalyticsJobToExist(analyticsId); }, async assertStartButtonExists() { @@ -362,8 +365,8 @@ export function MachineLearningDataFrameAnalyticsCreationProvider( }, async closeCreateAnalyticsJobFlyout() { - await testSubjects.click('mlAnalyticsCreateJobFlyoutCloseButton'); - await retry.tryForTime(5000, async () => { + await retry.tryForTime(10 * 1000, async () => { + await testSubjects.click('mlAnalyticsCreateJobFlyoutCloseButton'); await testSubjects.missingOrFail('mlAnalyticsCreateJobFlyout'); }); }, diff --git a/x-pack/test/functional/services/ml.ts b/x-pack/test/functional/services/ml.ts index f3981c9edf92f..af7cb51f4e3f0 100644 --- a/x-pack/test/functional/services/ml.ts +++ b/x-pack/test/functional/services/ml.ts @@ -45,7 +45,8 @@ export function MachineLearningProvider(context: FtrProviderContext) { const dataFrameAnalytics = MachineLearningDataFrameAnalyticsProvider(context, api); const dataFrameAnalyticsCreation = MachineLearningDataFrameAnalyticsCreationProvider( context, - common + common, + api ); const dataFrameAnalyticsTable = MachineLearningDataFrameAnalyticsTableProvider(context); const dataVisualizer = MachineLearningDataVisualizerProvider(context);