fix selenium tests broken by default panel size change (#9802)

This commit is contained in:
Stacey Gammon 2017-01-09 17:03:27 -05:00 committed by GitHub
parent 980b67ed68
commit d295553d95

View file

@ -1,5 +1,8 @@
import expect from 'expect.js';
import {
DEFAULT_PANEL_WIDTH, DEFAULT_PANEL_HEIGHT
} from '../../../../src/core_plugins/kibana/public/dashboard/components/panel/lib/panel_state';
import {
bdd,
@ -17,18 +20,18 @@ bdd.describe('dashboard tab', function describeIndexTests() {
// delete .kibana index and update configDoc
return esClient.deleteAndUpdateConfigDoc({ 'dateFormat:tz':'UTC', 'defaultIndex':'logstash-*' })
// and load a set of makelogs data
.then(function loadkibanaVisualizations() {
PageObjects.common.debug('load kibana index with visualizations');
return elasticDump.elasticLoad('dashboard','.kibana');
})
.then(function () {
PageObjects.common.debug('navigateToApp dashboard');
return PageObjects.common.navigateToApp('dashboard');
})
// wait for the logstash data load to finish if it hasn't already
.then(function () {
return logstash;
});
.then(function loadkibanaVisualizations() {
PageObjects.common.debug('load kibana index with visualizations');
return elasticDump.elasticLoad('dashboard','.kibana');
})
.then(function () {
PageObjects.common.debug('navigateToApp dashboard');
return PageObjects.common.navigateToApp('dashboard');
})
// wait for the logstash data load to finish if it hasn't already
.then(function () {
return logstash;
});
});
bdd.describe('add visualizations to dashboard', function dashboardTest() {
@ -47,17 +50,17 @@ bdd.describe('dashboard tab', function describeIndexTests() {
function addVisualizations(arr) {
return arr.reduce(function (promise, vizName) {
return promise
.then(function () {
return PageObjects.dashboard.addVisualization(vizName);
});
.then(function () {
return PageObjects.dashboard.addVisualization(vizName);
});
}, Promise.resolve());
}
return addVisualizations(visualizations)
.then(function () {
PageObjects.common.debug('done adding visualizations');
PageObjects.common.saveScreenshot('Dashboard-add-visualizations');
});
.then(function () {
PageObjects.common.debug('done adding visualizations');
PageObjects.common.saveScreenshot('Dashboard-add-visualizations');
});
});
bdd.it('set the timepicker time to that which contains our test data', function setTimepicker() {
@ -67,12 +70,12 @@ bdd.describe('dashboard tab', function describeIndexTests() {
// .then(function () {
PageObjects.common.debug('Set absolute time range from \"' + fromTime + '\" to \"' + toTime + '\"');
return PageObjects.header.setAbsoluteRange(fromTime, toTime)
.then(function () {
return PageObjects.header.isGlobalLoadingIndicatorHidden();
})
.then(function takeScreenshot() {
PageObjects.common.saveScreenshot('Dashboard-set-timepicker');
});
.then(function () {
return PageObjects.header.isGlobalLoadingIndicatorHidden();
})
.then(function takeScreenshot() {
PageObjects.common.saveScreenshot('Dashboard-set-timepicker');
});
});
bdd.it('should save and load dashboard', function saveAndLoadDashboard() {
@ -80,52 +83,55 @@ bdd.describe('dashboard tab', function describeIndexTests() {
// TODO: save time on the dashboard and test it
return PageObjects.dashboard.saveDashboard(dashboardName)
// click New Dashboard just to clear the one we just created
.then(function () {
return PageObjects.common.try(function () {
PageObjects.common.debug('saved Dashboard, now click New Dashboard');
return PageObjects.dashboard.clickNewDashboard();
.then(function () {
return PageObjects.common.try(function () {
PageObjects.common.debug('saved Dashboard, now click New Dashboard');
return PageObjects.dashboard.clickNewDashboard();
});
})
.then(function () {
return PageObjects.common.try(function () {
PageObjects.common.debug('now re-load previously saved dashboard');
return PageObjects.dashboard.loadSavedDashboard(dashboardName);
});
})
.then(function () {
PageObjects.common.saveScreenshot('Dashboard-load-saved');
});
})
.then(function () {
return PageObjects.common.try(function () {
PageObjects.common.debug('now re-load previously saved dashboard');
return PageObjects.dashboard.loadSavedDashboard(dashboardName);
});
})
.then(function () {
PageObjects.common.saveScreenshot('Dashboard-load-saved');
});
});
bdd.it('should have all the expected visualizations', function checkVisualizations() {
return PageObjects.common.tryForTime(10000, function () {
return PageObjects.dashboard.getPanelTitles()
.then(function (panelTitles) {
PageObjects.common.log('visualization titles = ' + panelTitles);
expect(panelTitles).to.eql(visualizations);
});
.then(function (panelTitles) {
PageObjects.common.log('visualization titles = ' + panelTitles);
expect(panelTitles).to.eql(visualizations);
});
})
.then(function () {
PageObjects.common.saveScreenshot('Dashboard-has-visualizations');
});
.then(function () {
PageObjects.common.saveScreenshot('Dashboard-has-visualizations');
});
});
bdd.it('should have all the expected initial sizes', function checkVisualizationSizes() {
const visObjects = [ { dataCol: '1', dataRow: '1', dataSizeX: '3', dataSizeY: '2', title: 'Visualization漢字 AreaChart' },
{ dataCol: '4', dataRow: '1', dataSizeX: '3', dataSizeY: '2', title: 'Visualization☺漢字 DataTable' },
{ dataCol: '7', dataRow: '1', dataSizeX: '3', dataSizeY: '2', title: 'Visualization漢字 LineChart' },
{ dataCol: '10', dataRow: '1', dataSizeX: '3', dataSizeY: '2', title: 'Visualization PieChart' },
{ dataCol: '1', dataRow: '3', dataSizeX: '3', dataSizeY: '2', title: 'Visualization TileMap' },
{ dataCol: '4', dataRow: '3', dataSizeX: '3', dataSizeY: '2', title: 'Visualization☺ VerticalBarChart' },
{ dataCol: '7', dataRow: '3', dataSizeX: '3', dataSizeY: '2', title: 'Visualization MetricChart' }
const width = DEFAULT_PANEL_WIDTH;
const height = DEFAULT_PANEL_HEIGHT;
const visObjects = [
{ dataCol: '1', dataRow: '1', dataSizeX: width, dataSizeY: height, title: 'Visualization漢字 AreaChart' },
{ dataCol: width + 1, dataRow: '1', dataSizeX: width, dataSizeY: height, title: 'Visualization☺漢字 DataTable' },
{ dataCol: '1', dataRow: height + 1, dataSizeX: width, dataSizeY: height, title: 'Visualization漢字 LineChart' },
{ dataCol: width + 1, dataRow: height + 1, dataSizeX: width, dataSizeY: height, title: 'Visualization PieChart' },
{ dataCol: '1', dataRow: (height * 2) + 1, dataSizeX: width, dataSizeY: height, title: 'Visualization TileMap' },
{ dataCol: width + 1, dataRow: (height * 2) + 1, dataSizeX: width, dataSizeY: height, title: 'Visualization☺ VerticalBarChart' },
{ dataCol: '1', dataRow: (height * 3) + 1, dataSizeX: width, dataSizeY: height, title: 'Visualization MetricChart' }
];
return PageObjects.common.tryForTime(10000, function () {
return PageObjects.dashboard.getPanelData()
.then(function (panelTitles) {
PageObjects.common.log('visualization titles = ' + panelTitles);
PageObjects.common.saveScreenshot('Dashboard-visualization-sizes');
expect(panelTitles).to.eql(visObjects);
});
.then(function (panelTitles) {
PageObjects.common.log('visualization titles = ' + panelTitles);
PageObjects.common.saveScreenshot('Dashboard-visualization-sizes');
expect(panelTitles).to.eql(visObjects);
});
});
});
});