fix NewCommandTimeout handling for freshly created sessions

This commit is contained in:
Jonah Stiennon
2016-01-20 11:50:09 -08:00
parent 17d512a21e
commit 72aeb807ad
2 changed files with 21 additions and 3 deletions
+9 -3
View File
@@ -16,6 +16,10 @@ import util from 'util';
class AppiumDriver extends BaseDriver {
constructor (args) {
super();
// the main Appium Driver has no new command timeout
this.newCommandTimeoutMs = 0;
this.args = args;
this.sessions = {};
@@ -110,12 +114,17 @@ class AppiumDriver extends BaseDriver {
.catch(B.CancellationError, () => {})
.catch((err) => {
log.warn(`Closing session, cause was '${err.message}'`);
log.info(`Removing session ${innerSessionId} from our master session list`);
delete this.sessions[innerSessionId];
})
.done();
log.info(`New ${InnerDriver.name} session created successfully, session ` +
`${innerSessionId} added to master session list`);
// set the New Command Timeout for the inner driver
d.startNewCommandTimeout();
return [innerSessionId, dCaps];
}
@@ -155,9 +164,6 @@ class AppiumDriver extends BaseDriver {
return super.executeCommand(cmd, ...args);
}
// since we don't call super.executeCommand, we need
// to clear the appium driver timeout manually
this.clearNewCommandTimeout();
let sessionId = args[args.length - 1];
return this.sessions[sessionId].executeCommand(cmd, ...args);
}