diff --git a/test/functional/page_objects/discover_page.js b/test/functional/page_objects/discover_page.js index 8d12b2117a2149..28d7526388b40f 100644 --- a/test/functional/page_objects/discover_page.js +++ b/test/functional/page_objects/discover_page.js @@ -31,6 +31,7 @@ export function DiscoverPageProvider({ getService, getPageObjects }) { const config = getService('config'); const defaultFindTimeout = config.get('timeouts.find'); const comboBox = getService('comboBox'); + const elasticChart = getService('elasticChart'); class DiscoverPage { async getQueryField() { @@ -292,6 +293,9 @@ export function DiscoverPageProvider({ getService, getPageObjects }) { await testSubjects.missingOrFail('filterSelectionPanel', { allowHidden: true }); } + async waitForChartLoadingComplete(renderCount) { + await elasticChart.waitForRenderingCount('discoverChart', renderCount); + } } return new DiscoverPage(); diff --git a/test/visual_regression/tests/discover/chart_visualization.js b/test/visual_regression/tests/discover/chart_visualization.js index 540d95973b547f..da6b7ff50e8f49 100644 --- a/test/visual_regression/tests/discover/chart_visualization.js +++ b/test/visual_regression/tests/discover/chart_visualization.js @@ -48,10 +48,12 @@ export default function ({ getService, getPageObjects }) { describe('query', function () { this.tags(['skipFirefox']); + let renderCounter = 0; it('should show bars in the correct time zone', async function () { await PageObjects.header.awaitGlobalLoadingIndicatorHidden(); await PageObjects.discover.waitUntilSearchingHasFinished(); + await PageObjects.discover.waitForChartLoadingComplete(++renderCounter); await visualTesting.snapshot({ show: ['discoverChart'], }); @@ -61,6 +63,7 @@ export default function ({ getService, getPageObjects }) { await PageObjects.header.awaitGlobalLoadingIndicatorHidden(); await PageObjects.discover.waitUntilSearchingHasFinished(); await PageObjects.discover.setChartInterval('Hourly'); + await PageObjects.discover.waitForChartLoadingComplete(++renderCounter); await visualTesting.snapshot({ show: ['discoverChart'], }); @@ -70,6 +73,7 @@ export default function ({ getService, getPageObjects }) { await PageObjects.header.awaitGlobalLoadingIndicatorHidden(); await PageObjects.discover.waitUntilSearchingHasFinished(); await PageObjects.discover.setChartInterval('Daily'); + await PageObjects.discover.waitForChartLoadingComplete(++renderCounter); await visualTesting.snapshot({ show: ['discoverChart'], }); @@ -79,6 +83,7 @@ export default function ({ getService, getPageObjects }) { await PageObjects.header.awaitGlobalLoadingIndicatorHidden(); await PageObjects.discover.waitUntilSearchingHasFinished(); await PageObjects.discover.setChartInterval('Weekly'); + await PageObjects.discover.waitForChartLoadingComplete(++renderCounter); await visualTesting.snapshot({ show: ['discoverChart'], }); @@ -92,6 +97,7 @@ export default function ({ getService, getPageObjects }) { }); await PageObjects.header.awaitGlobalLoadingIndicatorHidden(); await PageObjects.discover.waitUntilSearchingHasFinished(); + await PageObjects.discover.waitForChartLoadingComplete(++renderCounter); await visualTesting.snapshot({ show: ['discoverChart'], }); @@ -101,6 +107,7 @@ export default function ({ getService, getPageObjects }) { await PageObjects.header.awaitGlobalLoadingIndicatorHidden(); await PageObjects.discover.waitUntilSearchingHasFinished(); await PageObjects.discover.setChartInterval('Monthly'); + await PageObjects.discover.waitForChartLoadingComplete(++renderCounter); await visualTesting.snapshot({ show: ['discoverChart'], }); @@ -110,6 +117,7 @@ export default function ({ getService, getPageObjects }) { await PageObjects.header.awaitGlobalLoadingIndicatorHidden(); await PageObjects.discover.waitUntilSearchingHasFinished(); await PageObjects.discover.setChartInterval('Yearly'); + await PageObjects.discover.waitForChartLoadingComplete(++renderCounter); await visualTesting.snapshot({ show: ['discoverChart'], }); @@ -119,6 +127,7 @@ export default function ({ getService, getPageObjects }) { await PageObjects.header.awaitGlobalLoadingIndicatorHidden(); await PageObjects.discover.waitUntilSearchingHasFinished(); await PageObjects.discover.setChartInterval('Auto'); + await PageObjects.discover.waitForChartLoadingComplete(++renderCounter); await visualTesting.snapshot({ show: ['discoverChart'], }); @@ -133,6 +142,7 @@ export default function ({ getService, getPageObjects }) { await PageObjects.timePicker.setDefaultAbsoluteRange(); await PageObjects.header.awaitGlobalLoadingIndicatorHidden(); await PageObjects.discover.waitUntilSearchingHasFinished(); + await PageObjects.discover.waitForChartLoadingComplete(1); await visualTesting.snapshot({ show: ['discoverChart'], });