From 68a46618ab724dfbac6dc639f335c6ddb4f843cf Mon Sep 17 00:00:00 2001 From: LeeDr Date: Mon, 18 Jan 2016 11:37:51 -0600 Subject: [PATCH 01/11] Initial test to see if screenshot timing is the prob. --- test/functional/apps/visualize/_area_chart.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/functional/apps/visualize/_area_chart.js b/test/functional/apps/visualize/_area_chart.js index 68b2c3b1a304e..96b9c27ed651c 100644 --- a/test/functional/apps/visualize/_area_chart.js +++ b/test/functional/apps/visualize/_area_chart.js @@ -118,6 +118,9 @@ define(function (require) { common.debug('Waiting...'); return headerPage.getSpinnerDone(); }) + .then(function sleep() { + return common.sleep(10000); + }) .then(function takeScreenshot() { common.debug('Take screenshot'); common.saveScreenshot('./screenshot-' + testSubName + '.png'); From a7dce5012cccab915cac9e28f0aa6650af920976 Mon Sep 17 00:00:00 2001 From: LeeDr Date: Mon, 18 Jan 2016 13:09:30 -0600 Subject: [PATCH 02/11] Trying 4 sec sleep before screenshots. --- test/functional/apps/visualize/_area_chart.js | 79 +++++++++---------- test/functional/apps/visualize/_line_chart.js | 3 + test/functional/apps/visualize/_pie_chart.js | 3 + test/functional/apps/visualize/_tile_map.js | 3 + .../apps/visualize/_vertical_bar_chart.js | 3 + test/support/pages/HeaderPage.js | 5 -- 6 files changed, 50 insertions(+), 46 deletions(-) diff --git a/test/functional/apps/visualize/_area_chart.js b/test/functional/apps/visualize/_area_chart.js index 96b9c27ed651c..d7435a3dc8c0d 100644 --- a/test/functional/apps/visualize/_area_chart.js +++ b/test/functional/apps/visualize/_area_chart.js @@ -119,7 +119,7 @@ define(function (require) { return headerPage.getSpinnerDone(); }) .then(function sleep() { - return common.sleep(10000); + return common.sleep(4000); }) .then(function takeScreenshot() { common.debug('Take screenshot'); @@ -129,6 +129,43 @@ define(function (require) { }); + + bdd.it('should show correct chart', 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' + ]; + var yAxisLabels = ['0','200','400','600','800','1,000','1,200','1,400','1,600']; + var expectedAreaChartData = [37, 202, 740, 1437, 1371, 751, 188, 31, 42, 202, + 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); + }) + .then(function getYAxisLabels() { + return visualizePage.getYAxisLabels(); + }) + .then(function (labels) { + common.debug('Y-Axis labels = ' + labels); + expect(labels).to.eql(yAxisLabels); + }) + .then(function getAreaChartData() { + //return common.tryForTime(500, function () { + return visualizePage.getAreaChartData(); + }) + .then(function (paths) { + common.debug('expectedAreaChartData = ' + expectedAreaChartData); + common.debug('actual chart data = ' + paths); + expect(paths).to.eql(expectedAreaChartData); + }) + .catch(common.handleError(this)); + }); + + bdd.it('should show correct data', function pageHeader() { var expectedTableData = [ 'September 20th 2015, 00:00:00.000 37', @@ -168,50 +205,10 @@ define(function (require) { common.debug('getDataTableData = ' + data.split('\n')); expect(data.trim().split('\n')).to.eql(expectedTableData); }) - .then(function collapseChart() { - return visualizePage.collapseChart(); - }) - .then(function sleep() { - return common.sleep(2000); - }) .catch(common.handleError(this)); }); - bdd.it('should show correct chart', 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' - ]; - var yAxisLabels = ['0','200','400','600','800','1,000','1,200','1,400','1,600']; - var expectedAreaChartData = [37, 202, 740, 1437, 1371, 751, 188, 31, 42, 202, - 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); - }) - .then(function getYAxisLabels() { - return visualizePage.getYAxisLabels(); - }) - .then(function (labels) { - common.debug('Y-Axis labels = ' + labels); - expect(labels).to.eql(yAxisLabels); - }) - .then(function getAreaChartData() { - //return common.tryForTime(500, function () { - return visualizePage.getAreaChartData(); - }) - .then(function (paths) { - common.debug('expectedAreaChartData = ' + expectedAreaChartData); - common.debug('actual chart data = ' + paths); - expect(paths).to.eql(expectedAreaChartData); - }) - .catch(common.handleError(this)); - }); }); }); diff --git a/test/functional/apps/visualize/_line_chart.js b/test/functional/apps/visualize/_line_chart.js index bdf8617241ad8..e0e1951d6124d 100644 --- a/test/functional/apps/visualize/_line_chart.js +++ b/test/functional/apps/visualize/_line_chart.js @@ -104,6 +104,9 @@ define(function (require) { .then(function () { return visualizePage.loadSavedVisualization(vizName1); }) + .then(function sleep() { + return common.sleep(4000); + }) .then(function takeScreenshot() { // take a snapshot just as an example. common.debug('Take screenshot'); diff --git a/test/functional/apps/visualize/_pie_chart.js b/test/functional/apps/visualize/_pie_chart.js index 710321fbee3fd..06877b48d75b6 100644 --- a/test/functional/apps/visualize/_pie_chart.js +++ b/test/functional/apps/visualize/_pie_chart.js @@ -111,6 +111,9 @@ define(function (require) { .then(function () { return visualizePage.loadSavedVisualization(vizName1); }) + .then(function sleep() { + return common.sleep(4000); + }) .then(function takeScreenshot() { common.debug('Take screenshot'); common.saveScreenshot('./screenshot-' + testSubName + '.png'); diff --git a/test/functional/apps/visualize/_tile_map.js b/test/functional/apps/visualize/_tile_map.js index f192bd4c884c3..13d81d603a4ea 100644 --- a/test/functional/apps/visualize/_tile_map.js +++ b/test/functional/apps/visualize/_tile_map.js @@ -104,6 +104,9 @@ define(function (require) { .then(function () { return visualizePage.loadSavedVisualization(vizName1); }) + .then(function sleep() { + return common.sleep(4000); + }) .then(function takeScreenshot() { common.debug('Take screenshot'); common.saveScreenshot('./screenshot-' + testSubName + '.png'); diff --git a/test/functional/apps/visualize/_vertical_bar_chart.js b/test/functional/apps/visualize/_vertical_bar_chart.js index 6f1cbb67cdd54..9953b4fc7ab71 100644 --- a/test/functional/apps/visualize/_vertical_bar_chart.js +++ b/test/functional/apps/visualize/_vertical_bar_chart.js @@ -109,6 +109,9 @@ define(function (require) { .then(function () { return headerPage.getSpinnerDone(); // only matches the hidden spinner }) + .then(function sleep() { + return common.sleep(4000); + }) .then(function takeScreenshot() { common.debug('Take screenshot'); common.saveScreenshot('./screenshot-' + testSubName + '.png'); diff --git a/test/support/pages/HeaderPage.js b/test/support/pages/HeaderPage.js index 7789cbd46734a..c1e8767baf56c 100644 --- a/test/support/pages/HeaderPage.js +++ b/test/support/pages/HeaderPage.js @@ -142,11 +142,6 @@ define(function (require) { return this.remote .setFindTimeout(defaultTimeout * 10) .findByCssSelector('span.spinner.ng-hide'); - // .then(function () { - // return self.remote - // .setFindTimeout(defaultTimeout * 10) - // .findByCssSelector('div.spinner.large.ng-hide'); - // }); } }; From 55330638c775f7c6efd3fe493bb05ee9a9ecd7a7 Mon Sep 17 00:00:00 2001 From: LeeDr Date: Mon, 18 Jan 2016 13:43:40 -0600 Subject: [PATCH 03/11] Trying 4 sec sleep before screenshots. --- test/functional/apps/visualize/_data_table.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/functional/apps/visualize/_data_table.js b/test/functional/apps/visualize/_data_table.js index dfb047ec83132..ba2defaa49607 100644 --- a/test/functional/apps/visualize/_data_table.js +++ b/test/functional/apps/visualize/_data_table.js @@ -104,6 +104,9 @@ define(function (require) { .then(function () { return visualizePage.loadSavedVisualization(vizName1); }) + .then(function sleep() { + return common.sleep(4000); + }) .then(function takeScreenshot() { common.debug('Take screenshot'); common.saveScreenshot('./screenshot-' + testSubName + '.png'); From 9157cf7e16c3fe4d369096cda53980dd8434edd0 Mon Sep 17 00:00:00 2001 From: LeeDr Date: Mon, 18 Jan 2016 16:50:40 -0600 Subject: [PATCH 04/11] switch from sleeps to waiting for visualize-legend. --- test/functional/apps/visualize/_area_chart.js | 4 ++-- test/functional/apps/visualize/_data_table.js | 4 ++-- test/functional/apps/visualize/_line_chart.js | 4 ++-- test/functional/apps/visualize/_pie_chart.js | 4 ++-- test/functional/apps/visualize/_tile_map.js | 4 ++-- test/functional/apps/visualize/_vertical_bar_chart.js | 8 ++++---- test/intern.js | 6 +++--- test/support/pages/VisualizePage.js | 6 ++++++ 8 files changed, 23 insertions(+), 17 deletions(-) diff --git a/test/functional/apps/visualize/_area_chart.js b/test/functional/apps/visualize/_area_chart.js index d7435a3dc8c0d..088d3d540a4a7 100644 --- a/test/functional/apps/visualize/_area_chart.js +++ b/test/functional/apps/visualize/_area_chart.js @@ -118,8 +118,8 @@ define(function (require) { common.debug('Waiting...'); return headerPage.getSpinnerDone(); }) - .then(function sleep() { - return common.sleep(4000); + .then(function waitForVisualization() { + return visualizePage.waitForVisualization(); }) .then(function takeScreenshot() { common.debug('Take screenshot'); diff --git a/test/functional/apps/visualize/_data_table.js b/test/functional/apps/visualize/_data_table.js index ba2defaa49607..702d9193f2c07 100644 --- a/test/functional/apps/visualize/_data_table.js +++ b/test/functional/apps/visualize/_data_table.js @@ -104,8 +104,8 @@ define(function (require) { .then(function () { return visualizePage.loadSavedVisualization(vizName1); }) - .then(function sleep() { - return common.sleep(4000); + .then(function waitForVisualization() { + return visualizePage.waitForVisualization(); }) .then(function takeScreenshot() { common.debug('Take screenshot'); diff --git a/test/functional/apps/visualize/_line_chart.js b/test/functional/apps/visualize/_line_chart.js index e0e1951d6124d..1ec2212acfb8a 100644 --- a/test/functional/apps/visualize/_line_chart.js +++ b/test/functional/apps/visualize/_line_chart.js @@ -104,8 +104,8 @@ define(function (require) { .then(function () { return visualizePage.loadSavedVisualization(vizName1); }) - .then(function sleep() { - return common.sleep(4000); + .then(function waitForVisualization() { + return visualizePage.waitForVisualization(); }) .then(function takeScreenshot() { // take a snapshot just as an example. diff --git a/test/functional/apps/visualize/_pie_chart.js b/test/functional/apps/visualize/_pie_chart.js index 06877b48d75b6..a01e026af1a21 100644 --- a/test/functional/apps/visualize/_pie_chart.js +++ b/test/functional/apps/visualize/_pie_chart.js @@ -111,8 +111,8 @@ define(function (require) { .then(function () { return visualizePage.loadSavedVisualization(vizName1); }) - .then(function sleep() { - return common.sleep(4000); + .then(function waitForVisualization() { + return visualizePage.waitForVisualization(); }) .then(function takeScreenshot() { common.debug('Take screenshot'); diff --git a/test/functional/apps/visualize/_tile_map.js b/test/functional/apps/visualize/_tile_map.js index 13d81d603a4ea..50e9b5bd79651 100644 --- a/test/functional/apps/visualize/_tile_map.js +++ b/test/functional/apps/visualize/_tile_map.js @@ -104,8 +104,8 @@ define(function (require) { .then(function () { return visualizePage.loadSavedVisualization(vizName1); }) - .then(function sleep() { - return common.sleep(4000); + .then(function waitForVisualization() { + return visualizePage.waitForVisualization(); }) .then(function takeScreenshot() { common.debug('Take screenshot'); diff --git a/test/functional/apps/visualize/_vertical_bar_chart.js b/test/functional/apps/visualize/_vertical_bar_chart.js index 9953b4fc7ab71..f21fc8cc7cdb8 100644 --- a/test/functional/apps/visualize/_vertical_bar_chart.js +++ b/test/functional/apps/visualize/_vertical_bar_chart.js @@ -80,8 +80,8 @@ define(function (require) { .then(function () { return headerPage.getSpinnerDone(); // only matches the hidden spinner }) - .then(function sleep() { - return common.sleep(1000); + .then(function waitForVisualization() { + return visualizePage.waitForVisualization(); }); }); @@ -109,8 +109,8 @@ define(function (require) { .then(function () { return headerPage.getSpinnerDone(); // only matches the hidden spinner }) - .then(function sleep() { - return common.sleep(4000); + .then(function waitForVisualization() { + return visualizePage.waitForVisualization(); }) .then(function takeScreenshot() { common.debug('Take screenshot'); diff --git a/test/intern.js b/test/intern.js index 404b72b6c0841..da667d45fae0c 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)\//, diff --git a/test/support/pages/VisualizePage.js b/test/support/pages/VisualizePage.js index 203e98798cb8e..102b5fb1a13ec 100644 --- a/test/support/pages/VisualizePage.js +++ b/test/support/pages/VisualizePage.js @@ -673,6 +673,12 @@ define(function (require) { }); }, + waitForVisualization: function waitForVisualization() { + return this.remote + .setFindTimeout(defaultTimeout) + .findByCssSelector('visualize-legend'); + } + }; return VisualizePage; From 720faf45dd2fc773b4ff76d3c2f5cb9f86381f11 Mon Sep 17 00:00:00 2001 From: LeeDr Date: Mon, 18 Jan 2016 20:40:54 -0600 Subject: [PATCH 05/11] Fix screenshots with minimal sleep calls. Remove a couple unnecessary promise chains in visualizePage. --- test/functional/apps/visualize/_area_chart.js | 39 ++++++++---------- test/functional/apps/visualize/_data_table.js | 5 ++- test/functional/apps/visualize/_line_chart.js | 18 ++++---- test/functional/apps/visualize/_pie_chart.js | 41 +++++++++---------- test/intern.js | 7 ++-- test/support/pages/VisualizePage.js | 19 ++------- 6 files changed, 56 insertions(+), 73 deletions(-) diff --git a/test/functional/apps/visualize/_area_chart.js b/test/functional/apps/visualize/_area_chart.js index 088d3d540a4a7..e07bed2e54e5a 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 702d9193f2c07..197b042927a2d 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 1ec2212acfb8a..9b7f6c0c53c38 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 a01e026af1a21..68d41aeca2832 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 da667d45fae0c..67af1e763229e 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 102b5fb1a13ec..e72248a9d4493 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); From b9d626aa70a81c124cd8e75de82e44a3d190df58 Mon Sep 17 00:00:00 2001 From: LeeDr Date: Tue, 19 Jan 2016 10:08:33 -0600 Subject: [PATCH 06/11] Fix screenshots Data Table and Tile Map. --- test/functional/apps/visualize/_data_table.js | 19 ++++++++----------- test/functional/apps/visualize/_tile_map.js | 13 +++++-------- 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/test/functional/apps/visualize/_data_table.js b/test/functional/apps/visualize/_data_table.js index 197b042927a2d..72a23b032246e 100644 --- a/test/functional/apps/visualize/_data_table.js +++ b/test/functional/apps/visualize/_data_table.js @@ -90,12 +90,10 @@ define(function (require) { bdd.describe('data table', function indexPatternCreation() { + var testSubName = 'DataTable'; + var vizName1 = 'Visualization ' + testSubName; - bdd.it('should be able to save and load, take screenshot', function pageHeader() { - - var testSubName = 'DataTable'; - var vizName1 = 'Visualization ' + testSubName; - + bdd.it('should be able to save and load', function pageHeader() { return visualizePage.saveVisualization(vizName1) .then(function (message) { common.debug('Saved viz message = ' + message); @@ -110,16 +108,11 @@ define(function (require) { .then(function () { return visualizePage.waitForVisualization(); }) - .then(function takeScreenshot() { - common.debug('Take screenshot'); - common.saveScreenshot('./screenshot-' + testSubName + '.png'); - }) .catch(common.handleError(this)); }); - bdd.it('should show correct data', function pageHeader() { - + bdd.it('should show correct data, take screenshot', function pageHeader() { var chartHeight = 0; var expectedChartData = [ '0 2,088', '2,000 2,748', '4,000 2,707', '6,000 2,876', '8,000 2,863', '10,000 147', '12,000 148', '14,000 129', '16,000 161', '18,000 137' @@ -130,6 +123,10 @@ define(function (require) { common.debug(data.split('\n')); expect(data.split('\n')).to.eql(expectedChartData); }) + .then(function takeScreenshot() { + common.debug('Take screenshot'); + common.saveScreenshot('./screenshot-' + testSubName + '.png'); + }) .catch(common.handleError(this)); }); diff --git a/test/functional/apps/visualize/_tile_map.js b/test/functional/apps/visualize/_tile_map.js index 50e9b5bd79651..c913da29f7245 100644 --- a/test/functional/apps/visualize/_tile_map.js +++ b/test/functional/apps/visualize/_tile_map.js @@ -87,7 +87,7 @@ define(function (require) { bdd.describe('tile map chart', function indexPatternCreation() { - bdd.it('should save and load, take screenshot', function pageHeader() { + bdd.it('should save and load', function pageHeader() { var testSubName = 'TileMap'; common.debug('Start of test' + testSubName + 'Visualization'); var vizName1 = 'Visualization ' + testSubName; @@ -107,14 +107,10 @@ define(function (require) { .then(function waitForVisualization() { return visualizePage.waitForVisualization(); }) - .then(function takeScreenshot() { - common.debug('Take screenshot'); - common.saveScreenshot('./screenshot-' + testSubName + '.png'); - }) .catch(common.handleError(this)); }); - bdd.it('should show correct tile map data', function pageHeader() { + bdd.it('should show correct tile map data, take screenshot', function pageHeader() { var testSubName = 'TileMap'; common.debug('Start of test' + testSubName + 'Visualization'); // var remote = this.remote; @@ -137,8 +133,9 @@ define(function (require) { expect(data.trim().split('\n')).to.eql(expectedTableData); }); }) - .then(function () { - return visualizePage.collapseChart(); + .then(function takeScreenshot() { + common.debug('Take screenshot'); + common.saveScreenshot('./screenshot-' + testSubName + '.png'); }) .catch(common.handleError(this)); }); From b6f67920aadf435c63cf1ede5b96ec38bc643b67 Mon Sep 17 00:00:00 2001 From: LeeDr Date: Tue, 19 Jan 2016 10:28:05 -0600 Subject: [PATCH 07/11] Fix screenshots Data Table and Tile Map. --- test/functional/apps/visualize/_tile_map.js | 17 ++++++++++------- test/intern.js | 6 +++--- test/output/.empty | 0 3 files changed, 13 insertions(+), 10 deletions(-) delete mode 100644 test/output/.empty diff --git a/test/functional/apps/visualize/_tile_map.js b/test/functional/apps/visualize/_tile_map.js index c913da29f7245..13d81d603a4ea 100644 --- a/test/functional/apps/visualize/_tile_map.js +++ b/test/functional/apps/visualize/_tile_map.js @@ -87,7 +87,7 @@ define(function (require) { bdd.describe('tile map chart', function indexPatternCreation() { - bdd.it('should save and load', function pageHeader() { + bdd.it('should save and load, take screenshot', function pageHeader() { var testSubName = 'TileMap'; common.debug('Start of test' + testSubName + 'Visualization'); var vizName1 = 'Visualization ' + testSubName; @@ -104,13 +104,17 @@ define(function (require) { .then(function () { return visualizePage.loadSavedVisualization(vizName1); }) - .then(function waitForVisualization() { - return visualizePage.waitForVisualization(); + .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 show correct tile map data, take screenshot', function pageHeader() { + bdd.it('should show correct tile map data', function pageHeader() { var testSubName = 'TileMap'; common.debug('Start of test' + testSubName + 'Visualization'); // var remote = this.remote; @@ -133,9 +137,8 @@ define(function (require) { expect(data.trim().split('\n')).to.eql(expectedTableData); }); }) - .then(function takeScreenshot() { - common.debug('Take screenshot'); - common.saveScreenshot('./screenshot-' + testSubName + '.png'); + .then(function () { + return visualizePage.collapseChart(); }) .catch(common.handleError(this)); }); diff --git a/test/intern.js b/test/intern.js index 67af1e763229e..dafcea019f1c3 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)\//, diff --git a/test/output/.empty b/test/output/.empty deleted file mode 100644 index e69de29bb2d1d..0000000000000 From 24fa2d41f9230f3d666377fa683c9c12291ad2e5 Mon Sep 17 00:00:00 2001 From: LeeDr Date: Tue, 19 Jan 2016 10:39:51 -0600 Subject: [PATCH 08/11] Revert "Fix screenshots Data Table and Tile Map." This reverts commit b6f67920aadf435c63cf1ede5b96ec38bc643b67. --- test/functional/apps/visualize/_tile_map.js | 17 +++++++---------- test/intern.js | 6 +++--- test/output/.empty | 0 3 files changed, 10 insertions(+), 13 deletions(-) create mode 100644 test/output/.empty diff --git a/test/functional/apps/visualize/_tile_map.js b/test/functional/apps/visualize/_tile_map.js index 13d81d603a4ea..c913da29f7245 100644 --- a/test/functional/apps/visualize/_tile_map.js +++ b/test/functional/apps/visualize/_tile_map.js @@ -87,7 +87,7 @@ define(function (require) { bdd.describe('tile map chart', function indexPatternCreation() { - bdd.it('should save and load, take screenshot', function pageHeader() { + bdd.it('should save and load', function pageHeader() { var testSubName = 'TileMap'; common.debug('Start of test' + testSubName + 'Visualization'); var vizName1 = 'Visualization ' + testSubName; @@ -104,17 +104,13 @@ define(function (require) { .then(function () { return visualizePage.loadSavedVisualization(vizName1); }) - .then(function sleep() { - return common.sleep(4000); - }) - .then(function takeScreenshot() { - common.debug('Take screenshot'); - common.saveScreenshot('./screenshot-' + testSubName + '.png'); + .then(function waitForVisualization() { + return visualizePage.waitForVisualization(); }) .catch(common.handleError(this)); }); - bdd.it('should show correct tile map data', function pageHeader() { + bdd.it('should show correct tile map data, take screenshot', function pageHeader() { var testSubName = 'TileMap'; common.debug('Start of test' + testSubName + 'Visualization'); // var remote = this.remote; @@ -137,8 +133,9 @@ define(function (require) { expect(data.trim().split('\n')).to.eql(expectedTableData); }); }) - .then(function () { - return visualizePage.collapseChart(); + .then(function takeScreenshot() { + common.debug('Take screenshot'); + common.saveScreenshot('./screenshot-' + testSubName + '.png'); }) .catch(common.handleError(this)); }); diff --git a/test/intern.js b/test/intern.js index dafcea019f1c3..67af1e763229e 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)\//, diff --git a/test/output/.empty b/test/output/.empty new file mode 100644 index 0000000000000..e69de29bb2d1d From 21e996bd8815d9f0b9fd799f254dd5f43a206efc Mon Sep 17 00:00:00 2001 From: LeeDr Date: Tue, 19 Jan 2016 10:50:30 -0600 Subject: [PATCH 09/11] Fix screenshots Data Table and Tile Map. --- test/functional/apps/visualize/_tile_map.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/test/functional/apps/visualize/_tile_map.js b/test/functional/apps/visualize/_tile_map.js index c913da29f7245..7110646de0a08 100644 --- a/test/functional/apps/visualize/_tile_map.js +++ b/test/functional/apps/visualize/_tile_map.js @@ -87,7 +87,7 @@ define(function (require) { bdd.describe('tile map chart', function indexPatternCreation() { - bdd.it('should save and load', function pageHeader() { + bdd.it('should save and load, take screenshot', function pageHeader() { var testSubName = 'TileMap'; common.debug('Start of test' + testSubName + 'Visualization'); var vizName1 = 'Visualization ' + testSubName; @@ -107,10 +107,17 @@ define(function (require) { .then(function waitForVisualization() { return visualizePage.waitForVisualization(); }) + .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 show correct tile map data, take screenshot', function pageHeader() { + bdd.it('should show correct tile map data', function pageHeader() { var testSubName = 'TileMap'; common.debug('Start of test' + testSubName + 'Visualization'); // var remote = this.remote; @@ -133,10 +140,6 @@ define(function (require) { expect(data.trim().split('\n')).to.eql(expectedTableData); }); }) - .then(function takeScreenshot() { - common.debug('Take screenshot'); - common.saveScreenshot('./screenshot-' + testSubName + '.png'); - }) .catch(common.handleError(this)); }); From 127e8e67dd54c8abc5975d09a57b58754cf53ca8 Mon Sep 17 00:00:00 2001 From: LeeDr Date: Tue, 19 Jan 2016 12:20:09 -0600 Subject: [PATCH 10/11] Fix screenshots Data Table and Tile Map. --- .../apps/visualize/_vertical_bar_chart.js | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/test/functional/apps/visualize/_vertical_bar_chart.js b/test/functional/apps/visualize/_vertical_bar_chart.js index f21fc8cc7cdb8..88ee497427da5 100644 --- a/test/functional/apps/visualize/_vertical_bar_chart.js +++ b/test/functional/apps/visualize/_vertical_bar_chart.js @@ -86,15 +86,11 @@ define(function (require) { }); bdd.describe('vertical bar chart', function indexPatternCreation() { + var testSubName = 'VerticalBarChart'; + var vizName1 = 'Visualization ' + testSubName; - bdd.it('should save and load, take screenshot', function pageHeader() { - - var testSubName = 'VerticalBarChart'; - common.debug('Start of test' + testSubName + 'Visualization'); - var vizName1 = 'Visualization ' + testSubName; - // var remote = this.remote; - + bdd.it('should save and load', function pageHeader() { return visualizePage.saveVisualization(vizName1) .then(function (message) { common.debug('Saved viz message = ' + message); @@ -112,15 +108,11 @@ define(function (require) { .then(function waitForVisualization() { return visualizePage.waitForVisualization(); }) - .then(function takeScreenshot() { - 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 expectedChartValues = [37, 202, 740, 1437, 1371, 751, 188, 31, 42, 202, 683, 1361, 1415, 707, 177, 27, 32, 175, 707, 1408, 1355, 726, 201, 29 @@ -138,6 +130,10 @@ define(function (require) { common.debug('data.length=' + data.length); expect(data).to.eql(expectedChartValues); }) + .then(function takeScreenshot() { + common.debug('Take screenshot'); + common.saveScreenshot('./screenshot-' + testSubName + '.png'); + }) .catch(common.handleError(this)); }); From 24b0177688d78aedcec2bd4f03464b42468b6629 Mon Sep 17 00:00:00 2001 From: LeeDr Date: Tue, 19 Jan 2016 12:41:17 -0600 Subject: [PATCH 11/11] Fix screenshots Data Table and Tile Map. Add comments. --- test/functional/apps/visualize/_area_chart.js | 3 +++ test/functional/apps/visualize/_line_chart.js | 1 + test/functional/apps/visualize/_pie_chart.js | 1 + test/functional/apps/visualize/_tile_map.js | 1 + 4 files changed, 6 insertions(+) diff --git a/test/functional/apps/visualize/_area_chart.js b/test/functional/apps/visualize/_area_chart.js index e07bed2e54e5a..8251cec57d8c6 100644 --- a/test/functional/apps/visualize/_area_chart.js +++ b/test/functional/apps/visualize/_area_chart.js @@ -115,6 +115,9 @@ define(function (require) { .then(function () { return visualizePage.waitForVisualization(); }) + // We have to sleep sometime between loading the saved visTitle + // and trying to access the chart below with getXAxisLabels + // otherwise it hangs. .then(function sleep() { return common.sleep(2000); }) diff --git a/test/functional/apps/visualize/_line_chart.js b/test/functional/apps/visualize/_line_chart.js index 9b7f6c0c53c38..a6c817d20e8c8 100644 --- a/test/functional/apps/visualize/_line_chart.js +++ b/test/functional/apps/visualize/_line_chart.js @@ -119,6 +119,7 @@ define(function (require) { // it could also check the legend to verify the extensions var expectedChartData = ['jpg 9,109', 'css 2,159', 'png 1,373', 'gif 918', 'php 445']; + // sleep a bit before trying to get the chart data return common.sleep(3000) .then(function () { return visualizePage.getLineChartData() diff --git a/test/functional/apps/visualize/_pie_chart.js b/test/functional/apps/visualize/_pie_chart.js index 68d41aeca2832..6ff9096069479 100644 --- a/test/functional/apps/visualize/_pie_chart.js +++ b/test/functional/apps/visualize/_pie_chart.js @@ -114,6 +114,7 @@ define(function (require) { .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); }) diff --git a/test/functional/apps/visualize/_tile_map.js b/test/functional/apps/visualize/_tile_map.js index 7110646de0a08..75044876c2acf 100644 --- a/test/functional/apps/visualize/_tile_map.js +++ b/test/functional/apps/visualize/_tile_map.js @@ -107,6 +107,7 @@ define(function (require) { .then(function waitForVisualization() { return visualizePage.waitForVisualization(); }) + // sleep a bit before taking the screenshot or it won't show data .then(function sleep() { return common.sleep(4000); })