[ML] Functional tests - stabilize anomaly explorer tests for slow network (#95628)

This PR stabilizes the ML anomaly explorer functional tests for slow network environments.
This commit is contained in:
Robert Oskamp 2021-03-30 10:51:00 +02:00 committed by GitHub
parent e46a74f757
commit 3e4af77d5a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 1 deletions

View file

@ -189,6 +189,8 @@ export default function ({ getService }: FtrProviderContext) {
x: sampleCell.x + cellSize, x: sampleCell.x + cellSize,
y: sampleCell.y + cellSize, y: sampleCell.y + cellSize,
}); });
await ml.swimLane.waitForSwimLanesToLoad();
// TODO extend cell data with X and Y values, and cell width // TODO extend cell data with X and Y values, and cell width
await ml.swimLane.assertSelection(overallSwimLaneTestSubj, { await ml.swimLane.assertSelection(overallSwimLaneTestSubj, {
x: [1454846400000, 1454860800000], x: [1454846400000, 1454860800000],
@ -215,6 +217,8 @@ export default function ({ getService }: FtrProviderContext) {
await ml.testExecution.logTestStep('clears the selection'); await ml.testExecution.logTestStep('clears the selection');
await ml.anomalyExplorer.clearSwimLaneSelection(); await ml.anomalyExplorer.clearSwimLaneSelection();
await ml.swimLane.waitForSwimLanesToLoad();
await ml.navigation.assertCurrentURLNotContain( await ml.navigation.assertCurrentURLNotContain(
'selectedLanes%3A!(Overall)%2CselectedTimes%3A!(1454846400%2C1454860800)%2CselectedType%3Aoverall%2CshowTopFieldValues%3A!t%2CviewByFieldName%3Aairline%2CviewByFromPage%3A1%2CviewByPerPage%3A10' 'selectedLanes%3A!(Overall)%2CselectedTimes%3A!(1454846400%2C1454860800)%2CselectedType%3Aoverall%2CshowTopFieldValues%3A!t%2CviewByFieldName%3Aairline%2CviewByFromPage%3A1%2CviewByPerPage%3A10'
); );
@ -255,6 +259,7 @@ export default function ({ getService }: FtrProviderContext) {
x: sampleCell.x + cellSize, x: sampleCell.x + cellSize,
y: sampleCell.y + cellSize, y: sampleCell.y + cellSize,
}); });
await ml.swimLane.waitForSwimLanesToLoad();
await ml.testExecution.logTestStep('check page content'); await ml.testExecution.logTestStep('check page content');
await ml.swimLane.assertSelection(viewBySwimLaneTestSubj, { await ml.swimLane.assertSelection(viewBySwimLaneTestSubj, {
@ -274,6 +279,8 @@ export default function ({ getService }: FtrProviderContext) {
await ml.testExecution.logTestStep('clears the selection'); await ml.testExecution.logTestStep('clears the selection');
await ml.anomalyExplorer.clearSwimLaneSelection(); await ml.anomalyExplorer.clearSwimLaneSelection();
await ml.swimLane.waitForSwimLanesToLoad();
await ml.anomaliesTable.assertTableRowsCount(25); await ml.anomaliesTable.assertTableRowsCount(25);
await ml.anomalyExplorer.assertInfluencerFieldListLength('airline', 10); await ml.anomalyExplorer.assertInfluencerFieldListLength('airline', 10);
await ml.anomalyExplorer.assertAnomalyExplorerChartsCount(0); await ml.anomalyExplorer.assertAnomalyExplorerChartsCount(0);
@ -299,6 +306,7 @@ export default function ({ getService }: FtrProviderContext) {
x2: sampleCell2!.x + cellSize, x2: sampleCell2!.x + cellSize,
y2: sampleCell2!.y + cellSize, y2: sampleCell2!.y + cellSize,
}); });
await ml.swimLane.waitForSwimLanesToLoad();
await ml.swimLane.assertSelection(viewBySwimLaneTestSubj, { await ml.swimLane.assertSelection(viewBySwimLaneTestSubj, {
x: [1454817600000, 1454846400000], x: [1454817600000, 1454846400000],
@ -311,6 +319,8 @@ export default function ({ getService }: FtrProviderContext) {
await ml.testExecution.logTestStep('clears the selection'); await ml.testExecution.logTestStep('clears the selection');
await ml.anomalyExplorer.clearSwimLaneSelection(); await ml.anomalyExplorer.clearSwimLaneSelection();
await ml.swimLane.waitForSwimLanesToLoad();
await ml.anomaliesTable.assertTableRowsCount(25); await ml.anomaliesTable.assertTableRowsCount(25);
await ml.anomalyExplorer.assertInfluencerFieldListLength('airline', 10); await ml.anomalyExplorer.assertInfluencerFieldListLength('airline', 10);
await ml.anomalyExplorer.assertAnomalyExplorerChartsCount(0); await ml.anomalyExplorer.assertAnomalyExplorerChartsCount(0);

View file

@ -89,7 +89,8 @@ export function MachineLearningAnomalyExplorerProvider({ getService }: FtrProvid
true true
); );
await testSubjects.clickWhenNotDisabled('mlAddAndEditDashboardButton'); await testSubjects.clickWhenNotDisabled('mlAddAndEditDashboardButton');
const embeddable = await testSubjects.find('mlAnomalySwimlaneEmbeddableWrapper'); // changing to the dashboard app might take sime time
const embeddable = await testSubjects.find('mlAnomalySwimlaneEmbeddableWrapper', 30 * 1000);
const swimlane = await embeddable.findByClassName('mlSwimLaneContainer'); const swimlane = await embeddable.findByClassName('mlSwimLaneContainer');
expect(await swimlane.isDisplayed()).to.eql( expect(await swimlane.isDisplayed()).to.eql(
true, true,

View file

@ -208,5 +208,16 @@ export function SwimLaneProvider({ getService }: FtrProviderContext) {
await testSubjects.click(`mlSwimLanePageSizePanel > ${rowsCount} rows`); await testSubjects.click(`mlSwimLanePageSizePanel > ${rowsCount} rows`);
await this.assertPageSize(testSubj, rowsCount); await this.assertPageSize(testSubj, rowsCount);
}, },
async waitForSwimLanesToLoad() {
// when updating the swim lanes, the old lanes might still be displayed
// for some time, before the loading indicator is displayed
// wait for loading indicator to be displayed, but don't fail in case it's already gone
if (await testSubjects.exists('mlSwimLaneLoadingIndicator', { timeout: 10 * 1000 })) {
// only wait for loading indicator to disappear if it was actually displayed
await testSubjects.missingOrFail('mlSwimLaneLoadingIndicator', { timeout: 10 * 1000 });
}
},
}; };
} }