[ML] Functional tests - stabilize DFA dependent variable input (#74829)

This PR stabilizes the dependent variable input during tests by explicitly waiting for the options to load.
This commit is contained in:
Robert Oskamp 2020-08-12 13:42:43 +02:00 committed by GitHub
parent 21b9b36c94
commit 178afd71fc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 5 deletions

View file

@ -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>

View file

@ -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]);