mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
Stabilize tests involving absolute timepicker
The asynchronous nature of angular's digest cycle and the page rendering in the browser can lead to situations in which `isGlobalLoadingIndicatorHidden()` returns true because the loading triggered by the previous action has not yet started. In this case subsequent actions incorrectly assume the loading has already been completed. This is probably responsible for the flakiness described in #10302. The newly introduced `waitUntilLoadingHasFinished` first waits for a duration up to `defaultTimeout` for the loading indicator to appear before waiting for it to be hidden again. In the best case this will reduce the false positive rate of `setAbsoluteTimerange()`. In the worst case the function will wait `defaultTimeout` longer than when just using `isGlobalLoadingIndicatorHidden`. fixes #10302
This commit is contained in:
parent
042088085d
commit
345421bd63
1 changed files with 19 additions and 1 deletions
|
@ -123,7 +123,7 @@ export default class HeaderPage {
|
|||
return this.clickGoButton();
|
||||
})
|
||||
.then(() => {
|
||||
return this.isGlobalLoadingIndicatorHidden();
|
||||
return this.waitUntilLoadingHasFinished();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -144,6 +144,24 @@ export default class HeaderPage {
|
|||
.click();
|
||||
}
|
||||
|
||||
async waitUntilLoadingHasFinished() {
|
||||
try {
|
||||
await this.isGlobalLoadingIndicatorVisible();
|
||||
} catch (exception) {
|
||||
if (exception.name === 'NoSuchElement') {
|
||||
// selenium might just have been too slow to catch it
|
||||
} else {
|
||||
throw exception;
|
||||
}
|
||||
}
|
||||
await this.isGlobalLoadingIndicatorHidden();
|
||||
}
|
||||
|
||||
isGlobalLoadingIndicatorVisible() {
|
||||
return this.remote.setFindTimeout(defaultFindTimeout)
|
||||
.findByCssSelector('[data-test-subj="globalLoadingIndicator"]:not(.ng-hide)');
|
||||
}
|
||||
|
||||
isGlobalLoadingIndicatorHidden() {
|
||||
return this.remote.setFindTimeout(defaultFindTimeout * 10)
|
||||
.findByCssSelector('[data-test-subj="globalLoadingIndicator"].ng-hide');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue