diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/configuration_step/configuration_step_form.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/configuration_step/configuration_step_form.tsx index 571c7731822c..2ae199664746 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/configuration_step/configuration_step_form.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/configuration_step/configuration_step_form.tsx @@ -397,7 +397,9 @@ export const ConfigurationStepForm: FC = ({ } isClearable={false} isInvalid={dependentVariable === ''} - data-test-subj="mlAnalyticsCreateJobWizardDependentVariableSelect" + data-test-subj={`mlAnalyticsCreateJobWizardDependentVariableSelect${ + loadingDepVarOptions ? ' loading' : ' loaded' + }`} /> diff --git a/x-pack/test/functional/services/ml/data_frame_analytics_creation.ts b/x-pack/test/functional/services/ml/data_frame_analytics_creation.ts index d8df2fb869ed..474d6845ef3e 100644 --- a/x-pack/test/functional/services/ml/data_frame_analytics_creation.ts +++ b/x-pack/test/functional/services/ml/data_frame_analytics_creation.ts @@ -228,23 +228,33 @@ export function MachineLearningDataFrameAnalyticsCreationProvider( await this.assertDestIndexValue(destIndex); }, + async waitForDependentVariableInputLoaded() { + await testSubjects.existOrFail('~mlAnalyticsCreateJobWizardDependentVariableSelect', { + timeout: 5 * 1000, + }); + await testSubjects.existOrFail('mlAnalyticsCreateJobWizardDependentVariableSelect loaded', { + timeout: 30 * 1000, + }); + }, + async assertDependentVariableInputExists() { await retry.tryForTime(8000, async () => { await testSubjects.existOrFail( - 'mlAnalyticsCreateJobWizardDependentVariableSelect > comboBoxInput' + '~mlAnalyticsCreateJobWizardDependentVariableSelect > comboBoxInput' ); }); }, async assertDependentVariableInputMissing() { await testSubjects.missingOrFail( - 'mlAnalyticsCreateJobWizardDependentVariableSelect > comboBoxInput' + '~mlAnalyticsCreateJobWizardDependentVariableSelect > comboBoxInput' ); }, async assertDependentVariableSelection(expectedSelection: string[]) { + await this.waitForDependentVariableInputLoaded(); const actualSelection = await comboBox.getComboBoxSelectedOptions( - 'mlAnalyticsCreateJobWizardDependentVariableSelect > comboBoxInput' + '~mlAnalyticsCreateJobWizardDependentVariableSelect > comboBoxInput' ); expect(actualSelection).to.eql( expectedSelection, @@ -253,8 +263,9 @@ export function MachineLearningDataFrameAnalyticsCreationProvider( }, async selectDependentVariable(dependentVariable: string) { + await this.waitForDependentVariableInputLoaded(); await comboBox.set( - 'mlAnalyticsCreateJobWizardDependentVariableSelect > comboBoxInput', + '~mlAnalyticsCreateJobWizardDependentVariableSelect > comboBoxInput', dependentVariable ); await this.assertDependentVariableSelection([dependentVariable]);