Dont fix caps (will be done in inner drivers)

This commit is contained in:
Isaac Murchie
2016-03-16 14:07:12 -07:00
parent ba0fe81f6b
commit c2ac161a9e
4 changed files with 2 additions and 34 deletions
+1 -2
View File
@@ -1,7 +1,6 @@
import _ from 'lodash';
import log from './logger';
import { getAppiumConfig } from './config';
import { fixCaps } from './helpers';
import { BaseDriver } from 'appium-base-driver';
import { FakeDriver } from 'appium-fake-driver';
import { AndroidDriver } from 'appium-android-driver';
@@ -103,7 +102,7 @@ class AppiumDriver extends BaseDriver {
throw new errors.SessionNotCreatedError(e.message);
}
let d = new InnerDriver(this.args);
let [innerSessionId, dCaps] = await d.createSession(fixCaps(caps), reqCaps, curSessions);
let [innerSessionId, dCaps] = await d.createSession(caps, reqCaps, curSessions);
this.sessions[innerSessionId] = d;
// Remove the session on unexpected shutdown, so that we are in a position
-22
View File
@@ -1,22 +0,0 @@
import _ from 'lodash';
import log from './logger';
function fixCaps (originalCaps) {
let caps = _.clone(originalCaps);
// boolean capabilities can be passed in as strings 'false' and 'true'
// which we want to translate into boolean values
for (let [cap, value] of _.pairs(caps)) {
if (_.isString(value)) {
value = value.toLowerCase();
if (value === 'true' || value === 'false') {
log.debug(`Capability '${cap}' changed from string to boolean. This may cause unexpected behavior`);
caps[cap] = (value === 'true');
}
}
}
return caps;
}
export { fixCaps };
+1 -1
View File
@@ -35,7 +35,7 @@
},
"dependencies": {
"appium-android-driver": "^1.6.11",
"appium-base-driver": "^1.3.0",
"appium-base-driver": "^1.4.0",
"appium-express": "^1.2.0",
"appium-fake-driver": "^0.1.9",
"appium-ios-driver": "^1.8.7",
-9
View File
@@ -71,15 +71,6 @@ describe('AppiumDriver', () => {
await appium.createSession(BASE_CAPS);
mockFakeDriver.verify();
});
it('should call inner driver\'s createSession with desired capabilities with string booleans transformed to booleans', async () => {
let sentCaps = _.extend({autoAcceptAlerts: 'false', autoDismissAlerts: 'true'}, BASE_CAPS);
let expectedCaps = _.extend({autoAcceptAlerts: false, autoDismissAlerts: true}, BASE_CAPS);
mockFakeDriver.expects("createSession")
.once().withExactArgs(expectedCaps, undefined, [])
.returns([1, expectedCaps]);
await appium.createSession(sentCaps);
mockFakeDriver.verify();
});
});
describe('deleteSession', () => {
let appium