зеркало из https://github.com/xamarin/appium.old.git
fix NewCommandTimeout handling for freshly created sessions
This commit is contained in:
Родитель
17d512a21e
Коммит
72aeb807ad
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -66,5 +66,17 @@ describe('FakeDriver - via HTTP', () => {
|
|||
await driver2.init(caps).should.eventually.be.rejected;
|
||||
await driver1.quit();
|
||||
});
|
||||
|
||||
it('should use the newCommandTimeout of the inner Driver on session creation', async () => {
|
||||
let driver = wd.promiseChainRemote(TEST_HOST, TEST_PORT);
|
||||
|
||||
caps.newCommandTimeout = 0.25;
|
||||
|
||||
let [sessionId] = await driver.init(caps);
|
||||
should.exist(sessionId);
|
||||
|
||||
await B.delay(250);
|
||||
await driver.source().should.eventually.be.rejectedWith(/terminated/);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче