diff --git a/test/functional/apps/visualize/_area_chart.js b/test/functional/apps/visualize/_area_chart.js index 088d3d540a4a..e07bed2e54e5 100644 --- a/test/functional/apps/visualize/_area_chart.js +++ b/test/functional/apps/visualize/_area_chart.js @@ -97,12 +97,10 @@ define(function (require) { }); bdd.describe('area charts', function indexPatternCreation() { + var testSubName = 'AreaChart'; + var vizName1 = 'Visualization ' + testSubName; - bdd.it('should save and load, take screenshot', function pageHeader() { - - var testSubName = 'AreaChart'; - var vizName1 = 'Visualization ' + testSubName; - + bdd.it('should save and load', function pageHeader() { return visualizePage.saveVisualization(vizName1) .then(function (message) { common.debug('Saved viz message = ' + message); @@ -114,24 +112,17 @@ define(function (require) { .then(function loadSavedVisualization() { return visualizePage.loadSavedVisualization(vizName1); }) - .then(function getSpinnerDone() { - common.debug('Waiting...'); - return headerPage.getSpinnerDone(); - }) - .then(function waitForVisualization() { + .then(function () { return visualizePage.waitForVisualization(); }) - .then(function takeScreenshot() { - common.debug('Take screenshot'); - common.saveScreenshot('./screenshot-' + testSubName + '.png'); + .then(function sleep() { + return common.sleep(2000); }) .catch(common.handleError(this)); }); - - bdd.it('should show correct chart', function pageHeader() { - + bdd.it('should show correct chart, take screenshot', function pageHeader() { var chartHeight = 0; var xAxisLabels = [ '2015-09-20 00:00', '2015-09-21 00:00', '2015-09-22 00:00', '2015-09-23 00:00' @@ -141,10 +132,12 @@ define(function (require) { 683, 1361, 1415, 707, 177, 27, 32, 175, 707, 1408, 1355, 726, 201, 29 ]; - return visualizePage.getXAxisLabels() - .then(function (labels) { - common.debug('X-Axis labels = ' + labels); - expect(labels).to.eql(xAxisLabels); + return common.tryForTime(5000, function () { + return visualizePage.getXAxisLabels() + .then(function compareLabels(labels) { + common.debug('X-Axis labels = ' + labels); + expect(labels).to.eql(xAxisLabels); + }); }) .then(function getYAxisLabels() { return visualizePage.getYAxisLabels(); @@ -154,7 +147,6 @@ define(function (require) { expect(labels).to.eql(yAxisLabels); }) .then(function getAreaChartData() { - //return common.tryForTime(500, function () { return visualizePage.getAreaChartData(); }) .then(function (paths) { @@ -162,12 +154,15 @@ define(function (require) { common.debug('actual chart data = ' + paths); expect(paths).to.eql(expectedAreaChartData); }) + .then(function takeScreenshot() { + common.debug('Take screenshot'); + common.saveScreenshot('./screenshot-' + testSubName + '.png'); + }) .catch(common.handleError(this)); }); bdd.it('should show correct data', function pageHeader() { - var expectedTableData = [ 'September 20th 2015, 00:00:00.000 37', 'September 20th 2015, 03:00:00.000 202', 'September 20th 2015, 06:00:00.000 740', diff --git a/test/functional/apps/visualize/_data_table.js b/test/functional/apps/visualize/_data_table.js index 702d9193f2c0..197b042927a2 100644 --- a/test/functional/apps/visualize/_data_table.js +++ b/test/functional/apps/visualize/_data_table.js @@ -101,10 +101,13 @@ define(function (require) { 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() { + .then(function () { return visualizePage.waitForVisualization(); }) .then(function takeScreenshot() { diff --git a/test/functional/apps/visualize/_line_chart.js b/test/functional/apps/visualize/_line_chart.js index 1ec2212acfb8..9b7f6c0c53c3 100644 --- a/test/functional/apps/visualize/_line_chart.js +++ b/test/functional/apps/visualize/_line_chart.js @@ -85,12 +85,12 @@ define(function (require) { }); bdd.describe('line charts', function indexPatternCreation() { + var testSubName = 'LineChart'; + var vizName1 = 'Visualization ' + testSubName; - bdd.it('should be able to save and load, take screenshot', function pageHeader() { + bdd.it('should be able to save and load', function pageHeader() { - var testSubName = 'LineChart'; common.debug('Start of test' + testSubName + 'Visualization'); - var vizName1 = 'Visualization ' + testSubName; var remote = this.remote; return visualizePage.saveVisualization(vizName1) @@ -107,16 +107,11 @@ define(function (require) { .then(function waitForVisualization() { return visualizePage.waitForVisualization(); }) - .then(function takeScreenshot() { - // take a snapshot just as an example. - common.debug('Take screenshot'); - common.saveScreenshot('./screenshot-' + testSubName + '.png'); - }) .catch(common.handleError(this)); }); - bdd.it('should show correct chart', function pageHeader() { + bdd.it('should show correct chart, take screenshot', function pageHeader() { var remote = this.remote; @@ -138,6 +133,11 @@ define(function (require) { common.debug('Done'); }); }) + .then(function takeScreenshot() { + // take a snapshot just as an example. + common.debug('Take screenshot'); + common.saveScreenshot('./screenshot-' + testSubName + '.png'); + }) .catch(common.handleError(this)); }); diff --git a/test/functional/apps/visualize/_pie_chart.js b/test/functional/apps/visualize/_pie_chart.js index a01e026af1a2..68d41aeca283 100644 --- a/test/functional/apps/visualize/_pie_chart.js +++ b/test/functional/apps/visualize/_pie_chart.js @@ -92,12 +92,12 @@ define(function (require) { bdd.describe('pie chart', function indexPatternCreation() { + var testSubName = 'PieChart'; + var vizName1 = 'Visualization ' + testSubName; - bdd.it('should save and load, take screenshot', function pageHeader() { - var testSubName = 'PieChart'; + bdd.it('should save and load', function pageHeader() { common.debug('Start of test' + testSubName + 'Visualization'); - var vizName1 = 'Visualization ' + testSubName; var remote = this.remote; return visualizePage.saveVisualization(vizName1) @@ -114,6 +114,22 @@ define(function (require) { .then(function waitForVisualization() { return visualizePage.waitForVisualization(); }) + .then(function sleep() { + return common.sleep(2000); + }) + .catch(common.handleError(this)); + }); + + bdd.it('should show 10 slices in pie chart, take screenshot', function pageHeader() { + var remote = this.remote; + var expectedPieChartSliceCount = 10; + + return visualizePage.getPieChartData() + .then(function (pieData) { + var barHeightTolerance = 1; + common.debug('pieData.length = ' + pieData.length); + expect(pieData.length).to.be(expectedPieChartSliceCount); + }) .then(function takeScreenshot() { common.debug('Take screenshot'); common.saveScreenshot('./screenshot-' + testSubName + '.png'); @@ -138,28 +154,9 @@ define(function (require) { common.debug(data.split('\n')); expect(data.trim().split('\n')).to.eql(expectedTableData); }) - // expandChart (toggle) - .then(function () { - return visualizePage.collapseChart(); - }) - .then(function sleep() { - return common.sleep(500); - }) .catch(common.handleError(this)); }); - bdd.it('should show 10 slices in pie chart', function pageHeader() { - var remote = this.remote; - var expectedPieChartSliceCount = 10; - - return visualizePage.getPieChartData() - .then(function (pieData) { - var barHeightTolerance = 1; - common.debug('pieData.length = ' + pieData.length); - expect(pieData.length).to.be(expectedPieChartSliceCount); - }) - .catch(common.handleError(this)); - }); }); }); diff --git a/test/intern.js b/test/intern.js index da667d45fae0..67af1e763229 100644 --- a/test/intern.js +++ b/test/intern.js @@ -13,9 +13,9 @@ define(function (require) { }], tunnelOptions: serverConfig.servers.webdriver, functionalSuites: [ - // 'test/functional/status_page/index', - // 'test/functional/apps/settings/index', - // 'test/functional/apps/discover/index', + 'test/functional/status_page/index', + 'test/functional/apps/settings/index', + 'test/functional/apps/discover/index', 'test/functional/apps/visualize/index' ], excludeInstrumentation: /(fixtures|node_modules)\//, @@ -26,6 +26,7 @@ define(function (require) { } }, timeouts: { + // this is how long a test can run before timing out default: 90000 }, }, serverConfig); diff --git a/test/support/pages/VisualizePage.js b/test/support/pages/VisualizePage.js index 102b5fb1a13e..e72248a9d449 100644 --- a/test/support/pages/VisualizePage.js +++ b/test/support/pages/VisualizePage.js @@ -339,14 +339,7 @@ define(function (require) { return self.remote .setFindTimeout(defaultTimeout) .findByLinkText(vizName) - .click() - .then(function getSpinnerDone() { - return self.getSpinnerDone(); // only matches the hidden spinners - }) - .catch(function () { - common.debug('didn\'t find vis name on first page'); - return; - }); + .click(); }); }, @@ -357,10 +350,7 @@ define(function (require) { .then(function (chartTypes) { function getChartType(chart) { return chart - .getVisibleText() - .then(function (theText) { - return theText; - }); + .getVisibleText(); } var getChartTypesPromises = chartTypes.map(getChartType); return Promise.all(getChartTypesPromises); @@ -379,10 +369,7 @@ define(function (require) { .then(function (chartTypes) { function getChartType(chart) { return chart - .getVisibleText() - .then(function (theText) { - return theText; - }); + .getVisibleText(); } var getChartTypesPromises = chartTypes.map(getChartType); return Promise.all(getChartTypesPromises);