From a72ca1b697241c72bb427c8360ac9f0afd0a3c96 Mon Sep 17 00:00:00 2001 From: Marcel Pfotenhauer Date: Thu, 14 Feb 2019 11:18:20 +0100 Subject: [PATCH] #71: Add better Appium support --- config/browser.properties | 14 +++++-- pom.xml | 6 --- .../multibrowser/BrowserRunnerHelper.java | 38 +------------------ .../BrowserConfigurationMapper.java | 29 +++++++------- 4 files changed, 26 insertions(+), 61 deletions(-) diff --git a/config/browser.properties b/config/browser.properties index 2f1a85822..4fcbf939c 100644 --- a/config/browser.properties +++ b/config/browser.properties @@ -115,12 +115,20 @@ browserprofile.Galaxy_Note3_Emulation.name Samsung Galaxy Note 3 Chrome Emulatio browserprofile.Galaxy_Note3_Emulation.browser = chrome browserprofile.Galaxy_Note3_Emulation.chromeEmulationProfile = Samsung Galaxy Note 3 - -browserprofile.iphone8.name = iphone 8 on saucelabs +browserprofile.GalaxyS9.name = Samsung Galaxy S9 on SauceLabs +browserprofile.GalaxyS9.browser = Android +browserprofile.GalaxyS9.browserName = Chrome +browserprofile.GalaxyS9.platformName = Android +browserprofile.GalaxyS9.platformVersion = 7.1 +browserprofile.GalaxyS9.deviceName = Samsung Galaxy S9 WQHD GoogleAPI Emulator +browserprofile.GalaxyS9.deviceOrientation = portrait +browserprofile.GalaxyS9.testEnvironment = saucelabs + +browserprofile.iphone8.name = iPhone 8 on SauceLabs browserprofile.iphone8.browser = iphone browserprofile.iphone8.browserName = Safari browserprofile.iphone8.platformName = iOS -browserprofile.iphone8.platformVersion = 11.0 +browserprofile.iphone8.platformVersion = 12.0 browserprofile.iphone8.deviceName = iPhone 8 browserprofile.iphone8.deviceOrientation = portrait browserprofile.iphone8.testEnvironment = saucelabs diff --git a/pom.xml b/pom.xml index b279878be..7060e1e7b 100644 --- a/pom.xml +++ b/pom.xml @@ -263,12 +263,6 @@ slf4j-api 1.7.25 - - io.appium - java-client - 7.0.0 - - diff --git a/src/main/java/com/xceptance/neodymium/module/statement/browser/multibrowser/BrowserRunnerHelper.java b/src/main/java/com/xceptance/neodymium/module/statement/browser/multibrowser/BrowserRunnerHelper.java index 7eb93ca13..10e505888 100644 --- a/src/main/java/com/xceptance/neodymium/module/statement/browser/multibrowser/BrowserRunnerHelper.java +++ b/src/main/java/com/xceptance/neodymium/module/statement/browser/multibrowser/BrowserRunnerHelper.java @@ -33,7 +33,6 @@ import org.openqa.selenium.remote.BrowserType; import org.openqa.selenium.remote.CapabilityType; import org.openqa.selenium.remote.CommandInfo; -import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.remote.HttpCommandExecutor; import org.openqa.selenium.remote.RemoteWebDriver; @@ -42,27 +41,17 @@ import com.xceptance.neodymium.module.statement.browser.multibrowser.configuration.TestEnvironment; import com.xceptance.neodymium.util.Neodymium; -import io.appium.java_client.android.AndroidDriver; -import io.appium.java_client.ios.IOSDriver; - public final class BrowserRunnerHelper { - private static List androidBrowsers = new LinkedList(); - private static List chromeBrowsers = new LinkedList(); private static List firefoxBrowsers = new LinkedList(); private static List internetExplorerBrowsers = new LinkedList(); - private static List iPhoneBrowsers = new LinkedList(); - - private static List iPadBrowsers = new LinkedList(); - static { - androidBrowsers.add(BrowserType.ANDROID); - + chromeBrowsers.add(BrowserType.ANDROID); chromeBrowsers.add(BrowserType.CHROME); firefoxBrowsers.add(BrowserType.FIREFOX); @@ -73,9 +62,6 @@ public final class BrowserRunnerHelper internetExplorerBrowsers.add(BrowserType.IE_HTA); internetExplorerBrowsers.add(BrowserType.IEXPLORE); internetExplorerBrowsers.add(BrowserType.IEXPLORE_PROXY); - - iPhoneBrowsers.add(BrowserType.IPHONE); - iPadBrowsers.add(BrowserType.IPAD); } /** @@ -302,28 +288,6 @@ else if (internetExplorerBrowsers.contains(browserName)) return new InternetExplorerDriver(options); } - else if (androidBrowsers.contains(browserName)) - { - DesiredCapabilities options = DesiredCapabilities.android(); - options.merge(capabilities); - - return new AndroidDriver<>(options); - } - else if (iPhoneBrowsers.contains(browserName)) - { - DesiredCapabilities options = DesiredCapabilities.iphone(); - options.merge(capabilities); - - return new IOSDriver<>(options); - - } - else if (iPadBrowsers.contains(browserName)) - { - DesiredCapabilities options = DesiredCapabilities.ipad(); - options.merge(capabilities); - - return new IOSDriver<>(options); - } } else { diff --git a/src/main/java/com/xceptance/neodymium/module/statement/browser/multibrowser/configuration/BrowserConfigurationMapper.java b/src/main/java/com/xceptance/neodymium/module/statement/browser/multibrowser/configuration/BrowserConfigurationMapper.java index ca48b0a9e..365dd3ea2 100644 --- a/src/main/java/com/xceptance/neodymium/module/statement/browser/multibrowser/configuration/BrowserConfigurationMapper.java +++ b/src/main/java/com/xceptance/neodymium/module/statement/browser/multibrowser/configuration/BrowserConfigurationMapper.java @@ -15,8 +15,6 @@ import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.safari.SafariOptions; -import io.appium.java_client.remote.MobileCapabilityType; - public class BrowserConfigurationMapper { private static final String BROWSER = "browser"; @@ -45,14 +43,14 @@ public class BrowserConfigurationMapper private static final String ARGUMENTS = "arguments"; - // appium specific propertys + // Appium specific properties private static final String APPIUM_VERSION = "appiumVersion"; private static final String BROWSER_NAME = "browserName"; private static final String PLATFORM_NAME = "platformName"; - private static final String PLATTFORM_VERSION = "platformVersion"; + private static final String PLATFORM_VERSION = "platformVersion"; private static final String APP = "app"; @@ -116,10 +114,11 @@ else if ("opera".equals(emulatedBrowser)) */ String emulatedPlatform = browserProfileConfiguration.get(PLATFORM); if (!StringUtils.isEmpty(emulatedPlatform)) - { capabilities.setCapability(CapabilityType.PLATFORM, emulatedPlatform); - capabilities.setCapability(CapabilityType.PLATFORM_NAME, emulatedPlatform); - } + + String emulatedPlatformName = browserProfileConfiguration.get(PLATFORM_NAME); + if (!StringUtils.isEmpty(emulatedPlatformName)) + capabilities.setCapability(CapabilityType.PLATFORM_NAME, emulatedPlatformName); String emulatedVersion = browserProfileConfiguration.get(BROWSER_VERSION); if (!StringUtils.isEmpty(emulatedVersion)) @@ -141,31 +140,31 @@ else if ("opera".equals(emulatedBrowser)) String appiumVersion = browserProfileConfiguration.get(APPIUM_VERSION); if (!StringUtils.isEmpty(appiumVersion)) - capabilities.setCapability(MobileCapabilityType.APPIUM_VERSION, appiumVersion); + capabilities.setCapability(APPIUM_VERSION, appiumVersion); String browserName = browserProfileConfiguration.get(BROWSER_NAME); if (!StringUtils.isEmpty(browserName)) - capabilities.setCapability(CapabilityType.BROWSER_NAME, browserName); + capabilities.setCapability(BROWSER_NAME, browserName); - String plattformVersion = browserProfileConfiguration.get(PLATTFORM_VERSION); + String plattformVersion = browserProfileConfiguration.get(PLATFORM_VERSION); if (!StringUtils.isEmpty(plattformVersion)) - capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, plattformVersion); + capabilities.setCapability(PLATFORM_VERSION, plattformVersion); String plattformName = browserProfileConfiguration.get(PLATFORM_NAME); if (!StringUtils.isEmpty(plattformName)) - capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, plattformName); + capabilities.setCapability(PLATFORM_NAME, plattformName); String app = browserProfileConfiguration.get(APP); if (!StringUtils.isEmpty(app)) - capabilities.setCapability(MobileCapabilityType.APP, app); + capabilities.setCapability(APP, app); String automationName = browserProfileConfiguration.get(AUTOMATION_NAME); if (!StringUtils.isEmpty(automationName)) - capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, automationName); + capabilities.setCapability(AUTOMATION_NAME, automationName); String oriantation = browserProfileConfiguration.get(ORIENTATION); if (!StringUtils.isEmpty(oriantation)) - capabilities.setCapability(MobileCapabilityType.ORIENTATION, oriantation); + capabilities.setCapability(ORIENTATION, oriantation); /* * Chrome device emulation