-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Test order aggs by term #8141 #8154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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(); | ||
| }) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any reason not to pass a direct reference to .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(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And then here we can compare against the precomputed 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() { | ||
|
|
@@ -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(); | ||
| }); | ||
| }); | ||
|
|
||
|
|
||
|
|
||
| }); | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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:
b: