Skip to content

Commit

Permalink
[ML] Functional tests - stabilize typing during df analytics creation (
Browse files Browse the repository at this point in the history
…#58227) (#58442)

This PR makes the typing in data frame analytics tests more robust.
  • Loading branch information
pheyos committed Feb 25, 2020
1 parent dd2b311 commit 328333d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
import expect from '@kbn/expect';

import { FtrProviderContext } from '../../ftr_provider_context';
import { MlCommon } from './common';

export function MachineLearningDataFrameAnalyticsCreationProvider({
getService,
}: FtrProviderContext) {
export function MachineLearningDataFrameAnalyticsCreationProvider(
{ getService }: FtrProviderContext,
mlCommon: MlCommon
) {
const testSubjects = getService('testSubjects');
const comboBox = getService('comboBox');
const retry = getService('retry');
Expand Down Expand Up @@ -85,14 +87,14 @@ export function MachineLearningDataFrameAnalyticsCreationProvider({
},

async setJobId(jobId: string) {
await testSubjects.setValue('mlAnalyticsCreateJobFlyoutJobIdInput', jobId, {
await mlCommon.setValueWithChecks('mlAnalyticsCreateJobFlyoutJobIdInput', jobId, {
clearWithKeyboard: true,
});
await this.assertJobIdValue(jobId);
},

async setJobDescription(jobDescription: string) {
await testSubjects.setValue('mlDFAnalyticsJobCreationJobDescription', jobDescription, {
await mlCommon.setValueWithChecks('mlDFAnalyticsJobCreationJobDescription', jobDescription, {
clearWithKeyboard: true,
});
await this.assertJobDescriptionValue(jobDescription);
Expand Down Expand Up @@ -136,9 +138,13 @@ export function MachineLearningDataFrameAnalyticsCreationProvider({
},

async setDestIndex(destIndex: string) {
await testSubjects.setValue('mlAnalyticsCreateJobFlyoutDestinationIndexInput', destIndex, {
clearWithKeyboard: true,
});
await mlCommon.setValueWithChecks(
'mlAnalyticsCreateJobFlyoutDestinationIndexInput',
destIndex,
{
clearWithKeyboard: true,
}
);
await this.assertDestIndexValue(destIndex);
},

Expand Down Expand Up @@ -248,7 +254,7 @@ export function MachineLearningDataFrameAnalyticsCreationProvider({
},

async setModelMemory(modelMemory: string) {
await testSubjects.setValue('mlAnalyticsCreateJobFlyoutModelMemoryInput', modelMemory, {
await mlCommon.setValueWithChecks('mlAnalyticsCreateJobFlyoutModelMemoryInput', modelMemory, {
clearWithKeyboard: true,
});
await this.assertModelMemoryValue(modelMemory);
Expand Down
5 changes: 4 additions & 1 deletion x-pack/test/functional/services/ml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ export function MachineLearningProvider(context: FtrProviderContext) {
const api = MachineLearningAPIProvider(context);
const customUrls = MachineLearningCustomUrlsProvider(context);
const dataFrameAnalytics = MachineLearningDataFrameAnalyticsProvider(context, api);
const dataFrameAnalyticsCreation = MachineLearningDataFrameAnalyticsCreationProvider(context);
const dataFrameAnalyticsCreation = MachineLearningDataFrameAnalyticsCreationProvider(
context,
common
);
const dataFrameAnalyticsTable = MachineLearningDataFrameAnalyticsTableProvider(context);
const dataVisualizer = MachineLearningDataVisualizerProvider(context);
const dataVisualizerIndexBased = MachineLearningDataVisualizerIndexBasedProvider(context);
Expand Down

0 comments on commit 328333d

Please sign in to comment.