diff --git a/src/main/java/com/github/wasiqb/coteafs/appium/checker/DeviceChecker.java b/src/main/java/com/github/wasiqb/coteafs/appium/checker/DeviceChecker.java index 6d842e3..32af5c7 100644 --- a/src/main/java/com/github/wasiqb/coteafs/appium/checker/DeviceChecker.java +++ b/src/main/java/com/github/wasiqb/coteafs/appium/checker/DeviceChecker.java @@ -47,7 +47,8 @@ public static void checkCapabilitiesParams (final String key, final Object value * @param element * @param name */ - public static void checkDeviceElementDisplayed (final MobileElement element, final String name) { + public static void checkDeviceElementDisplayed (final MobileElement element, + final String name) { if (!element.isDisplayed ()) { final String msg = "Device element [%s] is not displayed."; fail (DeviceElementNotDisplayedError.class, String.format (msg, name)); @@ -67,10 +68,6 @@ public static void checkDeviceElementEnabled (final MobileElement element, final } } - /** - * @author wasiq.bhamla - * @since Jul 22, 2017 10:12:20 PM - */ private DeviceChecker () { // Utility class. } diff --git a/src/main/java/com/github/wasiqb/coteafs/appium/checker/ServerChecker.java b/src/main/java/com/github/wasiqb/coteafs/appium/checker/ServerChecker.java index 5ab65ba..6c6bb98 100644 --- a/src/main/java/com/github/wasiqb/coteafs/appium/checker/ServerChecker.java +++ b/src/main/java/com/github/wasiqb/coteafs/appium/checker/ServerChecker.java @@ -50,10 +50,6 @@ public static void checkServerRunning (final AppiumServer server) { } } - /** - * @author wasiq.bhamla - * @since Jul 22, 2017 10:50:03 PM - */ private ServerChecker () { // Utility class. } diff --git a/src/main/java/com/github/wasiqb/coteafs/appium/config/AppiumSetting.java b/src/main/java/com/github/wasiqb/coteafs/appium/config/AppiumSetting.java index 7f1652f..8763467 100644 --- a/src/main/java/com/github/wasiqb/coteafs/appium/config/AppiumSetting.java +++ b/src/main/java/com/github/wasiqb/coteafs/appium/config/AppiumSetting.java @@ -22,9 +22,20 @@ * @since 12-Apr-2017 8:58:57 PM */ public class AppiumSetting { + private DeviceSetting device; private Map devices; + private ServerSetting server; private Map servers; + /** + * @author wasiqb + * @since Oct 16, 2018 + * @return the device + */ + public DeviceSetting getDevice () { + return this.device; + } + /** * @author wasiq.bhamla * @param key @@ -44,6 +55,15 @@ public Map getDevices () { return this.devices; } + /** + * @author wasiqb + * @since Oct 16, 2018 + * @return the server + */ + public ServerSetting getServer () { + return this.server; + } + /** * @author wasiq.bhamla * @param key @@ -63,6 +83,16 @@ public Map getServers () { return this.servers; } + /** + * @author wasiqb + * @since Oct 16, 2018 + * @param device + * the device to set + */ + public void setDevice (final DeviceSetting device) { + this.device = device; + } + /** * @author wasiq.bhamla * @since 13-Apr-2017 9:59:40 PM @@ -73,6 +103,16 @@ public void setDevices (final Map devices) { this.devices = devices; } + /** + * @author wasiqb + * @since Oct 16, 2018 + * @param server + * the server to set + */ + public void setServer (final ServerSetting server) { + this.server = server; + } + /** * @author wasiq.bhamla * @since 13-Apr-2017 9:59:40 PM diff --git a/src/main/java/com/github/wasiqb/coteafs/appium/config/DeviceSetting.java b/src/main/java/com/github/wasiqb/coteafs/appium/config/DeviceSetting.java index c1b7f63..94250d3 100644 --- a/src/main/java/com/github/wasiqb/coteafs/appium/config/DeviceSetting.java +++ b/src/main/java/com/github/wasiqb/coteafs/appium/config/DeviceSetting.java @@ -64,6 +64,7 @@ public DeviceSetting () { this.clearSystemFiles = false; this.sessionTimeout = 120; this.cloudApp = false; + this.playback = new PlaybackSetting (); } /** diff --git a/src/main/java/com/github/wasiqb/coteafs/appium/config/ServerArgumentSetting.java b/src/main/java/com/github/wasiqb/coteafs/appium/config/ServerArgumentSetting.java index adbe9f1..a3e132e 100644 --- a/src/main/java/com/github/wasiqb/coteafs/appium/config/ServerArgumentSetting.java +++ b/src/main/java/com/github/wasiqb/coteafs/appium/config/ServerArgumentSetting.java @@ -38,6 +38,8 @@ public class ServerArgumentSetting { */ public ServerArgumentSetting () { this.logLevel = LogLevel.ERROR; + this.android = new AndroidArgumentSetting (); + this.ios = new IOSArgumentSetting (); } /** diff --git a/src/main/java/com/github/wasiqb/coteafs/appium/config/ServerSetting.java b/src/main/java/com/github/wasiqb/coteafs/appium/config/ServerSetting.java index 7bf2b5c..d4a771a 100644 --- a/src/main/java/com/github/wasiqb/coteafs/appium/config/ServerSetting.java +++ b/src/main/java/com/github/wasiqb/coteafs/appium/config/ServerSetting.java @@ -27,11 +27,7 @@ * @since 12-Apr-2017 8:43:22 PM */ public class ServerSetting { - private static int countInstance; - - static { - countInstance = 0; - } + private static int countInstance = 0; private String appiumJsPath; private ServerArgumentSetting arguments; @@ -65,7 +61,8 @@ public ServerSetting () { this.environmentVariables = new HashMap <> (); this.protocol = Protocol.HTTP; this.logFilePath = String.format ("%s/logs/server-%d.log", System.getProperty ("user.dir"), - countInstance); + countInstance); + this.arguments = new ServerArgumentSetting (); } /** diff --git a/src/test/resources/appium-config.yaml b/src/test/resources/appium-config.yaml index aa1d067..4847b40 100644 --- a/src/test/resources/appium-config.yaml +++ b/src/test/resources/appium-config.yaml @@ -1,16 +1,19 @@ +server: &default_server + appium_js_path: C:\Users\wasiqb\AppData\Roaming\npm\node_modules\appium\build\lib\main.js + node_path: C:\Program Files\nodejs\node.exe + arguments: + log_level: DEBUG + log_time_stamp: true + local_time_zone: true + session_override: true + android: + suppress_adb_kill_server: true + servers: android: host: 0.0.0.0 port: 4723 - appium_js_path: C:\Users\wasiqb\AppData\Roaming\npm\node_modules\appium\build\lib\main.js - node_path: C:\Program Files\nodejs\node.exe - arguments: - log_level: DEBUG - log_time_stamp: true - local_time_zone: true - session_override: true - android: - suppress_adb_kill_server: true + <<: *default_server browserstack: protocol: HTTPS host: hub-cloud.browserstack.com @@ -18,37 +21,29 @@ servers: user_name: ${env.user} password: ${env.pass} +device: &default_device + platform_type: ANDROID + app_type: HYBRID + device_type: REAL + automation_name: APPIUM + session_timeout: 120000 + playback: + record: + enabled: true + delay_before_swipe: 2 + delay_after_swipe: 1 + delay_before_tap: 2 + delay_after_tap: 1 + devices: test_local: - platform_type: ANDROID device_name: MI Redmi Note 4 device_version: 7.0 - app_type: HYBRID - device_type: REAL - automation_name: APPIUM app_location: apps/android/VodQA.apk - session_timeout: 120000 - playback: - record: - enabled: true - delay_before_swipe: 2 - delay_after_swipe: 1 - delay_before_tap: 2 - delay_after_tap: 1 + <<: *default_device test_browserstack: - platform_type: ANDROID device_name: Samsung Galaxy S8 device_version: 7.0 - app_type: HYBRID - device_type: REAL - automation_name: APPIUM app_location: ${env.app} cloud_app: true - session_timeout: 120000 - playback: - record: - enabled: true - delay_before_swipe: 2 - delay_after_swipe: 1 - delay_before_tap: 2 - delay_after_tap: 1 \ No newline at end of file + <<: *default_device \ No newline at end of file