mirror of
https://github.com/appium/appium.git
synced 2026-10-28 12:21:20 +08:00
pass sessionId arg when calling deleteSession. Make error message for NewCommandTimeout more helpful
This commit is contained in:
@@ -54,7 +54,7 @@ commands.getSession = async function () {
|
||||
return this.caps;
|
||||
};
|
||||
|
||||
commands.deleteSession = async function () {
|
||||
commands.deleteSession = async function (/* sessionId */) {
|
||||
this.clearNewCommandTimeout();
|
||||
this.sessionId = null;
|
||||
};
|
||||
|
||||
@@ -24,7 +24,7 @@ helpers.clearNewCommandTimeout = function () {
|
||||
}
|
||||
};
|
||||
|
||||
helpers.startNewCommandTimeout = function (cmd) {
|
||||
helpers.startNewCommandTimeout = function () {
|
||||
// make sure there are no rogue timeouts
|
||||
this.clearNewCommandTimeout();
|
||||
|
||||
@@ -36,7 +36,11 @@ helpers.startNewCommandTimeout = function (cmd) {
|
||||
.then(async () => {
|
||||
log.warn(`Shutting down because we waited ` +
|
||||
`${this.newCommandTimeoutMs / 1000} seconds for a command`);
|
||||
await this.startUnexpectedShutdown(new Error(`Command ${cmd} timed out!`));
|
||||
let errorMessage = `New Command Timeout of ` +
|
||||
`${this.newCommandTimeoutMs / 1000} seconds ` +
|
||||
`expired. Try customizing the timeout using the ` +
|
||||
`'newCommandTimeout' desired capability`;
|
||||
await this.startUnexpectedShutdown(new Error(errorMessage));
|
||||
})
|
||||
.catch(B.CancellationError, (/*err*/) => {
|
||||
// ignore
|
||||
|
||||
+3
-3
@@ -175,7 +175,7 @@ class BaseDriver extends MobileJsonWireProtocol {
|
||||
// intentionally
|
||||
if (cmd !== 'deleteSession') {
|
||||
// reseting existing timeout
|
||||
this.startNewCommandTimeout(cmd);
|
||||
this.startNewCommandTimeout();
|
||||
}
|
||||
|
||||
return res;
|
||||
@@ -185,7 +185,7 @@ class BaseDriver extends MobileJsonWireProtocol {
|
||||
this.unexpectedShutdownDeferred.reject(err); // allow others to listen for this
|
||||
this.curCommandCancellable.cancel(err);
|
||||
this.shutdownUnexpectedly = true;
|
||||
await this.deleteSession();
|
||||
await this.deleteSession(this.sessionId);
|
||||
this.shutdownUnexpectedly = false;
|
||||
}
|
||||
|
||||
@@ -219,7 +219,7 @@ class BaseDriver extends MobileJsonWireProtocol {
|
||||
this.resetOnUnexpectedShutdown = () => {};
|
||||
|
||||
try {
|
||||
await this.deleteSession();
|
||||
await this.deleteSession(this.sessionId);
|
||||
log.debug('Restarting app');
|
||||
await this.createSession(this.caps);
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user