Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Visualize] Fixes functional tests to run for vislib and es-charts #101461

Merged
merged 1 commit into from
Jun 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion test/functional/apps/visualize/_area_chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
);

describe('area charts', function indexPatternCreation() {
let isNewChartsLibraryEnabled = false;
before(async () => {
await PageObjects.visualize.initTests();
isNewChartsLibraryEnabled = await PageObjects.visChart.isNewChartsLibraryEnabled();
await PageObjects.visualize.initTests(isNewChartsLibraryEnabled);
});
const initAreaChart = async () => {
log.debug('navigateToApp visualize');
Expand Down
4 changes: 3 additions & 1 deletion test/functional/apps/visualize/_line_chart_split_chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
]);

describe('line charts - split chart', function () {
let isNewChartsLibraryEnabled = false;
const initLineChart = async function () {
log.debug('navigateToApp visualize');
await PageObjects.visualize.navigateToNewAggBasedVisualization();
Expand All @@ -44,7 +45,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
};

before(async () => {
await PageObjects.visualize.initTests();
isNewChartsLibraryEnabled = await PageObjects.visChart.isNewChartsLibraryEnabled();
await PageObjects.visualize.initTests(isNewChartsLibraryEnabled);
await initLineChart();
});

Expand Down
4 changes: 3 additions & 1 deletion test/functional/apps/visualize/_line_chart_split_series.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
]);

describe('line charts - split series', function () {
let isNewChartsLibraryEnabled = false;
const initLineChart = async function () {
log.debug('navigateToApp visualize');
await PageObjects.visualize.navigateToNewAggBasedVisualization();
Expand All @@ -42,7 +43,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
};

before(async () => {
await PageObjects.visualize.initTests();
isNewChartsLibraryEnabled = await PageObjects.visChart.isNewChartsLibraryEnabled();
await PageObjects.visualize.initTests(isNewChartsLibraryEnabled);
await initLineChart();
});

Expand Down
11 changes: 2 additions & 9 deletions test/functional/apps/visualize/_pie_chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const filterBar = getService('filterBar');
const pieChart = getService('pieChart');
const inspector = getService('inspector');
const browser = getService('browser');
const kibanaServer = getService('kibanaServer');

const PageObjects = getPageObjects([
'common',
Expand All @@ -33,13 +31,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const vizName1 = 'Visualization PieChart';
before(async function () {
isNewChartsLibraryEnabled = await PageObjects.visChart.isNewChartsLibraryEnabled();
await PageObjects.visualize.initTests();
if (isNewChartsLibraryEnabled) {
await kibanaServer.uiSettings.update({
'visualization:visualize:legacyChartsLibrary': false,
});
await browser.refresh();
}
await PageObjects.visualize.initTests(isNewChartsLibraryEnabled);

log.debug('navigateToApp visualize');
await PageObjects.visualize.navigateToNewAggBasedVisualization();
log.debug('clickPieChart');
Expand Down
6 changes: 4 additions & 2 deletions test/functional/apps/visualize/_point_series_options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,11 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.visEditor.clickGo();
}

describe('vlad point series', function describeIndexTests() {
describe('point series', function describeIndexTests() {
let isNewChartsLibraryEnabled = false;
before(async () => {
await PageObjects.visualize.initTests();
isNewChartsLibraryEnabled = await PageObjects.visChart.isNewChartsLibraryEnabled();
await PageObjects.visualize.initTests(isNewChartsLibraryEnabled);
await initChart();
});

Expand Down
4 changes: 3 additions & 1 deletion test/functional/apps/visualize/_vertical_bar_chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const PageObjects = getPageObjects(['visualize', 'visEditor', 'visChart', 'timePicker']);

describe('vertical bar chart', function () {
let isNewChartsLibraryEnabled = false;
before(async () => {
await PageObjects.visualize.initTests();
isNewChartsLibraryEnabled = await PageObjects.visChart.isNewChartsLibraryEnabled();
await PageObjects.visualize.initTests(isNewChartsLibraryEnabled);
});

const vizName1 = 'Visualization VerticalBarChart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {

describe('vertical bar chart with index without time filter', function () {
const vizName1 = 'Visualization VerticalBarChart without time filter';
let isNewChartsLibraryEnabled = false;

const initBarChart = async () => {
log.debug('navigateToApp visualize');
Expand All @@ -40,7 +41,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
};

before(async () => {
await PageObjects.visualize.initTests();
isNewChartsLibraryEnabled = await PageObjects.visChart.isNewChartsLibraryEnabled();
await PageObjects.visualize.initTests(isNewChartsLibraryEnabled);
await initBarChart();
});

Expand Down
3 changes: 2 additions & 1 deletion test/functional/page_objects/visualize_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,14 @@ export class VisualizePageObject extends FtrService {
LOGSTASH_NON_TIME_BASED: 'logstash*',
};

public async initTests() {
public async initTests(isNewLibrary = false) {
await this.kibanaServer.savedObjects.clean({ types: ['visualization'] });
await this.kibanaServer.importExport.load('visualize');

await this.kibanaServer.uiSettings.replace({
defaultIndex: 'logstash-*',
[UI_SETTINGS.FORMAT_BYTES_DEFAULT_PATTERN]: '0,0.[000]b',
'visualization:visualize:legacyChartsLibrary': !isNewLibrary,
});
}

Expand Down
2 changes: 1 addition & 1 deletion test/functional/services/visualizations/pie_chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class PieChartService extends FtrService {
const pieWidth = pieSize.width;
await pie.clickMouseButton({
xOffset: pieSlice.coords[0] - Math.floor(pieWidth / 2),
yOffset: Math.floor(pieHeight / 2) - pieSlice.coords[1],
yOffset: pieSlice.coords[1] - Math.floor(pieHeight / 2),
});
}
} else {
Expand Down