[ML] Functional tests - increase stability of source selection (#51988) (#52287)

This PR adds a retry to the ML source selection service method for functional tests.
This commit is contained in:
Robert Oskamp 2019-12-05 16:52:46 +01:00 committed by GitHub
parent 39d211be0f
commit 4c4382898f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 15 additions and 8 deletions

View file

@ -297,7 +297,7 @@ export default function({ getService }: FtrProviderContext) {
});
it('job creation loads the job type selection page', async () => {
await ml.jobSourceSelection.selectSource(testData.jobSource);
await ml.jobSourceSelection.selectSourceForAnomalyDetectionJob(testData.jobSource);
});
it('job creation loads the advanced job wizard page', async () => {

View file

@ -92,7 +92,7 @@ export default function({ getService }: FtrProviderContext) {
});
it('job creation loads the job type selection page', async () => {
await ml.jobSourceSelection.selectSource('farequote');
await ml.jobSourceSelection.selectSourceForAnomalyDetectionJob('farequote');
});
it('job creation loads the multi metric job wizard page', async () => {

View file

@ -106,7 +106,7 @@ export default function({ getService }: FtrProviderContext) {
});
it('job creation loads the job type selection page', async () => {
await ml.jobSourceSelection.selectSource('ecommerce');
await ml.jobSourceSelection.selectSourceForAnomalyDetectionJob('ecommerce');
});
it('job creation loads the population job wizard page', async () => {

View file

@ -294,7 +294,7 @@ export default function({ getService }: FtrProviderContext) {
});
it('job creation loads the job type selection page', async () => {
await ml.jobSourceSelection.selectSource(testData.jobSource);
await ml.jobSourceSelection.selectSourceForAnomalyDetectionJob(testData.jobSource);
});
it('job creation loads the multi metric job wizard page', async () => {

View file

@ -91,7 +91,7 @@ export default function({ getService }: FtrProviderContext) {
});
it('job creation loads the job type selection page', async () => {
await ml.jobSourceSelection.selectSource('farequote');
await ml.jobSourceSelection.selectSourceForAnomalyDetectionJob('farequote');
});
it('job creation loads the single metric job wizard page', async () => {

View file

@ -8,6 +8,7 @@ import { FtrProviderContext } from '../../ftr_provider_context';
export function MachineLearningJobSourceSelectionProvider({ getService }: FtrProviderContext) {
const testSubjects = getService('testSubjects');
const retry = getService('retry');
return {
async assertSourceListContainsEntry(sourceName: string) {
@ -21,10 +22,16 @@ export function MachineLearningJobSourceSelectionProvider({ getService }: FtrPro
await this.assertSourceListContainsEntry(sourceName);
},
async selectSource(sourceName: string) {
async selectSource(sourceName: string, nextPageSubj: string) {
await this.filterSourceSelection(sourceName);
await testSubjects.clickWhenNotDisabled(`savedObjectTitle${sourceName}`);
await testSubjects.existOrFail('mlPageJobTypeSelection');
await retry.tryForTime(30 * 1000, async () => {
await testSubjects.clickWhenNotDisabled(`savedObjectTitle${sourceName}`);
await testSubjects.existOrFail(nextPageSubj, { timeout: 10 * 1000 });
});
},
async selectSourceForAnomalyDetectionJob(sourceName: string) {
await this.selectSource(sourceName, 'mlPageJobTypeSelection');
},
};
}