Skip to content

Commit

Permalink
[ML] Functional tests - increase stability of source selection (elast…
Browse files Browse the repository at this point in the history
…ic#51988)

This PR adds a retry to the ML source selection service method for functional tests.
  • Loading branch information
pheyos authored Dec 3, 2019
1 parent 36e7bc3 commit 0ac7d53
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -21,16 +22,20 @@ 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');
},

async selectSourceForIndexBasedDataVisualizer(sourceName: string) {
await this.filterSourceSelection(sourceName);
await testSubjects.clickWhenNotDisabled(`savedObjectTitle${sourceName}`);
await testSubjects.existOrFail('mlPageIndexDataVisualizer', { timeout: 10 * 1000 });
await this.selectSource(sourceName, 'mlPageIndexDataVisualizer');
},
};
}

0 comments on commit 0ac7d53

Please sign in to comment.