mirror of
https://github.com/appium/appium.git
synced 2026-05-21 19:38:52 -05:00
get rid of old device and version caps
This commit is contained in:
@@ -116,7 +116,6 @@ Appium.prototype.start = function (desiredCaps, cb) {
|
||||
Appium.prototype.getDeviceType = function (args, caps) {
|
||||
var type = this.getDeviceFromMJSONWP(args, caps) ||
|
||||
this.getDeviceTypeFromArgsOrNamedApp(args, caps) ||
|
||||
this.getDeviceTypePreMJSONWP(args, caps) ||
|
||||
this.getDeviceTypeFromAppOrPackage(args, caps);
|
||||
if (type) {
|
||||
return type;
|
||||
@@ -126,12 +125,6 @@ Appium.prototype.getDeviceType = function (args, caps) {
|
||||
"'deviceName' capability");
|
||||
};
|
||||
|
||||
Appium.prototype.getDeviceTypePreMJSONWP = function (args, caps) {
|
||||
var device = caps.device ? caps.device.toString().toLowerCase() : '';
|
||||
var type = this.getDeviceTypeFromDeviceCap(device);
|
||||
if (type) return type;
|
||||
};
|
||||
|
||||
Appium.prototype.getDeviceFromMJSONWP = function (args, caps) {
|
||||
var platform = caps.platformName || args.platformName;
|
||||
platform = platform ? platform.toString().toLowerCase() : '';
|
||||
|
||||
@@ -866,7 +866,6 @@ IOS.prototype.checkDeviceAvailable = function (cb) {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
IOS.prototype.setDeviceAndLaunchSimulator = function (cb) {
|
||||
var msg;
|
||||
if (this.args.udid) {
|
||||
|
||||
@@ -4,8 +4,6 @@ var _ = require('underscore')
|
||||
, warnDeprecated = require('../helpers.js').logDeprecationWarning;
|
||||
|
||||
var capsConversion = {
|
||||
'device': 'platformName',
|
||||
'version': 'platformVersion',
|
||||
'launch': 'autoLaunch'
|
||||
};
|
||||
|
||||
|
||||
@@ -22,34 +22,6 @@ describe('capabilities', function () {
|
||||
c.platformVersion.should.equal(7.0);
|
||||
(typeof c.platformVersion).should.equal("number");
|
||||
});
|
||||
describe('with pre-mjsonwp capabilities', function () {
|
||||
var capabilityConversion = [
|
||||
['device', 'platformName']
|
||||
, ['version', 'platformVersion']
|
||||
];
|
||||
|
||||
beforeEach(function () {
|
||||
sinon.spy(logger, "warn");
|
||||
});
|
||||
afterEach(function () {
|
||||
logger.warn.restore();
|
||||
});
|
||||
|
||||
_.each(capabilityConversion, function (item) {
|
||||
var specName = "Should return a deprecation warning when given the " +
|
||||
JSON.stringify(item[0]) + " capability";
|
||||
it(specName, function () {
|
||||
var expected = "[DEPRECATED] The " + item[0] + " capability has " +
|
||||
"been deprecated and will be removed. Please use " +
|
||||
"the " + item[1] + " capability instead.";
|
||||
var fakeCaps = {};
|
||||
fakeCaps[item[0]] = 'dontcare';
|
||||
new Capabilities(fakeCaps);
|
||||
(logger.warn.args[0][0]).should.equal(expected);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('with mjsonwp capabilities', function () {
|
||||
describe('deprecation warnings', function () {
|
||||
var newCapabilities = [
|
||||
|
||||
@@ -7,13 +7,11 @@ var common = require('../../lib/devices/common.js')
|
||||
, logger = loggerjs.get('appium');
|
||||
|
||||
var _ = require('underscore')
|
||||
, chai = require('chai')
|
||||
, should = chai.should()
|
||||
, sinon = require('sinon');
|
||||
|
||||
describe('devices/common.js', function () {
|
||||
var null_cb = function () {};
|
||||
|
||||
|
||||
var assertLocatorValidity = function (name, loc, includeWeb, expected) {
|
||||
var cb = function () {};
|
||||
it(name, function () {
|
||||
@@ -123,4 +121,4 @@ describe('devices/common.js', function () {
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
var getAppium = require('../../lib/appium')
|
||||
, chai = require('chai')
|
||||
, should = chai.should()
|
||||
, _ = require('underscore');
|
||||
|
||||
var assertCapsGiveCorrectDevices = function (appium, args) {
|
||||
@@ -17,62 +15,6 @@ describe('Appium', function () {
|
||||
describe('#getDeviceType', function () {
|
||||
// test is [args, caps, device]
|
||||
var appium = getAppium({});
|
||||
describe('pre mjsonwp capabilities', function () {
|
||||
describe('device capabilities', function () {
|
||||
var happyTests = [
|
||||
[{}, {app: 'chromium', device: 'android'}, 'chrome']
|
||||
, [{}, {app: '/path/to/my.app', device: 'Android'}, 'android']
|
||||
, [{}, {browserName: "safari"}, 'safari']
|
||||
, [{app: '/path/to/my.app'}, {device: 'Android'}, 'android']
|
||||
, [{}, {device: 'iPhone Simulator'}, 'ios']
|
||||
, [{}, {device: 'iPhone Simulator', browserName: 'Safari'}, 'safari']
|
||||
, [{}, {device: 'iPhone Simulator', browserName: 'safari'}, 'safari']
|
||||
, [{}, {device: 'iPhone'}, 'ios']
|
||||
, [{}, {device: 'iphone'}, 'ios']
|
||||
, [{}, {device: 'ipad'}, 'ios']
|
||||
, [{}, {device: 'iPad Simulator'}, 'ios']
|
||||
, [{}, {device: 'Selendroid'}, 'selendroid']
|
||||
, [{}, {device: 'Android'}, 'android']
|
||||
, [{}, {device: 'FirefoxOS'}, 'firefoxos']
|
||||
, [{}, {device: 'firefox'}, 'firefoxos']
|
||||
, [{}, {device: 'firefox', 'app-package': 'com.android.chrome'}, 'firefoxos']
|
||||
, [{}, {device: 'iphone', 'app-package': 'lol'}, 'ios']
|
||||
];
|
||||
_.each(happyTests, function (test) {
|
||||
var spec = 'should turn ' + JSON.stringify(test[0]) + ' args and ' +
|
||||
JSON.stringify(test[1]) + ' caps into ' + test[2] + ' device';
|
||||
it(spec, function () {
|
||||
appium.getDeviceType(test[0], test[1]).should.equal(test[2]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('negative cases', function () {
|
||||
|
||||
var unhappyTests = [
|
||||
[{}, {}]
|
||||
, [{}, {device: 'rando'}]
|
||||
, [{}, {app: '/path/to/my.exe'}]
|
||||
, [{ipa: '/path/to/my.exe'}, {}]
|
||||
, [{}, {platformName: 'notarealdevice'}]
|
||||
];
|
||||
_.each(unhappyTests, function (test) {
|
||||
var spec = 'should fail with args ' + JSON.stringify(test[0]) +
|
||||
' and caps ' + JSON.stringify(test[1]);
|
||||
it(spec, function () {
|
||||
var err;
|
||||
try {
|
||||
appium.getDeviceType(test[0], test[1]);
|
||||
} catch (e) {
|
||||
err = e;
|
||||
}
|
||||
should.exist(err);
|
||||
err.message.should.contain("Could not determine your device");
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('mjsonwp spec capabilities', function () {
|
||||
describe('deviceName', function () {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user