From 0ef0ea990751a73c2881ac427325f7d95eabafd1 Mon Sep 17 00:00:00 2001 From: Prayag Verma Date: Mon, 18 Jan 2016 22:34:29 +0530 Subject: [PATCH 01/30] Matching license year range with latest released version --- LICENSE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE.md b/LICENSE.md index 484bbafe7b7a..d049908847b8 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,4 +1,4 @@ -Copyright 2012–2014 Elasticsearch BV +Copyright 2012–2015 Elasticsearch BV Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at From 68a46618ab724dfbac6dc639f335c6ddb4f843cf Mon Sep 17 00:00:00 2001 From: LeeDr Date: Mon, 18 Jan 2016 11:37:51 -0600 Subject: [PATCH 02/30] 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 68b2c3b1a304..96b9c27ed651 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 03/30] 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 96b9c27ed651..d7435a3dc8c0 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 bdf8617241ad..e0e1951d6124 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 710321fbee3f..06877b48d75b 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 f192bd4c884c..13d81d603a4e 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 6f1cbb67cdd5..9953b4fc7ab7 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 7789cbd46734..c1e8767baf56 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 04/30] 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 dfb047ec8313..ba2defaa4960 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 05/30] 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 d7435a3dc8c0..088d3d540a4a 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 ba2defaa4960..702d9193f2c0 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 e0e1951d6124..1ec2212acfb8 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 06877b48d75b..a01e026af1a2 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 13d81d603a4e..50e9b5bd7965 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 9953b4fc7ab7..f21fc8cc7cdb 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 404b72b6c084..da667d45fae0 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 203e98798cb8..102b5fb1a13e 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 06/30] 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 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); From b9d626aa70a81c124cd8e75de82e44a3d190df58 Mon Sep 17 00:00:00 2001 From: LeeDr Date: Tue, 19 Jan 2016 10:08:33 -0600 Subject: [PATCH 07/30] 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 197b042927a2..72a23b032246 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 50e9b5bd7965..c913da29f724 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 08/30] 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 c913da29f724..13d81d603a4e 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 67af1e763229..dafcea019f1c 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 e69de29bb2d1..000000000000 From 24fa2d41f9230f3d666377fa683c9c12291ad2e5 Mon Sep 17 00:00:00 2001 From: LeeDr Date: Tue, 19 Jan 2016 10:39:51 -0600 Subject: [PATCH 09/30] 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 13d81d603a4e..c913da29f724 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 dafcea019f1c..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)\//, diff --git a/test/output/.empty b/test/output/.empty new file mode 100644 index 000000000000..e69de29bb2d1 From 21e996bd8815d9f0b9fd799f254dd5f43a206efc Mon Sep 17 00:00:00 2001 From: LeeDr Date: Tue, 19 Jan 2016 10:50:30 -0600 Subject: [PATCH 10/30] 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 c913da29f724..7110646de0a0 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 11/30] 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 f21fc8cc7cdb..88ee497427da 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 12/30] 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 e07bed2e54e5..8251cec57d8c 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 9b7f6c0c53c3..a6c817d20e8c 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 68d41aeca283..6ff909606947 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 7110646de0a0..75044876c2ac 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); }) From e90e18240a7dec5f6eda8a08f3e42053fadd7dba Mon Sep 17 00:00:00 2001 From: Joe Fleming Date: Tue, 19 Jan 2016 13:25:51 -0700 Subject: [PATCH 13/30] create navbar directive --- src/ui/public/navbar/navbar.js | 52 ++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 src/ui/public/navbar/navbar.js diff --git a/src/ui/public/navbar/navbar.js b/src/ui/public/navbar/navbar.js new file mode 100644 index 000000000000..a520757326a4 --- /dev/null +++ b/src/ui/public/navbar/navbar.js @@ -0,0 +1,52 @@ +const _ = require('lodash'); +const $ = require('jquery'); +const navbar = require('ui/modules').get('kibana/navbar'); + +require('ui/render_directive'); + +navbar.directive('navbar', function (Private, $compile) { + const navbarExtensions = Private(require('ui/registry/navbar_extensions')); + const getExtensions = _.memoize(function (name) { + if (!name) throw new Error('navbar directive requires a name attribute'); + return _.sortBy(navbarExtensions.byAppName[name], 'order'); + }); + + return { + restrict: 'E', + template: function ($el, $attrs) { + const $buttonGroup = $el.children('.button-group'); + if ($buttonGroup.length !== 1) throw new Error('navbar must have exactly 1 button group'); + + const extensions = getExtensions($attrs.name); + const controls = $buttonGroup.children().detach().toArray().map(function (button) { + return { + order: 0, + $el: $(button), + }; + }).concat(extensions.map(function (extension, i) { + return { + order: extension.order, + index: i, + extension: extension, + }; + })); + + _.sortBy(controls, 'order').forEach(function (control) { + if (control.$el) { + return $buttonGroup.append(control.$el); + } + + const { extension, index } = control; + const $ext = $(``); + $ext.html(extension.template); + $buttonGroup.append($ext); + }); + + return $el.html(); + }, + controllerAs: 'navbar', + controller: function ($attrs) { + this.extensions = getExtensions($attrs.name); + } + }; +}); From c55f3c43c78a5f220d20e305e60af1104cba52a1 Mon Sep 17 00:00:00 2001 From: Joe Fleming Date: Tue, 19 Jan 2016 13:26:59 -0700 Subject: [PATCH 14/30] consume navbar directive used anywhere the navbar is being used currently --- src/plugins/kibana/public/dashboard/index.html | 2 +- src/plugins/kibana/public/dashboard/index.js | 1 + src/plugins/kibana/public/discover/index.html | 2 +- src/plugins/kibana/public/discover/index.js | 5 +++-- src/plugins/kibana/public/visualize/editor/editor.html | 2 +- src/plugins/kibana/public/visualize/editor/editor.js | 1 + 6 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/plugins/kibana/public/dashboard/index.html b/src/plugins/kibana/public/dashboard/index.html index d2a2688c801c..9a3f94fa3832 100644 --- a/src/plugins/kibana/public/dashboard/index.html +++ b/src/plugins/kibana/public/dashboard/index.html @@ -1,5 +1,5 @@
- +
- +
- +
Date: Tue, 19 Jan 2016 18:05:14 -0600 Subject: [PATCH 15/30] Added tests that change the interval through most of the choices and check the data. --- test/functional/apps/discover/_discover.js | 187 +++++++++++++++++++-- test/support/pages/DiscoverPage.js | 30 +++- 2 files changed, 199 insertions(+), 18 deletions(-) diff --git a/test/functional/apps/discover/_discover.js b/test/functional/apps/discover/_discover.js index 13707abc2e58..5a96a8ac8f5f 100644 --- a/test/functional/apps/discover/_discover.js +++ b/test/functional/apps/discover/_discover.js @@ -48,10 +48,11 @@ define(function (require) { bdd.describe('query', function () { var queryName1 = 'Query # 1'; + var fromTimeString = 'September 19th 2015, 06:31:44.000'; + var toTimeString = 'September 23rd 2015, 18:31:44.000'; - bdd.it('should show correct time range string', function () { - var expectedTimeRangeString = - 'September 19th 2015, 06:31:44.000 to September 23rd 2015, 18:31:44.000'; + bdd.it('should show correct time range string by timepicker', function () { + var expectedTimeRangeString = fromTimeString + ' to ' + toTimeString; return discoverPage.getTimespanText() .then(function (actualTimeString) { expect(actualTimeString).to.be(expectedTimeRangeString); @@ -59,6 +60,7 @@ define(function (require) { .catch(common.handleError(this)); }); + bdd.it('save query should show toast message and display query name', function () { var expectedSavedQueryMessage = 'Discover: Saved Data Source "' + queryName1 + '"'; return discoverPage.saveSearch(queryName1) @@ -104,25 +106,176 @@ define(function (require) { ]; return common.sleep(4000) .then(function () { - return common.tryForTime(20 * 1000, function tryingForTime() { - return discoverPage.getBarChartData() - .then(function compareData(paths) { - // the largest bars are over 100 pixels high so this is less than 1% tolerance - var barHeightTolerance = 1; - for (var y = 0; y < expectedBarChartData.length; y++) { - common.debug(y + ': expected = ' + expectedBarChartData[y] + ', actual = ' + paths[y] + - ', Pass = ' + (Math.abs(expectedBarChartData[y] - paths[y]) < barHeightTolerance)); - }; - for (var x = 0; x < expectedBarChartData.length; x++) { - expect(Math.abs(expectedBarChartData[x] - paths[x]) < barHeightTolerance).to.be.ok(); - } - }); - }); + return verifyChartData(expectedBarChartData); + }) + .catch(common.handleError(this)); + }); + + bdd.it('should show correct time range string in chart', function () { + var expectedTimeRangeString = fromTimeString + ' - ' + toTimeString; + return discoverPage.getChartTimespan() + .then(function (actualTimeString) { + expect(actualTimeString).to.be(expectedTimeRangeString); + }) + .catch(common.handleError(this)); + }); + + bdd.it('should show correct initial chart interval of 3 hours', function () { + var expectedChartInterval = 'by 3 hours'; + return discoverPage.getChartInterval() + .then(function (actualInterval) { + expect(actualInterval).to.be(expectedChartInterval); + }) + .catch(common.handleError(this)); + }); + + bdd.it('should show correct data for chart interval Hourly', function () { + var chartInterval = 'Hourly'; + var expectedBarChartData = [ '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '1.2763636363636266', '1.914545454545447', + '4.680000000000007', '6.594545454545454', '11.061818181818168', '25.314545454545453', + '38.50363636363636', '46.374545454545455', '72.53999999999999', '93.60000000000001', + '102.10909090909091', '109.97999999999999', '111.04363636363637', '94.87636363636364', + '85.72909090909091', '68.28545454545454', '54.88363636363636', '36.58909090909091', + '20.209090909090904', '11.700000000000003', '8.083636363636359', '5.105454545454549', + '0.6381818181818204', '0.8509090909090986', '2.3400000000000034', '2.978181818181824', + '3.61636363636363', '8.083636363636359', '10.423636363636362', '24.46363636363637', + '32.33454545454545', '45.94909090909091', '67.00909090909092', '85.51636363636365', + '94.87636363636364', '109.1290909090909', '110.61818181818181', '100.83272727272727', + '89.55818181818182', '65.30727272727273', '48.92727272727274', '36.16363636363636', + '21.059999999999988', '10.210909090909098', '6.38181818181819', '3.190909090909088', + '2.127272727272725', '0.4254545454545422', '1.701818181818183', '1.4890909090909048', + '3.61636363636363', '7.232727272727274', '7.870909090909095', '22.123636363636365', + '32.54727272727273', '51.267272727272726', '66.58363636363637', '85.94181818181818', + '104.66181818181818', '108.91636363636364', '107.00181818181818', '100.62', + '80.62363636363636', '62.32909090909091', '58.92545454545455', '33.18545454545455', + '21.059999999999988', '11.274545454545446', '10.423636363636362', '3.403636363636366', + '1.914545454545447', '0.8509090909090986', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0' + ]; + return discoverPage.setChartInterval(chartInterval) + .then(function () { + return common.sleep(8000); + }) + .then(function () { + return verifyChartData(expectedBarChartData); + }) + .catch(common.handleError(this)); + }); + + bdd.it('should show correct data for chart interval Daily', function () { + var chartInterval = 'Daily'; + var expectedBarChartData = [ '0', '111.3138', '107.96759999999999', '108.4122', '0']; + return discoverPage.setChartInterval(chartInterval) + .then(function () { + return common.sleep(8000); + }) + .then(function () { + return verifyChartData(expectedBarChartData); + }) + .catch(common.handleError(this)); + }); + + bdd.it('should show correct data for chart interval Weekly', function () { + var chartInterval = 'Weekly'; + var expectedBarChartData = [ '55.6569', '108.1899']; + return discoverPage.setChartInterval(chartInterval) + .then(function () { + return common.sleep(2000); + }) + .then(function () { + return verifyChartData(expectedBarChartData); + }) + .catch(common.handleError(this)); + }); + + bdd.it('should show correct data for chart interval Monthly', function () { + var chartInterval = 'Monthly'; + var expectedBarChartData = [ '102.404']; + return discoverPage.setChartInterval(chartInterval) + .then(function () { + return common.sleep(2000); + }) + .then(function () { + return verifyChartData(expectedBarChartData); + }) + .catch(common.handleError(this)); + }); + + bdd.it('should show correct data for chart interval Yearly', function () { + var chartInterval = 'Yearly'; + var expectedBarChartData = [ '102.404']; + return discoverPage.setChartInterval(chartInterval) + .then(function () { + return common.sleep(2000); + }) + .then(function () { + return verifyChartData(expectedBarChartData); }) .catch(common.handleError(this)); }); + + bdd.it('should show correct data for chart interval Auto', function () { + var chartInterval = 'Auto'; + var expectedBarChartData = [ '0', '0', '0', '0', '0', '0', + '2.7056249999999977', '14.771249999999995', '54.112500000000004', + '105.080625', '100.25437500000001', '54.916875', '13.747499999999988', + '2.266874999999999', '3.0712500000000063', '14.771249999999995', + '49.944374999999994', '99.523125', '103.471875', '51.699375', + '12.943124999999995', '1.9743749999999949', '2.3400000000000034', + '12.796875', '51.699375', '102.96000000000001', '99.08437500000001', + '53.08875', '14.698125000000005', '2.1206249999999898', '0', '0', + '0', '0', '0', '0', '0' + ]; + return discoverPage.setChartInterval(chartInterval) + .then(function () { + return common.sleep(4000); + }) + .then(function () { + return verifyChartData(expectedBarChartData); + }) + .catch(common.handleError(this)); + }); + + bdd.it('should show Auto chart interval of 3 hours', function () { + var expectedChartInterval = 'by 3 hours'; + return discoverPage.getChartInterval() + .then(function (actualInterval) { + expect(actualInterval).to.be(expectedChartInterval); + }) + .catch(common.handleError(this)); + }); + + + function verifyChartData(expectedBarChartData) { + return common.tryForTime(20 * 1000, function tryingForTime() { + return discoverPage.getBarChartData() + .then(function compareData(paths) { + // console.log(paths); + // the largest bars are over 100 pixels high so this is less than 1% tolerance + var barHeightTolerance = 1; + var stringResults = ''; + var hasFailure = false; + for (var y = 0; y < expectedBarChartData.length; y++) { + stringResults += y + ': expected = ' + expectedBarChartData[y] + ', actual = ' + paths[y] + + ', Pass = ' + (Math.abs(expectedBarChartData[y] - paths[y]) < barHeightTolerance); + if ((Math.abs(expectedBarChartData[y] - paths[y]) > barHeightTolerance)) { + hasFailure = true; + }; + }; + if (hasFailure) { + common.log(stringResults); + } + for (var x = 0; x < expectedBarChartData.length; x++) { + expect(Math.abs(expectedBarChartData[x] - paths[x]) < barHeightTolerance).to.be.ok(); + } + }); + }); + + } + }); }); }; diff --git a/test/support/pages/DiscoverPage.js b/test/support/pages/DiscoverPage.js index eb611669fe75..63c8086d6d63 100644 --- a/test/support/pages/DiscoverPage.js +++ b/test/support/pages/DiscoverPage.js @@ -32,6 +32,13 @@ define(function (require) { .getVisibleText(); }, + getChartTimespan: function getChartTimespan() { + return thisTime + .findByCssSelector('center.small > span:nth-child(1)') + // .findByCssSelector('center.small > span.ng-binding') + .getVisibleText(); + }, + saveSearch: function saveSearch(searchName) { var self = this; return self.clickSaveSearchButton() @@ -85,7 +92,6 @@ define(function (require) { }, getBarChartData: function getBarChartData() { - common.debug('in getBarChartData'); return thisTime .findAllByCssSelector('rect[data-label="Count"]') .then(function (chartData) { @@ -101,8 +107,30 @@ define(function (require) { .then(function (bars) { return bars; }); + }, + + getChartInterval: function getChartInterval() { + return thisTime + .findByCssSelector('span.results-interval:nth-child(2) > a:nth-child(1)') + .getVisibleText(); + }, + + setChartInterval: function setChartInterval(interval) { + return thisTime + .findByCssSelector('span.results-interval:nth-child(2) > a:nth-child(1)') + .click() + .catch(function () { + // in some cases we have the link above, but after we've made a + // selection we just have a select list. + }) + .then(function () { + return thisTime + .findByCssSelector('option[label="' + interval + '"]') + .click(); + }); } + }; return DiscoverPage; From a0f5a00ad8d9bb53006b655a24201632a066af90 Mon Sep 17 00:00:00 2001 From: michaelcheng429 Date: Tue, 19 Jan 2016 19:57:40 -0600 Subject: [PATCH 16/30] fix typos in modules.js --- src/ui/public/modules.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ui/public/modules.js b/src/ui/public/modules.js index f187aad2302a..3cef8b28ed52 100644 --- a/src/ui/public/modules.js +++ b/src/ui/public/modules.js @@ -8,8 +8,8 @@ * * In the scenario below, require.js would load directive.js first because it is a * dependency of app.js. This would cause the call to `angular.module('app')` to - * execute before the module is actually created. This causes angular to through an - * error. This effect is magnifies when app.js links off to many different modules. + * execute before the module is actually created. This causes angular to throw an + * error. This effect is magnified when app.js links off to many different modules. * * This is normally solved by creating unique modules per file, listed as the 1st * alternate solution below. Unfortunately this solution would have required that From c477ab40a8c109362d155ace86ccbd775751c6b4 Mon Sep 17 00:00:00 2001 From: LeeDr Date: Wed, 20 Jan 2016 12:14:49 -0600 Subject: [PATCH 17/30] Minor changes from review comments. --- test/functional/apps/discover/_discover.js | 2 +- test/support/pages/DiscoverPage.js | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/test/functional/apps/discover/_discover.js b/test/functional/apps/discover/_discover.js index 5a96a8ac8f5f..5aabaa869789 100644 --- a/test/functional/apps/discover/_discover.js +++ b/test/functional/apps/discover/_discover.js @@ -253,7 +253,6 @@ define(function (require) { return common.tryForTime(20 * 1000, function tryingForTime() { return discoverPage.getBarChartData() .then(function compareData(paths) { - // console.log(paths); // the largest bars are over 100 pixels high so this is less than 1% tolerance var barHeightTolerance = 1; var stringResults = ''; @@ -267,6 +266,7 @@ define(function (require) { }; if (hasFailure) { common.log(stringResults); + common.log(paths); } for (var x = 0; x < expectedBarChartData.length; x++) { expect(Math.abs(expectedBarChartData[x] - paths[x]) < barHeightTolerance).to.be.ok(); diff --git a/test/support/pages/DiscoverPage.js b/test/support/pages/DiscoverPage.js index 63c8086d6d63..91c643d4be5f 100644 --- a/test/support/pages/DiscoverPage.js +++ b/test/support/pages/DiscoverPage.js @@ -35,7 +35,6 @@ define(function (require) { getChartTimespan: function getChartTimespan() { return thisTime .findByCssSelector('center.small > span:nth-child(1)') - // .findByCssSelector('center.small > span.ng-binding') .getVisibleText(); }, From 3ad167c90d70826cf4068528916766145e283f1c Mon Sep 17 00:00:00 2001 From: Matthew Bargar Date: Wed, 20 Jan 2016 13:36:43 -0500 Subject: [PATCH 18/30] Log all request events by default and request error events in quiet mode This change only logs events generated by request.log(), it does not include Hapi's internally generated request events. See: http://hapijs.com/api#server-events --- src/server/logging/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/server/logging/index.js b/src/server/logging/index.js index 779b20975686..bc53aa80aff0 100644 --- a/src/server/logging/index.js +++ b/src/server/logging/index.js @@ -14,6 +14,7 @@ module.exports = function (kbnServer, server, config) { else if (config.get('logging.quiet')) { _.defaults(events, { log: ['listening', 'error', 'fatal'], + request: ['error'], error: '*' }); } @@ -30,6 +31,7 @@ module.exports = function (kbnServer, server, config) { _.defaults(events, { log: ['info', 'warning', 'error', 'fatal'], response: config.get('logging.json') ? '*' : '!', + request: '*', error: '*' }); } From d7843dbb1cc1b2456bc2c31915c70e056f1d2d1f Mon Sep 17 00:00:00 2001 From: Joe Fleming Date: Wed, 20 Jan 2016 14:41:37 -0700 Subject: [PATCH 19/30] navbar directive tests --- src/ui/public/navbar/__tests__/navbar.js | 117 +++++++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 src/ui/public/navbar/__tests__/navbar.js diff --git a/src/ui/public/navbar/__tests__/navbar.js b/src/ui/public/navbar/__tests__/navbar.js new file mode 100644 index 000000000000..9729b44ebb95 --- /dev/null +++ b/src/ui/public/navbar/__tests__/navbar.js @@ -0,0 +1,117 @@ +const ngMock = require('ngMock'); +const sinon = require('sinon'); +const expect = require('expect.js'); +const angular = require('angular'); +const _ = require('lodash'); + +require('ui/navbar'); +const navbarExtensionsRegistry = require('ui/registry/navbar_extensions'); +const Registry = require('ui/registry/_registry'); + +const defaultMarkup = ` + + + `; + + +describe('navbar directive', function () { + let $rootScope; + let $compile; + let stubRegistry; + + beforeEach(function () { + ngMock.module('kibana', function (PrivateProvider) { + stubRegistry = new Registry({ + index: ['name'], + group: ['appName'], + order: ['order'] + }); + + PrivateProvider.swap(navbarExtensionsRegistry, stubRegistry); + }); + + ngMock.module('kibana/navbar'); + + // Create the scope + ngMock.inject(function ($injector) { + $rootScope = $injector.get('$rootScope'); + $compile = $injector.get('$compile'); + }); + }); + + function init(markup = defaultMarkup) { + // Give us a scope + const $el = angular.element(markup); + $compile($el)($rootScope); + $el.scope().$digest(); + return $el; + } + + describe('incorrect use', function () { + + it('should throw if missing a name property', function () { + let markup = ``; + expect(() => init(markup)).to.throwException(/requires a name attribute/); + }); + + it('should throw if missing a button group', function () { + let markup = ``; + expect(() => init(markup)).to.throwException(/must have exactly 1 button group/); + }); + }); + + describe('injecting extensions', function () { + function registerExtension(def = {}) { + stubRegistry.register(function () { + return _.defaults(def, { + name: 'exampleButton', + appName: 'testing', + order: 0, + template: ` + ` + }); + }); + } + + it('should use the default markup', function () { + var $el = init(); + expect($el.find('.button-group button').length).to.equal(3); + }); + + it('should append to end then order == 0', function () { + registerExtension({ order: 0 }); + var $el = init(); + + expect($el.find('.button-group button').length).to.equal(4); + expect($el.find('.button-group button').last().hasClass('test-button')).to.be.ok(); + }); + + it('should append to end then order > 0', function () { + registerExtension({ order: 1 }); + var $el = init(); + + expect($el.find('.button-group button').length).to.equal(4); + expect($el.find('.button-group button').last().hasClass('test-button')).to.be.ok(); + }); + + it('should append to end then order < 0', function () { + registerExtension({ order: -1 }); + var $el = init(); + + expect($el.find('.button-group button').length).to.equal(4); + expect($el.find('.button-group button').first().hasClass('test-button')).to.be.ok(); + }); + }); +}); From ee78fde20fb1a4b1099b0a8e513a64203c5f3499 Mon Sep 17 00:00:00 2001 From: spalger Date: Wed, 20 Jan 2016 18:44:26 -0700 Subject: [PATCH 20/30] [https] automatically redirect http traffic to https When we moved the dev server to use https it became obvious that the Kibana server fails very quick when it receives http traffic. In most cases this is a good thing, but automatically redirecting to https is a far more user-friendly experience. To do this we tell Hapi to listen to an alternate Server when we are using https. That server is provided by the httpolygot library, which knows how to handle both http and https requests. Then, when the server sees these requests it simply redirects when necessary. --- package.json | 1 + src/server/http/setup_connection.js | 88 +++++++++++++++-------------- src/server/http/tls_ciphers.js | 26 +++++++++ 3 files changed, 74 insertions(+), 41 deletions(-) create mode 100644 src/server/http/tls_ciphers.js diff --git a/package.json b/package.json index 0296d50c30d7..067eaea06baa 100644 --- a/package.json +++ b/package.json @@ -104,6 +104,7 @@ "good-squeeze": "2.1.0", "gridster": "0.5.6", "hapi": "8.8.1", + "httpolyglot": "0.1.1", "imports-loader": "0.6.4", "jade": "1.11.0", "jade-loader": "0.7.1", diff --git a/src/server/http/setup_connection.js b/src/server/http/setup_connection.js index 9c2b477a9bfc..4b0afe8ecbb2 100644 --- a/src/server/http/setup_connection.js +++ b/src/server/http/setup_connection.js @@ -1,13 +1,19 @@ -import fs from 'fs'; +import { readFileSync } from 'fs'; +import { format as formatUrl } from 'url'; +import httpolyglot from 'httpolyglot'; + +import tlsCiphers from './tls_ciphers'; export default function (kbnServer, server, config) { // this mixin is used outside of the kbn server, so it MUST work without a full kbnServer object. kbnServer = null; - // Create a new connection - var connectionOptions = { - host: config.get('server.host'), - port: config.get('server.port'), + const host = config.get('server.host'); + const port = config.get('server.port'); + + const connectionOptions = { + host, + port, state: { strictHeader: false }, @@ -19,42 +25,42 @@ export default function (kbnServer, server, config) { } }; - // enable tls if ssl key and cert are defined - if (config.get('server.ssl.key') && config.get('server.ssl.cert')) { - connectionOptions.tls = { - key: fs.readFileSync(config.get('server.ssl.key')), - cert: fs.readFileSync(config.get('server.ssl.cert')), - // The default ciphers in node 0.12.x include insecure ciphers, so until - // we enforce a more recent version of node, we craft our own list - // @see https://github.com/nodejs/node/blob/master/src/node_constants.h#L8-L28 - ciphers: [ - 'ECDHE-RSA-AES128-GCM-SHA256', - 'ECDHE-ECDSA-AES128-GCM-SHA256', - 'ECDHE-RSA-AES256-GCM-SHA384', - 'ECDHE-ECDSA-AES256-GCM-SHA384', - 'DHE-RSA-AES128-GCM-SHA256', - 'ECDHE-RSA-AES128-SHA256', - 'DHE-RSA-AES128-SHA256', - 'ECDHE-RSA-AES256-SHA384', - 'DHE-RSA-AES256-SHA384', - 'ECDHE-RSA-AES256-SHA256', - 'DHE-RSA-AES256-SHA256', - 'HIGH', - '!aNULL', - '!eNULL', - '!EXPORT', - '!DES', - '!RC4', - '!MD5', - '!PSK', - '!SRP', - '!CAMELLIA' - ].join(':'), - // We use the server's cipher order rather than the client's to prevent - // the BEAST attack - honorCipherOrder: true - }; + // enable tlsOpts if ssl key and cert are defined + const useSsl = config.get('server.ssl.key') && config.get('server.ssl.cert'); + + // not using https? well that's easy! + if (!useSsl) { + server.connection(connectionOptions); + return; } - server.connection(connectionOptions); + // for https servers we have some extra settings + const tls = { + key: readFileSync(config.get('server.ssl.key')), + cert: readFileSync(config.get('server.ssl.cert')), + + ciphers: tlsCiphers, + // We use the server's cipher order rather than the client's to prevent the BEAST attack + honorCipherOrder: true + }; + + server.connection({ + ...connectionOptions, + tls: tls, + listener: httpolyglot.createServer(tls) + }); + + server.ext('onRequest', function (req, reply) { + if (req.raw.req.socket.encrypted) { + reply.continue(); + } else { + reply.redirect(formatUrl({ + port, + protocol: 'https', + hostname: host, + pathname: req.url.pathname, + search: req.url.search, + })); + } + }); } diff --git a/src/server/http/tls_ciphers.js b/src/server/http/tls_ciphers.js new file mode 100644 index 000000000000..b2662f4c870d --- /dev/null +++ b/src/server/http/tls_ciphers.js @@ -0,0 +1,26 @@ +// The default ciphers in node 0.12.x include insecure ciphers, so until +// we enforce a more recent version of node, we craft our own list +// @see https://github.com/nodejs/node/blob/master/src/node_constants.h#L8-L28 +export default [ + 'ECDHE-RSA-AES128-GCM-SHA256', + 'ECDHE-ECDSA-AES128-GCM-SHA256', + 'ECDHE-RSA-AES256-GCM-SHA384', + 'ECDHE-ECDSA-AES256-GCM-SHA384', + 'DHE-RSA-AES128-GCM-SHA256', + 'ECDHE-RSA-AES128-SHA256', + 'DHE-RSA-AES128-SHA256', + 'ECDHE-RSA-AES256-SHA384', + 'DHE-RSA-AES256-SHA384', + 'ECDHE-RSA-AES256-SHA256', + 'DHE-RSA-AES256-SHA256', + 'HIGH', + '!aNULL', + '!eNULL', + '!EXPORT', + '!DES', + '!RC4', + '!MD5', + '!PSK', + '!SRP', + '!CAMELLIA' +].join(':'); From 3c599484320de36923ee73f0778192e5e5e2a647 Mon Sep 17 00:00:00 2001 From: Matthew Bargar Date: Thu, 21 Jan 2016 11:39:05 -0500 Subject: [PATCH 21/30] Make request logging less chatty by default --- src/server/logging/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/logging/index.js b/src/server/logging/index.js index bc53aa80aff0..0a98a9f0dc99 100644 --- a/src/server/logging/index.js +++ b/src/server/logging/index.js @@ -31,7 +31,7 @@ module.exports = function (kbnServer, server, config) { _.defaults(events, { log: ['info', 'warning', 'error', 'fatal'], response: config.get('logging.json') ? '*' : '!', - request: '*', + request: ['info', 'warning', 'error', 'fatal'], error: '*' }); } From d50c48bccbd4a772e5a289d039ce5cd7556397ba Mon Sep 17 00:00:00 2001 From: Court Ewing Date: Thu, 21 Jan 2016 11:26:36 -0500 Subject: [PATCH 22/30] Configurable shield credentials for tests While there are still hardcoded defaults, this change allows people to specify custom credentials via environment variables for each shield role in our tests. --- test/serverConfig.js | 6 ++++-- test/shield.js | 16 ++++++++++++++++ test/utils/kbn_server.js | 8 +++++--- 3 files changed, 25 insertions(+), 5 deletions(-) create mode 100644 test/shield.js diff --git a/test/serverConfig.js b/test/serverConfig.js index e88daa58e978..ea3438e728bb 100644 --- a/test/serverConfig.js +++ b/test/serverConfig.js @@ -1,3 +1,5 @@ +var shield = require('./shield'); + var kibanaURL = '/app/kibana'; module.exports = { @@ -11,13 +13,13 @@ module.exports = { protocol: process.env.TEST_UI_KIBANA_PROTOCOL || 'http', hostname: process.env.TEST_UI_KIBANA_HOSTNAME || 'localhost', port: parseInt(process.env.TEST_UI_KIBANA_PORT, 10) || 5620, - auth: 'user:notsecure' + auth: shield.kibanaUser.username + ':' + shield.kibanaUser.password }, elasticsearch: { protocol: process.env.TEST_UI_ES_PROTOCOL || 'http', hostname: process.env.TEST_UI_ES_HOSTNAME || 'localhost', port: parseInt(process.env.TEST_UI_ES_PORT, 10) || 9220, - auth: 'admin:notsecure' + auth: shield.admin.username + ':' + shield.admin.password } }, apps: { diff --git a/test/shield.js b/test/shield.js new file mode 100644 index 000000000000..826945be5a22 --- /dev/null +++ b/test/shield.js @@ -0,0 +1,16 @@ +const env = process.env; + +exports.kibanaUser = { + username: env.SHIELD_KIBANA_USER || 'user', + password: env.SHIELD_KIBANA_USER_PASS || 'notsecure' +}; + +exports.kibanaServer = { + username: env.SHIELD_KIBANA_SERVER || 'kibana', + password: env.SHIELD_KIBANA_SERVER_PASS || 'notsecure' +}; + +exports.admin = { + username: env.SHIELD_ADMIN || 'admin', + password: env.SHIELD_ADMIN_PASS || 'notsecure' +}; diff --git a/test/utils/kbn_server.js b/test/utils/kbn_server.js index d97d586e7a79..35a0bc3aa1c5 100644 --- a/test/utils/kbn_server.js +++ b/test/utils/kbn_server.js @@ -1,6 +1,7 @@ import { defaultsDeep, set } from 'lodash'; import requirefrom from 'requirefrom'; import { header as basicAuthHeader } from './base_auth'; +import { kibanaUser, kibanaServer } from '../shield'; const src = requirefrom('src'); const KbnServer = src('server/KbnServer'); @@ -26,8 +27,8 @@ const SERVER_DEFAULTS = { }, elasticsearch: { url: 'http://localhost:9210', - username: 'kibana', - password: 'notsecure' + username: kibanaServer.username, + password: kibanaServer.password } }; @@ -46,7 +47,8 @@ export function createServer(params = {}) { * Creates request configuration with a basic auth header */ export function authOptions() { - const authHeader = basicAuthHeader('user', 'notsecure'); + const { username, password } = kibanaUser; + const authHeader = basicAuthHeader(username, password); return set({}, 'headers.Authorization', authHeader); }; From babdf8d1089fcdf22e84a35470b62020facdc6b4 Mon Sep 17 00:00:00 2001 From: spalger Date: Thu, 21 Jan 2016 12:24:33 -0700 Subject: [PATCH 23/30] [server/connection] just pass tls:true to hapi --- src/server/http/setup_connection.js | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/server/http/setup_connection.js b/src/server/http/setup_connection.js index 4b0afe8ecbb2..cd922c7ca936 100644 --- a/src/server/http/setup_connection.js +++ b/src/server/http/setup_connection.js @@ -34,20 +34,17 @@ export default function (kbnServer, server, config) { return; } - // for https servers we have some extra settings - const tls = { - key: readFileSync(config.get('server.ssl.key')), - cert: readFileSync(config.get('server.ssl.cert')), - - ciphers: tlsCiphers, - // We use the server's cipher order rather than the client's to prevent the BEAST attack - honorCipherOrder: true - }; - server.connection({ ...connectionOptions, - tls: tls, - listener: httpolyglot.createServer(tls) + tls: true, + listener: httpolyglot.createServer({ + key: readFileSync(config.get('server.ssl.key')), + cert: readFileSync(config.get('server.ssl.cert')), + + ciphers: tlsCiphers, + // We use the server's cipher order rather than the client's to prevent the BEAST attack + honorCipherOrder: true + }) }); server.ext('onRequest', function (req, reply) { From c312603a3c1a96698fa0f3d54b031905bfd9d961 Mon Sep 17 00:00:00 2001 From: Joe Fleming Date: Thu, 21 Jan 2016 13:56:47 -0700 Subject: [PATCH 24/30] better button group sanity tests --- src/ui/public/navbar/__tests__/navbar.js | 29 +++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/src/ui/public/navbar/__tests__/navbar.js b/src/ui/public/navbar/__tests__/navbar.js index 9729b44ebb95..9f8c3e9910b6 100644 --- a/src/ui/public/navbar/__tests__/navbar.js +++ b/src/ui/public/navbar/__tests__/navbar.js @@ -58,14 +58,37 @@ describe('navbar directive', function () { } describe('incorrect use', function () { - it('should throw if missing a name property', function () { - let markup = ``; + const markup = ``; expect(() => init(markup)).to.throwException(/requires a name attribute/); }); it('should throw if missing a button group', function () { - let markup = ``; + const markup = ``; + expect(() => init(markup)).to.throwException(/must have exactly 1 button group/); + }); + + it('should throw if multiple button groups', function () { + const markup = ` + + + `; + expect(() => init(markup)).to.throwException(/must have exactly 1 button group/); + }); + + it('should throw if button group not direct child', function () { + const markup = `
`; expect(() => init(markup)).to.throwException(/must have exactly 1 button group/); }); }); From aeb45136d483f6f12f6f4cfa9d0f5cf4b1cd7cfb Mon Sep 17 00:00:00 2001 From: LeeDr Date: Thu, 21 Jan 2016 15:44:33 -0600 Subject: [PATCH 25/30] 8 new discover tests, _field_data --- test/functional/apps/discover/_discover.js | 13 + test/functional/apps/discover/_field_data.js | 268 +++++++++++++++++++ test/functional/apps/discover/index.js | 3 + test/support/pages/DiscoverPage.js | 50 +++- test/support/pages/HeaderPage.js | 7 + 5 files changed, 339 insertions(+), 2 deletions(-) create mode 100644 test/functional/apps/discover/_field_data.js diff --git a/test/functional/apps/discover/_discover.js b/test/functional/apps/discover/_discover.js index 5a96a8ac8f5f..db869df8044f 100644 --- a/test/functional/apps/discover/_discover.js +++ b/test/functional/apps/discover/_discover.js @@ -93,6 +93,19 @@ define(function (require) { .catch(common.handleError(this)); }); + bdd.it('should show the correct hit count', function () { + var expectedHitCount = '14,004'; + return common.tryForTime(20 * 1000, function tryingForTime() { + return discoverPage.getHitCount() + .then(function compareData(hitCount) { + expect(hitCount).to.be(expectedHitCount); + }); + }) + .catch(common.handleError(this)); + }); + + + bdd.it('should show the correct bar chart', function () { var expectedBarChartData = [ '0', '0', '0', '0', '0', '0', '2.7056249999999977', '14.771249999999995', '54.112500000000004', diff --git a/test/functional/apps/discover/_field_data.js b/test/functional/apps/discover/_field_data.js new file mode 100644 index 000000000000..e50f65678ca2 --- /dev/null +++ b/test/functional/apps/discover/_field_data.js @@ -0,0 +1,268 @@ +define(function (require) { + var Common = require('../../../support/pages/Common'); + var HeaderPage = require('../../../support/pages/HeaderPage'); + var SettingsPage = require('../../../support/pages/settings_page'); + var DiscoverPage = require('../../../support/pages/DiscoverPage'); + var expect = require('intern/dojo/node!expect.js'); + + return function (bdd, scenarioManager) { + bdd.describe('discover app', function describeIndexTests() { + var common; + var headerPage; + var settingsPage; + var discoverPage; + + bdd.before(function () { + common = new Common(this.remote); + headerPage = new HeaderPage(this.remote); + settingsPage = new SettingsPage(this.remote); + discoverPage = new DiscoverPage(this.remote); + var fromTime = '2015-09-19 06:31:44.000'; + var toTime = '2015-09-23 18:31:44.000'; + + // start each test with an empty kibana index + return scenarioManager.reload('emptyKibana') + // and load a set of makelogs data + .then(function loadIfEmptyMakelogs() { + return scenarioManager.loadIfEmpty('logstashFunctional'); + }) + .then(function (navigateTo) { + common.debug('navigateTo'); + return settingsPage.navigateTo(); + }) + .then(function () { + common.debug('createIndexPattern'); + return settingsPage.createIndexPattern(); + }) + .then(function () { + common.debug('discover'); + return common.navigateToApp('discover'); + }) + .then(function () { + common.debug('setAbsoluteRange'); + return headerPage.setAbsoluteRange(fromTime, toTime); + }) + .catch(common.handleError(this)); + }); + + + bdd.describe('field data', function () { + var queryName1 = 'Query # 1'; + var fromTimeString = 'September 19th 2015, 06:31:44.000'; + var toTimeString = 'September 23rd 2015, 18:31:44.000'; + + + bdd.it('search php should show the correct hit count', function () { + var expectedHitCount = '445'; + return discoverPage.query('php') + .then(function () { + return common.tryForTime(20 * 1000, function tryingForTime() { + return discoverPage.getHitCount() + .then(function compareData(hitCount) { + expect(hitCount).to.be(expectedHitCount); + }); + }); + }) + .catch(common.handleError(this)); + }); + + bdd.it('the search term should be highlighted in the field data', function () { + // marks is the style that highlights the text in yellow + return discoverPage.getMarks() + .then(function (marks) { + expect(marks.length).to.be(50); + expect(marks.indexOf('php')).to.be(0); + }) + .catch(common.handleError(this)); + }); + + + bdd.it('search _type:apache should show the correct hit count', function () { + var expectedHitCount = '11,156'; + return discoverPage.query('_type:apache') + .then(function () { + return common.tryForTime(20 * 1000, function tryingForTime() { + return discoverPage.getHitCount() + .then(function compareData(hitCount) { + expect(hitCount).to.be(expectedHitCount); + }); + }); + }) + .catch(common.handleError(this)); + }); + + bdd.it('doc view should show Time and _source columns', function () { + var expectedHeader = 'Time _source'; + return discoverPage.getDocHeader() + .then(function (header) { + expect(header).to.be(expectedHeader); + }) + .catch(common.handleError(this)); + }); + + bdd.it('doc view should show oldest time first', function () { + // Note: Could just check the timestamp, but might as well check that the whole doc is as expected. + var ExpectedDoc = + 'September 22nd 2015, 23:50:13.253 index:logstash-2015.09.22 @timestamp:September 22nd 2015, 23:50:13.253' + + ' ip:238.171.34.42 extension:jpg response:200 geo.coordinates:{ "lat": 38.66494528, "lon": -88.45299556' + + ' } geo.src:FR geo.dest:KH geo.srcdest:FR:KH @tags:success, info utc_time:September 22nd 2015,' + + ' 23:50:13.253 referer:http://twitter.com/success/nancy-currie agent:Mozilla/4.0 (compatible; MSIE 6.0;' + + ' Windows NT 5.1; SV1; .NET CLR 1.1.4322) clientip:238.171.34.42 bytes:7,124' + + ' host:media-for-the-masses.theacademyofperformingartsandscience.org request:/uploads/karl-henize.jpg' + + ' url:https://media-for-the-masses.theacademyofperformingartsandscience.org/uploads/karl-henize.jpg' + + ' @message:238.171.34.42 - - [2015-09-22T23:50:13.253Z] "GET /uploads/karl-henize.jpg HTTP/1.1" 200 7124' + + ' "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)" spaces:this is a' + + ' thing with lots of spaces wwwwoooooo xss:' + + ' headings:

alexander-viktorenko

, http://nytimes.com/warning/michael-massimino' + + ' links:@www.slate.com, http://www.slate.com/security/frederick-w-leslie, www.www.slate.com' + + ' relatedContent:{ "url": "http://www.laweekly.com/music/bjork-at-the-nokia-theatre-12-12-2408191",' + + ' "og:type": "article", "og:title": "Bjork at the Nokia Theatre, 12/12", "og:description": "Bjork at the' + + ' Nokia Theater, December 12 By Randall Roberts Last night’s Bjork show at the Dystopia –' + + ' er, I mean Nokia -- Theatre downtown di...", "og:url": "' + + 'http://www.laweekly.com/music/bjork-at-the-nokia-theatre-12-12-2408191", "article:published_time":' + + ' "2007-12-13T12:19:35-08:00", "article:modified_time": "2014-11-27T08:28:42-08:00", "article:section":' + + ' "Music", "og:image": "' + + 'http://IMAGES1.laweekly.com/imager/bjork-at-the-nokia-theatre-12-12/u/original/2470701/bjorktn003.jpg",' + + ' "og:image:height": "334", "og:image:width": "480", "og:site_name": "LA Weekly", "twitter:title":' + + ' "Bjork at the Nokia Theatre, 12/12", "twitter:description": "Bjork at the Nokia Theater, December 12' + + ' By Randall Roberts Last night’s Bjork show at the Dystopia – er, I mean Nokia -- Theatre' + + ' downtown di...", "twitter:card": "summary", "twitter:image": "' + + 'http://IMAGES1.laweekly.com/imager/bjork-at-the-nokia-theatre-12-12/u/original/2470701/bjorktn003.jpg",' + + ' "twitter:site": "@laweekly" }, { "url": "' + + 'http://www.laweekly.com/music/the-rapture-at-the-mayan-7-25-2401011", "og:type": "article", "og:title":' + + ' "The Rapture at the Mayan, 7/25", "og:description": "If you haven’t yet experienced the' + + ' phenomenon of people walk-dancing, apparently the best place to witness this is at a Rapture show.' + + ' Here’s...", "og:url": "http://www.laweekly.com/music/the-rapture-at-the-mayan-7-25-2401011",' + + ' "article:published_time": "2007-07-26T12:42:30-07:00", "article:modified_time":' + + ' "2014-11-27T08:00:51-08:00", "article:section": "Music", "og:image": "' + + 'http://IMAGES1.laweekly.com/imager/the-rapture-at-the-mayan-7-25/u/original/2463272/rapturetn05.jpg",' + + ' "og:image:height": "321", "og:image:width": "480", "og:site_name": "LA Weekly", "twitter:title": "The' + + ' Rapture at the Mayan, 7/25", "twitter:description": "If you haven’t yet experienced the' + + ' phenomenon of people walk-dancing, apparently the best place to witness this is at a Rapture show.' + + ' Here’s...", "twitter:card": "summary", "twitter:image": "' + + 'http://IMAGES1.laweekly.com/imager/the-rapture-at-the-mayan-7-25/u/original/2463272/rapturetn05.jpg",' + + ' "twitter:site": "@laweekly" } machine.os:win 7 machine.ram:7,516,192,768 _id:AU_x3_g4GFA8no6QjkYX' + + ' _type:apache _index:logstash-2015.09.22 _score: relatedContent.article:modified_time:November 27th' + + ' 2014, 16:00:51.000, November 27th 2014, 16:28:42.000 relatedContent.article:published_time:July 26th' + + ' 2007, 19:42:30.000, December 13th 2007, 20:19:35.000'; + return discoverPage.getDocTableIndex(1) + .then(function (rowData) { + expect(rowData).to.be(ExpectedDoc); + }) + .catch(common.handleError(this)); + }); + + bdd.it('doc view should sort ascending', function () { + // Note: Could just check the timestamp, but might as well check that the whole doc is as expected. + var ExpectedDoc = + 'September 20th 2015, 00:00:00.000 index:logstash-2015.09.20 @timestamp:September 20th 2015, 00:00:00.000' + + ' ip:143.84.142.7 extension:jpg response:200 geo.coordinates:{ "lat": 38.68407028, "lon": -120.9871642 }' + + ' geo.src:ES geo.dest:US geo.srcdest:ES:US @tags:error, info utc_time:September 20th 2015, 00:00:00.000' + + ' referer:http://www.slate.com/success/vladimir-kovalyonok agent:Mozilla/4.0 (compatible; MSIE 6.0;' + + ' Windows NT 5.1; SV1; .NET CLR 1.1.4322) clientip:143.84.142.7 bytes:1,623' + + ' host:media-for-the-masses.theacademyofperformingartsandscience.org request:/uploads/steven-hawley.jpg' + + ' url:https://media-for-the-masses.theacademyofperformingartsandscience.org/uploads/steven-hawley.jpg' + + ' @message:143.84.142.7 - - [2015-09-20T00:00:00.000Z] "GET /uploads/steven-hawley.jpg HTTP/1.1" 200' + + ' 1623 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)" spaces:this is a' + + ' thing with lots of spaces wwwwoooooo xss:' + + ' headings:

kimiya-yui

, http://www.slate.com/success/koichi-wakata' + + ' links:thomas-marshburn@twitter.com, http://www.slate.com/info/michael-p-anderson, www.twitter.com' + + ' relatedContent:{ "url":' + + ' "http://www.laweekly.com/music/jay-electronica-much-better-than-his-name-would-suggest-2412364",' + + ' "og:type": "article", "og:title": "Jay Electronica: Much Better Than His Name Would Suggest",' + + ' "og:description": "You may not know who Jay Electronica is yet, but I'm willing to bet that you' + + ' would had he chosen a better name. Jay Electronica does not sound like the ...", "og:url":' + + ' "http://www.laweekly.com/music/jay-electronica-much-better-than-his-name-would-suggest-2412364",' + + ' "article:published_time": "2008-04-04T16:00:00-07:00", "article:modified_time":' + + ' "2014-11-27T08:01:03-08:00", "article:section": "Music", "og:site_name": "LA Weekly", "twitter:title":' + + ' "Jay Electronica: Much Better Than His Name Would Suggest", "twitter:description": "You may not know' + + ' who Jay Electronica is yet, but I'm willing to bet that you would had he chosen a better name.' + + ' Jay Electronica does not sound like the ...", "twitter:card": "summary", "twitter:site": "@laweekly"' + + ' }, { "url": "http://www.laweekly.com/news/mandoe-on-gower-near-fountain-2368123", "og:type":' + + ' "article", "og:title": "MANDOE On Gower Near Fountain", "og:description": "MANDOE has a stunner on a' + + ' wall north of an east-west street crossing Gower around Fountain (but not on Fountain). MADNOE, PROSE' + + ' and FUKM are listed on t...", "og:url": "' + + 'http://www.laweekly.com/news/mandoe-on-gower-near-fountain-2368123", "article:published_time":' + + ' "2008-04-25T07:26:41-07:00", "article:modified_time": "2014-10-28T15:00:08-07:00", "article:section":' + + ' "News", "og:image": "' + + 'http://images1.laweekly.com/imager/mandoe-on-gower-near-fountain/u/original/2430891/img_6648.jpg",' + + ' "og:image:height": "640", "og:image:width": "480", "og:site_name": "LA Weekly", "twitter:title": ' + + '"MANDOE On Gower Near Fountain", "twitter:description": "MANDOE has a stunner on a wall north of an' + + ' east-west street crossing Gower around Fountain (but not on Fountain). MADNOE, PROSE and FUKM are' + + ' listed on t...", "twitter:card": "summary", "twitter:image": "' + + 'http://images1.laweekly.com/imager/mandoe-on-gower-near-fountain/u/original/2430891/img_6648.jpg", ' + + '"twitter:site": "@laweekly" }, { "url": "http://www.laweekly.com/arts/meghan-finds-the-love-2373346",' + + ' "og:type": "article", "og:title": "Meghan Finds The Love", "og:description": "LA Weekly is the' + + ' definitive source of information for news, music, movies, restaurants, reviews, and events in Los' + + ' Angeles.", "og:url": "http://www.laweekly.com/arts/meghan-finds-the-love-2373346",' + + ' "article:published_time": "2005-10-20T18:10:25-07:00", "article:modified_time":' + + ' "2014-11-25T19:52:35-08:00", "article:section": "Arts", "og:site_name": "LA Weekly", "twitter:title":' + + ' "Meghan Finds The Love", "twitter:description": "LA Weekly is the definitive source of information for' + + ' news, music, movies, restaurants, reviews, and events in Los Angeles.", "twitter:card": "summary",' + + ' "twitter:site": "@laweekly" }, { "url": "http://www.laweekly.com/arts/these-clowns-are-with-me-2371051' + + '", "og:type": "article", "og:title": "These Clowns Are With Me", "og:description": "    I' + + ' didn't mean to blow off all my responsibilities yesterday, but when a schmoozy Hollywood luncheon' + + ' turns into a full-on party by 3pm, and...", "og:url": "' + + 'http://www.laweekly.com/arts/these-clowns-are-with-me-2371051", "article:published_time": ' + + '"2006-03-04T17:03:42-08:00", "article:modified_time": "2014-11-25T17:05:47-08:00", "article:section":' + + ' "Arts", "og:image": "' + + 'http://images1.laweekly.com/imager/these-clowns-are-with-me/u/original/2434556/e4b8scd.jpg",' + + ' "og:image:height": "375", "og:image:width": "500", "og:site_name": "LA Weekly", "twitter:title":' + + ' "These Clowns Are With Me", "twitter:description": "    I didn't mean to blow off all' + + ' my responsibilities yesterday, but when a schmoozy Hollywood luncheon turns into a full-on party by' + + ' 3pm, and...", "twitter:card": "summary", "twitter:image": "' + + 'http://images1.laweekly.com/imager/these-clowns-are-with-me/u/original/2434556/e4b8scd.jpg",' + + ' "twitter:site": "@laweekly" }, { "url": "http://www.laweekly.com/arts/shopping-daze-2373807",' + + ' "og:type": "article", "og:title": "Shopping Daze", "og:description": "LA Weekly is the definitive ' + + 'source of information for news, music, movies, restaurants, reviews, and events in Los Angeles.",' + + ' "og:url": "http://www.laweekly.com/arts/shopping-daze-2373807", "article:published_time":' + + ' "2006-12-13T12:12:04-08:00", "article:modified_time": "2014-11-25T20:15:21-08:00", "article:section":' + + ' "Arts", "og:site_name": "LA Weekly", "twitter:title": "Shopping Daze", "twitter:description": "LA' + + ' Weekly is the definitive source of information for news, music, movies, restaurants, reviews, and' + + ' events in Los Angeles.", "twitter:card": "summary", "twitter:site": "@laweekly" } machine.os:osx' + + ' machine.ram:15,032,385,536 _id:AU_x3_g3GFA8no6QjkFm _type:apache _index:logstash-2015.09.20 _score:' + + ' relatedContent.article:modified_time:October 28th 2014, 22:00:08.000, November 26th 2014,' + + ' 01:05:47.000, November 26th 2014, 03:52:35.000, November 26th 2014, 04:15:21.000, November 27th 2014,' + + ' 16:01:03.000 relatedContent.article:published_time:October 21st 2005, 01:10:25.000, March 5th 2006,' + + ' 01:03:42.000, December 13th 2006, 20:12:04.000, April 4th 2008, 23:00:00.000, April 25th 2008,' + + ' 14:26:41.000'; + return discoverPage.clickDocSortDown() + .then(function () { + // we don't technically need this sleep here because the tryForTime will retry and the + // results will match on the 2nd or 3rd attempt, but that debug output is huge in this + // case and it can be avoided with just a few seconds sleep. + return common.sleep(2000); + }) + .then(function () { + return common.tryForTime(20 * 1000, function tryingForTime() { + return discoverPage.getDocTableIndex(1) + .then(function (rowData) { + expect(rowData).to.be(ExpectedDoc); + }); + }); + }) + .catch(common.handleError(this)); + }); + + + bdd.it('a bad syntax query should show an error message', function () { + var expectedHitCount = '1011,156'; + var expectedError = 'Discover: Failed to parse query [xxx(yyy]'; + return discoverPage.query('xxx(yyy') + .then(function () { + return headerPage.getToastMessage(); + }) + .then(function (toastMessage) { + expect(toastMessage).to.be(expectedError); + }) + .then(function () { + return headerPage.clickToastOK(); + }) + .catch(common.handleError(this)); + }); + + + }); + }); + }; +}); diff --git a/test/functional/apps/discover/index.js b/test/functional/apps/discover/index.js index c2677dd248a3..eef3af445e9a 100644 --- a/test/functional/apps/discover/index.js +++ b/test/functional/apps/discover/index.js @@ -4,6 +4,7 @@ define(function (require) { var url = require('intern/dojo/node!url'); var ScenarioManager = require('intern/dojo/node!../../../fixtures/scenarioManager'); var discoverTest = require('./_discover'); + var fieldData = require('./_field_data'); bdd.describe('discover app', function () { var scenarioManager; @@ -22,5 +23,7 @@ define(function (require) { discoverTest(bdd, scenarioManager); + fieldData(bdd, scenarioManager); + }); }); diff --git a/test/support/pages/DiscoverPage.js b/test/support/pages/DiscoverPage.js index 63c8086d6d63..cbaa0073f43a 100644 --- a/test/support/pages/DiscoverPage.js +++ b/test/support/pages/DiscoverPage.js @@ -35,7 +35,6 @@ define(function (require) { getChartTimespan: function getChartTimespan() { return thisTime .findByCssSelector('center.small > span:nth-child(1)') - // .findByCssSelector('center.small > span.ng-binding') .getVisibleText(); }, @@ -128,8 +127,55 @@ define(function (require) { .findByCssSelector('option[label="' + interval + '"]') .click(); }); - } + }, + getHitCount: function getHitCount() { + return thisTime + .findByCssSelector('strong.discover-info-hits') + .getVisibleText(); + }, + + query: function query(queryString) { + return thisTime + .findByCssSelector('input[aria-label="Search input"]') + .clearValue() + .type(queryString) + .then(function () { + return thisTime + .findByCssSelector('button[aria-label="Search"]') + .click(); + }); + }, + + getDocHeader: function getDocHeader() { + return thisTime + .findByCssSelector('thead.ng-isolate-scope > tr:nth-child(1)') + .getVisibleText(); + }, + + getDocTableIndex: function getDocTableIndex(index) { + return thisTime + .findByCssSelector('tr.discover-table-row:nth-child(' + (index) + ')') + .getVisibleText(); + }, + + clickDocSortDown: function clickDocSortDown() { + return thisTime + .findByCssSelector('.fa-sort-down') + .click(); + }, + + clickDocSortUp: function clickDocSortUp() { + return thisTime + .findByCssSelector('.fa-sort-up') + .click(); + }, + + getMarks: function getMarks() { + return thisTime + .findAllByCssSelector('mark') + .getVisibleText(); + } }; diff --git a/test/support/pages/HeaderPage.js b/test/support/pages/HeaderPage.js index c1e8767baf56..5a78ebb7736e 100644 --- a/test/support/pages/HeaderPage.js +++ b/test/support/pages/HeaderPage.js @@ -137,6 +137,13 @@ define(function (require) { }); }, + clickToastOK: function clickToastOK() { + return this.remote + .setFindTimeout(defaultTimeout) + .findByCssSelector('button[ng-if="notif.accept"]') + .click(); + }, + getSpinnerDone: function getSpinnerDone() { var self = this; return this.remote From 61dbbeb0eafb6e8b4a69db2debfd398de5565ac0 Mon Sep 17 00:00:00 2001 From: Joe Fleming Date: Thu, 21 Jan 2016 15:31:22 -0700 Subject: [PATCH 26/30] spread the magic --- src/ui/public/navbar/navbar.js | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/ui/public/navbar/navbar.js b/src/ui/public/navbar/navbar.js index a520757326a4..2e49a760708b 100644 --- a/src/ui/public/navbar/navbar.js +++ b/src/ui/public/navbar/navbar.js @@ -18,18 +18,22 @@ navbar.directive('navbar', function (Private, $compile) { if ($buttonGroup.length !== 1) throw new Error('navbar must have exactly 1 button group'); const extensions = getExtensions($attrs.name); - const controls = $buttonGroup.children().detach().toArray().map(function (button) { - return { - order: 0, - $el: $(button), - }; - }).concat(extensions.map(function (extension, i) { - return { - order: extension.order, - index: i, - extension: extension, - }; - })); + const buttons = $buttonGroup.children().detach().toArray(); + const controls = [ + ...buttons.map(function (button) { + return { + order: 0, + $el: $(button), + }; + }), + ...extensions.map(function (extension, i) { + return { + order: extension.order, + index: i, + extension: extension, + }; + }), + ]; _.sortBy(controls, 'order').forEach(function (control) { if (control.$el) { From 1b85822e263bfc37dc40541daa244af7181864ac Mon Sep 17 00:00:00 2001 From: spalger Date: Thu, 21 Jan 2016 16:52:25 -0700 Subject: [PATCH 27/30] [cli/serve] allow disabling the base path proxy if needed --- src/cli/cluster/cluster_manager.js | 14 +++++++++----- src/cli/serve/serve.js | 1 + tasks/config/run.js | 2 ++ 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/cli/cluster/cluster_manager.js b/src/cli/cluster/cluster_manager.js index dbc12f66ccf2..4828f95ce62b 100644 --- a/src/cli/cluster/cluster_manager.js +++ b/src/cli/cluster/cluster_manager.js @@ -15,7 +15,9 @@ module.exports = class ClusterManager { this.log = new Log(opts.quiet, opts.silent); this.addedCount = 0; - this.basePathProxy = new BasePathProxy(this, settings); + if (opts.basePathProxy) { + this.basePathProxy = new BasePathProxy(this, settings); + } this.workers = [ this.optimizer = new Worker({ @@ -25,7 +27,7 @@ module.exports = class ClusterManager { argv: compact([ '--plugins.initialize=false', '--server.autoListen=false', - `--server.basePath=${this.basePathProxy.basePath}` + this.basePathProxy && `--server.basePath=${this.basePathProxy.basePath}` ]), watch: false }), @@ -34,8 +36,8 @@ module.exports = class ClusterManager { type: 'server', log: this.log, argv: compact([ - `--server.port=${this.basePathProxy.targetPort}`, - `--server.basePath=${this.basePathProxy.basePath}` + this.basePathProxy && `--server.port=${this.basePathProxy.targetPort}`, + this.basePathProxy && `--server.basePath=${this.basePathProxy.basePath}` ]) }) ]; @@ -60,7 +62,9 @@ module.exports = class ClusterManager { startCluster() { this.setupManualRestart(); invoke(this.workers, 'start'); - this.basePathProxy.listen(); + if (this.basePathProxy) { + this.basePathProxy.listen(); + } } setupWatching() { diff --git a/src/cli/serve/serve.js b/src/cli/serve/serve.js index 49df7e77f8d2..0534021e7e94 100644 --- a/src/cli/serve/serve.js +++ b/src/cli/serve/serve.js @@ -107,6 +107,7 @@ module.exports = function (program) { command .option('--dev', 'Run the server with development mode defaults') .option('--no-ssl', 'Don\'t run the dev server using HTTPS') + .option('--no-base-path', 'Don\'t put a proxy in front of the dev server, which adds a random basePath') .option('--no-watch', 'Prevents automatic restarts of the server in --dev mode'); } diff --git a/tasks/config/run.js b/tasks/config/run.js index e5c6fbb7fcc0..aacd6a045378 100644 --- a/tasks/config/run.js +++ b/tasks/config/run.js @@ -86,6 +86,8 @@ module.exports = function (grunt) { args: [ '--dev', '--no-watch', + '--no-ssl', + '--no-base-path', '--server.port=5610', '--optimize.lazyPort=5611', '--optimize.lazyPrebuild=true', From fca34c09565ff924dbdd0356f2c279401fc5cc0e Mon Sep 17 00:00:00 2001 From: Timothy Sullivan Date: Thu, 21 Jan 2016 12:44:46 -0700 Subject: [PATCH 28/30] Add timepicker module to autoload/modules to be included with "all" --- src/ui/public/autoload/modules.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ui/public/autoload/modules.js b/src/ui/public/autoload/modules.js index 533f05236d2c..0dd221c55245 100644 --- a/src/ui/public/autoload/modules.js +++ b/src/ui/public/autoload/modules.js @@ -27,6 +27,7 @@ require('ui/storage'); require('ui/stringify/register'); require('ui/styleCompile'); require('ui/timefilter'); +require('ui/timepicker'); require('ui/tooltip'); require('ui/typeahead'); require('ui/url'); From 62242d922b3e5de91ec53aa4ba7a10d43a5a5485 Mon Sep 17 00:00:00 2001 From: spalger Date: Fri, 22 Jan 2016 08:13:28 -0700 Subject: [PATCH 29/30] [cli/serve] consolidate basePathProxy conditional logic --- src/cli/cluster/cluster_manager.js | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/cli/cluster/cluster_manager.js b/src/cli/cluster/cluster_manager.js index 4828f95ce62b..033dcf07dce0 100644 --- a/src/cli/cluster/cluster_manager.js +++ b/src/cli/cluster/cluster_manager.js @@ -15,8 +15,23 @@ module.exports = class ClusterManager { this.log = new Log(opts.quiet, opts.silent); this.addedCount = 0; - if (opts.basePathProxy) { + const serverArgv = []; + const optimizerArgv = [ + '--plugins.initialize=false', + '--server.autoListen=false', + ]; + + if (opts.basePath) { this.basePathProxy = new BasePathProxy(this, settings); + + optimizerArgv.push( + `--server.basePath=${this.basePathProxy.basePath}` + ); + + serverArgv.push( + `--server.port=${this.basePathProxy.targetPort}`, + `--server.basePath=${this.basePathProxy.basePath}` + ); } this.workers = [ @@ -24,21 +39,14 @@ module.exports = class ClusterManager { type: 'optmzr', title: 'optimizer', log: this.log, - argv: compact([ - '--plugins.initialize=false', - '--server.autoListen=false', - this.basePathProxy && `--server.basePath=${this.basePathProxy.basePath}` - ]), + argv: optimizerArgv, watch: false }), this.server = new Worker({ type: 'server', log: this.log, - argv: compact([ - this.basePathProxy && `--server.port=${this.basePathProxy.targetPort}`, - this.basePathProxy && `--server.basePath=${this.basePathProxy.basePath}` - ]) + argv: serverArgv }) ]; From 5bbf1c0389c9911af8a11d043cb52551b16fa3b9 Mon Sep 17 00:00:00 2001 From: michaelcheng429 Date: Thu, 21 Jan 2016 14:09:48 -0600 Subject: [PATCH 30/30] fix active search source hover background issue Fixes #5971 --- src/ui/public/styles/base.less | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/ui/public/styles/base.less b/src/ui/public/styles/base.less index 016c09af33c3..6dcb58bf4b15 100644 --- a/src/ui/public/styles/base.less +++ b/src/ui/public/styles/base.less @@ -457,3 +457,14 @@ fieldset { overflow-y: hidden; } } + +.list-group { + .list-group-item { + &.active, + &.active:hover, + &.active:focus { + background-color: @list-group-menu-item-active-bg; + cursor: default; + } + } +}