Skip to content

Commit

Permalink
[ML] Functional tests - stabilize DFA dependent variable input (#74829)
Browse files Browse the repository at this point in the history
This PR stabilizes the dependent variable input during tests by explicitly waiting for the options to load.
  • Loading branch information
pheyos authored Aug 12, 2020
1 parent 21b9b36 commit 178afd7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,9 @@ export const ConfigurationStepForm: FC<CreateAnalyticsStepProps> = ({
}
isClearable={false}
isInvalid={dependentVariable === ''}
data-test-subj="mlAnalyticsCreateJobWizardDependentVariableSelect"
data-test-subj={`mlAnalyticsCreateJobWizardDependentVariableSelect${
loadingDepVarOptions ? ' loading' : ' loaded'
}`}
/>
</EuiFormRow>
</Fragment>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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]);
Expand Down

0 comments on commit 178afd7

Please sign in to comment.