Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
4 changes: 2 additions & 2 deletions test/functional/apps/management/_index_pattern_popularity.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand All @@ -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 () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions test/functional/apps/visualize/_area_chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
Expand All @@ -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'
Expand Down Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion test/functional/apps/visualize/_chart_types.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
4 changes: 2 additions & 2 deletions test/functional/apps/visualize/_data_table.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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'
Expand Down
82 changes: 56 additions & 26 deletions test/functional/apps/visualize/_line_chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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++) {
Expand All @@ -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'];
Copy link
Contributor

@cjcenizal cjcenizal Sep 6, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we're only comparing against the numerical parts of these strings, why not either a) hardcode these values as numbers or b) precompute the numerical values ahead of time to improve readability?

a:

const expectedChartsData = [1373, 445, 9109, 918, 2159];

b:

const expectedChartData = ['jpg 9,109', 'css 2,159', 'png 1,373', 'gif 918', 'php 445'];
// Strip out label value and convert to numbers.
const expectedChartYData = expectedChartData.map(val => val.split(' ')[1]).replace(',', ''));


PageObjects.common.debug('Order By = Term');
return PageObjects.visualize.selectOrderBy('_term')
.then(function clickGo() {
return PageObjects.visualize.clickGo();
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason not to pass a direct reference to clickGo here?

.then(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();
Copy link
Contributor

@cjcenizal cjcenizal Sep 6, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And then here we can compare against the precomputed expectedChartY:

const expectedChartY = expectedChartYData[x];
const chartY = data[x];
expect(Math.abs(expectedChartY - chartY < 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() {
Expand All @@ -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();
});
});



});
});
20 changes: 10 additions & 10 deletions test/functional/apps/visualize/_metric_chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 () {
Expand All @@ -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')
Expand All @@ -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');
Expand All @@ -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')
Expand All @@ -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')
Expand All @@ -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'
Expand All @@ -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')
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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')
Expand Down
10 changes: 3 additions & 7 deletions test/functional/apps/visualize/_pie_chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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()
Expand All @@ -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'
];
Expand Down
10 changes: 5 additions & 5 deletions test/functional/apps/visualize/_tile_map.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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 },
Expand Down Expand Up @@ -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 },
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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 () {
Expand Down
Loading