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

Changed viz tests to leave all visualizations. New dashboard tests. #6576

Closed
wants to merge 2 commits into from
Closed
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
120 changes: 120 additions & 0 deletions test/functional/apps/dashboard/_dashboard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
define(function (require) {
var Common = require('../../../support/pages/common');
var HeaderPage = require('../../../support/pages/header_page');
var DashboardPage = require('../../../support/pages/dashboard_page');
var expect = require('intern/dojo/node!expect.js');

return function (bdd, scenarioManager) {
bdd.describe('dashboard app', function describeIndexTests() {
var common;
var headerPage;
var settingsPage;
var dashboardPage;

bdd.before(function () {
common = new Common(this.remote);
headerPage = new HeaderPage(this.remote);
dashboardPage = new DashboardPage(this.remote);

common.debug('navigateToApp dashboard');
return common.navigateToApp('dashboard')
.catch(common.handleError(this));
});


bdd.describe('add visualizations to dashboard', function indexPatternCreation() {
var visualizations = ['Visualization AreaChart',
'Visualization DataTable',
'Visualization LineChart',
'Visualization PieChart',
'Visualization TileMap',
'Visualization VerticalBarChart',
'Visualization MetricChart'
];


bdd.it('should be able to add visualizations to dashboard', function pageHeader() {

function addVisualizations(arr) {
return arr.reduce(function (promise, vizName) {
return promise
.then(function () {
return dashboardPage.addVisualization(vizName);
});
}, Promise.resolve());
}

return addVisualizations(visualizations)
.then(function () {
console.log('all done');
});

});

bdd.it('set the timepicker time to that which contains our test data', function pageHeader() {
var fromTime = '2015-09-19 06:31:44.000';
var toTime = '2015-09-23 18:31:44.000';
var testSubName = 'Dashboard Test 1';

// .then(function () {
common.debug('Set absolute time range from \"' + fromTime + '\" to \"' + toTime + '\"');
return headerPage.setAbsoluteRange(fromTime, toTime)
.then(function sleep() {
return common.sleep(4000);
})
.then(function takeScreenshot() {
common.debug('Take screenshot');
common.saveScreenshot('./screenshot-' + testSubName + '.png');
})
.catch(common.handleError(this));
});

bdd.it('should save and load dashboard', function pageHeader() {
var testSubName = 'Dashboard Test 1';
// save time on the dashboard?
return dashboardPage.saveDashboard(testSubName)
// click New Dashboard just to clear the one we just created
.then(function () {
return dashboardPage.clickNewDashboard();
})
.then(function () {
return dashboardPage.loadSavedDashboard(testSubName);
})
.catch(common.handleError(this));
});

bdd.it('should have all the expected visualizations', function pageHeader() {
return common.tryForTime(10000, function () {
return dashboardPage.getPanelTitles()
.then(function (panelTitles) {
common.log('visualization titles = ' + panelTitles);
expect(panelTitles).to.eql(visualizations);
});
})
.catch(common.handleError(this));
});

bdd.it('should have all the expected initial sizes', function pageHeader() {
var 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' }
];
return common.tryForTime(10000, function () {
return dashboardPage.getPanelData()
.then(function (panelTitles) {
common.log('visualization titles = ' + panelTitles);
expect(panelTitles).to.eql(visObjects);
});
})
.catch(common.handleError(this));
});


});
});
};
});
33 changes: 33 additions & 0 deletions test/functional/apps/dashboard/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
define(function (require) {
var bdd = require('intern!bdd');
var config = require('intern').config;
var url = require('intern/dojo/node!url');
var _ = require('intern/dojo/node!lodash');
var ScenarioManager = require('intern/dojo/node!../../../fixtures/scenario_manager');

var dashboardTest = require('./_dashboard');

bdd.describe('dashboard app', function () {
var scenarioManager;
var remote;
var scenarioManager = new ScenarioManager(url.format(config.servers.elasticsearch));
this.timeout = config.timeouts.default;

// on setup, we create an settingsPage instance
// that we will use for all the tests
bdd.before(function () {
remote = this.remote;
});

bdd.before(function () {
var self = this;
remote.setWindowSize(1200,800);
});

// This test REQUIRES the visualize tests to run before it.
// This dashboard test adds the visualizations which were created by the
// visualize tests.
dashboardTest(bdd, scenarioManager);

});
});
26 changes: 3 additions & 23 deletions test/functional/apps/visualize/_area_chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,29 +28,9 @@ define(function (require) {
var fromTime = '2015-09-19 06:31:44.000';
var toTime = '2015-09-23 18:31:44.000';

return scenarioManager.reload('emptyKibana')
.then(function () {
common.debug('navigateTo');
return settingsPage.navigateTo();
})
.then(function () {
common.debug('createIndexPattern');
return settingsPage.createIndexPattern();
})
.then(function () {
return settingsPage.clickAdvancedTab();
})
.then(function GetAdvancedSetting() {
common.debug('check for required UTC timezone');
return settingsPage.getAdvancedSettings('dateFormat:tz');
})
.then(function (advancedSetting) {
expect(advancedSetting).to.be('UTC');
})
.then(function () {
common.debug('navigateToApp visualize');
return common.navigateToApp('visualize');
})
common.debug('navigateToApp visualize');
return common.navigateToApp('visualize')//;
// })
.then(function () {
common.debug('clickAreaChart');
return visualizePage.clickAreaChart();
Expand Down
16 changes: 3 additions & 13 deletions test/functional/apps/visualize/_chart_types.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,9 @@ define(function (require) {
settingsPage = new SettingsPage(this.remote);
visualizePage = new VisualizePage(this.remote);

return scenarioManager.reload('emptyKibana')
.then(function () {
common.debug('navigateTo');
return settingsPage.navigateTo();
})
.then(function () {
common.debug('createIndexPattern');
return settingsPage.createIndexPattern();
})
.then(function () {
common.debug('navigateToApp visualize');
return common.navigateToApp('visualize');
})
common.debug('navigateToApp visualize');
return common.navigateToApp('visualize')//;
// })
.catch(common.handleError(this));
});

Expand Down
26 changes: 3 additions & 23 deletions test/functional/apps/visualize/_data_table.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,29 +28,9 @@ define(function (require) {
toTime = '2015-09-23 18:31:44.000';


return scenarioManager.reload('emptyKibana')
.then(function () {
common.debug('navigateTo');
return settingsPage.navigateTo();
})
.then(function () {
common.debug('createIndexPattern');
return settingsPage.createIndexPattern();
})
.then(function () {
return settingsPage.clickAdvancedTab();
})
.then(function GetAdvancedSetting() {
common.debug('check for required UTC timezone');
return settingsPage.getAdvancedSettings('dateFormat:tz');
})
.then(function (advancedSetting) {
expect(advancedSetting).to.be('UTC');
})
.then(function () {
common.debug('navigateToApp visualize');
return common.navigateToApp('visualize');
})
common.debug('navigateToApp visualize');
return common.navigateToApp('visualize')//;
// })
.then(function () {
common.debug('clickDataTable');
return visualizePage.clickDataTable();
Expand Down
26 changes: 3 additions & 23 deletions test/functional/apps/visualize/_line_chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,9 @@ define(function (require) {
var fromTime = '2015-09-19 06:31:44.000';
var toTime = '2015-09-23 18:31:44.000';

return scenarioManager.reload('emptyKibana')
.then(function () {
common.debug('navigateTo');
return settingsPage.navigateTo();
})
.then(function () {
common.debug('createIndexPattern');
return settingsPage.createIndexPattern();
})
.then(function () {
return settingsPage.clickAdvancedTab();
})
.then(function GetAdvancedSetting() {
common.debug('check for required UTC timezone');
return settingsPage.getAdvancedSettings('dateFormat:tz');
})
.then(function (advancedSetting) {
expect(advancedSetting).to.be('UTC');
})
.then(function () {
common.debug('navigateToApp visualize');
return common.navigateToApp('visualize');
})
common.debug('navigateToApp visualize');
return common.navigateToApp('visualize')//;
// })
.then(function () {
common.debug('clickLineChart');
return visualizePage.clickLineChart();
Expand Down
60 changes: 36 additions & 24 deletions test/functional/apps/visualize/_metric_chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,29 +31,9 @@ define(function (require) {
common.debug('Start of test' + testSubName + 'Visualization');
var vizName1 = 'Visualization ' + testSubName;

return scenarioManager.reload('emptyKibana')
.then(function () {
common.debug('navigateTo');
return settingsPage.navigateTo();
})
.then(function () {
common.debug('createIndexPattern');
return settingsPage.createIndexPattern();
})
.then(function () {
return settingsPage.clickAdvancedTab();
})
.then(function GetAdvancedSetting() {
common.debug('check for required UTC timezone');
return settingsPage.getAdvancedSettings('dateFormat:tz');
})
.then(function (advancedSetting) {
expect(advancedSetting).to.be('UTC');
})
.then(function () {
common.debug('navigateToApp visualize');
return common.navigateToApp('visualize');
})
common.debug('navigateToApp visualize');
return common.navigateToApp('visualize')//;
// })
.then(function () {
common.debug('clickMetric');
return visualizePage.clickMetric();
Expand Down Expand Up @@ -284,7 +264,8 @@ define(function (require) {
.catch(common.handleError(this));
});

bdd.it('should show Percentile Ranks', function pageHeader() {
bdd.it('should show Percentile Ranks, take screenshot', function pageHeader() {
var testSubName = 'MetricChart';
var percentileRankBytes = [ '2.036%', 'Percentile rank 99 of "memory"'];
common.debug('Aggregation = Percentile Ranks');
return visualizePage.selectAggregation('Percentile Ranks')
Expand All @@ -307,6 +288,37 @@ define(function (require) {
});
});
})
.then(function takeScreenshot() {
common.debug('Take screenshot');
common.saveScreenshot('./screenshot-' + testSubName + '.png');
})
.catch(common.handleError(this));
});

bdd.it('should save and load', function pageHeader() {
var testSubName = 'MetricChart';
common.debug('Start of test' + testSubName + 'Visualization');
var vizName1 = 'Visualization ' + testSubName;
var remote = this.remote;

return visualizePage.saveVisualization(vizName1)
.then(function (message) {
common.debug('Saved viz message = ' + message);
expect(message).to.be('Visualization Editor: Saved Visualization \"' + vizName1 + '\"');
})
.then(function testVisualizeWaitForToastMessageGone() {
return visualizePage.waitForToastMessageGone();
})
.then(function () {
return visualizePage.loadSavedVisualization(vizName1);
})
.then(function waitForVisualization() {
return visualizePage.waitForVisualization();
})
// sleep a bit before trying to get the pie chart data below
.then(function sleep() {
return common.sleep(2000);
})
.catch(common.handleError(this));
});

Expand Down
26 changes: 3 additions & 23 deletions test/functional/apps/visualize/_pie_chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,9 @@ define(function (require) {
var fromTime = '2015-09-19 06:31:44.000';
var toTime = '2015-09-23 18:31:44.000';

return scenarioManager.reload('emptyKibana')
.then(function () {
common.debug('navigateTo');
return settingsPage.navigateTo();
})
.then(function () {
common.debug('createIndexPattern');
return settingsPage.createIndexPattern();
})
.then(function () {
return settingsPage.clickAdvancedTab();
})
.then(function GetAdvancedSetting() {
common.debug('check for required UTC timezone');
return settingsPage.getAdvancedSettings('dateFormat:tz');
})
.then(function (advancedSetting) {
expect(advancedSetting).to.be('UTC');
})
.then(function () {
common.debug('navigateToApp visualize');
return common.navigateToApp('visualize');
})
common.debug('navigateToApp visualize');
return common.navigateToApp('visualize')//;
// })
.then(function () {
common.debug('clickPieChart');
return visualizePage.clickPieChart();
Expand Down
Loading