Skip to content

Commit

Permalink
[ML] Make navigation in tests more stable (#50132) (#50291)
Browse files Browse the repository at this point in the history
This PR fixes the ML navigation.
  • Loading branch information
pheyos authored Nov 12, 2019
1 parent aa0c797 commit 4d64a3f
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions x-pack/test/functional/services/machine_learning/navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,10 @@ export function MachineLearningNavigationProvider({
},

async navigateToArea(linkSubject: string, pageSubject: string) {
await retry.tryForTime(2 * 60 * 1000, async () => {
if ((await testSubjects.exists(`${linkSubject} selected`)) === false) {
await testSubjects.click(linkSubject);
await testSubjects.existOrFail(`${linkSubject} selected`, { timeout: 30 * 1000 });
await testSubjects.existOrFail(pageSubject, { timeout: 30 * 1000 });
}
await testSubjects.click(linkSubject);
await retry.tryForTime(60 * 1000, async () => {
await testSubjects.existOrFail(`${linkSubject} & ~selected`);
await testSubjects.existOrFail(pageSubject);
});
},

Expand All @@ -51,11 +49,11 @@ export function MachineLearningNavigationProvider({
},

async navigateToOverview() {
await this.navigateToArea('mlMainTab overview', 'mlPageOverview');
await this.navigateToArea('~mlMainTab & ~overview', 'mlPageOverview');
},

async navigateToAnomalyDetection() {
await this.navigateToArea('mlMainTab anomalyDetection', 'mlPageJobManagement');
await this.navigateToArea('~mlMainTab & ~anomalyDetection', 'mlPageJobManagement');
await this.assertTabsExist('mlSubTab', [
'jobManagement',
'anomalyExplorer',
Expand All @@ -65,33 +63,33 @@ export function MachineLearningNavigationProvider({
},

async navigateToDataFrameAnalytics() {
await this.navigateToArea('mlMainTab dataFrameAnalytics', 'mlPageDataFrameAnalytics');
await this.navigateToArea('~mlMainTab & ~dataFrameAnalytics', 'mlPageDataFrameAnalytics');
await this.assertTabsExist('mlSubTab', []);
},

async navigateToDataVisualizer() {
await this.navigateToArea('mlMainTab dataVisualizer', 'mlPageDataVisualizerSelector');
await this.navigateToArea('~mlMainTab & ~dataVisualizer', 'mlPageDataVisualizerSelector');
await this.assertTabsExist('mlSubTab', []);
},

async navigateToJobManagement() {
await this.navigateToAnomalyDetection();
await this.navigateToArea('mlSubTab jobManagement', 'mlPageJobManagement');
await this.navigateToArea('~mlSubTab & ~jobManagement', 'mlPageJobManagement');
},

async navigateToAnomalyExplorer() {
await this.navigateToAnomalyDetection();
await this.navigateToArea('mlSubTab anomalyExplorer', 'mlPageAnomalyExplorer');
await this.navigateToArea('~mlSubTab & ~anomalyExplorer', 'mlPageAnomalyExplorer');
},

async navigateToSingleMetricViewer() {
await this.navigateToAnomalyDetection();
await this.navigateToArea('mlSubTab singleMetricViewer', 'mlPageSingleMetricViewer');
await this.navigateToArea('~mlSubTab & ~singleMetricViewer', 'mlPageSingleMetricViewer');
},

async navigateToSettings() {
await this.navigateToAnomalyDetection();
await this.navigateToArea('mlSubTab settings', 'mlPageSettings');
await this.navigateToArea('~mlSubTab & ~settings', 'mlPageSettings');
},
};
}

0 comments on commit 4d64a3f

Please sign in to comment.