mirror of
https://github.com/appium/appium.git
synced 2026-02-13 05:19:47 -06:00
make safari its own device module
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
// Appium webserver controller methods
|
||||
// https://github.com/hugs/appium/blob/master/appium/appium.py
|
||||
"use strict";
|
||||
|
||||
var routing = require('./server/routing.js')
|
||||
, loggerjs = require('./server/logger.js')
|
||||
, logger = loggerjs.get('appium')
|
||||
@@ -14,6 +13,7 @@ var routing = require('./server/routing.js')
|
||||
, _ = require('underscore')
|
||||
, fs = require('fs')
|
||||
, IOS = require('./devices/ios/ios.js')
|
||||
, Safari = require('./devices/ios/safari.js')
|
||||
, Android = require('./devices/android/android.js')
|
||||
, Selendroid = require('./devices/android/selendroid.js')
|
||||
, Chrome = require('./devices/android/chrome.js')
|
||||
@@ -536,7 +536,6 @@ Appium.prototype.initDevice = function() {
|
||||
, removeTraceDir: !this.args.keepArtifacts
|
||||
, withoutDelay: !this.args.nativeInstrumentsLib
|
||||
, reset: !this.args.noReset
|
||||
, autoWebview: this.desiredCapabilities.safari
|
||||
, launchTimeout: this.desiredCapabilities.launchTimeout
|
||||
, version: this.desiredCapabilities.version
|
||||
, deviceType: this.iosDeviceType
|
||||
@@ -550,7 +549,12 @@ Appium.prototype.initDevice = function() {
|
||||
, desiredCapabilities: this.desiredCapabilities
|
||||
, logNoColors: this.args.logNoColors
|
||||
};
|
||||
this.device = new IOS(iosOpts);
|
||||
if (this.desiredCapabilities.safari) {
|
||||
iosOpts.autoWebview = true;
|
||||
this.device = new Safari(iosOpts);
|
||||
} else {
|
||||
this.device = new IOS(iosOpts);
|
||||
}
|
||||
} else if (this.isAndroid()) {
|
||||
var androidOpts = {
|
||||
rest: this.rest
|
||||
|
||||
@@ -22,7 +22,21 @@ var path = require('path')
|
||||
, iOSHybrid = require('./ios-hybrid.js')
|
||||
, UnknownError = errors.UnknownError;
|
||||
|
||||
// XML Plist library helper
|
||||
var xmlPlistFile = function(filename, callback) {
|
||||
try {
|
||||
var result = xmlplist.parseFileSync(filename);
|
||||
return callback(null, result);
|
||||
} catch (ex) {
|
||||
return callback(ex);
|
||||
}
|
||||
};
|
||||
|
||||
var IOS = function(args) {
|
||||
this.init(args);
|
||||
};
|
||||
|
||||
IOS.prototype.init = function(args) {
|
||||
this.rest = args.rest;
|
||||
this.version = args.version;
|
||||
this.webSocket = args.webSocket;
|
||||
@@ -84,16 +98,6 @@ var IOS = function(args) {
|
||||
this.localizableStrings = {};
|
||||
};
|
||||
|
||||
// XML Plist library helper
|
||||
var xmlPlistFile = function(filename, callback) {
|
||||
try {
|
||||
var result = xmlplist.parseFileSync(filename);
|
||||
return callback(null, result);
|
||||
} catch (ex) {
|
||||
return callback(ex);
|
||||
}
|
||||
};
|
||||
|
||||
IOS.prototype.cleanup = function(cb) {
|
||||
var removeTracedirs = function(innerCb) {
|
||||
if (this.removeTraceDir) {
|
||||
|
||||
12
lib/devices/ios/safari.js
Normal file
12
lib/devices/ios/safari.js
Normal file
@@ -0,0 +1,12 @@
|
||||
"use strict";
|
||||
|
||||
var IOS = require('./ios.js')
|
||||
, _ = require('underscore');
|
||||
|
||||
var Safari = function(args) {
|
||||
this.init(args);
|
||||
};
|
||||
|
||||
_.extend(Safari.prototype, IOS.prototype);
|
||||
|
||||
module.exports = Safari;
|
||||
Reference in New Issue
Block a user