Skip to content

Commit

Permalink
[Visualize] unskip visualize flaky tests (elastic#190249)
Browse files Browse the repository at this point in the history
## Summary

Fixes elastic#181884
Fixes elastic#181883
Fixes elastic#181895
Fixes elastic#181881
  • Loading branch information
mbondyra authored Aug 15, 2024
1 parent 17b2be1 commit f27a477
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 36 deletions.
43 changes: 19 additions & 24 deletions src/plugins/vis_types/vislib/public/vis_wrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,37 +48,32 @@ const VislibWrapper = ({ core, charts, visData, visConfig, handlers }: VislibWra
const visController = useRef<VislibVisController | null>(null);
const skipRenderComplete = useRef<boolean>(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(() => {
Expand Down
9 changes: 4 additions & 5 deletions test/functional/apps/visualize/group2/_gauge_chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Expand Down Expand Up @@ -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'];
Expand All @@ -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 () => {
Expand Down Expand Up @@ -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();
Expand Down
9 changes: 4 additions & 5 deletions test/functional/apps/visualize/group2/_heatmap_chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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 () {
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down
2 changes: 2 additions & 0 deletions test/functional/page_objects/visualize_editor_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down

0 comments on commit f27a477

Please sign in to comment.