From d05585ef70db1fb89ecc55ce1da578fcb85a127e Mon Sep 17 00:00:00 2001 From: Robert Oskamp Date: Thu, 12 Dec 2019 13:04:21 +0100 Subject: [PATCH] [ML] Functional tests - export service types (#52612) (#52857) With this PR the types of the ML services that are used in other services are exported from the service file to allow a cleaner re-use. --- x-pack/test/functional/services/machine_learning/api.ts | 3 +++ x-pack/test/functional/services/machine_learning/common.ts | 3 +++ .../functional/services/machine_learning/job_management.ts | 5 ++--- .../services/machine_learning/job_wizard_advanced.ts | 5 ++--- .../services/machine_learning/job_wizard_common.ts | 5 ++--- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/x-pack/test/functional/services/machine_learning/api.ts b/x-pack/test/functional/services/machine_learning/api.ts index 2fc027a81ea8cf..cee1032dad880b 100644 --- a/x-pack/test/functional/services/machine_learning/api.ts +++ b/x-pack/test/functional/services/machine_learning/api.ts @@ -4,12 +4,15 @@ * you may not use this file except in compliance with the Elastic License. */ import expect from '@kbn/expect'; +import { ProvidedType } from '@kbn/test/types/ftr'; import { isEmpty } from 'lodash'; import { FtrProviderContext } from '../../ftr_provider_context'; import { JOB_STATE, DATAFEED_STATE } from '../../../../legacy/plugins/ml/common/constants/states'; +export type MlApi = ProvidedType; + export function MachineLearningAPIProvider({ getService }: FtrProviderContext) { const es = getService('legacyEs'); const log = getService('log'); diff --git a/x-pack/test/functional/services/machine_learning/common.ts b/x-pack/test/functional/services/machine_learning/common.ts index 12b9e8a1cfb294..35ee32fa5d94ee 100644 --- a/x-pack/test/functional/services/machine_learning/common.ts +++ b/x-pack/test/functional/services/machine_learning/common.ts @@ -3,6 +3,7 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ +import { ProvidedType } from '@kbn/test/types/ftr'; import { FtrProviderContext } from '../../ftr_provider_context'; @@ -11,6 +12,8 @@ interface SetValueOptions { typeCharByChar?: boolean; } +export type MlCommon = ProvidedType; + export function MachineLearningCommonProvider({ getService }: FtrProviderContext) { const log = getService('log'); const retry = getService('retry'); diff --git a/x-pack/test/functional/services/machine_learning/job_management.ts b/x-pack/test/functional/services/machine_learning/job_management.ts index 5ffb235a828d6b..1fa1f62a9ae119 100644 --- a/x-pack/test/functional/services/machine_learning/job_management.ts +++ b/x-pack/test/functional/services/machine_learning/job_management.ts @@ -3,16 +3,15 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ -import { ProvidedType } from '@kbn/test/types/ftr'; import { FtrProviderContext } from '../../ftr_provider_context'; -import { MachineLearningAPIProvider } from './api'; +import { MlApi } from './api'; import { JOB_STATE, DATAFEED_STATE } from '../../../../legacy/plugins/ml/common/constants/states'; export function MachineLearningJobManagementProvider( { getService }: FtrProviderContext, - mlApi: ProvidedType + mlApi: MlApi ) { const testSubjects = getService('testSubjects'); diff --git a/x-pack/test/functional/services/machine_learning/job_wizard_advanced.ts b/x-pack/test/functional/services/machine_learning/job_wizard_advanced.ts index ab53b0412ca353..755091ca10f3b6 100644 --- a/x-pack/test/functional/services/machine_learning/job_wizard_advanced.ts +++ b/x-pack/test/functional/services/machine_learning/job_wizard_advanced.ts @@ -4,14 +4,13 @@ * you may not use this file except in compliance with the Elastic License. */ import expect from '@kbn/expect'; -import { ProvidedType } from '@kbn/test/types/ftr'; import { FtrProviderContext } from '../../ftr_provider_context'; -import { MachineLearningCommonProvider } from './common'; +import { MlCommon } from './common'; export function MachineLearningJobWizardAdvancedProvider( { getService }: FtrProviderContext, - mlCommon: ProvidedType + mlCommon: MlCommon ) { const comboBox = getService('comboBox'); const testSubjects = getService('testSubjects'); diff --git a/x-pack/test/functional/services/machine_learning/job_wizard_common.ts b/x-pack/test/functional/services/machine_learning/job_wizard_common.ts index 5b646e598b6cf5..cd64419dd9254b 100644 --- a/x-pack/test/functional/services/machine_learning/job_wizard_common.ts +++ b/x-pack/test/functional/services/machine_learning/job_wizard_common.ts @@ -4,14 +4,13 @@ * you may not use this file except in compliance with the Elastic License. */ import expect from '@kbn/expect'; -import { ProvidedType } from '@kbn/test/types/ftr'; import { FtrProviderContext } from '../../ftr_provider_context'; -import { MachineLearningCommonProvider } from './common'; +import { MlCommon } from './common'; export function MachineLearningJobWizardCommonProvider( { getService }: FtrProviderContext, - mlCommon: ProvidedType + mlCommon: MlCommon ) { const comboBox = getService('comboBox'); const retry = getService('retry');