diff --git a/test/functional/apps/management/_index_pattern_create_delete.js b/test/functional/apps/management/_index_pattern_create_delete.js index fa272902a0a22..47881e4459219 100644 --- a/test/functional/apps/management/_index_pattern_create_delete.js +++ b/test/functional/apps/management/_index_pattern_create_delete.js @@ -27,7 +27,7 @@ bdd.describe('creating and deleting default index', function describeIndexTests( return PageObjects.settings.createIndexPattern(); }); - bdd.it('should have index pattern in page header', function pageHeader() { + bdd.it('should have index pattern in page header', function () { return PageObjects.settings.getIndexPageHeading().getVisibleText() .then(function (patternName) { PageObjects.common.saveScreenshot('Settings-indices-new-index-pattern'); diff --git a/test/functional/apps/management/_index_pattern_popularity.js b/test/functional/apps/management/_index_pattern_popularity.js index 220fa32abd870..dda2748db24b6 100644 --- a/test/functional/apps/management/_index_pattern_popularity.js +++ b/test/functional/apps/management/_index_pattern_popularity.js @@ -68,7 +68,7 @@ bdd.describe('index result popularity', function describeIndexTests() { }); }); - bdd.it('should be reset on cancel', function pageHeader() { + bdd.it('should be reset on cancel', function () { // Cancel saving the popularity change return PageObjects.settings.controlChangeCancel() .then(function () { @@ -87,7 +87,7 @@ bdd.describe('index result popularity', function describeIndexTests() { }); }); - bdd.it('can be saved', function pageHeader() { + bdd.it('can be saved', function () { // Saving the popularity change return PageObjects.settings.controlChangeSave() .then(function () { diff --git a/test/functional/apps/management/_index_pattern_results_sort.js b/test/functional/apps/management/_index_pattern_results_sort.js index 9eeba547be3ea..4183987e4a8b7 100644 --- a/test/functional/apps/management/_index_pattern_results_sort.js +++ b/test/functional/apps/management/_index_pattern_results_sort.js @@ -49,7 +49,7 @@ bdd.describe('index result field sort', function describeIndexTests() { return PageObjects.settings.removeIndexPattern(); }); - bdd.it('should sort ascending', function pageHeader() { + bdd.it('should sort ascending', function () { return PageObjects.settings.sortBy(col.heading) .then(function getText() { return col.selector(); @@ -60,7 +60,7 @@ bdd.describe('index result field sort', function describeIndexTests() { }); }); - bdd.it('should sort descending', function pageHeader() { + bdd.it('should sort descending', function () { return PageObjects.settings.sortBy(col.heading) .then(function sortAgain() { return PageObjects.settings.sortBy(col.heading); diff --git a/test/functional/apps/visualize/_area_chart.js b/test/functional/apps/visualize/_area_chart.js index 8176333202185..15bbf4aada834 100644 --- a/test/functional/apps/visualize/_area_chart.js +++ b/test/functional/apps/visualize/_area_chart.js @@ -62,7 +62,7 @@ bdd.describe('visualize app', function describeIndexTests() { bdd.describe('area charts', function indexPatternCreation() { var vizName1 = 'Visualization AreaChart'; - bdd.it('should save and load with special characters', function pageHeader() { + bdd.it('should save and load with special characters', function () { const vizNamewithSpecialChars = vizName1 + '/?&=%'; return PageObjects.visualize.saveVisualization(vizNamewithSpecialChars) .then(function (message) { @@ -74,7 +74,7 @@ bdd.describe('visualize app', function describeIndexTests() { }); }); - bdd.it('should save and load', function pageHeader() { + bdd.it('should save and load', function () { return PageObjects.visualize.saveVisualization(vizName1) .then(function (message) { PageObjects.common.debug('Saved viz message = ' + message); @@ -98,7 +98,7 @@ bdd.describe('visualize app', function describeIndexTests() { }); }); - bdd.it('should show correct chart, take screenshot', function pageHeader() { + bdd.it('should show correct chart, take screenshot', function () { 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' @@ -133,7 +133,7 @@ bdd.describe('visualize app', function describeIndexTests() { }); }); - bdd.it('should show correct data', function pageHeader() { + bdd.it('should show correct data', function () { 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/_chart_types.js b/test/functional/apps/visualize/_chart_types.js index 42191bdb65aab..3656968f2f4b4 100644 --- a/test/functional/apps/visualize/_chart_types.js +++ b/test/functional/apps/visualize/_chart_types.js @@ -16,7 +16,7 @@ bdd.describe('visualize app', function describeIndexTests() { }); bdd.describe('chart types', function indexPatternCreation() { - bdd.it('should show the correct chart types', function pageHeader() { + bdd.it('should show the correct chart types', function () { var expectedChartTypes = [ 'Area chart', 'Data table', 'Line chart', 'Markdown widget', 'Metric', 'Pie chart', 'Tile map', 'Vertical bar chart' diff --git a/test/functional/apps/visualize/_data_table.js b/test/functional/apps/visualize/_data_table.js index d49bd7b2cb090..8fdba25c2192f 100644 --- a/test/functional/apps/visualize/_data_table.js +++ b/test/functional/apps/visualize/_data_table.js @@ -54,7 +54,7 @@ bdd.describe('visualize app', function describeIndexTests() { bdd.describe('data table', function indexPatternCreation() { var vizName1 = 'Visualization DataTable'; - bdd.it('should be able to save and load', function pageHeader() { + bdd.it('should be able to save and load', function () { return PageObjects.visualize.saveVisualization(vizName1) .then(function (message) { PageObjects.common.debug('Saved viz message = ' + message); @@ -71,7 +71,7 @@ bdd.describe('visualize app', function describeIndexTests() { }); }); - bdd.it('should show correct data, take screenshot', function pageHeader() { + bdd.it('should show correct data, take screenshot', function () { 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' diff --git a/test/functional/apps/visualize/_line_chart.js b/test/functional/apps/visualize/_line_chart.js index e3f11e38aedcc..29630c39035b9 100644 --- a/test/functional/apps/visualize/_line_chart.js +++ b/test/functional/apps/visualize/_line_chart.js @@ -53,29 +53,7 @@ bdd.describe('visualize app', function describeIndexTests() { bdd.describe('line charts', function indexPatternCreation() { var vizName1 = 'Visualization LineChart'; - bdd.it('should be able to save and load', function pageHeader() { - var remote = this.remote; - - return PageObjects.visualize.saveVisualization(vizName1) - .then(function (message) { - PageObjects.common.debug('Saved viz message = ' + message); - expect(message).to.be('Visualization Editor: Saved Visualization \"' + vizName1 + '\"'); - }) - .then(function testVisualizeWaitForToastMessageGone() { - return PageObjects.visualize.waitForToastMessageGone(); - }) - .then(function () { - return PageObjects.visualize.loadSavedVisualization(vizName1); - }) - .then(function waitForVisualization() { - return PageObjects.visualize.waitForVisualization(); - }); - }); - - - bdd.it('should show correct chart, take screenshot', function pageHeader() { - - var remote = this.remote; + bdd.it('should show correct chart, take screenshot', function () { // this test only verifies the numerical part of this data // it could also check the legend to verify the extensions @@ -86,6 +64,7 @@ bdd.describe('visualize app', function describeIndexTests() { .then(function () { return PageObjects.visualize.getLineChartData('fill="#57c17b"') .then(function showData(data) { + PageObjects.common.debug('data=' + data); PageObjects.common.saveScreenshot('Visualize-line-chart'); var tolerance = 10; // the y-axis scale is 10000 so 10 is 0.1% for (var x = 0; x < data.length; x++) { @@ -99,10 +78,41 @@ bdd.describe('visualize app', function describeIndexTests() { }); }); - bdd.it('should show correct data', function pageHeader() { - var remote = this.remote; - var expectedChartData = ['jpg 9,109', 'css 2,159', 'png 1,373', 'gif 918', 'php 445']; + bdd.it('should show correct chart order by Term', function () { + + // this test only verifies the numerical part of this data + // https://github.com/elastic/kibana/issues/8141 + var expectedChartData = ['png 1,373', 'php 445', 'jpg 9,109', 'gif 918', 'css 2,159']; + + PageObjects.common.debug('Order By = Term'); + return PageObjects.visualize.selectOrderBy('_term') + .then(function clickGo() { + return PageObjects.visualize.clickGo(); + }) + .then(function () { + return PageObjects.common.try(function () { + return PageObjects.visualize.getLineChartData('fill="#57c17b"') + .then(function showData(data) { + PageObjects.common.debug('data=' + data); + PageObjects.common.saveScreenshot('Visualize-line-chart'); + var tolerance = 10; // the y-axis scale is 10000 so 10 is 0.1% + for (var x = 0; x < data.length; x++) { + PageObjects.common.debug('x=' + x + ' expectedChartData[x].split(\' \')[1] = ' + + (expectedChartData[x].split(' ')[1]).replace(',', '') + ' data[x]=' + data[x] + + ' diff=' + Math.abs(expectedChartData[x].split(' ')[1].replace(',', '') - data[x])); + expect(Math.abs(expectedChartData[x].split(' ')[1].replace(',', '') - data[x]) < tolerance).to.be.ok(); + } + PageObjects.common.debug('Done'); + }); + }); + }); + }); + + + bdd.it('should show correct data, ordered by Term', function () { + + var expectedChartData = ['png 1,373', 'php 445', 'jpg 9,109', 'gif 918', 'css 2,159']; return PageObjects.visualize.collapseChart() .then(function getDataTableData() { @@ -115,5 +125,25 @@ bdd.describe('visualize app', function describeIndexTests() { }); + bdd.it('should be able to save and load', function () { + + return PageObjects.visualize.saveVisualization(vizName1) + .then(function (message) { + PageObjects.common.debug('Saved viz message = ' + message); + expect(message).to.be('Visualization Editor: Saved Visualization \"' + vizName1 + '\"'); + }) + .then(function testVisualizeWaitForToastMessageGone() { + return PageObjects.visualize.waitForToastMessageGone(); + }) + .then(function () { + return PageObjects.visualize.loadSavedVisualization(vizName1); + }) + .then(function waitForVisualization() { + return PageObjects.visualize.waitForVisualization(); + }); + }); + + + }); }); diff --git a/test/functional/apps/visualize/_metric_chart.js b/test/functional/apps/visualize/_metric_chart.js index bdadd31fb8b04..ff67bfcc6b507 100644 --- a/test/functional/apps/visualize/_metric_chart.js +++ b/test/functional/apps/visualize/_metric_chart.js @@ -30,7 +30,7 @@ bdd.describe('visualize app', function describeIndexTests() { bdd.describe('metric chart', function indexPatternCreation() { - bdd.it('should show Count', function pageHeader() { + bdd.it('should show Count', function () { var expectedCount = ['14,004', 'Count']; // initial metric of "Count" is selected by default @@ -43,7 +43,7 @@ bdd.describe('visualize app', function describeIndexTests() { }); }); - bdd.it('should show Average', function pageHeader() { + bdd.it('should show Average', function () { var avgMachineRam = ['13,104,036,080.615', 'Average machine.ram']; return PageObjects.visualize.clickMetricEditor() .then(function () { @@ -67,7 +67,7 @@ bdd.describe('visualize app', function describeIndexTests() { }); }); - bdd.it('should show Sum', function pageHeader() { + bdd.it('should show Sum', function () { var sumPhpMemory = ['85,865,880', 'Sum of phpmemory']; PageObjects.common.debug('Aggregation = Sum'); return PageObjects.visualize.selectAggregation('Sum') @@ -88,7 +88,7 @@ bdd.describe('visualize app', function describeIndexTests() { }); }); - bdd.it('should show Median', function pageHeader() { + bdd.it('should show Median', function () { var medianBytes = ['5,565.263', '50th percentile of bytes']; // For now, only comparing the text label part of the metric PageObjects.common.debug('Aggregation = Median'); @@ -111,7 +111,7 @@ bdd.describe('visualize app', function describeIndexTests() { }); }); - bdd.it('should show Min', function pageHeader() { + bdd.it('should show Min', function () { var minTimestamp = ['September 20th 2015, 00:00:00.000', 'Min @timestamp']; PageObjects.common.debug('Aggregation = Min'); return PageObjects.visualize.selectAggregation('Min') @@ -132,7 +132,7 @@ bdd.describe('visualize app', function describeIndexTests() { }); }); - bdd.it('should show Max', function pageHeader() { + bdd.it('should show Max', function () { var maxRelatedContentArticleModifiedTime = ['April 4th 2015, 00:54:41.000', 'Max relatedContent.article:modified_time']; PageObjects.common.debug('Aggregation = Max'); return PageObjects.visualize.selectAggregation('Max') @@ -153,7 +153,7 @@ bdd.describe('visualize app', function describeIndexTests() { }); }); - bdd.it('should show Standard Deviation', function pageHeader() { + bdd.it('should show Standard Deviation', function () { var standardDeviationBytes = [ '-1,435.138', 'Lower Standard Deviation of bytes', '12,889.766', 'Upper Standard Deviation of bytes' @@ -177,7 +177,7 @@ bdd.describe('visualize app', function describeIndexTests() { }); }); - bdd.it('should show Unique Count', function pageHeader() { + bdd.it('should show Unique Count', function () { var uniqueCountClientip = ['1,000', 'Unique count of clientip']; PageObjects.common.debug('Aggregation = Unique Count'); return PageObjects.visualize.selectAggregation('Unique Count') @@ -205,7 +205,7 @@ bdd.describe('visualize app', function describeIndexTests() { }); }); - bdd.it('should show Percentiles', function pageHeader() { + bdd.it('should show Percentiles', function () { var percentileMachineRam = [ '2,147,483,648', '1st percentile of machine.ram', '3,221,225,472', '5th percentile of machine.ram', @@ -235,7 +235,7 @@ bdd.describe('visualize app', function describeIndexTests() { }); }); - bdd.it('should show Percentile Ranks', function pageHeader() { + bdd.it('should show Percentile Ranks', function () { var percentileRankBytes = [ '2.036%', 'Percentile rank 99 of "memory"']; PageObjects.common.debug('Aggregation = Percentile Ranks'); return PageObjects.visualize.selectAggregation('Percentile Ranks') diff --git a/test/functional/apps/visualize/_pie_chart.js b/test/functional/apps/visualize/_pie_chart.js index 4629067fac949..e242decac72e0 100644 --- a/test/functional/apps/visualize/_pie_chart.js +++ b/test/functional/apps/visualize/_pie_chart.js @@ -61,9 +61,7 @@ bdd.describe('visualize app', function describeIndexTests() { bdd.describe('pie chart', function indexPatternCreation() { var vizName1 = 'Visualization PieChart'; - bdd.it('should save and load', function pageHeader() { - var remote = this.remote; - + bdd.it('should save and load', function () { return PageObjects.visualize.saveVisualization(vizName1) .then(function (message) { PageObjects.common.debug('Saved viz message = ' + message); @@ -84,8 +82,7 @@ bdd.describe('visualize app', function describeIndexTests() { }); }); - bdd.it('should show 10 slices in pie chart, take screenshot', function pageHeader() { - var remote = this.remote; + bdd.it('should show 10 slices in pie chart, take screenshot', function () { var expectedPieChartSliceCount = 10; return PageObjects.visualize.getPieChartData() @@ -97,8 +94,7 @@ bdd.describe('visualize app', function describeIndexTests() { }); }); - bdd.it('should show correct data', function pageHeader() { - var remote = this.remote; + bdd.it('should show correct data', function () { var expectedTableData = [ '0 55', '40,000 50', '80,000 41', '120,000 43', '160,000 44', '200,000 40', '240,000 46', '280,000 39', '320,000 40', '360,000 47' ]; diff --git a/test/functional/apps/visualize/_tile_map.js b/test/functional/apps/visualize/_tile_map.js index 901b161b39804..432defe59db50 100644 --- a/test/functional/apps/visualize/_tile_map.js +++ b/test/functional/apps/visualize/_tile_map.js @@ -51,7 +51,7 @@ bdd.describe('visualize app', function describeIndexTests() { bdd.describe('tile map chart', function indexPatternCreation() { - bdd.it('should show correct tile map data on default zoom level', function pageHeader() { + bdd.it('should show correct tile map data on default zoom level', function () { var expectedTableData = [ 'dn 1,429', 'dp 1,418', '9y 1,215', '9z 1,099', 'dr 1,076', 'dj 982', '9v 938', '9q 722', '9w 475', 'cb 457', 'c2 453', '9x 420', 'dq 399', '9r 396', '9t 274', 'c8 271', 'dh 214', 'b6 207', 'bd 206', 'b7 167', 'f0 141', @@ -74,7 +74,7 @@ bdd.describe('visualize app', function describeIndexTests() { }); - bdd.it('should zoom out to level 1 from default level 2', function pageHeader() { + bdd.it('should zoom out to level 1 from default level 2', function () { var expectedPrecision2Circles = [ { color: '#750000', radius: 48 }, { color: '#750000', radius: 48 }, { color: '#750000', radius: 44 }, @@ -142,7 +142,7 @@ bdd.describe('visualize app', function describeIndexTests() { }); }); - bdd.it('Fit data bounds should zoom to level 3', function pageHeader() { + bdd.it('Fit data bounds should zoom to level 3', function () { var expectedPrecision2ZoomCircles = [ { color: '#750000', radius: 192 }, { color: '#750000', radius: 191 }, { color: '#750000', radius: 177 }, @@ -205,7 +205,7 @@ bdd.describe('visualize app', function describeIndexTests() { ** check some data after we save the viz, then zoom in and check that the data ** changed, then open the saved viz and check that it's back to the original data. */ - bdd.it('should save with zoom level and load, take screenshot', function pageHeader() { + bdd.it('should save with zoom level and load, take screenshot', function () { var vizName1 = 'Visualization TileMap'; var expectedTableData = [ 'dr4 127', 'dr7 92', '9q5 91', '9qc 89', 'drk 87', 'dps 82', 'dph 82', 'dp3 79', 'dpe 78', 'dp8 77' @@ -285,7 +285,7 @@ bdd.describe('visualize app', function describeIndexTests() { - bdd.it('should zoom in to level 10', function pageHeader() { + bdd.it('should zoom in to level 10', function () { // 6 return PageObjects.visualize.clickMapZoomIn() .then(function () { diff --git a/test/functional/apps/visualize/_vertical_bar_chart.js b/test/functional/apps/visualize/_vertical_bar_chart.js index b8c8dea03f65a..db4565bf73b41 100644 --- a/test/functional/apps/visualize/_vertical_bar_chart.js +++ b/test/functional/apps/visualize/_vertical_bar_chart.js @@ -53,7 +53,7 @@ bdd.describe('visualize app', function describeIndexTests() { bdd.describe('vertical bar chart', function indexPatternCreation() { var vizName1 = 'Visualization VerticalBarChart'; - bdd.it('should save and load', function pageHeader() { + bdd.it('should save and load', function () { return PageObjects.visualize.saveVisualization(vizName1) .then(function (message) { PageObjects.common.debug('Saved viz message = ' + message); @@ -73,7 +73,7 @@ bdd.describe('visualize app', function describeIndexTests() { }); }); - bdd.it('should show correct chart, take screenshot', function pageHeader() { + bdd.it('should show correct chart, take screenshot', function () { 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 ]; @@ -94,7 +94,7 @@ bdd.describe('visualize app', function describeIndexTests() { }); - bdd.it('should show correct data', function pageHeader() { + bdd.it('should show correct data', function () { // this is only the first page of the tabular data. var expectedChartData = [ 'September 20th 2015, 00:00:00.000 37', 'September 20th 2015, 03:00:00.000 202', diff --git a/test/functional/apps/visualize/index.js b/test/functional/apps/visualize/index.js index e3dd74b79cec6..bc13a824148a6 100644 --- a/test/functional/apps/visualize/index.js +++ b/test/functional/apps/visualize/index.js @@ -16,7 +16,6 @@ bdd.describe('visualize app', function () { this.timeout = defaultTimeout; bdd.before(function () { - var self = this; remote.setWindowSize(1280,800); PageObjects.common.debug('Starting visualize before method'); diff --git a/test/support/page_objects/visualize_page.js b/test/support/page_objects/visualize_page.js index 094d7e2e010a2..44b6cda612f10 100644 --- a/test/support/page_objects/visualize_page.js +++ b/test/support/page_objects/visualize_page.js @@ -247,6 +247,14 @@ export default class VisualizePage { .click(); } + selectOrderBy(fieldValue) { + return this.remote + .setFindTimeout(defaultFindTimeout) + .findByCssSelector('select[name="orderBy"] > option[value="' + fieldValue + '"]') + .click(); + } + + getInterval() { return this.remote .setFindTimeout(defaultFindTimeout)