Skip to content

Commit

Permalink
[8.x] [Visualize] remove never executing functional tests code (#198512
Browse files Browse the repository at this point in the history
…) (#199737)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Visualize] remove never executing functional tests code
(#198512)](#198512)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Marta
Bondyra","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-11-08T09:00:36Z","message":"[Visualize]
remove never executing functional tests code (#198512)\n\n##
Summary\r\n\r\nRemoves the code that goes through the condition if the
vis comes from\r\nnew or legacy library. Pie charts or xy charts don't
use vislib\r\nimplementation anymore, so the condition will always give
the
same\r\nresult.","sha":"2ba6560d0d8fcb110ebb84abaf20df259da803e2","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Visualizations","release_note:skip","backport
missing","v9.0.0","backport:prev-minor"],"title":"[Visualize] remove
never executing functional tests
code","number":198512,"url":"https://github.com/elastic/kibana/pull/198512","mergeCommit":{"message":"[Visualize]
remove never executing functional tests code (#198512)\n\n##
Summary\r\n\r\nRemoves the code that goes through the condition if the
vis comes from\r\nnew or legacy library. Pie charts or xy charts don't
use vislib\r\nimplementation anymore, so the condition will always give
the
same\r\nresult.","sha":"2ba6560d0d8fcb110ebb84abaf20df259da803e2"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/198512","number":198512,"mergeCommit":{"message":"[Visualize]
remove never executing functional tests code (#198512)\n\n##
Summary\r\n\r\nRemoves the code that goes through the condition if the
vis comes from\r\nnew or legacy library. Pie charts or xy charts don't
use vislib\r\nimplementation anymore, so the condition will always give
the
same\r\nresult.","sha":"2ba6560d0d8fcb110ebb84abaf20df259da803e2"}}]}]
BACKPORT-->

Co-authored-by: Marta Bondyra <[email protected]>
  • Loading branch information
kibanamachine and mbondyra authored Nov 12, 2024
1 parent 27ca4fb commit e4f727e
Show file tree
Hide file tree
Showing 23 changed files with 224 additions and 324 deletions.
2 changes: 1 addition & 1 deletion test/functional/apps/getting_started/_shakespeare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {

// Remove refresh click when vislib is removed
// https://github.com/elastic/kibana/issues/56143
await PageObjects.visualize.clickRefresh(true);
await PageObjects.visualize.clickRefresh();

const expectedChartValues = [111396];
await retry.try(async () => {
Expand Down
6 changes: 3 additions & 3 deletions test/functional/apps/visualize/group2/_gauge_chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await testSubjects.click('gaugePercentageMode');
await testSubjects.setValue('gaugePercentageModeFormatPattern', '0.0%');
await visChart.waitForVisualizationRenderingStabilized();
await visEditor.clickGo(false);
await visEditor.clickGo(true);

await retry.try(async function tryingForTime() {
const expectedTexts = ['57.3%', 'Average bytes'];
Expand All @@ -82,7 +82,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await visEditor.selectField('machine.os.raw');
log.debug('Size = 4');
await visEditor.setSize(4);
await visEditor.clickGo(false);
await visEditor.clickGo(true);
});

it('should show Split Gauges', async () => {
Expand Down Expand Up @@ -118,7 +118,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await visEditor.clickBucket('Metric', 'metrics');
await visEditor.selectAggregation('Min', 'metrics');
await visEditor.selectField('bytes', 'metrics');
await visEditor.clickGo(false);
await visEditor.clickGo(true);

await retry.try(async function tryingForTime() {
const metricValue = await visChart.getGaugeValue();
Expand Down
8 changes: 4 additions & 4 deletions test/functional/apps/visualize/group2/_heatmap_chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
isNewChartsLibraryEnabled = await visChart.isNewChartsLibraryEnabled(
'visualization:visualize:legacyHeatmapChartsLibrary'
);
await visualize.initTests(isNewChartsLibraryEnabled);
await visualize.initTests(!isNewChartsLibraryEnabled);
log.debug('navigateToApp visualize');
await visualize.navigateToNewAggBasedVisualization();
log.debug('clickHeatmapChart');
Expand All @@ -43,7 +43,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
log.debug('Field = @timestamp');
await visEditor.selectField('@timestamp');
// leaving Interval set to Auto
await visEditor.clickGo(isNewChartsLibraryEnabled);
await visEditor.clickGo(!isNewChartsLibraryEnabled);
});

it('should save and load', async function () {
Expand Down Expand Up @@ -102,7 +102,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
it('should show 6 color ranges if changed on options', async function () {
await visEditor.clickOptionsTab();
await visEditor.changeHeatmapColorNumbers(6);
await visEditor.clickGo(isNewChartsLibraryEnabled);
await visEditor.clickGo(!isNewChartsLibraryEnabled);
await visChart.waitForVisualizationRenderingStabilized();

const legends = await visChart.getLegendEntries();
Expand Down Expand Up @@ -143,7 +143,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
log.debug('customize 2 last ranges');
await visEditor.setCustomRangeByIndex(6, '650', '720');
await visEditor.setCustomRangeByIndex(7, '800', '905');
await visEditor.clickGo(isNewChartsLibraryEnabled);
await visEditor.clickGo(!isNewChartsLibraryEnabled);

await visChart.waitForVisualizationRenderingStabilized();
const legends = await visChart.getLegendEntries();
Expand Down
69 changes: 31 additions & 38 deletions test/functional/apps/visualize/group3/_pie_chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,9 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {

describe('pie chart', function () {
// Used to track flag before and after reset
let isNewChartsLibraryEnabled = false;
const vizName1 = 'Visualization PieChart';
before(async function () {
isNewChartsLibraryEnabled = await visChart.isNewChartsLibraryEnabled();
await visualize.initTests(isNewChartsLibraryEnabled);
await visualize.initTests();

log.debug('navigateToApp visualize');
await visualize.navigateToNewAggBasedVisualization();
Expand All @@ -51,7 +49,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
log.debug('setNumericInterval 4000');
await visEditor.setInterval('40000', { type: 'numeric' });
log.debug('clickGo');
await visEditor.clickGo(isNewChartsLibraryEnabled);
await visEditor.clickGo();
});

after(async () => {
Expand All @@ -70,7 +68,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});

it('should show 10 slices in pie chart', async function () {
await pieChart.expectPieSliceCount(10, isNewChartsLibraryEnabled);
await pieChart.expectPieSliceCount(10);
});

it('should show correct data', async function () {
Expand Down Expand Up @@ -109,16 +107,16 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await visEditor.toggleOtherBucket(2);
await visEditor.toggleMissingBucket(2);
log.debug('clickGo');
await visEditor.clickGo(isNewChartsLibraryEnabled);
await pieChart.expectPieChartLabels(expectedTableData, isNewChartsLibraryEnabled);
await visEditor.clickGo();
await pieChart.expectPieChartLabels(expectedTableData);
});

it('should apply correct filter on other bucket', async () => {
const expectedTableData = ['Missing', 'osx'];

await pieChart.filterOnPieSlice('Other');
await visChart.waitForVisualization();
await pieChart.expectPieChartLabels(expectedTableData, isNewChartsLibraryEnabled);
await pieChart.expectPieChartLabels(expectedTableData);
await filterBar.removeFilter('machine.os.raw');
await visChart.waitForVisualization();
});
Expand All @@ -128,7 +126,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {

await visChart.filterLegend('Other');
await visChart.waitForVisualization();
await pieChart.expectPieChartLabels(expectedTableData, isNewChartsLibraryEnabled);
await pieChart.expectPieChartLabels(expectedTableData);
await filterBar.removeFilter('machine.os.raw');
await visChart.waitForVisualization();
});
Expand Down Expand Up @@ -187,8 +185,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await visEditor.toggleOtherBucket(3);
await visEditor.toggleMissingBucket(3);
log.debug('clickGo');
await visEditor.clickGo(isNewChartsLibraryEnabled);
await pieChart.expectPieChartLabels(expectedTableData, isNewChartsLibraryEnabled);
await visEditor.clickGo();
await pieChart.expectPieChartLabels(expectedTableData);
});
});

Expand All @@ -205,9 +203,9 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await visEditor.selectAggregation('Terms');
await visEditor.selectField('machine.os.raw');
await visEditor.toggleDisabledAgg(2);
await visEditor.clickGo(isNewChartsLibraryEnabled);
await visEditor.clickGo();

await pieChart.expectPieChartLabels(expectedTableData, isNewChartsLibraryEnabled);
await pieChart.expectPieChartLabels(expectedTableData);
});

it('should correctly save disabled agg', async () => {
Expand All @@ -217,12 +215,12 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await visChart.waitForRenderingCount();

const expectedTableData = ['ios', 'osx', 'win 7', 'win 8', 'win xp'];
await pieChart.expectPieChartLabels(expectedTableData, isNewChartsLibraryEnabled);
await pieChart.expectPieChartLabels(expectedTableData);
});

it('should show correct result when agg is re-enabled', async () => {
await visEditor.toggleDisabledAgg(2);
await visEditor.clickGo(isNewChartsLibraryEnabled);
await visEditor.clickGo();

const expectedTableData = [
'0',
Expand Down Expand Up @@ -287,7 +285,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
'osx',
].sort();

await pieChart.expectPieChartLabels(expectedTableData, isNewChartsLibraryEnabled);
await pieChart.expectPieChartLabels(expectedTableData);
});
});

Expand All @@ -307,15 +305,14 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await visEditor.addNewFilterAggregation();
log.debug('Set the 2nd filter value');
await visEditor.setFilterAggregationValue('geo.dest:"CN"', 1);
await visEditor.clickGo(isNewChartsLibraryEnabled);
await visEditor.clickGo();
const emptyFromTime = 'Sep 19, 2016 @ 06:31:44.000';
const emptyToTime = 'Sep 23, 2016 @ 18:31:44.000';
log.debug(
'Switch to a different time range from "' + emptyFromTime + '" to "' + emptyToTime + '"'
);
await timePicker.setAbsoluteRange(emptyFromTime, emptyToTime);
await visChart.waitForVisualization();
await visChart.expectError();
});
});
describe('multi series slice', () => {
Expand All @@ -341,7 +338,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await visEditor.clickBucket('Split slices');
await visEditor.selectAggregation('Terms');
await visEditor.selectField('geo.dest');
await visEditor.clickGo(isNewChartsLibraryEnabled);
await visEditor.clickGo();
});

it('should show correct chart', async () => {
Expand Down Expand Up @@ -398,7 +395,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
['360,000', '47', 'BR', '2'],
].map((row) =>
// the count of records is not shown for every split level in the new charting library
isNewChartsLibraryEnabled ? [row[0], ...row.slice(2)] : row
[row[0], ...row.slice(2)]
);

await inspector.open();
Expand Down Expand Up @@ -430,26 +427,22 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
'360,000',
'CN',
].sort();
if (isNewChartsLibraryEnabled) {
await visEditor.clickOptionsTab();
await visEditor.togglePieLegend();
await visEditor.togglePieNestedLegend();
await visEditor.clickDataTab();
await visEditor.clickGo(isNewChartsLibraryEnabled);
}

await visEditor.clickOptionsTab();
await visEditor.togglePieLegend();
await visEditor.togglePieNestedLegend();
await visEditor.clickDataTab();
await visEditor.clickGo();

await visChart.filterLegend('CN');
await visChart.waitForVisualization();
await pieChart.expectPieChartLabels(expectedTableData, isNewChartsLibraryEnabled);
await pieChart.expectPieChartLabels(expectedTableData);
await filterBar.removeFilter('geo.dest');
await visChart.waitForVisualization();
});

it('should still showing pie chart when a subseries have zero data', async function () {
if (isNewChartsLibraryEnabled) {
// TODO: it seems that adding a filter agg which has no results to a pie chart breaks it and instead it shows "no data"
return;
}

// TODO: it seems that adding a filter agg which has no results to a pie chart breaks it and instead it shows "no data"
it.skip('should still showing pie chart when a subseries have zero data', async function () {
await visualize.navigateToNewAggBasedVisualization();
log.debug('clickPieChart');
await visualize.clickPieChart();
Expand All @@ -468,7 +461,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await visEditor.selectAggregation('Filters');
log.debug('Set the 1st filter value of the aggregation id 3');
await visEditor.setFilterAggregationValue('geo.dest:"UX"', 0, 3);
await visEditor.clickGo(isNewChartsLibraryEnabled);
await visEditor.clickGo();
const legends = await visChart.getLegendEntries();
const expectedLegends = ['geo.dest:"US"', 'geo.dest:"UX"'];
expect(legends).to.eql(expectedLegends);
Expand All @@ -489,7 +482,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await visEditor.clickBucket('Split slices');
await visEditor.selectAggregation('Terms');
await visEditor.selectField('geo.src');
await visEditor.clickGo(isNewChartsLibraryEnabled);
await visEditor.clickGo();
});

it('shows correct split chart', async () => {
Expand Down Expand Up @@ -521,7 +514,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
['osx', '1,322', 'BR', '30'],
].map((row) =>
// the count of records is not shown for every split level in the new charting library
isNewChartsLibraryEnabled ? [row[0], ...row.slice(2)] : row
[row[0], ...row.slice(2)]
);
await inspector.open();
await inspector.setTablePageSize(50);
Expand All @@ -538,7 +531,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
['osx', '228', 'CN', '228'],
].map((row) =>
// the count of records is not shown for every split level in the new charting library
isNewChartsLibraryEnabled ? [row[0], ...row.slice(2)] : row
[row[0], ...row.slice(2)]
);
await visChart.filterLegend('CN');
await header.waitUntilLoadingHasFinished();
Expand Down
2 changes: 1 addition & 1 deletion test/functional/apps/visualize/group5/_tsvb_time_series.ts
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
legendNames = await visualBuilder.getLegendNames();
expect(legendNames).to.eql(['png', 'php']);

await visualize.clickRefresh(true);
await visualize.clickRefresh();
legendNames = await visualBuilder.getLegendNames();
expect(legendNames).to.eql(['png', 'php']);
});
Expand Down
Loading

0 comments on commit e4f727e

Please sign in to comment.