Skip to content

Commit

Permalink
[Visualize] Fixes functional tests to run for vislib and es-charts (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
stratoula authored Jun 7, 2021
1 parent f670fd2 commit 1cd88f4
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 18 deletions.
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

0 comments on commit 1cd88f4

Please sign in to comment.