From f27a477719cff70c8f54049dfe1b4085d25cb356 Mon Sep 17 00:00:00 2001 From: Marta Bondyra <4283304+mbondyra@users.noreply.github.com> Date: Thu, 15 Aug 2024 21:19:49 +0200 Subject: [PATCH] [Visualize] unskip visualize flaky tests (#190249) ## Summary Fixes https://github.com/elastic/kibana/issues/181884 Fixes https://github.com/elastic/kibana/issues/181883 Fixes https://github.com/elastic/kibana/issues/181895 Fixes https://github.com/elastic/kibana/issues/181881 --- .../vis_types/vislib/public/vis_wrapper.tsx | 43 ++++++++----------- .../apps/visualize/group2/_gauge_chart.ts | 9 ++-- .../apps/visualize/group2/_heatmap_chart.ts | 9 ++-- .../page_objects/visualize_editor_page.ts | 2 + .../apps/lens/open_in_lens/agg_based/gauge.ts | 3 +- 5 files changed, 30 insertions(+), 36 deletions(-) diff --git a/src/plugins/vis_types/vislib/public/vis_wrapper.tsx b/src/plugins/vis_types/vislib/public/vis_wrapper.tsx index 50e1b266963db..262f6cc70038a 100644 --- a/src/plugins/vis_types/vislib/public/vis_wrapper.tsx +++ b/src/plugins/vis_types/vislib/public/vis_wrapper.tsx @@ -48,37 +48,32 @@ const VislibWrapper = ({ core, charts, visData, visConfig, handlers }: VislibWra const visController = useRef(null); const skipRenderComplete = useRef(true); - const renderComplete = useMemo( - () => () => { - const usageCollection = getUsageCollectionStart(); - const containerType = extractContainerType(handlers.getExecutionContext()); - - if (usageCollection && containerType) { - usageCollection.reportUiCounter( - containerType, - METRIC_TYPE.COUNT, - `render_agg_based_${visConfig!.type}` - ); - } - handlers.done(); - }, - [handlers, visConfig] - ); + const renderComplete = useCallback(() => { + if (skipRenderComplete.current) { + return; + } + const usageCollection = getUsageCollectionStart(); + const containerType = extractContainerType(handlers.getExecutionContext()); + + if (usageCollection && containerType) { + usageCollection.reportUiCounter( + containerType, + METRIC_TYPE.COUNT, + `render_agg_based_${visConfig!.type}` + ); + } + handlers.done(); + skipRenderComplete.current = true; + }, [handlers, visConfig]); const renderChart = useMemo( () => debounce(() => { if (visController.current) { - visController.current.render( - visData, - visConfig, - handlers, - skipRenderComplete.current ? undefined : renderComplete - ); + visController.current.render(visData, visConfig, handlers, renderComplete); } - skipRenderComplete.current = true; }, 100), - [handlers, renderComplete, skipRenderComplete, visConfig, visData] + [handlers, renderComplete, visConfig, visData] ); const onResize: EuiResizeObserverProps['onResize'] = useCallback(() => { diff --git a/test/functional/apps/visualize/group2/_gauge_chart.ts b/test/functional/apps/visualize/group2/_gauge_chart.ts index 5c35a90d42027..e9b7ff7d29582 100644 --- a/test/functional/apps/visualize/group2/_gauge_chart.ts +++ b/test/functional/apps/visualize/group2/_gauge_chart.ts @@ -18,8 +18,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const testSubjects = getService('testSubjects'); const PageObjects = getPageObjects(['visualize', 'visEditor', 'visChart', 'timePicker']); - // FLAKY: https://github.com/elastic/kibana/issues/181883 - describe.skip('gauge chart', function indexPatternCreation() { + describe('gauge chart', function indexPatternCreation() { before(async () => { await PageObjects.visualize.initTests(); }); @@ -57,7 +56,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await testSubjects.click('gaugePercentageMode'); await testSubjects.setValue('gaugePercentageModeFormatPattern', '0.0%'); await PageObjects.visChart.waitForVisualizationRenderingStabilized(); - await PageObjects.visEditor.clickGo(); + await PageObjects.visEditor.clickGo(false); await retry.try(async function tryingForTime() { const expectedTexts = ['57.3%', 'Average bytes']; @@ -77,7 +76,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.visEditor.selectField('machine.os.raw'); log.debug('Size = 4'); await PageObjects.visEditor.setSize(4); - await PageObjects.visEditor.clickGo(); + await PageObjects.visEditor.clickGo(false); }); it('should show Split Gauges', async () => { @@ -113,7 +112,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.visEditor.clickBucket('Metric', 'metrics'); await PageObjects.visEditor.selectAggregation('Min', 'metrics'); await PageObjects.visEditor.selectField('bytes', 'metrics'); - await PageObjects.visEditor.clickGo(); + await PageObjects.visEditor.clickGo(false); await retry.try(async function tryingForTime() { const metricValue = await PageObjects.visChart.getGaugeValue(); diff --git a/test/functional/apps/visualize/group2/_heatmap_chart.ts b/test/functional/apps/visualize/group2/_heatmap_chart.ts index 09439635ebc5e..4054ea334cac8 100644 --- a/test/functional/apps/visualize/group2/_heatmap_chart.ts +++ b/test/functional/apps/visualize/group2/_heatmap_chart.ts @@ -15,8 +15,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const inspector = getService('inspector'); const PageObjects = getPageObjects(['visualize', 'visEditor', 'visChart', 'timePicker']); - // FLAKY: https://github.com/elastic/kibana/issues/181884 - describe.skip('heatmap chart', function indexPatternCreation() { + describe('heatmap chart', function indexPatternCreation() { const vizName1 = 'Visualization HeatmapChart'; let isNewChartsLibraryEnabled = false; @@ -38,7 +37,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { log.debug('Field = @timestamp'); await PageObjects.visEditor.selectField('@timestamp'); // leaving Interval set to Auto - await PageObjects.visEditor.clickGo(); + await PageObjects.visEditor.clickGo(isNewChartsLibraryEnabled); }); it('should save and load', async function () { @@ -97,7 +96,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('should show 6 color ranges if changed on options', async function () { await PageObjects.visEditor.clickOptionsTab(); await PageObjects.visEditor.changeHeatmapColorNumbers(6); - await PageObjects.visEditor.clickGo(); + await PageObjects.visEditor.clickGo(isNewChartsLibraryEnabled); await PageObjects.visChart.waitForVisualizationRenderingStabilized(); const legends = await PageObjects.visChart.getLegendEntries(); @@ -138,7 +137,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { log.debug('customize 2 last ranges'); await PageObjects.visEditor.setCustomRangeByIndex(6, '650', '720'); await PageObjects.visEditor.setCustomRangeByIndex(7, '800', '905'); - await PageObjects.visEditor.clickGo(); + await PageObjects.visEditor.clickGo(isNewChartsLibraryEnabled); await PageObjects.visChart.waitForVisualizationRenderingStabilized(); const legends = await PageObjects.visChart.getLegendEntries(); diff --git a/test/functional/page_objects/visualize_editor_page.ts b/test/functional/page_objects/visualize_editor_page.ts index f6f4f121ad11a..1d399f4e9c741 100644 --- a/test/functional/page_objects/visualize_editor_page.ts +++ b/test/functional/page_objects/visualize_editor_page.ts @@ -68,6 +68,8 @@ export class VisualizeEditorPageObject extends FtrService { await this.elasticChart.setNewChartUiDebugFlag(); } + await this.common.sleep(500); // wait for the visualization to render + const prevRenderingCount = await this.visChart.getVisualizationRenderingCount(); this.log.debug(`Before Rendering count ${prevRenderingCount}`); await this.testSubjects.clickWhenNotDisabledWithoutRetry('visualizeEditorRenderButton'); diff --git a/x-pack/test/functional/apps/lens/open_in_lens/agg_based/gauge.ts b/x-pack/test/functional/apps/lens/open_in_lens/agg_based/gauge.ts index 67f1739a53d9b..8a0cd091bb85d 100644 --- a/x-pack/test/functional/apps/lens/open_in_lens/agg_based/gauge.ts +++ b/x-pack/test/functional/apps/lens/open_in_lens/agg_based/gauge.ts @@ -21,8 +21,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { const testSubjects = getService('testSubjects'); const elasticChart = getService('elasticChart'); - // Failing: See https://github.com/elastic/kibana/issues/181895 - describe.skip('Gauge', function describeIndexTests() { + describe('Gauge', function describeIndexTests() { const isNewChartsLibraryEnabled = true; before(async () => {