Skip to content

Commit

Permalink
Merge pull request elastic#7256 from LeeDr/fixSaveVis
Browse files Browse the repository at this point in the history
Wrapped part of saveVisualization in a try loop.
  • Loading branch information
Lee Drengenberg committed May 20, 2016
2 parents a11a86e + f2b4711 commit 95132dd
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 28 deletions.
4 changes: 2 additions & 2 deletions test/functional/apps/discover/_discover.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ import {

bdd.it('should show the correct hit count', function () {
var expectedHitCount = '14,004';
return common.tryForTime(20 * 1000, function tryingForTime() {
return common.try(function tryingForTime() {
return discoverPage.getHitCount()
.then(function compareData(hitCount) {
expect(hitCount).to.be(expectedHitCount);
Expand Down Expand Up @@ -243,7 +243,7 @@ import {


function verifyChartData(expectedBarChartData) {
return common.tryForTime(20 * 1000, function tryingForTime() {
return common.try(function tryingForTime() {
return discoverPage.getBarChartData()
.then(function compareData(paths) {
// the largest bars are over 100 pixels high so this is less than 1% tolerance
Expand Down
6 changes: 3 additions & 3 deletions test/functional/apps/discover/_field_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ import {
var expectedHitCount = '445';
return discoverPage.query('php')
.then(function () {
return common.tryForTime(20 * 1000, function tryingForTime() {
return common.try(function tryingForTime() {
return discoverPage.getHitCount()
.then(function compareData(hitCount) {
expect(hitCount).to.be(expectedHitCount);
Expand All @@ -76,7 +76,7 @@ import {
var expectedHitCount = '11,156';
return discoverPage.query('_type:apache')
.then(function () {
return common.tryForTime(20 * 1000, function tryingForTime() {
return common.try(function tryingForTime() {
return discoverPage.getHitCount()
.then(function compareData(hitCount) {
expect(hitCount).to.be(expectedHitCount);
Expand Down Expand Up @@ -229,7 +229,7 @@ import {
return common.sleep(2000);
})
.then(function () {
return common.tryForTime(20 * 1000, function tryingForTime() {
return common.try(function tryingForTime() {
return discoverPage.getDocTableIndex(1)
.then(function (rowData) {
expect(rowData).to.be(ExpectedDoc);
Expand Down
2 changes: 1 addition & 1 deletion test/functional/apps/discover/_shared_links.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ import { bdd, common, discoverPage, headerPage, settingsPage, scenarioManager }
var re = new RegExp(baseUrl + '/goto/[0-9a-f]{32}$');
return discoverPage.clickShortenUrl()
.then(function () {
return common.tryForTime(20 * 1000, function tryingForTime() {
return common.try(function tryingForTime() {
return discoverPage.getShortenedUrl()
.then(function (actualUrl) {
expect(actualUrl).to.match(re);
Expand Down
6 changes: 3 additions & 3 deletions test/functional/apps/settings/_index_pattern_create_delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {
});

bdd.it('should have index pattern in url', function url() {
return common.tryForTime(5000, function () {
return common.try(function tryingForTime() {
return remote.getCurrentUrl()
.then(function (currentUrl) {
expect(currentUrl).to.contain('logstash-*');
Expand Down Expand Up @@ -80,15 +80,15 @@ import {
});

bdd.it('should return to index pattern creation page', function returnToPage() {
return common.tryForTime(5000, function () {
return common.try(function tryingForTime() {
return settingsPage.getCreateButton();
})
.catch(common.handleError(this));
});

bdd.it('should remove index pattern from url', function indexNotInUrl() {
// give the url time to settle
return common.tryForTime(5000, function () {
return common.try(function tryingForTime() {
return remote.getCurrentUrl()
.then(function (currentUrl) {
common.debug('currentUrl = ' + currentUrl);
Expand Down
2 changes: 1 addition & 1 deletion test/functional/apps/visualize/_area_chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ import {
683, 1361, 1415, 707, 177, 27, 32, 175, 707, 1408, 1355, 726, 201, 29
];

return common.tryForTime(5000, function () {
return common.try(function tryingForTime() {
return visualizePage.getXAxisLabels()
.then(function compareLabels(labels) {
common.debug('X-Axis labels = ' + labels);
Expand Down
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 @@ -65,7 +65,7 @@ import {
var expectedCount = ['14,004', 'Count'];

// initial metric of "Count" is selected by default
return common.tryForTime(2000, function () {
return common.try(function tryingForTime() {
return visualizePage.getMetric()
.then(function (metricValue) {
expect(expectedCount).to.eql(metricValue.split('\n'));
Expand All @@ -88,7 +88,7 @@ import {
return visualizePage.clickGo();
})
.then(function () {
return common.tryForTime(2000, function () {
return common.try(function tryingForTime() {
return visualizePage.getMetric()
.then(function (metricValue) {
expect(avgMachineRam).to.eql(metricValue.split('\n'));
Expand All @@ -110,7 +110,7 @@ import {
return visualizePage.clickGo();
})
.then(function () {
return common.tryForTime(2000, function () {
return common.try(function tryingForTime() {
return visualizePage.getMetric()
.then(function (metricValue) {
expect(sumPhpMemory).to.eql(metricValue.split('\n'));
Expand All @@ -133,7 +133,7 @@ import {
return visualizePage.clickGo();
})
.then(function () {
return common.tryForTime(2000, function () {
return common.try(function tryingForTime() {
return visualizePage.getMetric()
.then(function (metricValue) {
// only comparing the text label!
Expand All @@ -156,7 +156,7 @@ import {
return visualizePage.clickGo();
})
.then(function () {
return common.tryForTime(2000, function () {
return common.try(function tryingForTime() {
return visualizePage.getMetric()
.then(function (metricValue) {
expect(minTimestamp).to.eql(metricValue.split('\n'));
Expand All @@ -178,7 +178,7 @@ import {
return visualizePage.clickGo();
})
.then(function () {
return common.tryForTime(2000, function () {
return common.try(function tryingForTime() {
return visualizePage.getMetric()
.then(function (metricValue) {
expect(maxRelatedContentArticleModifiedTime).to.eql(metricValue.split('\n'));
Expand All @@ -204,7 +204,7 @@ import {
return visualizePage.clickGo();
})
.then(function () {
return common.tryForTime(2000, function () {
return common.try(function tryingForTime() {
return visualizePage.getMetric()
.then(function (metricValue) {
expect(standardDeviationBytes).to.eql(metricValue.split('\n'));
Expand All @@ -226,7 +226,7 @@ import {
return visualizePage.clickGo();
})
.then(function () {
return common.tryForTime(2000, function () {
return common.try(function tryingForTime() {
return visualizePage.getMetric()
.then(function (metricValue) {
expect(uniqueCountClientip).to.eql(metricValue.split('\n'));
Expand Down Expand Up @@ -264,7 +264,7 @@ import {
return visualizePage.clickGo();
})
.then(function () {
return common.tryForTime(2000, function () {
return common.try(function tryingForTime() {
return visualizePage.getMetric()
.then(function (metricValue) {
expect(percentileMachineRam).to.eql(metricValue.split('\n'));
Expand All @@ -290,7 +290,7 @@ import {
return visualizePage.clickGo();
})
.then(function () {
return common.tryForTime(2000, function () {
return common.try(function tryingForTime() {
return visualizePage.getMetric()
.then(function (metricValue) {
expect(percentileRankBytes).to.eql(metricValue.split('\n'));
Expand Down
2 changes: 1 addition & 1 deletion test/functional/apps/visualize/_tile_map.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ import {
})
.then(function () {
common.debug('Click field geo.coordinates');
return common.tryForTime(1000, function () {
return common.try(function tryingForTime() {
return visualizePage.selectField('geo.coordinates');
});
})
Expand Down
16 changes: 9 additions & 7 deletions test/support/pages/visualize_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ export default (function () {

selectField: function selectField(fieldValue) {
var self = this;
return common.try(function () {
return common.try(function tryingForTime() {
return self.remote
.setFindTimeout(defaultFindTimeout)
// the css below should be more selective
Expand Down Expand Up @@ -316,10 +316,12 @@ export default (function () {
// verify that green message at the top of the page.
// it's only there for about 5 seconds
.then(function () {
return self.remote
.setFindTimeout(defaultFindTimeout)
.findByCssSelector('kbn-truncated.toast-message.ng-isolate-scope')
.getVisibleText();
return common.try(function tryingForTime() {
return self.remote
.setFindTimeout(defaultFindTimeout)
.findByCssSelector('kbn-truncated.toast-message.ng-isolate-scope')
.getVisibleText();
});
});
},

Expand All @@ -344,7 +346,7 @@ export default (function () {
var self = this;
common.debug('clickVisualizationByLinkText(' + vizName + ')');

return common.try(function () {
return common.try(function tryingForTime() {
return self.remote
.setFindTimeout(defaultFindTimeout)
.findByLinkText(vizName)
Expand Down Expand Up @@ -662,7 +664,7 @@ export default (function () {

waitForToastMessageGone: function waitForToastMessageGone() {
var self = this;
return common.tryForTime(defaultFindTimeout * 5, function tryingForTime() {
return common.try(function tryingForTime() {
return self.remote
.setFindTimeout(100)
.findAllByCssSelector('kbn-truncated.toast-message.ng-isolate-scope')
Expand Down

0 comments on commit 95132dd

Please sign in to comment.