Skip to content

Commit

Permalink
[ML] Functional tests - stabilize DFA dependent variable input (elast…
Browse files Browse the repository at this point in the history
…ic#74829) (elastic#74846)

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 ad21625 commit 4368f63
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 @@ -224,23 +224,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 @@ -249,8 +259,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 4368f63

Please sign in to comment.