Files
appium/lib/server/capabilities.js
T
Dylan Lacey 21c8feb8e5 Add new device and automation capabilities, deprecate old caps
Added deprecation warning for older style caps.  Warnings are output
once only for a given function or capability.  A final trailing log
message is released saying there were deprecations.

Busted unit tests into smaller tests

Capabilities are now an object, created by passing the capabilities
to Capabilities.  Properties on that object are copied into the Capabilities object so the API is identical.

Store the value of platformVersion as version.
2014-03-19 09:35:36 -07:00

26 lines
648 B
JavaScript

"use strict";
var _ = require('underscore')
, warnDeprecated = require('../helpers.js').logDeprecationWarning;
var capsConversion = {
'device': 'platformName',
'version': 'platformVersion'
};
var Capabilities = function (capabilities) {
this.desired = capabilities;
this.warnings = {};
_.each(capabilities, function (cap, name) {
if (_.contains(_.keys(capsConversion), name)) {
warnDeprecated('capability', name, capsConversion[name]);
}
// Hacky alias for version
if (name.indexOf('platformVersion') !== -1) {
this.version = cap;
}
this[name] = cap;
}, this);
};
module.exports = Capabilities;