Skip to content
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

Make tryForTime return the resolved value #5488

Merged
merged 5 commits into from
Nov 24, 2015
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
10 changes: 4 additions & 6 deletions test/functional/apps/discover/_discover.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,10 @@ define(function (require) {
bdd.it('load query should show query name', function () {
return discoverPage.loadSavedSearch(queryName1)
.then(function () {
return common.tryForTime(15000, function () {
return discoverPage.getCurrentQueryName()
.then(function (actualQueryNameString) {
expect(actualQueryNameString).to.be(queryName1);
});
});
return discoverPage.getCurrentQueryName();
})
.then(function (actualQueryNameString) {
expect(actualQueryNameString).to.be(queryName1);
})
.catch(common.handleError(this));
});
Expand Down
9 changes: 4 additions & 5 deletions test/support/pages/Common.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,13 @@ define(function (require) {
self.debug(msg);
throw new Error(msg);
}

return currentUrl;
});
});
};

return doNavigation(appUrl)
.then(function () {
return self.remote.getCurrentUrl();
})
.then(function (currentUrl) {
var lastUrl = currentUrl;
return self.tryForTime(defaultTimeout, function () {
Expand Down Expand Up @@ -148,9 +147,9 @@ define(function (require) {

return Promise
.try(block)
.then(function tryForTimeSuccess() {
.then(function tryForTimeSuccess(resolved) {
self.debug('tryForTime success in about ' + (lastTry - start) + ' ms');
return (lastTry - start);
return resolved;
})
.catch(function tryForTimeCatch(err) {
self.debug('tryForTime failure, retry in ' + retryDelay + 'ms - ' + err.message);
Expand Down
11 changes: 6 additions & 5 deletions test/support/pages/DiscoverPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ define(function (require) {
// at runtime
var Common = require('./Common');

var defaultTimeout = 20000;
var defaultTimeout = 60000;
var common;
var thisTime;

Expand Down Expand Up @@ -76,10 +76,11 @@ define(function (require) {
},

getCurrentQueryName: function getCurrentQueryName() {
return thisTime
.findByCssSelector('span.discover-info-title')
// .findByCssSelector('span[bo-bind="opts.savedSearch.title"]')
.getVisibleText();
return common.tryForTime(defaultTimeout, function () {
return thisTime
.findByCssSelector('span.discover-info-title')
.getVisibleText();
});
},

getBarChartData: function getBarChartData() {
Expand Down
6 changes: 3 additions & 3 deletions test/support/pages/HeaderPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ define(function (require) {
common = new Common(this.remote);
}

var defaultTimeout = 5000;
var defaultTimeout = 60000;

HeaderPage.prototype = {
constructor: HeaderPage,

clickSelector: function (selector) {
var self = this.remote;
return common.tryForTime(5000, function () {
return common.tryForTime(defaultTimeout, function () {
return self.setFindTimeout(defaultTimeout)
.findByCssSelector(selector)
.then(function (tab) {
Expand Down Expand Up @@ -111,7 +111,7 @@ define(function (require) {

waitForToastMessageGone: function waitForToastMessageGone() {
var self = this;
return common.tryForTime(defaultTimeout * 5, function tryingForTime() {
return common.tryForTime(defaultTimeout * 2, function () {
return self.remote.setFindTimeout(1000)
.findAllByCssSelector('kbn-truncated.toast-message.ng-isolate-scope')
.then(function toastMessage(messages) {
Expand Down