mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
Fixed sleep function to use setTimeout instead of setFindTimeout on something that doesn't exist.
This commit is contained in:
parent
25c78e6a0d
commit
fb5fcca5b6
1 changed files with 7 additions and 16 deletions
|
@ -6,10 +6,6 @@ define(function (require) {
|
|||
var Promise = require('bluebird');
|
||||
var moment = require('moment');
|
||||
|
||||
|
||||
// the page object is created as a constructor
|
||||
// so we can provide the remote Command object
|
||||
// at runtime
|
||||
function Common(remote) {
|
||||
this.remote = remote;
|
||||
}
|
||||
|
@ -19,7 +15,6 @@ define(function (require) {
|
|||
Common.prototype = {
|
||||
constructor: Common,
|
||||
|
||||
|
||||
tryForTime: function tryForTime(timeout, block) {
|
||||
var self = this;
|
||||
var start = Date.now();
|
||||
|
@ -48,26 +43,22 @@ define(function (require) {
|
|||
return Promise.try(attempt);
|
||||
},
|
||||
|
||||
|
||||
log: function log(logString) {
|
||||
console.log(moment().format('HH:mm:ss.SSS') + ': ' + logString);
|
||||
},
|
||||
|
||||
|
||||
sleep: function sleep(sleepMilliseconds) {
|
||||
var self = this;
|
||||
self.log('... sleep(' + sleepMilliseconds + ') start');
|
||||
return this.remote
|
||||
.setFindTimeout(sleepMilliseconds)
|
||||
.findByCssSelector('youWillNeverFindThis')
|
||||
.catch(function (reason) {
|
||||
|
||||
var promise = new Promise(function (resolve, reject) {
|
||||
setTimeout(function () {
|
||||
self.log('... sleep(' + sleepMilliseconds + ') end');
|
||||
});
|
||||
|
||||
resolve({});
|
||||
}, sleepMilliseconds);
|
||||
});
|
||||
return promise;
|
||||
}
|
||||
|
||||
|
||||
// …additional page interaction tasks…
|
||||
};
|
||||
|
||||
return Common;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue