diff --git a/src/main/java/io/appium/java_client/android/AndroidOptions.java b/src/main/java/io/appium/java_client/android/AndroidOptions.java index 780f92cd4..3841ab62c 100644 --- a/src/main/java/io/appium/java_client/android/AndroidOptions.java +++ b/src/main/java/io/appium/java_client/android/AndroidOptions.java @@ -20,6 +20,11 @@ import io.appium.java_client.remote.MobilePlatform; import org.openqa.selenium.Capabilities; +/** + * Use the specific options class for your driver, + * for example UiAutomator2Options. + */ +@Deprecated public class AndroidOptions extends MobileOptions { public AndroidOptions() { setAndroidPlatformName(); diff --git a/src/main/java/io/appium/java_client/android/options/UiAutomator2Options.java b/src/main/java/io/appium/java_client/android/options/UiAutomator2Options.java new file mode 100644 index 000000000..3514db845 --- /dev/null +++ b/src/main/java/io/appium/java_client/android/options/UiAutomator2Options.java @@ -0,0 +1,53 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * See the NOTICE file distributed with this work for additional + * information regarding copyright ownership. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.appium.java_client.android.options; + +import io.appium.java_client.remote.AutomationName; +import io.appium.java_client.remote.MobilePlatform; +import io.appium.java_client.remote.options.BaseOptions; +import io.appium.java_client.remote.options.SupportsAppOption; +import io.appium.java_client.remote.options.SupportsAutoWebViewOption; +import io.appium.java_client.remote.options.SupportsClearSystemFilesOption; +import io.appium.java_client.remote.options.SupportsDeviceNameOption; +import io.appium.java_client.remote.options.SupportsEnablePerformanceLoggingOption; +import io.appium.java_client.remote.options.SupportsLanguageOption; +import io.appium.java_client.remote.options.SupportsLocaleOption; +import io.appium.java_client.remote.options.SupportsOrientationOption; +import io.appium.java_client.remote.options.SupportsOtherAppsOption; +import io.appium.java_client.remote.options.SupportsUdidOption; +import org.openqa.selenium.Capabilities; + +public class UiAutomator2Options extends BaseOptions implements + SupportsAppOption, SupportsAutoWebViewOption, + SupportsClearSystemFilesOption, SupportsDeviceNameOption, + SupportsEnablePerformanceLoggingOption, SupportsLanguageOption, + SupportsLocaleOption, SupportsOrientationOption, + SupportsOtherAppsOption, SupportsUdidOption { + public UiAutomator2Options() { + setCommonOptions(); + } + + public UiAutomator2Options(Capabilities source) { + super(source); + setCommonOptions(); + } + + private void setCommonOptions() { + setPlatformName(MobilePlatform.ANDROID); + setAutomationName(AutomationName.ANDROID_UIAUTOMATOR2); + } +} diff --git a/src/main/java/io/appium/java_client/ios/IOSOptions.java b/src/main/java/io/appium/java_client/ios/IOSOptions.java index 9d4c82b6e..9cb847d1e 100644 --- a/src/main/java/io/appium/java_client/ios/IOSOptions.java +++ b/src/main/java/io/appium/java_client/ios/IOSOptions.java @@ -20,6 +20,11 @@ import io.appium.java_client.remote.MobilePlatform; import org.openqa.selenium.Capabilities; +/** + * Use the specific options class for your driver, + * for example XCUITestOptions. + */ +@Deprecated public class IOSOptions extends MobileOptions { public IOSOptions() { setIOSPlatformName(); diff --git a/src/main/java/io/appium/java_client/ios/options/XCUITestOptions.java b/src/main/java/io/appium/java_client/ios/options/XCUITestOptions.java new file mode 100644 index 000000000..8c8143da1 --- /dev/null +++ b/src/main/java/io/appium/java_client/ios/options/XCUITestOptions.java @@ -0,0 +1,53 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * See the NOTICE file distributed with this work for additional + * information regarding copyright ownership. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.appium.java_client.ios.options; + +import io.appium.java_client.remote.AutomationName; +import io.appium.java_client.remote.MobilePlatform; +import io.appium.java_client.remote.options.BaseOptions; +import io.appium.java_client.remote.options.SupportsAppOption; +import io.appium.java_client.remote.options.SupportsAutoWebViewOption; +import io.appium.java_client.remote.options.SupportsClearSystemFilesOption; +import io.appium.java_client.remote.options.SupportsDeviceNameOption; +import io.appium.java_client.remote.options.SupportsEnablePerformanceLoggingOption; +import io.appium.java_client.remote.options.SupportsLanguageOption; +import io.appium.java_client.remote.options.SupportsLocaleOption; +import io.appium.java_client.remote.options.SupportsOrientationOption; +import io.appium.java_client.remote.options.SupportsOtherAppsOption; +import io.appium.java_client.remote.options.SupportsUdidOption; +import org.openqa.selenium.Capabilities; + +public class XCUITestOptions extends BaseOptions implements + SupportsAppOption, SupportsAutoWebViewOption, + SupportsClearSystemFilesOption, SupportsDeviceNameOption, + SupportsEnablePerformanceLoggingOption, SupportsLanguageOption, + SupportsLocaleOption, SupportsOrientationOption, + SupportsOtherAppsOption, SupportsUdidOption { + public XCUITestOptions() { + setCommonOptions(); + } + + public XCUITestOptions(Capabilities source) { + super(source); + setCommonOptions(); + } + + private void setCommonOptions() { + setPlatformName(MobilePlatform.IOS); + setAutomationName(AutomationName.IOS_XCUI_TEST); + } +} diff --git a/src/main/java/io/appium/java_client/remote/MobileOptions.java b/src/main/java/io/appium/java_client/remote/MobileOptions.java index bf8ea1f38..fad8d5ad1 100644 --- a/src/main/java/io/appium/java_client/remote/MobileOptions.java +++ b/src/main/java/io/appium/java_client/remote/MobileOptions.java @@ -16,16 +16,32 @@ package io.appium.java_client.remote; +import io.appium.java_client.remote.options.BaseOptions; +import io.appium.java_client.remote.options.SupportsAppOption; +import io.appium.java_client.remote.options.SupportsAutoWebViewOption; +import io.appium.java_client.remote.options.SupportsClearSystemFilesOption; +import io.appium.java_client.remote.options.SupportsDeviceNameOption; +import io.appium.java_client.remote.options.SupportsEnablePerformanceLoggingOption; +import io.appium.java_client.remote.options.SupportsLanguageOption; +import io.appium.java_client.remote.options.SupportsLocaleOption; +import io.appium.java_client.remote.options.SupportsOrientationOption; +import io.appium.java_client.remote.options.SupportsOtherAppsOption; +import io.appium.java_client.remote.options.SupportsUdidOption; import org.openqa.selenium.Capabilities; -import org.openqa.selenium.MutableCapabilities; -import org.openqa.selenium.Platform; -import org.openqa.selenium.ScreenOrientation; -import org.openqa.selenium.remote.CapabilityType; -import java.net.URL; -import java.time.Duration; - -public class MobileOptions> extends MutableCapabilities { +/** + * Use the specific options class for your driver, + * for example XCUITestOptions or UiAutomator2Options. + * + * @param The child class for a proper chaining. + */ +@Deprecated +public class MobileOptions> extends BaseOptions + implements SupportsAppOption, SupportsAutoWebViewOption, + SupportsClearSystemFilesOption, SupportsDeviceNameOption, + SupportsEnablePerformanceLoggingOption, SupportsLanguageOption, + SupportsLocaleOption, SupportsOrientationOption, SupportsOtherAppsOption, + SupportsUdidOption { /** * Creates new instance with no preset capabilities. @@ -41,466 +57,4 @@ public MobileOptions() { public MobileOptions(Capabilities source) { super(source); } - - /** - * Set the kind of mobile device or emulator to use. - * - * @param platform the kind of mobile device or emulator to use. - * @return this MobileOptions, for chaining. - * @see org.openqa.selenium.remote.CapabilityType#PLATFORM_NAME - */ - public T setPlatformName(String platform) { - return amend(CapabilityType.PLATFORM_NAME, platform); - } - - /** - * Set the absolute local path for the location of the App. - * The or remote http URL to a {@code .ipa} file (IOS), - * - * @param path is a String representing the location of the App - * @return this MobileOptions, for chaining. - * @see MobileCapabilityType#APP - */ - public T setApp(String path) { - return amend(MobileCapabilityType.APP, path); - } - - /** - * Set the remote http URL for the location of the App. - * - * @param url is the URL representing the location of the App - * @return this MobileOptions, for chaining. - * @see MobileCapabilityType#APP - */ - public T setApp(URL url) { - return setApp(url.toString()); - } - - /** - * Get the app location. - * - * @return String representing app location - * @see MobileCapabilityType#APP - */ - public String getApp() { - return (String) getCapability(MobileCapabilityType.APP); - } - - /** - * Set the automation engine to use. - * - * @param name is the name of the automation engine - * @return this MobileOptions, for chaining. - * @see MobileCapabilityType#AUTOMATION_NAME - */ - public T setAutomationName(String name) { - return amend(MobileCapabilityType.AUTOMATION_NAME, name); - } - - /** - * Get the automation engine to use. - * - * @return String representing the name of the automation engine - * @see MobileCapabilityType#AUTOMATION_NAME - */ - public String getAutomationName() { - return (String) getCapability(MobileCapabilityType.AUTOMATION_NAME); - } - - /** - * Set the app to move directly into Webview context. - * - * @return this MobileOptions, for chaining. - * @see MobileCapabilityType#AUTO_WEBVIEW - */ - public T setAutoWebview() { - return setAutoWebview(true); - } - - /** - * Set whether the app moves directly into Webview context. - * - * @param bool is whether the app moves directly into Webview context. - * @return this MobileOptions, for chaining. - * @see MobileCapabilityType#AUTO_WEBVIEW - */ - public T setAutoWebview(boolean bool) { - return amend(MobileCapabilityType.AUTO_WEBVIEW, bool); - } - - /** - * Get whether the app moves directly into Webview context. - * - * @return true if app moves directly into Webview context. - * @see MobileCapabilityType#AUTO_WEBVIEW - */ - public boolean doesAutoWebview() { - return (boolean) getCapability(MobileCapabilityType.AUTO_WEBVIEW); - } - - /** - * Set the app to delete any generated files at the end of a session. - * - * @return this MobileOptions, for chaining. - * @see MobileCapabilityType#CLEAR_SYSTEM_FILES - */ - public T setClearSystemFiles() { - return setClearSystemFiles(true); - } - - /** - * Set whether the app deletes generated files at the end of a session. - * - * @param bool is whether the app deletes generated files at the end of a session. - * @return this MobileOptions, for chaining. - * @see MobileCapabilityType#CLEAR_SYSTEM_FILES - */ - public T setClearSystemFiles(boolean bool) { - return amend(MobileCapabilityType.CLEAR_SYSTEM_FILES, bool); - } - - /** - * Get whether the app deletes generated files at the end of a session. - * - * @return true if the app deletes generated files at the end of a session. - * @see MobileCapabilityType#CLEAR_SYSTEM_FILES - */ - public boolean doesClearSystemFiles() { - return (boolean) getCapability(MobileCapabilityType.CLEAR_SYSTEM_FILES); - } - - /** - * Set the name of the device. - * - * @param deviceName is the name of the device. - * @return this MobileOptions, for chaining. - * @see MobileCapabilityType#DEVICE_NAME - */ - public T setDeviceName(String deviceName) { - return amend(MobileCapabilityType.DEVICE_NAME, deviceName); - } - - /** - * Get the name of the device. - * - * @return String representing the name of the device. - * @see MobileCapabilityType#DEVICE_NAME - */ - public String getDeviceName() { - return (String) getCapability(MobileCapabilityType.DEVICE_NAME); - } - - /** - * Set the app to enable performance logging. - * - * @return this MobileOptions, for chaining. - * @see MobileCapabilityType#ENABLE_PERFORMANCE_LOGGING - */ - public T setEnablePerformanceLogging() { - return setEnablePerformanceLogging(true); - } - - /** - * Set whether the app logs performance. - * - * @param bool is whether the app logs performance. - * @return this MobileOptions, for chaining. - * @see MobileCapabilityType#ENABLE_PERFORMANCE_LOGGING - */ - public T setEnablePerformanceLogging(boolean bool) { - return amend(MobileCapabilityType.ENABLE_PERFORMANCE_LOGGING, bool); - } - - /** - * Get the app logs performance. - * - * @return true if the app logs performance. - * @see MobileCapabilityType#ENABLE_PERFORMANCE_LOGGING - */ - public boolean isEnablePerformanceLogging() { - return (boolean) getCapability(MobileCapabilityType.ENABLE_PERFORMANCE_LOGGING); - } - - /** - * Set the app to report the timings for various Appium-internal events. - * - * @return this MobileOptions, for chaining. - * @see MobileCapabilityType#EVENT_TIMINGS - */ - public T setEventTimings() { - return setEventTimings(true); - } - - /** - * Set whether the app reports the timings for various Appium-internal events. - * - * @param bool is whether the app enables event timings. - * @return this MobileOptions, for chaining. - * @see MobileCapabilityType#EVENT_TIMINGS - */ - public T setEventTimings(boolean bool) { - return amend(MobileCapabilityType.EVENT_TIMINGS, bool); - } - - /** - * Get whether the app reports the timings for various Appium-internal events. - * - * @return true if the app reports event timings. - * @see MobileCapabilityType#EVENT_TIMINGS - */ - public boolean doesEventTimings() { - return (boolean) getCapability(MobileCapabilityType.EVENT_TIMINGS); - } - - /** - * Set the app to do a full reset. - * - * @return this MobileOptions, for chaining. - * @see MobileCapabilityType#FULL_RESET - */ - public T setFullReset() { - return setFullReset(true); - } - - /** - * Set whether the app does a full reset. - * - * @param bool is whether the app does a full reset. - * @return this MobileOptions, for chaining. - * @see MobileCapabilityType#FULL_RESET - */ - public T setFullReset(boolean bool) { - return amend(MobileCapabilityType.FULL_RESET, bool); - } - - /** - * Get whether the app does a full reset. - * - * @return true if the app does a full reset. - * @see MobileCapabilityType#FULL_RESET - */ - public boolean doesFullReset() { - return (boolean) getCapability(MobileCapabilityType.FULL_RESET); - } - - /** - * Set language abbreviation for use in session. - * - * @param language is the language abbreviation. - * @return this MobileOptions, for chaining. - * @see MobileCapabilityType#LANGUAGE - */ - public T setLanguage(String language) { - return amend(MobileCapabilityType.LANGUAGE, language); - } - - /** - * Get language abbreviation for use in session. - * - * @return String representing the language abbreviation. - * @see MobileCapabilityType#LANGUAGE - */ - public String getLanguage() { - return (String) getCapability(MobileCapabilityType.LANGUAGE); - } - - /** - * Set locale abbreviation for use in session. - * - * @param locale is the locale abbreviation. - * @return this MobileOptions, for chaining. - * @see MobileCapabilityType#LOCALE - */ - public T setLocale(String locale) { - return amend(MobileCapabilityType.LOCALE, locale); - } - - /** - * Get locale abbreviation for use in session. - * - * @return String representing the locale abbreviation. - * @see MobileCapabilityType#LOCALE - */ - public String getLocale() { - return (String) getCapability(MobileCapabilityType.LOCALE); - } - - /** - * Set the timeout for new commands. - * - * @param duration is the allowed time before seeing a new command. - * @return this MobileOptions, for chaining. - * @see MobileCapabilityType#NEW_COMMAND_TIMEOUT - */ - public T setNewCommandTimeout(Duration duration) { - return amend(MobileCapabilityType.NEW_COMMAND_TIMEOUT, duration.getSeconds()); - } - - /** - * Get the timeout for new commands. - * - * @return allowed time before seeing a new command. - * @see MobileCapabilityType#NEW_COMMAND_TIMEOUT - */ - public Duration getNewCommandTimeout() { - Object duration = getCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT); - return Duration.ofSeconds(Long.parseLong("" + duration)); - } - - /** - * Set the app not to do a reset. - * - * @return this MobileOptions, for chaining. - * @see MobileCapabilityType#NO_RESET - */ - public T setNoReset() { - return setNoReset(true); - } - - /** - * Set whether the app does not do a reset. - * - * @param bool is whether the app does not do a reset. - * @return this MobileOptions, for chaining. - * @see MobileCapabilityType#NO_RESET - */ - public T setNoReset(boolean bool) { - return amend(MobileCapabilityType.NO_RESET, bool); - } - - /** - * Get whether the app does not do a reset. - * - * @return true if the app does not do a reset. - * @see MobileCapabilityType#NO_RESET - */ - public boolean doesNoReset() { - return (boolean) getCapability(MobileCapabilityType.NO_RESET); - } - - /** - * Set the orientation of the screen. - * - * @param orientation is the screen orientation. - * @return this MobileOptions, for chaining. - * @see MobileCapabilityType#ORIENTATION - */ - public T setOrientation(ScreenOrientation orientation) { - return amend(MobileCapabilityType.ORIENTATION, orientation); - } - - /** - * Get the orientation of the screen. - * - * @return ScreenOrientation of the app. - * @see MobileCapabilityType#ORIENTATION - */ - public ScreenOrientation getOrientation() { - return (ScreenOrientation) getCapability(MobileCapabilityType.ORIENTATION); - } - - /** - * Set the location of the app(s) to install before running a test. - * - * @param apps is the apps to install. - * @return this MobileOptions, for chaining. - * @see MobileCapabilityType#OTHER_APPS - */ - public T setOtherApps(String apps) { - return amend(MobileCapabilityType.OTHER_APPS, apps); - } - - /** - * Get the list of apps to install before running a test. - * - * @return String of apps to install. - * @see MobileCapabilityType#OTHER_APPS - */ - public String getOtherApps() { - return (String) getCapability(MobileCapabilityType.OTHER_APPS); - } - - /** - * Set the version of the platform. - * - * @param version is the platform version. - * @return this MobileOptions, for chaining. - * @see MobileCapabilityType#PLATFORM_VERSION - */ - public T setPlatformVersion(String version) { - return amend(MobileCapabilityType.PLATFORM_VERSION, version); - } - - /** - * Get the version of the platform. - * - * @return String representing the platform version. - * @see MobileCapabilityType#PLATFORM_VERSION - */ - public String getPlatformVersion() { - return (String) getCapability(MobileCapabilityType.PLATFORM_VERSION); - } - - /** - * Set the app to print page source when a find operation fails. - * - * @return this MobileOptions, for chaining. - * @see MobileCapabilityType#PRINT_PAGE_SOURCE_ON_FIND_FAILURE - */ - public T setPrintPageSourceOnFindFailure() { - return setPrintPageSourceOnFindFailure(true); - } - - /** - * Set whether the app to print page source when a find operation fails. - * - * @param bool is whether to print page source. - * @return this MobileOptions, for chaining. - * @see MobileCapabilityType#PRINT_PAGE_SOURCE_ON_FIND_FAILURE - */ - public T setPrintPageSourceOnFindFailure(boolean bool) { - return amend(MobileCapabilityType.PRINT_PAGE_SOURCE_ON_FIND_FAILURE, bool); - } - - /** - * Get whether the app to print page source when a find operation fails. - * - * @return true if app prints page source. - * @see MobileCapabilityType#PRINT_PAGE_SOURCE_ON_FIND_FAILURE - */ - public boolean doesPrintPageSourceOnFindFailure() { - return (boolean) getCapability(MobileCapabilityType.PRINT_PAGE_SOURCE_ON_FIND_FAILURE); - } - - /** - * Set the id of the device. - * - * @param id is the unique device identifier. - * @return this MobileOptions, for chaining. - * @see MobileCapabilityType#UDID - */ - public T setUdid(String id) { - return amend(MobileCapabilityType.UDID, id); - } - - /** - * Get the id of the device. - * - * @return String representing the unique device identifier. - * @see MobileCapabilityType#UDID - */ - public String getUdid() { - return (String) getCapability(MobileCapabilityType.UDID); - } - - @Override - public T merge(Capabilities extraCapabilities) { - super.merge(extraCapabilities); - return (T) this; - } - - protected T amend(String optionName, Object value) { - setCapability(optionName, value); - return (T) this; - } } diff --git a/src/main/java/io/appium/java_client/remote/options/BaseOptions.java b/src/main/java/io/appium/java_client/remote/options/BaseOptions.java new file mode 100644 index 000000000..cdfb8f168 --- /dev/null +++ b/src/main/java/io/appium/java_client/remote/options/BaseOptions.java @@ -0,0 +1,273 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * See the NOTICE file distributed with this work for additional + * information regarding copyright ownership. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.appium.java_client.remote.options; + +import io.appium.java_client.remote.MobileCapabilityType; +import org.openqa.selenium.Capabilities; +import org.openqa.selenium.MutableCapabilities; +import org.openqa.selenium.remote.AcceptedW3CCapabilityKeys; +import org.openqa.selenium.remote.CapabilityType; + +import java.time.Duration; +import java.util.Map; +import java.util.stream.Collectors; + +import static io.appium.java_client.internal.CapabilityHelpers.APPIUM_PREFIX; +import static java.util.Collections.unmodifiableMap; + +/** + * This class represents capabilities that are available in the base driver, + * e.g. are acceptable by any Appium driver + * + * @param The child class for a proper chaining. + */ +@SuppressWarnings("unused") +public class BaseOptions> extends MutableCapabilities + implements CanSetCapability { + private static final AcceptedW3CCapabilityKeys W3C_KEY_PATTERNS = + new AcceptedW3CCapabilityKeys(); + + + /** + * Creates new instance with no preset capabilities. + */ + public BaseOptions() { + } + + /** + * Creates new instance with provided capabilities. + * + * @param source is Capabilities instance to merge into new instance + */ + public BaseOptions(Capabilities source) { + super(source); + } + + /** + * Set the kind of mobile device or emulator to use. + * + * @param platform the kind of mobile device or emulator to use. + * @return this MobileOptions, for chaining. + * @see CapabilityType#PLATFORM_NAME + */ + public T setPlatformName(String platform) { + return amend(CapabilityType.PLATFORM_NAME, platform); + } + + /** + * Set the automation engine to use. + * + * @param name is the name of the automation engine + * @return this MobileOptions, for chaining. + * @see MobileCapabilityType#AUTOMATION_NAME + */ + public T setAutomationName(String name) { + return amend(MobileCapabilityType.AUTOMATION_NAME, name); + } + + /** + * Get the automation engine to use. + * + * @return String representing the name of the automation engine + * @see MobileCapabilityType#AUTOMATION_NAME + */ + public String getAutomationName() { + return (String) getCapability(MobileCapabilityType.AUTOMATION_NAME); + } + + /** + * Set the app to report the timings for various Appium-internal events. + * + * @return this MobileOptions, for chaining. + * @see MobileCapabilityType#EVENT_TIMINGS + */ + public T setEventTimings() { + return setEventTimings(true); + } + + /** + * Set whether the app reports the timings for various Appium-internal events. + * + * @param bool is whether the app enables event timings. + * @return this MobileOptions, for chaining. + * @see MobileCapabilityType#EVENT_TIMINGS + */ + public T setEventTimings(boolean bool) { + return amend(MobileCapabilityType.EVENT_TIMINGS, bool); + } + + /** + * Get whether the app reports the timings for various Appium-internal events. + * + * @return true if the app reports event timings. + * @see MobileCapabilityType#EVENT_TIMINGS + */ + public boolean doesEventTimings() { + return (boolean) getCapability(MobileCapabilityType.EVENT_TIMINGS); + } + + /** + * Set the app to do a full reset. + * + * @return this MobileOptions, for chaining. + * @see MobileCapabilityType#FULL_RESET + */ + public T setFullReset() { + return setFullReset(true); + } + + /** + * Set whether the app does a full reset. + * + * @param bool is whether the app does a full reset. + * @return this MobileOptions, for chaining. + * @see MobileCapabilityType#FULL_RESET + */ + public T setFullReset(boolean bool) { + return amend(MobileCapabilityType.FULL_RESET, bool); + } + + /** + * Get whether the app does a full reset. + * + * @return true if the app does a full reset. + * @see MobileCapabilityType#FULL_RESET + */ + public boolean doesFullReset() { + return (boolean) getCapability(MobileCapabilityType.FULL_RESET); + } + + /** + * Set the timeout for new commands. + * + * @param duration is the allowed time before seeing a new command. + * @return this MobileOptions, for chaining. + * @see MobileCapabilityType#NEW_COMMAND_TIMEOUT + */ + public T setNewCommandTimeout(Duration duration) { + return amend(MobileCapabilityType.NEW_COMMAND_TIMEOUT, duration.getSeconds()); + } + + /** + * Get the timeout for new commands. + * + * @return allowed time before seeing a new command. + * @see MobileCapabilityType#NEW_COMMAND_TIMEOUT + */ + public Duration getNewCommandTimeout() { + Object duration = getCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT); + return Duration.ofSeconds(Long.parseLong("" + duration)); + } + + /** + * Set the app not to do a reset. + * + * @return this MobileOptions, for chaining. + * @see MobileCapabilityType#NO_RESET + */ + public T setNoReset() { + return setNoReset(true); + } + + /** + * Set whether the app does not do a reset. + * + * @param bool is whether the app does not do a reset. + * @return this MobileOptions, for chaining. + * @see MobileCapabilityType#NO_RESET + */ + public T setNoReset(boolean bool) { + return amend(MobileCapabilityType.NO_RESET, bool); + } + + /** + * Get whether the app does not do a reset. + * + * @return true if the app does not do a reset. + * @see MobileCapabilityType#NO_RESET + */ + public boolean doesNoReset() { + return (boolean) getCapability(MobileCapabilityType.NO_RESET); + } + + /** + * Set the version of the platform. + * + * @param version is the platform version. + * @return this MobileOptions, for chaining. + * @see MobileCapabilityType#PLATFORM_VERSION + */ + public T setPlatformVersion(String version) { + return amend(MobileCapabilityType.PLATFORM_VERSION, version); + } + + /** + * Get the version of the platform. + * + * @return String representing the platform version. + * @see MobileCapabilityType#PLATFORM_VERSION + */ + public String getPlatformVersion() { + return (String) getCapability(MobileCapabilityType.PLATFORM_VERSION); + } + + /** + * Set the app to print page source when a find operation fails. + * + * @return this MobileOptions, for chaining. + * @see MobileCapabilityType#PRINT_PAGE_SOURCE_ON_FIND_FAILURE + */ + public T setPrintPageSourceOnFindFailure() { + return setPrintPageSourceOnFindFailure(true); + } + + /** + * Set whether the app to print page source when a find operation fails. + * + * @param bool is whether to print page source. + * @return this MobileOptions, for chaining. + * @see MobileCapabilityType#PRINT_PAGE_SOURCE_ON_FIND_FAILURE + */ + public T setPrintPageSourceOnFindFailure(boolean bool) { + return amend(MobileCapabilityType.PRINT_PAGE_SOURCE_ON_FIND_FAILURE, bool); + } + + /** + * Get whether the app to print page source when a find operation fails. + * + * @return true if app prints page source. + * @see MobileCapabilityType#PRINT_PAGE_SOURCE_ON_FIND_FAILURE + */ + public boolean doesPrintPageSourceOnFindFailure() { + return (boolean) getCapability(MobileCapabilityType.PRINT_PAGE_SOURCE_ON_FIND_FAILURE); + } + + @Override + public Map asMap() { + return unmodifiableMap(super.asMap().entrySet().stream() + .collect(Collectors.toMap(entry -> W3C_KEY_PATTERNS.test(entry.getKey()) + ? entry.getKey() : APPIUM_PREFIX + entry.getKey(), Map.Entry::getValue) + )); + } + + @Override + public T merge(Capabilities extraCapabilities) { + super.merge(extraCapabilities); + //noinspection unchecked + return (T) this; + } +} diff --git a/src/main/java/io/appium/java_client/remote/options/CanSetCapability.java b/src/main/java/io/appium/java_client/remote/options/CanSetCapability.java new file mode 100644 index 000000000..c992569c6 --- /dev/null +++ b/src/main/java/io/appium/java_client/remote/options/CanSetCapability.java @@ -0,0 +1,34 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * See the NOTICE file distributed with this work for additional + * information regarding copyright ownership. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.appium.java_client.remote.options; + +public interface CanSetCapability> { + void setCapability(String key, Object value); + + /** + * Set a custom option. + * + * @param optionName Option name. + * @param value Option value. + * @return self instance for chaining. + */ + default T amend(String optionName, Object value) { + setCapability(optionName, value); + //noinspection unchecked + return (T) this; + } +} diff --git a/src/main/java/io/appium/java_client/remote/options/SupportsAppOption.java b/src/main/java/io/appium/java_client/remote/options/SupportsAppOption.java new file mode 100644 index 000000000..8e112a32f --- /dev/null +++ b/src/main/java/io/appium/java_client/remote/options/SupportsAppOption.java @@ -0,0 +1,59 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * See the NOTICE file distributed with this work for additional + * information regarding copyright ownership. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.appium.java_client.remote.options; + +import io.appium.java_client.remote.MobileCapabilityType; +import org.openqa.selenium.Capabilities; + +import java.net.URL; + +public interface SupportsAppOption> extends + Capabilities, CanSetCapability { + + /** + * Set the absolute local path for the location of the App. + * The or remote http URL to a {@code .ipa} file (IOS), + * + * @param path is a String representing the location of the App + * @return this MobileOptions, for chaining. + * @see MobileCapabilityType#APP + */ + default T setApp(String path) { + return amend(MobileCapabilityType.APP, path); + } + + /** + * Set the remote http URL for the location of the App. + * + * @param url is the URL representing the location of the App + * @return this MobileOptions, for chaining. + * @see MobileCapabilityType#APP + */ + default T setApp(URL url) { + return setApp(url.toString()); + } + + /** + * Get the app location. + * + * @return String representing app location + * @see MobileCapabilityType#APP + */ + default String getApp() { + return (String) getCapability(MobileCapabilityType.APP); + } +} diff --git a/src/main/java/io/appium/java_client/remote/options/SupportsAutoWebViewOption.java b/src/main/java/io/appium/java_client/remote/options/SupportsAutoWebViewOption.java new file mode 100644 index 000000000..8c68c20bf --- /dev/null +++ b/src/main/java/io/appium/java_client/remote/options/SupportsAutoWebViewOption.java @@ -0,0 +1,54 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * See the NOTICE file distributed with this work for additional + * information regarding copyright ownership. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.appium.java_client.remote.options; + +import io.appium.java_client.remote.MobileCapabilityType; +import org.openqa.selenium.Capabilities; + +public interface SupportsAutoWebViewOption> extends + Capabilities, CanSetCapability { + /** + * Set the app to move directly into Webview context. + * + * @return this MobileOptions, for chaining. + * @see MobileCapabilityType#AUTO_WEBVIEW + */ + default T setAutoWebview() { + return setAutoWebview(true); + } + + /** + * Set whether the app moves directly into Webview context. + * + * @param bool is whether the app moves directly into Webview context. + * @return this MobileOptions, for chaining. + * @see MobileCapabilityType#AUTO_WEBVIEW + */ + default T setAutoWebview(boolean bool) { + return amend(MobileCapabilityType.AUTO_WEBVIEW, bool); + } + + /** + * Get whether the app moves directly into Webview context. + * + * @return true if app moves directly into Webview context. + * @see MobileCapabilityType#AUTO_WEBVIEW + */ + default boolean doesAutoWebview() { + return (boolean) getCapability(MobileCapabilityType.AUTO_WEBVIEW); + } +} diff --git a/src/main/java/io/appium/java_client/remote/options/SupportsClearSystemFilesOption.java b/src/main/java/io/appium/java_client/remote/options/SupportsClearSystemFilesOption.java new file mode 100644 index 000000000..162956fc1 --- /dev/null +++ b/src/main/java/io/appium/java_client/remote/options/SupportsClearSystemFilesOption.java @@ -0,0 +1,55 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * See the NOTICE file distributed with this work for additional + * information regarding copyright ownership. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.appium.java_client.remote.options; + +import io.appium.java_client.remote.MobileCapabilityType; +import org.openqa.selenium.Capabilities; + +public interface SupportsClearSystemFilesOption> extends + Capabilities, CanSetCapability { + + /** + * Set the app to delete any generated files at the end of a session. + * + * @return this MobileOptions, for chaining. + * @see MobileCapabilityType#CLEAR_SYSTEM_FILES + */ + default T setClearSystemFiles() { + return setClearSystemFiles(true); + } + + /** + * Set whether the app deletes generated files at the end of a session. + * + * @param bool is whether the app deletes generated files at the end of a session. + * @return this MobileOptions, for chaining. + * @see MobileCapabilityType#CLEAR_SYSTEM_FILES + */ + default T setClearSystemFiles(boolean bool) { + return amend(MobileCapabilityType.CLEAR_SYSTEM_FILES, bool); + } + + /** + * Get whether the app deletes generated files at the end of a session. + * + * @return true if the app deletes generated files at the end of a session. + * @see MobileCapabilityType#CLEAR_SYSTEM_FILES + */ + default boolean doesClearSystemFiles() { + return (boolean) getCapability(MobileCapabilityType.CLEAR_SYSTEM_FILES); + } +} diff --git a/src/main/java/io/appium/java_client/remote/options/SupportsDeviceNameOption.java b/src/main/java/io/appium/java_client/remote/options/SupportsDeviceNameOption.java new file mode 100644 index 000000000..91f1a8c75 --- /dev/null +++ b/src/main/java/io/appium/java_client/remote/options/SupportsDeviceNameOption.java @@ -0,0 +1,44 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * See the NOTICE file distributed with this work for additional + * information regarding copyright ownership. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.appium.java_client.remote.options; + +import io.appium.java_client.remote.MobileCapabilityType; +import org.openqa.selenium.Capabilities; + +public interface SupportsDeviceNameOption> extends + Capabilities, CanSetCapability { + /** + * Set the name of the device. + * + * @param deviceName is the name of the device. + * @return this MobileOptions, for chaining. + * @see MobileCapabilityType#DEVICE_NAME + */ + default T setDeviceName(String deviceName) { + return amend(MobileCapabilityType.DEVICE_NAME, deviceName); + } + + /** + * Get the name of the device. + * + * @return String representing the name of the device. + * @see MobileCapabilityType#DEVICE_NAME + */ + default String getDeviceName() { + return (String) getCapability(MobileCapabilityType.DEVICE_NAME); + } +} diff --git a/src/main/java/io/appium/java_client/remote/options/SupportsEnablePerformanceLoggingOption.java b/src/main/java/io/appium/java_client/remote/options/SupportsEnablePerformanceLoggingOption.java new file mode 100644 index 000000000..82ff44573 --- /dev/null +++ b/src/main/java/io/appium/java_client/remote/options/SupportsEnablePerformanceLoggingOption.java @@ -0,0 +1,55 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * See the NOTICE file distributed with this work for additional + * information regarding copyright ownership. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.appium.java_client.remote.options; + +import io.appium.java_client.remote.MobileCapabilityType; +import org.openqa.selenium.Capabilities; + +public interface SupportsEnablePerformanceLoggingOption> extends + Capabilities, CanSetCapability { + + /** + * Set the app to enable performance logging. + * + * @return this MobileOptions, for chaining. + * @see MobileCapabilityType#ENABLE_PERFORMANCE_LOGGING + */ + default T setEnablePerformanceLogging() { + return setEnablePerformanceLogging(true); + } + + /** + * Set whether the app logs performance. + * + * @param bool is whether the app logs performance. + * @return this MobileOptions, for chaining. + * @see MobileCapabilityType#ENABLE_PERFORMANCE_LOGGING + */ + default T setEnablePerformanceLogging(boolean bool) { + return amend(MobileCapabilityType.ENABLE_PERFORMANCE_LOGGING, bool); + } + + /** + * Get the app logs performance. + * + * @return true if the app logs performance. + * @see MobileCapabilityType#ENABLE_PERFORMANCE_LOGGING + */ + default boolean isEnablePerformanceLogging() { + return (boolean) getCapability(MobileCapabilityType.ENABLE_PERFORMANCE_LOGGING); + } +} diff --git a/src/main/java/io/appium/java_client/remote/options/SupportsLanguageOption.java b/src/main/java/io/appium/java_client/remote/options/SupportsLanguageOption.java new file mode 100644 index 000000000..12e46838e --- /dev/null +++ b/src/main/java/io/appium/java_client/remote/options/SupportsLanguageOption.java @@ -0,0 +1,45 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * See the NOTICE file distributed with this work for additional + * information regarding copyright ownership. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.appium.java_client.remote.options; + +import io.appium.java_client.remote.MobileCapabilityType; +import org.openqa.selenium.Capabilities; + +public interface SupportsLanguageOption> extends + Capabilities, CanSetCapability { + + /** + * Set language abbreviation for use in session. + * + * @param language is the language abbreviation. + * @return this MobileOptions, for chaining. + * @see MobileCapabilityType#LANGUAGE + */ + default T setLanguage(String language) { + return amend(MobileCapabilityType.LANGUAGE, language); + } + + /** + * Get language abbreviation for use in session. + * + * @return String representing the language abbreviation. + * @see MobileCapabilityType#LANGUAGE + */ + default String getLanguage() { + return (String) getCapability(MobileCapabilityType.LANGUAGE); + } +} diff --git a/src/main/java/io/appium/java_client/remote/options/SupportsLocaleOption.java b/src/main/java/io/appium/java_client/remote/options/SupportsLocaleOption.java new file mode 100644 index 000000000..f2f0d26e5 --- /dev/null +++ b/src/main/java/io/appium/java_client/remote/options/SupportsLocaleOption.java @@ -0,0 +1,45 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * See the NOTICE file distributed with this work for additional + * information regarding copyright ownership. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.appium.java_client.remote.options; + +import io.appium.java_client.remote.MobileCapabilityType; +import org.openqa.selenium.Capabilities; + +public interface SupportsLocaleOption> extends + Capabilities, CanSetCapability { + + /** + * Set locale abbreviation for use in session. + * + * @param locale is the locale abbreviation. + * @return this MobileOptions, for chaining. + * @see MobileCapabilityType#LOCALE + */ + default T setLocale(String locale) { + return amend(MobileCapabilityType.LOCALE, locale); + } + + /** + * Get locale abbreviation for use in session. + * + * @return String representing the locale abbreviation. + * @see MobileCapabilityType#LOCALE + */ + default String getLocale() { + return (String) getCapability(MobileCapabilityType.LOCALE); + } +} diff --git a/src/main/java/io/appium/java_client/remote/options/SupportsOrientationOption.java b/src/main/java/io/appium/java_client/remote/options/SupportsOrientationOption.java new file mode 100644 index 000000000..4bc34bb59 --- /dev/null +++ b/src/main/java/io/appium/java_client/remote/options/SupportsOrientationOption.java @@ -0,0 +1,46 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * See the NOTICE file distributed with this work for additional + * information regarding copyright ownership. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.appium.java_client.remote.options; + +import io.appium.java_client.remote.MobileCapabilityType; +import org.openqa.selenium.Capabilities; +import org.openqa.selenium.ScreenOrientation; + +public interface SupportsOrientationOption> extends + Capabilities, CanSetCapability { + + /** + * Set the orientation of the screen. + * + * @param orientation is the screen orientation. + * @return this MobileOptions, for chaining. + * @see MobileCapabilityType#ORIENTATION + */ + default T setOrientation(ScreenOrientation orientation) { + return amend(MobileCapabilityType.ORIENTATION, orientation); + } + + /** + * Get the orientation of the screen. + * + * @return ScreenOrientation of the app. + * @see MobileCapabilityType#ORIENTATION + */ + default ScreenOrientation getOrientation() { + return (ScreenOrientation) getCapability(MobileCapabilityType.ORIENTATION); + } +} diff --git a/src/main/java/io/appium/java_client/remote/options/SupportsOtherAppsOption.java b/src/main/java/io/appium/java_client/remote/options/SupportsOtherAppsOption.java new file mode 100644 index 000000000..2de4c224f --- /dev/null +++ b/src/main/java/io/appium/java_client/remote/options/SupportsOtherAppsOption.java @@ -0,0 +1,46 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * See the NOTICE file distributed with this work for additional + * information regarding copyright ownership. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.appium.java_client.remote.options; + +import io.appium.java_client.remote.MobileCapabilityType; +import org.openqa.selenium.Capabilities; + +public interface SupportsOtherAppsOption> extends + Capabilities, CanSetCapability { + + + /** + * Set the location of the app(s) to install before running a test. + * + * @param apps is the apps to install. + * @return this MobileOptions, for chaining. + * @see MobileCapabilityType#OTHER_APPS + */ + default T setOtherApps(String apps) { + return amend(MobileCapabilityType.OTHER_APPS, apps); + } + + /** + * Get the list of apps to install before running a test. + * + * @return String of apps to install. + * @see MobileCapabilityType#OTHER_APPS + */ + default String getOtherApps() { + return (String) getCapability(MobileCapabilityType.OTHER_APPS); + } +} diff --git a/src/main/java/io/appium/java_client/remote/options/SupportsUdidOption.java b/src/main/java/io/appium/java_client/remote/options/SupportsUdidOption.java new file mode 100644 index 000000000..bc6e59b37 --- /dev/null +++ b/src/main/java/io/appium/java_client/remote/options/SupportsUdidOption.java @@ -0,0 +1,44 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * See the NOTICE file distributed with this work for additional + * information regarding copyright ownership. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.appium.java_client.remote.options; + +import io.appium.java_client.remote.MobileCapabilityType; +import org.openqa.selenium.Capabilities; + +public interface SupportsUdidOption> extends + Capabilities, CanSetCapability { + /** + * Set the id of the device. + * + * @param id is the unique device identifier. + * @return this MobileOptions, for chaining. + * @see MobileCapabilityType#UDID + */ + default T setUdid(String id) { + return amend(MobileCapabilityType.UDID, id); + } + + /** + * Get the id of the device. + * + * @return String representing the unique device identifier. + * @see MobileCapabilityType#UDID + */ + default String getUdid() { + return (String) getCapability(MobileCapabilityType.UDID); + } +} diff --git a/src/test/java/io/appium/java_client/remote/MobileOptionsTest.java b/src/test/java/io/appium/java_client/remote/MobileOptionsTest.java index 27e1a6765..ab2b776e1 100644 --- a/src/test/java/io/appium/java_client/remote/MobileOptionsTest.java +++ b/src/test/java/io/appium/java_client/remote/MobileOptionsTest.java @@ -23,12 +23,11 @@ import java.net.MalformedURLException; import java.net.URL; import java.time.Duration; -import java.util.ArrayList; import static org.junit.Assert.*; public class MobileOptionsTest { - private MobileOptions mobileOptions = new MobileOptions<>(); + private MobileOptions mobileOptions = new MobileOptions<>(); @Test public void acceptsExistingCapabilities() {