mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
Migrate dashboard functional tests to use PageObjects.
This commit is contained in:
parent
dc51ad098f
commit
0f397f2bc4
2 changed files with 39 additions and 33 deletions
|
@ -1,29 +1,29 @@
|
|||
|
||||
import expect from 'expect.js';
|
||||
|
||||
import {
|
||||
bdd,
|
||||
common,
|
||||
dashboardPage,
|
||||
headerPage,
|
||||
scenarioManager,
|
||||
esClient,
|
||||
elasticDump
|
||||
} from '../../../support';
|
||||
|
||||
var expect = require('expect.js');
|
||||
import PageObjects from '../../../support/page_objects';
|
||||
|
||||
bdd.describe('dashboard tab', function describeIndexTests() {
|
||||
bdd.before(function () {
|
||||
common.debug('Starting dashboard before method');
|
||||
PageObjects.common.debug('Starting dashboard before method');
|
||||
var logstash = scenarioManager.loadIfEmpty('logstashFunctional');
|
||||
// delete .kibana index and update configDoc
|
||||
return esClient.deleteAndUpdateConfigDoc({'dateFormat:tz':'UTC', 'defaultIndex':'logstash-*'})
|
||||
// and load a set of makelogs data
|
||||
.then(function loadkibanaVisualizations() {
|
||||
common.debug('load kibana index with visualizations');
|
||||
PageObjects.common.debug('load kibana index with visualizations');
|
||||
return elasticDump.elasticLoad('dashboard','.kibana');
|
||||
})
|
||||
.then(function () {
|
||||
common.debug('navigateToApp dashboard');
|
||||
return common.navigateToApp('dashboard');
|
||||
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 () {
|
||||
|
@ -42,21 +42,21 @@ bdd.describe('dashboard tab', function describeIndexTests() {
|
|||
];
|
||||
|
||||
bdd.it('should be able to add visualizations to dashboard', function addVisualizations() {
|
||||
common.saveScreenshot('Dashboard-no-visualizations');
|
||||
PageObjects.common.saveScreenshot('Dashboard-no-visualizations');
|
||||
|
||||
function addVisualizations(arr) {
|
||||
return arr.reduce(function (promise, vizName) {
|
||||
return promise
|
||||
.then(function () {
|
||||
return dashboardPage.addVisualization(vizName);
|
||||
return PageObjects.dashboard.addVisualization(vizName);
|
||||
});
|
||||
}, Promise.resolve());
|
||||
}
|
||||
|
||||
return addVisualizations(visualizations)
|
||||
.then(function () {
|
||||
common.debug('done adding visualizations');
|
||||
common.saveScreenshot('Dashboard-add-visualizations');
|
||||
PageObjects.common.debug('done adding visualizations');
|
||||
PageObjects.common.saveScreenshot('Dashboard-add-visualizations');
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -65,48 +65,48 @@ bdd.describe('dashboard tab', function describeIndexTests() {
|
|||
var toTime = '2015-09-23 18:31:44.000';
|
||||
|
||||
// .then(function () {
|
||||
common.debug('Set absolute time range from \"' + fromTime + '\" to \"' + toTime + '\"');
|
||||
return headerPage.setAbsoluteRange(fromTime, toTime)
|
||||
PageObjects.common.debug('Set absolute time range from \"' + fromTime + '\" to \"' + toTime + '\"');
|
||||
return PageObjects.header.setAbsoluteRange(fromTime, toTime)
|
||||
.then(function () {
|
||||
return headerPage.getSpinnerDone();
|
||||
return PageObjects.header.getSpinnerDone();
|
||||
})
|
||||
.then(function takeScreenshot() {
|
||||
common.saveScreenshot('Dashboard-set-timepicker');
|
||||
PageObjects.common.saveScreenshot('Dashboard-set-timepicker');
|
||||
});
|
||||
});
|
||||
|
||||
bdd.it('should save and load dashboard', function saveAndLoadDashboard() {
|
||||
const dashboardName = 'Dashboard Test 1';
|
||||
// TODO: save time on the dashboard and test it
|
||||
return dashboardPage.saveDashboard(dashboardName)
|
||||
return PageObjects.dashboard.saveDashboard(dashboardName)
|
||||
// click New Dashboard just to clear the one we just created
|
||||
.then(function () {
|
||||
return common.try(function () {
|
||||
common.debug('saved Dashboard, now click New Dashboard');
|
||||
return dashboardPage.clickNewDashboard();
|
||||
return PageObjects.common.try(function () {
|
||||
PageObjects.common.debug('saved Dashboard, now click New Dashboard');
|
||||
return PageObjects.dashboard.clickNewDashboard();
|
||||
});
|
||||
})
|
||||
.then(function () {
|
||||
return common.try(function () {
|
||||
common.debug('now re-load previously saved dashboard');
|
||||
return dashboardPage.loadSavedDashboard(dashboardName);
|
||||
return PageObjects.common.try(function () {
|
||||
PageObjects.common.debug('now re-load previously saved dashboard');
|
||||
return PageObjects.dashboard.loadSavedDashboard(dashboardName);
|
||||
});
|
||||
})
|
||||
.then(function () {
|
||||
common.saveScreenshot('Dashboard-load-saved');
|
||||
PageObjects.common.saveScreenshot('Dashboard-load-saved');
|
||||
});
|
||||
});
|
||||
|
||||
bdd.it('should have all the expected visualizations', function checkVisualizations() {
|
||||
return common.tryForTime(10000, function () {
|
||||
return dashboardPage.getPanelTitles()
|
||||
return PageObjects.common.tryForTime(10000, function () {
|
||||
return PageObjects.dashboard.getPanelTitles()
|
||||
.then(function (panelTitles) {
|
||||
common.log('visualization titles = ' + panelTitles);
|
||||
PageObjects.common.log('visualization titles = ' + panelTitles);
|
||||
expect(panelTitles).to.eql(visualizations);
|
||||
});
|
||||
})
|
||||
.then(function () {
|
||||
common.saveScreenshot('Dashboard-has-visualizations');
|
||||
PageObjects.common.saveScreenshot('Dashboard-has-visualizations');
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -119,11 +119,11 @@ bdd.describe('dashboard tab', function describeIndexTests() {
|
|||
{ dataCol: '4', dataRow: '3', dataSizeX: '3', dataSizeY: '2', title: 'Visualization☺ VerticalBarChart' },
|
||||
{ dataCol: '7', dataRow: '3', dataSizeX: '3', dataSizeY: '2', title: 'Visualization MetricChart' }
|
||||
];
|
||||
return common.tryForTime(10000, function () {
|
||||
return dashboardPage.getPanelData()
|
||||
return PageObjects.common.tryForTime(10000, function () {
|
||||
return PageObjects.dashboard.getPanelData()
|
||||
.then(function (panelTitles) {
|
||||
common.log('visualization titles = ' + panelTitles);
|
||||
common.saveScreenshot('Dashboard-visualization-sizes');
|
||||
PageObjects.common.log('visualization titles = ' + panelTitles);
|
||||
PageObjects.common.saveScreenshot('Dashboard-visualization-sizes');
|
||||
expect(panelTitles).to.eql(visObjects);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
import { bdd, remote, scenarioManager, defaultTimeout } from '../../../support';
|
||||
|
||||
import {
|
||||
bdd,
|
||||
remote,
|
||||
scenarioManager,
|
||||
defaultTimeout,
|
||||
} from '../../../support';
|
||||
|
||||
bdd.describe('dashboard app', function () {
|
||||
this.timeout = defaultTimeout;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue