Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into kbn-76935-extract…
Browse files Browse the repository at this point in the history
…-cli-dev-mode
  • Loading branch information
pgayvallet committed Mar 30, 2021
2 parents b007289 + cd703c0 commit a123e34
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ export default function ({ getService }: FtrProviderContext) {
x: sampleCell.x + cellSize,
y: sampleCell.y + cellSize,
});
await ml.swimLane.waitForSwimLanesToLoad();

// TODO extend cell data with X and Y values, and cell width
await ml.swimLane.assertSelection(overallSwimLaneTestSubj, {
x: [1454846400000, 1454860800000],
Expand All @@ -215,6 +217,8 @@ export default function ({ getService }: FtrProviderContext) {

await ml.testExecution.logTestStep('clears the selection');
await ml.anomalyExplorer.clearSwimLaneSelection();
await ml.swimLane.waitForSwimLanesToLoad();

await ml.navigation.assertCurrentURLNotContain(
'selectedLanes%3A!(Overall)%2CselectedTimes%3A!(1454846400%2C1454860800)%2CselectedType%3Aoverall%2CshowTopFieldValues%3A!t%2CviewByFieldName%3Aairline%2CviewByFromPage%3A1%2CviewByPerPage%3A10'
);
Expand Down Expand Up @@ -255,6 +259,7 @@ export default function ({ getService }: FtrProviderContext) {
x: sampleCell.x + cellSize,
y: sampleCell.y + cellSize,
});
await ml.swimLane.waitForSwimLanesToLoad();

await ml.testExecution.logTestStep('check page content');
await ml.swimLane.assertSelection(viewBySwimLaneTestSubj, {
Expand All @@ -274,6 +279,8 @@ export default function ({ getService }: FtrProviderContext) {

await ml.testExecution.logTestStep('clears the selection');
await ml.anomalyExplorer.clearSwimLaneSelection();
await ml.swimLane.waitForSwimLanesToLoad();

await ml.anomaliesTable.assertTableRowsCount(25);
await ml.anomalyExplorer.assertInfluencerFieldListLength('airline', 10);
await ml.anomalyExplorer.assertAnomalyExplorerChartsCount(0);
Expand All @@ -299,6 +306,7 @@ export default function ({ getService }: FtrProviderContext) {
x2: sampleCell2!.x + cellSize,
y2: sampleCell2!.y + cellSize,
});
await ml.swimLane.waitForSwimLanesToLoad();

await ml.swimLane.assertSelection(viewBySwimLaneTestSubj, {
x: [1454817600000, 1454846400000],
Expand All @@ -311,6 +319,8 @@ export default function ({ getService }: FtrProviderContext) {

await ml.testExecution.logTestStep('clears the selection');
await ml.anomalyExplorer.clearSwimLaneSelection();
await ml.swimLane.waitForSwimLanesToLoad();

await ml.anomaliesTable.assertTableRowsCount(25);
await ml.anomalyExplorer.assertInfluencerFieldListLength('airline', 10);
await ml.anomalyExplorer.assertAnomalyExplorerChartsCount(0);
Expand Down
3 changes: 2 additions & 1 deletion x-pack/test/functional/services/ml/anomaly_explorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ export function MachineLearningAnomalyExplorerProvider({ getService }: FtrProvid
true
);
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');
expect(await swimlane.isDisplayed()).to.eql(
true,
Expand Down
11 changes: 11 additions & 0 deletions x-pack/test/functional/services/ml/swim_lane.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,5 +208,16 @@ export function SwimLaneProvider({ getService }: FtrProviderContext) {
await testSubjects.click(`mlSwimLanePageSizePanel > ${rowsCount} rows`);
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 });
}
},
};
}

0 comments on commit a123e34

Please sign in to comment.