[6.x] [pageObjects/visalize/waitForRenderingCount] wait for rendering count to be >= (#29366) (#29388)

Backports the following commits to 6.x:
 - [pageObjects/visalize/waitForRenderingCount] wait for rendering count to be >=  (#29366)
This commit is contained in:
Spencer 2019-01-25 14:40:09 -08:00 committed by GitHub
parent 44e98ce662
commit bd3dcf8b7e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -584,7 +584,7 @@ export function VisualizePageProvider({ getService, getPageObjects }) {
const prevRenderingCount = await this.getVisualizationRenderingCount();
log.debug(`Before Rendering count ${prevRenderingCount}`);
await testSubjects.clickWhenNotDisabled('visualizeEditorRenderButton');
await this.waitForRenderingCount(prevRenderingCount);
await this.waitForRenderingCount(prevRenderingCount + 1);
}
async clickReset() {
@ -949,22 +949,26 @@ export function VisualizePageProvider({ getService, getPageObjects }) {
return Number(renderingCount);
}
async waitForRenderingCount(previousCount = 0, increment = 1) {
await retry.try(async () => {
async waitForRenderingCount(minimumCount = 1) {
await retry.waitFor(`rendering count to be greater than or equal to [${minimumCount}]`, async () => {
const currentRenderingCount = await this.getVisualizationRenderingCount();
log.debug(`Readed rendering count ${previousCount} ${currentRenderingCount}`);
expect(currentRenderingCount).to.be(previousCount + increment);
log.debug(`-- currentRenderingCount=${currentRenderingCount}`);
return currentRenderingCount >= minimumCount;
});
}
async waitForVisualizationRenderingStabilized() {
//assuming rendering is done when data-rendering-count is constant within 1000 ms
await retry.try(async () => {
const previousCount = await this.getVisualizationRenderingCount();
await retry.waitFor('rendering count to stabilize', async () => {
const firstCount = await this.getVisualizationRenderingCount();
log.debug(`-- firstCount=${firstCount}`);
await PageObjects.common.sleep(1000);
const currentCount = await this.getVisualizationRenderingCount();
log.debug(`Readed rendering count ${previousCount} ${currentCount}`);
expect(currentCount).to.be(previousCount);
const secondCount = await this.getVisualizationRenderingCount();
log.debug(`-- secondCount=${secondCount}`);
return firstCount === secondCount;
});
}