mirror of
https://github.com/appium/appium.git
synced 2026-04-27 05:52:35 -05:00
Dont fix caps (will be done in inner drivers)
This commit is contained in:
+1
-2
@@ -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
|
||||
|
||||
@@ -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
@@ -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",
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user