Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should fall back to MJSONWP if Inner Driver is not ready for W3C', async function () {
const combinedCaps = {
desiredCapabilities: {
...caps,
},
capabilities: {
alwaysMatch: {
...caps,
deviceName: null,
},
},
};
const createSessionStub = sinon.stub(FakeDriver.prototype, 'createSession').callsFake(async function (jsonwpCaps) {
const res = await BaseDriver.prototype.createSession.call(this, jsonwpCaps);
this.protocol.should.equal('MJSONWP');
return res;
});
const {value, sessionId, status} = await request.post({url: baseUrl, json: combinedCaps});
status.should.exist;
sessionId.should.exist;
value.should.deep.equal(caps);
createSessionStub.restore();
// End session
await request.delete({ url: `${baseUrl}/${sessionId}` });
});
function getDriverAndFakeDriver () {
const appium = new AppiumDriver({});
const fakeDriver = new FakeDriver();
const mockFakeDriver = sinon.mock(fakeDriver);
appium.getDriverAndVersionForCaps = function (/*args*/) {
return {
driver: function Driver () {
return fakeDriver;
},
version: '1.2.3',
};
};
return [appium, mockFakeDriver];
}
describe('createSession', function () {