diff --git a/appium/options/mac/mac2/bundle_id_option.py b/appium/options/common/bundle_id_option.py similarity index 76% rename from appium/options/mac/mac2/bundle_id_option.py rename to appium/options/common/bundle_id_option.py index 06a3bdb8..0546571a 100644 --- a/appium/options/mac/mac2/bundle_id_option.py +++ b/appium/options/common/bundle_id_option.py @@ -33,12 +33,6 @@ def bundle_id(self) -> Optional[str]: @bundle_id.setter def bundle_id(self, value: str) -> None: """ - Set the bundle identifier of the application to automate, for example - com.apple.TextEdit. This is an optional capability. If it is not provided - then the session will be started without an application under test - (actually, it will be Finder). If the application with the given - identifier is not installed then an error will be thrown on session - startup. If the application is already running then it will be moved to - the foreground. + Set the bundle identifier of the application to automate. """ self.set_capability(BUNDLE_ID, value) diff --git a/appium/options/ios/safari/automatic_inspection_option.py b/appium/options/ios/safari/automatic_inspection_option.py index ef95aa7b..3ab38e82 100644 --- a/appium/options/ios/safari/automatic_inspection_option.py +++ b/appium/options/ios/safari/automatic_inspection_option.py @@ -26,7 +26,7 @@ class AutomaticInspectionOption(SupportsCapabilities): @property def automatic_inspection(self) -> Optional[bool]: """ - :Returns: Whether to use automatic inspection. + Whether to use automatic inspection. """ return self.get_capability(AUTOMATIC_INSPECTION) diff --git a/appium/options/ios/safari/automatic_profiling_option.py b/appium/options/ios/safari/automatic_profiling_option.py index e45089d9..76eae620 100644 --- a/appium/options/ios/safari/automatic_profiling_option.py +++ b/appium/options/ios/safari/automatic_profiling_option.py @@ -26,7 +26,7 @@ class AutomaticProfilingOption(SupportsCapabilities): @property def automatic_profiling(self) -> Optional[bool]: """ - :Returns: Whether to use automatic profiling. + Whether to use automatic profiling. """ return self.get_capability(AUTOMATIC_PROFILING) diff --git a/appium/options/ios/safari/device_name_option.py b/appium/options/ios/safari/device_name_option.py index b7697ed2..ebc949ad 100644 --- a/appium/options/ios/safari/device_name_option.py +++ b/appium/options/ios/safari/device_name_option.py @@ -26,7 +26,7 @@ class DeviceNameOption(SupportsCapabilities): @property def device_name(self) -> Optional[str]: """ - :Returns: String representing the name of the device. + String representing the name of the device. """ return self.get_capability(DEVICE_NAME) diff --git a/appium/options/ios/safari/device_type_option.py b/appium/options/ios/safari/device_type_option.py index d7951513..329974e3 100644 --- a/appium/options/ios/safari/device_type_option.py +++ b/appium/options/ios/safari/device_type_option.py @@ -26,7 +26,7 @@ class DeviceTypeOption(SupportsCapabilities): @property def device_type(self) -> Optional[str]: """ - :Returns: String representing the type of the device. + String representing the type of the device. """ return self.get_capability(DEVICE_TYPE) diff --git a/appium/options/ios/safari/device_udid_option.py b/appium/options/ios/safari/device_udid_option.py index 7ef435fd..12850acf 100644 --- a/appium/options/ios/safari/device_udid_option.py +++ b/appium/options/ios/safari/device_udid_option.py @@ -26,7 +26,7 @@ class DeviceUdidOption(SupportsCapabilities): @property def device_udid(self) -> Optional[str]: """ - :Returns: String representing the UDID of the device. + String representing the UDID of the device. """ return self.get_capability(DEVICE_UDID) diff --git a/appium/options/ios/safari/platform_build_version_option.py b/appium/options/ios/safari/platform_build_version_option.py index 4f6497c7..f411ec22 100644 --- a/appium/options/ios/safari/platform_build_version_option.py +++ b/appium/options/ios/safari/platform_build_version_option.py @@ -26,7 +26,7 @@ class PlatformBuildVersionOption(SupportsCapabilities): @property def platform_build_version(self) -> Optional[str]: """ - :Returns: String representing the platform build version. + String representing the platform build version. """ return self.get_capability(PLATFORM_BUILD_VERSION) diff --git a/appium/options/ios/safari/platform_version_option.py b/appium/options/ios/safari/platform_version_option.py index d6a91fb7..fd3d4b60 100644 --- a/appium/options/ios/safari/platform_version_option.py +++ b/appium/options/ios/safari/platform_version_option.py @@ -26,7 +26,7 @@ class PlatformVersionOption(SupportsCapabilities): @property def platform_version(self) -> Optional[str]: """ - :Returns: String representing the platform version. + String representing the platform version. """ return self.get_capability(PLATFORM_VERSION) diff --git a/appium/options/ios/safari/use_simulator_option.py b/appium/options/ios/safari/use_simulator_option.py index 8ac641d3..25a09a6b 100644 --- a/appium/options/ios/safari/use_simulator_option.py +++ b/appium/options/ios/safari/use_simulator_option.py @@ -26,7 +26,7 @@ class UseSimulatorOption(SupportsCapabilities): @property def use_simulator(self) -> Optional[bool]: """ - :Returns: Whether to use iOS Simulator. + Whether to use iOS Simulator. """ return self.get_capability(USE_SIMULATOR) diff --git a/appium/options/ios/safari/webkit_webrtc_option.py b/appium/options/ios/safari/webkit_webrtc_option.py index 0890b654..7980df7a 100644 --- a/appium/options/ios/safari/webkit_webrtc_option.py +++ b/appium/options/ios/safari/webkit_webrtc_option.py @@ -26,7 +26,7 @@ class WebkitWebrtcOption(SupportsCapabilities): @property def webkit_webrtc(self) -> Optional[Dict[str, Any]]: """ - :Returns: WebRTC policies. + WebRTC policies. """ return self.get_capability(WEBKIT_WEBRTC) diff --git a/appium/options/ios/xcuitest/app/__init__.py b/appium/options/ios/xcuitest/app/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/appium/options/ios/xcuitest/app/app_install_strategy_option.py b/appium/options/ios/xcuitest/app/app_install_strategy_option.py new file mode 100644 index 00000000..ff812fe8 --- /dev/null +++ b/appium/options/ios/xcuitest/app/app_install_strategy_option.py @@ -0,0 +1,46 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +APP_INSTALL_STRATEGY = 'appInstallStrategy' + + +class AppInstallStrategyOption(SupportsCapabilities): + @property + def app_install_strategy(self) -> Optional[str]: + """ + App install strategy. + """ + return self.get_capability(APP_INSTALL_STRATEGY) + + @app_install_strategy.setter + def app_install_strategy(self, value: str) -> None: + """ + Select application installation strategy for real devices. The following + strategies are supported: + * serial (default) - pushes app files to the device in a sequential order; + this is the least performant strategy, although the most reliable; + * parallel - pushes app files simultaneously; this is usually the + most performant strategy, but sometimes could not be very stable; + * ios-deploy - tells the driver to use a third-party tool ios-deploy to + install the app; obviously the tool must be installed separately + first and must be present in PATH before it could be used. + """ + self.set_capability(APP_INSTALL_STRATEGY, value) diff --git a/appium/options/ios/xcuitest/app/app_push_timeout_option.py b/appium/options/ios/xcuitest/app/app_push_timeout_option.py new file mode 100644 index 00000000..15ae4c24 --- /dev/null +++ b/appium/options/ios/xcuitest/app/app_push_timeout_option.py @@ -0,0 +1,42 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from datetime import timedelta +from typing import Optional, Union + +from appium.options.common.supports_capabilities import SupportsCapabilities + +APP_PUSH_TIMEOUT = 'appPushTimeout' + + +class AppPushTimeoutOption(SupportsCapabilities): + @property + def app_push_timeout(self) -> Optional[timedelta]: + """ + Maximum timeout for application upload. + """ + value = self.get_capability(APP_PUSH_TIMEOUT) + return None if value is None else timedelta(milliseconds=value) + + @app_push_timeout.setter + def app_push_timeout(self, value: Union[timedelta, int]) -> None: + """ + The timeout for application upload. + Works for real devices only. + The default value is 30000ms. + """ + self.set_capability(APP_PUSH_TIMEOUT, value.microseconds // 1000 if isinstance(value, timedelta) else value) diff --git a/appium/options/ios/xcuitest/app/localizable_strings_dir_option.py b/appium/options/ios/xcuitest/app/localizable_strings_dir_option.py new file mode 100644 index 00000000..e78155a6 --- /dev/null +++ b/appium/options/ios/xcuitest/app/localizable_strings_dir_option.py @@ -0,0 +1,39 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +LOCALIZABLE_STRINGS_DIR = 'localizableStringsDir' + + +class LocalizableStringsDirOption(SupportsCapabilities): + @property + def localizable_strings_dir(self) -> Optional[str]: + """ + Resource folder name where the main locale strings are stored. + """ + return self.get_capability(LOCALIZABLE_STRINGS_DIR) + + @localizable_strings_dir.setter + def localizable_strings_dir(self, value: str) -> None: + """ + Where to look for localizable strings in the application bundle. + Defaults to en.lproj. + """ + self.set_capability(LOCALIZABLE_STRINGS_DIR, value) diff --git a/appium/options/ios/xcuitest/base.py b/appium/options/ios/xcuitest/base.py index 12f609d8..5ee96aca 100644 --- a/appium/options/ios/xcuitest/base.py +++ b/appium/options/ios/xcuitest/base.py @@ -32,6 +32,88 @@ from appium.options.common.skip_log_capture_option import SkipLogCaptureOption from appium.options.common.udid_option import UdidOption +from .app.app_install_strategy_option import AppInstallStrategyOption +from .app.app_push_timeout_option import AppPushTimeoutOption +from .app.localizable_strings_dir_option import LocalizableStringsDirOption +from .general.include_device_caps_to_session_info_option import IncludeDeviceCapsToSessionInfoOption +from .general.reset_location_service_option import ResetLocationServiceOption +from .other.command_timeouts_option import CommandTimeoutsOption +from .other.launch_with_idb_option import LaunchWithIdbOption +from .other.show_ios_log_option import ShowIosLogOption +from .other.use_json_source_option import UseJsonSourceOption +from .simulator.calendar_access_authorized_option import CalendarAccessAuthorizedOption +from .simulator.calendar_format_option import CalendarFormatOption +from .simulator.connect_hardware_keyboard_option import ConnectHardwareKeyboardOption +from .simulator.custom_ssl_cert_option import CustomSslCertOption +from .simulator.enforce_fresh_simulator_creation_option import EnforceFreshSimulatorCreationOption +from .simulator.force_simulator_software_keyboard_presence_option import ForceSimulatorSoftwareKeyboardPresenceOption +from .simulator.ios_simulator_logs_predicate_option import IosSimulatorLogsPredicateOption +from .simulator.keep_key_chains_option import KeepKeyChainsOption +from .simulator.keychains_exclude_patterns_option import KeychainsExcludePatternsOption +from .simulator.permissions_option import PermissionsOption +from .simulator.reduce_motion_option import ReduceMotionOption +from .simulator.reset_on_session_start_only_option import ResetOnSessionStartOnlyOption +from .simulator.scale_factor_option import ScaleFactorOption +from .simulator.shutdown_other_simulators_option import ShutdownOtherSimulatorsOption +from .simulator.simulator_devices_set_path_option import SimulatorDevicesSetPathOption +from .simulator.simulator_pasteboard_automatic_sync_option import SimulatorPasteboardAutomaticSyncOption +from .simulator.simulator_startup_timeout_option import SimulatorStartupTimeoutOption +from .simulator.simulator_trace_pointer_option import SimulatorTracePointerOption +from .simulator.simulator_window_center_option import SimulatorWindowCenterOption +from .wda.allow_provisioning_device_regitration_option import AllowProvisioningDeviceRegistrationOption +from .wda.auto_accept_alerts_option import AutoAcceptAlertsOption +from .wda.auto_disimiss_alerts_option import AutoDismissAlertsOption +from .wda.derived_data_path_option import DerivedDataPathOption +from .wda.disable_automatic_screenshots_option import DisableAutomaticScreenshotsOption +from .wda.force_app_launch_option import ForceAppLaunchOption +from .wda.keychain_password_option import KeychainPasswordOption +from .wda.keychain_path_option import KeychainPathOption +from .wda.max_typing_frequency_option import MaxTypingFrequencyOption +from .wda.mjpeg_server_port_option import MjpegServerPortOption +from .wda.process_arguments_option import ProcessArgumentsOption +from .wda.result_bundle_path_option import ResultBundlePathOption +from .wda.screenshot_quality_option import ScreenshotQualityOption +from .wda.should_terminate_app_option import ShouldTerminateAppOption +from .wda.should_use_singleton_test_manager_option import ShouldUseSingletonTestManagerOption +from .wda.show_xcode_log_option import ShowXcodeLogOption +from .wda.simple_is_visible_check_option import SimpleIsVisibleCheckOption +from .wda.updated_wda_bundle_id_option import UpdatedWdaBundleIdOption +from .wda.use_native_caching_strategy_option import UseNativeCachingStrategyOption +from .wda.use_new_wda_option import UseNewWdaOption +from .wda.use_prebuilt_wda_option import UsePrebuiltWdaOption +from .wda.use_simple_build_test_option import UseSimpleBuildTestOption +from .wda.use_xctestrun_file_option import UseXctestrunFileOption +from .wda.wait_for_idle_timeout_option import WaitForIdleTimeoutOption +from .wda.wait_for_quiescence_option import WaitForQuiescenceOption +from .wda.wda_base_url_option import WdaBaseUrlOption +from .wda.wda_connection_timeout_option import WdaConnectionTimeoutOption +from .wda.wda_eventloop_idle_delay_option import WdaEventloopIdleDelayOption +from .wda.wda_launch_timeout_option import WdaLaunchTimeoutOption +from .wda.wda_local_port_option import WdaLocalPortOption +from .wda.wda_startup_retries_option import WdaStartupRetriesOption +from .wda.wda_startup_retry_interval_option import WdaStartupRetryIntervalOption +from .wda.web_driver_agent_url_option import WebDriverAgentUrlOption +from .wda.xcode_org_id_option import XcodeOrgIdOption +from .wda.xcode_signing_id_option import XcodeSigningIdOption +from .webview.absolute_web_locations_option import AbsoluteWebLocationsOption +from .webview.additional_webview_bundle_ids_option import AdditionalWebviewBundleIdsOption +from .webview.enable_async_execute_from_https_option import EnableAsyncExecuteFromHttpsOption +from .webview.full_context_list_option import FullContextListOption +from .webview.include_safari_in_webviews_option import IncludeSafariInWebviewsOption +from .webview.native_web_tap_option import NativeWebTapOption +from .webview.safari_garbage_collect_option import SafariGarbageCollectOption +from .webview.safari_ignore_fraud_warning_option import SafariIgnoreFraudWarningOption +from .webview.safari_ignore_web_hostnames_option import SafariIgnoreWebHostnamesOption +from .webview.safari_initial_url_option import SafariInitialUrlOption +from .webview.safari_log_all_communication_hex_dump_option import SafariLogAllCommunicationHexDumpOption +from .webview.safari_log_all_communication_option import SafariLogAllCommunicationOption +from .webview.safari_open_links_in_background_option import SafariOpenLinksInBackgroundOption +from .webview.safari_socket_chunk_size_option import SafariSocketChunkSizeOption +from .webview.safari_web_inspector_max_frame_length_option import SafariWebInspectorMaxFrameLengthOption +from .webview.webkit_response_timeout_option import WebkitResponseTimeoutOption +from .webview.webview_connect_retries_option import WebviewConnectRetriesOption +from .webview.webview_connect_timeout_option import WebviewConnectTimeoutOption + class XCUITestOptions( AppiumOptions, @@ -47,6 +129,87 @@ class XCUITestOptions( EnablePerformanceLoggingOption, OtherAppsOption, DeviceNameOption, + IncludeDeviceCapsToSessionInfoOption, + ResetLocationServiceOption, + AppInstallStrategyOption, + AppPushTimeoutOption, + LocalizableStringsDirOption, + CommandTimeoutsOption, + LaunchWithIdbOption, + ShowIosLogOption, + UseJsonSourceOption, + CalendarAccessAuthorizedOption, + CalendarFormatOption, + ConnectHardwareKeyboardOption, + CustomSslCertOption, + EnforceFreshSimulatorCreationOption, + ForceSimulatorSoftwareKeyboardPresenceOption, + IosSimulatorLogsPredicateOption, + KeepKeyChainsOption, + KeychainsExcludePatternsOption, + PermissionsOption, + ReduceMotionOption, + ResetOnSessionStartOnlyOption, + ScaleFactorOption, + ShutdownOtherSimulatorsOption, + SimulatorDevicesSetPathOption, + SimulatorPasteboardAutomaticSyncOption, + SimulatorStartupTimeoutOption, + SimulatorTracePointerOption, + SimulatorWindowCenterOption, + AllowProvisioningDeviceRegistrationOption, + AutoAcceptAlertsOption, + AutoDismissAlertsOption, + DerivedDataPathOption, + DisableAutomaticScreenshotsOption, + ForceAppLaunchOption, + KeychainPasswordOption, + KeychainPathOption, + MaxTypingFrequencyOption, + MjpegServerPortOption, + ProcessArgumentsOption, + ResultBundlePathOption, + ScreenshotQualityOption, + ShouldTerminateAppOption, + ShouldUseSingletonTestManagerOption, + ShowXcodeLogOption, + SimpleIsVisibleCheckOption, + UpdatedWdaBundleIdOption, + UseNativeCachingStrategyOption, + UseNewWdaOption, + UsePrebuiltWdaOption, + UseSimpleBuildTestOption, + UseXctestrunFileOption, + WaitForIdleTimeoutOption, + WaitForQuiescenceOption, + WdaBaseUrlOption, + WdaConnectionTimeoutOption, + WdaEventloopIdleDelayOption, + WdaLaunchTimeoutOption, + WdaLocalPortOption, + WdaStartupRetriesOption, + WdaStartupRetryIntervalOption, + WebDriverAgentUrlOption, + XcodeOrgIdOption, + XcodeSigningIdOption, + AbsoluteWebLocationsOption, + AdditionalWebviewBundleIdsOption, + EnableAsyncExecuteFromHttpsOption, + FullContextListOption, + IncludeSafariInWebviewsOption, + NativeWebTapOption, + SafariGarbageCollectOption, + SafariIgnoreFraudWarningOption, + SafariIgnoreWebHostnamesOption, + SafariInitialUrlOption, + SafariLogAllCommunicationHexDumpOption, + SafariLogAllCommunicationOption, + SafariOpenLinksInBackgroundOption, + SafariSocketChunkSizeOption, + SafariWebInspectorMaxFrameLengthOption, + WebkitResponseTimeoutOption, + WebviewConnectRetriesOption, + WebviewConnectTimeoutOption, ): @property def default_capabilities(self) -> Dict: diff --git a/appium/options/ios/xcuitest/general/__init__.py b/appium/options/ios/xcuitest/general/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/appium/options/ios/xcuitest/general/include_device_caps_to_session_info_option.py b/appium/options/ios/xcuitest/general/include_device_caps_to_session_info_option.py new file mode 100644 index 00000000..b5df6d28 --- /dev/null +++ b/appium/options/ios/xcuitest/general/include_device_caps_to_session_info_option.py @@ -0,0 +1,41 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +INCLUDE_DEVICE_CAPS_TO_SESSION_INFO = 'includeDeviceCapsToSessionInfo' + + +class IncludeDeviceCapsToSessionInfoOption(SupportsCapabilities): + @property + def include_device_caps_to_session_info(self) -> Optional[bool]: + """ + Whether to include screen information as the result of Get Session Capabilities. + """ + return self.get_capability(INCLUDE_DEVICE_CAPS_TO_SESSION_INFO) + + @include_device_caps_to_session_info.setter + def include_device_caps_to_session_info(self, value: bool) -> None: + """ + Whether to include screen information as the result of Get Session Capabilities. + It includes pixelRatio, statBarHeight and viewportRect, but + it causes an extra API call to WDA which may increase the response time. + Defaults to true. + """ + self.set_capability(INCLUDE_DEVICE_CAPS_TO_SESSION_INFO, value) diff --git a/appium/options/ios/xcuitest/general/reset_location_service_option.py b/appium/options/ios/xcuitest/general/reset_location_service_option.py new file mode 100644 index 00000000..c9e242cc --- /dev/null +++ b/appium/options/ios/xcuitest/general/reset_location_service_option.py @@ -0,0 +1,39 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +RESET_LOCATION_SERVICE = 'resetLocationService' + + +class ResetLocationServiceOption(SupportsCapabilities): + @property + def reset_location_service(self) -> Optional[bool]: + """ + Whether to reset the location service in the session deletion on real devices. + """ + return self.get_capability(RESET_LOCATION_SERVICE) + + @reset_location_service.setter + def reset_location_service(self, value: bool) -> None: + """ + Whether reset the location service in the session deletion on real devices. + Defaults to false. + """ + self.set_capability(RESET_LOCATION_SERVICE, value) diff --git a/appium/options/ios/xcuitest/other/__init__.py b/appium/options/ios/xcuitest/other/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/appium/options/ios/xcuitest/other/command_timeouts_option.py b/appium/options/ios/xcuitest/other/command_timeouts_option.py new file mode 100644 index 00000000..7c98d5cf --- /dev/null +++ b/appium/options/ios/xcuitest/other/command_timeouts_option.py @@ -0,0 +1,57 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from datetime import timedelta +from typing import Dict, Optional, Union + +from appium.options.common.supports_capabilities import SupportsCapabilities + +COMMAND_TIMEOUTS = 'commandTimeouts' + + +class CommandTimeoutsOption(SupportsCapabilities): + @property + def command_timeouts(self) -> Optional[Union[Dict[str, timedelta], timedelta]]: + """ + Custom timeout(s) for WDA backend commands execution. + """ + value = self.get_capability(COMMAND_TIMEOUTS) + if value is None: + return None + if isinstance(value, dict): + return {k: timedelta(milliseconds=v) for k, v in value.items()} + return timedelta(milliseconds=int(value)) + + @command_timeouts.setter + def command_timeouts(self, value: Union[Dict[str, timedelta], timedelta, int]) -> None: + """ + Custom timeout for all WDA backend commands execution. + This might be useful if WDA backend freezes unexpectedly or requires too + much time to fail and blocks automated test execution. + Dictionary keys are command names which you can find in server logs. Look for + "Executing command 'command_name'" records. + Timeout value is expected to contain max duration to wait for + the given WDA command to be executed before terminating the session forcefully. + The magic 'default' key allows to provide the timeout for all other commands that + were not explicitly mentioned as dictionary keys + """ + if isinstance(value, dict): + self.set_capability(COMMAND_TIMEOUTS, {k: v.microseconds // 1000 for k, v in value.items()}) + elif isinstance(value, timedelta): + self.set_capability(COMMAND_TIMEOUTS, f'{value.microseconds // 1000}') + else: + self.set_capability(COMMAND_TIMEOUTS, value) diff --git a/appium/options/ios/xcuitest/other/launch_with_idb_option.py b/appium/options/ios/xcuitest/other/launch_with_idb_option.py new file mode 100644 index 00000000..c8701c62 --- /dev/null +++ b/appium/options/ios/xcuitest/other/launch_with_idb_option.py @@ -0,0 +1,42 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +LAUNCH_WITH_IDB = 'launchWithIDB' + + +class LaunchWithIdbOption(SupportsCapabilities): + @property + def launch_with_idb(self) -> Optional[bool]: + """ + Whether to launch WebDriverAgentRunner with idb instead of xcodebuild. + """ + return self.get_capability(LAUNCH_WITH_IDB) + + @launch_with_idb.setter + def launch_with_idb(self, value: bool) -> None: + """ + Launch WebDriverAgentRunner with idb instead of xcodebuild. This could save + a significant amount of time by skipping the xcodebuild process, although the + idb might not be very reliable, especially with fresh Xcode SDKs. Check + the idb repository for more details on possible compatibility issues. + Defaults to false. + """ + self.set_capability(LAUNCH_WITH_IDB, value) diff --git a/appium/options/ios/xcuitest/other/show_ios_log_option.py b/appium/options/ios/xcuitest/other/show_ios_log_option.py new file mode 100644 index 00000000..b4bf75d3 --- /dev/null +++ b/appium/options/ios/xcuitest/other/show_ios_log_option.py @@ -0,0 +1,39 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +SHOW_IOS_LOG = 'showIOSLog' + + +class ShowIosLogOption(SupportsCapabilities): + @property + def show_ios_log(self) -> Optional[bool]: + """ + Whether to show any logs captured from a device in the appium logs. + """ + return self.get_capability(SHOW_IOS_LOG) + + @show_ios_log.setter + def show_ios_log(self, value: bool) -> None: + """ + Whether to show any logs captured from a device in the appium logs. + Default false. + """ + self.set_capability(SHOW_IOS_LOG, value) diff --git a/appium/options/ios/xcuitest/other/use_json_source_option.py b/appium/options/ios/xcuitest/other/use_json_source_option.py new file mode 100644 index 00000000..1eac50bb --- /dev/null +++ b/appium/options/ios/xcuitest/other/use_json_source_option.py @@ -0,0 +1,39 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +USE_JSON_SOURCE = 'useJSONSource' + + +class UseJsonSourceOption(SupportsCapabilities): + @property + def use_json_source(self) -> Optional[bool]: + """ + Whether to get JSON source from WDA and transform it to XML on the driver side. + """ + return self.get_capability(USE_JSON_SOURCE) + + @use_json_source.setter + def use_json_source(self, value: bool) -> None: + """ + Whether to get JSON source from WDA and transform it to XML on the driver side. + Defaults to false. + """ + self.set_capability(USE_JSON_SOURCE, value) diff --git a/appium/options/ios/xcuitest/simulator/__init__.py b/appium/options/ios/xcuitest/simulator/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/appium/options/ios/xcuitest/simulator/calendar_access_authorized_option.py b/appium/options/ios/xcuitest/simulator/calendar_access_authorized_option.py new file mode 100644 index 00000000..a0e1afe9 --- /dev/null +++ b/appium/options/ios/xcuitest/simulator/calendar_access_authorized_option.py @@ -0,0 +1,41 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +CALENDAR_ACCESS_AUTHORIZED = 'calendarAccessAuthorized' + + +class CalendarAccessAuthorizedOption(SupportsCapabilities): + @property + def calendar_access_authorized(self) -> Optional[bool]: + """ + Whether to enable calendar access on IOS Simulator. + """ + return self.get_capability(CALENDAR_ACCESS_AUTHORIZED) + + @calendar_access_authorized.setter + def calendar_access_authorized(self, value: bool) -> None: + """ + Set this to true if you want to enable calendar access on IOS Simulator + with given bundleId. Set to false, if you want to disable calendar access + on IOS Simulator with given bundleId. If not set, the calendar + authorization status will not be set. + """ + self.set_capability(CALENDAR_ACCESS_AUTHORIZED, value) diff --git a/appium/options/ios/xcuitest/simulator/calendar_format_option.py b/appium/options/ios/xcuitest/simulator/calendar_format_option.py new file mode 100644 index 00000000..4e756598 --- /dev/null +++ b/appium/options/ios/xcuitest/simulator/calendar_format_option.py @@ -0,0 +1,38 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +CALENDAR_FORMAT = 'calendarFormat' + + +class CalendarFormatOption(SupportsCapabilities): + @property + def calendar_format(self) -> Optional[str]: + """ + Calendar format for the iOS Simulator. + """ + return self.get_capability(CALENDAR_FORMAT) + + @calendar_format.setter + def calendar_format(self, value: str) -> None: + """ + Set calendar format for the iOS Simulator. + """ + self.set_capability(CALENDAR_FORMAT, value) diff --git a/appium/options/ios/xcuitest/simulator/connect_hardware_keyboard_option.py b/appium/options/ios/xcuitest/simulator/connect_hardware_keyboard_option.py new file mode 100644 index 00000000..f7118d6d --- /dev/null +++ b/appium/options/ios/xcuitest/simulator/connect_hardware_keyboard_option.py @@ -0,0 +1,43 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +CONNECT_HARDWARE_KEYBOARD = 'connectHardwareKeyboard' + + +class ConnectHardwareKeyboardOption(SupportsCapabilities): + @property + def connect_hardware_keyboard(self) -> Optional[bool]: + """ + Whether to connect hardware keyboard to Simulator. + """ + return self.get_capability(CONNECT_HARDWARE_KEYBOARD) + + @connect_hardware_keyboard.setter + def connect_hardware_keyboard(self, value: bool) -> None: + """ + Set this option to true in order to enable hardware keyboard in Simulator. + The preference works only when Appium launches a simulator instance with + this value. It is set to false by default, because this helps to workaround + some XCTest bugs. connectHardwareKeyboard: true makes + forceSimulatorSoftwareKeyboardPresence: false if no explicit value is set + for forceSimulatorSoftwareKeyboardPresence capability since Appium 1.22.0. + """ + self.set_capability(CONNECT_HARDWARE_KEYBOARD, value) diff --git a/appium/options/ios/xcuitest/simulator/custom_ssl_cert_option.py b/appium/options/ios/xcuitest/simulator/custom_ssl_cert_option.py new file mode 100644 index 00000000..a3914b93 --- /dev/null +++ b/appium/options/ios/xcuitest/simulator/custom_ssl_cert_option.py @@ -0,0 +1,39 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +CUSTOM_SSL_CERT = 'customSSLCert' + + +class CustomSslCertOption(SupportsCapabilities): + @property + def custom_ssl_cert(self) -> Optional[str]: + """ + SSL certificate content. + """ + return self.get_capability(CUSTOM_SSL_CERT) + + @custom_ssl_cert.setter + def custom_ssl_cert(self, value: str) -> None: + """ + Adds a root SSL certificate to IOS Simulator. + The certificate content must be provided in PEM format. + """ + self.set_capability(CUSTOM_SSL_CERT, value) diff --git a/appium/options/ios/xcuitest/simulator/enforce_fresh_simulator_creation_option.py b/appium/options/ios/xcuitest/simulator/enforce_fresh_simulator_creation_option.py new file mode 100644 index 00000000..cea87eb0 --- /dev/null +++ b/appium/options/ios/xcuitest/simulator/enforce_fresh_simulator_creation_option.py @@ -0,0 +1,39 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +ENFORCE_FRESH_SIMULATOR_CREATION = 'enforceFreshSimulatorCreation' + + +class EnforceFreshSimulatorCreationOption(SupportsCapabilities): + @property + def enforce_fresh_simulator_creation(self) -> Optional[bool]: + """ + Whether to create a new simulator for each new test session. + """ + return self.get_capability(ENFORCE_FRESH_SIMULATOR_CREATION) + + @enforce_fresh_simulator_creation.setter + def enforce_fresh_simulator_creation(self, value: bool) -> None: + """ + Creates a new simulator in session creation and deletes it in session deletion. + Defaults to false. + """ + self.set_capability(ENFORCE_FRESH_SIMULATOR_CREATION, value) diff --git a/appium/options/ios/xcuitest/simulator/force_simulator_software_keyboard_presence_option.py b/appium/options/ios/xcuitest/simulator/force_simulator_software_keyboard_presence_option.py new file mode 100644 index 00000000..1e1a697a --- /dev/null +++ b/appium/options/ios/xcuitest/simulator/force_simulator_software_keyboard_presence_option.py @@ -0,0 +1,45 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +FORCE_SIMULATOR_SOFTWARE_KEYBOARD_PRESENCE = 'forceSimulatorSoftwareKeyboardPresence' + + +class ForceSimulatorSoftwareKeyboardPresenceOption(SupportsCapabilities): + @property + def force_simulator_software_keyboard_presence(self) -> Optional[bool]: + """ + Whether to enforce software keyboard presence. + """ + return self.get_capability(FORCE_SIMULATOR_SOFTWARE_KEYBOARD_PRESENCE) + + @force_simulator_software_keyboard_presence.setter + def force_simulator_software_keyboard_presence(self, value: bool) -> None: + """ + Set this option to true in order to turn software keyboard on and turn + hardware keyboard off in Simulator since Appium 1.22.0. This option helps + to avoid Keyboard is not present error. It is set to true by default. + Appium respects preset simulator software/hardware keyboard preference + when this value is false, so connectHardwareKeyboard: false and + forceSimulatorSoftwareKeyboardPresence: false means for Appium to keep + the current Simulator keyboard preferences. This option has priority + over connectHardwareKeyboard. + """ + self.set_capability(FORCE_SIMULATOR_SOFTWARE_KEYBOARD_PRESENCE, value) diff --git a/appium/options/ios/xcuitest/simulator/ios_simulator_logs_predicate_option.py b/appium/options/ios/xcuitest/simulator/ios_simulator_logs_predicate_option.py new file mode 100644 index 00000000..c7d48647 --- /dev/null +++ b/appium/options/ios/xcuitest/simulator/ios_simulator_logs_predicate_option.py @@ -0,0 +1,38 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +IOS_SIMULATOR_LOGS_PREDICATE = 'iosSimulatorLogsPredicate' + + +class IosSimulatorLogsPredicateOption(SupportsCapabilities): + @property + def ios_simulator_logs_predicate(self) -> Optional[bool]: + """ + Get Simulator log filtering predicate. + """ + return self.get_capability(IOS_SIMULATOR_LOGS_PREDICATE) + + @ios_simulator_logs_predicate.setter + def ios_simulator_logs_predicate(self, value: bool) -> None: + """ + Set the --predicate flag in the ios simulator logs. + """ + self.set_capability(IOS_SIMULATOR_LOGS_PREDICATE, value) diff --git a/appium/options/ios/xcuitest/simulator/keep_key_chains_option.py b/appium/options/ios/xcuitest/simulator/keep_key_chains_option.py new file mode 100644 index 00000000..a304c935 --- /dev/null +++ b/appium/options/ios/xcuitest/simulator/keep_key_chains_option.py @@ -0,0 +1,39 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +KEEP_KEY_CHAINS = 'keepKeyChains' + + +class KeepKeyChainsOption(SupportsCapabilities): + @property + def keep_key_chains(self) -> Optional[bool]: + """ + Whether to preserve Simulator keychains after full reset. + """ + return self.get_capability(KEEP_KEY_CHAINS) + + @keep_key_chains.setter + def keep_key_chains(self, value: bool) -> None: + """ + Set the capability to true in order to preserve Simulator keychains folder after + full reset. This feature has no effect on real devices. Defaults to false. + """ + self.set_capability(KEEP_KEY_CHAINS, value) diff --git a/appium/options/ios/xcuitest/simulator/keychains_exclude_patterns_option.py b/appium/options/ios/xcuitest/simulator/keychains_exclude_patterns_option.py new file mode 100644 index 00000000..d971f5c5 --- /dev/null +++ b/appium/options/ios/xcuitest/simulator/keychains_exclude_patterns_option.py @@ -0,0 +1,44 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +KEYCHAINS_EXCLUDE_PATTERNS = 'keychainsExcludePatterns' + + +class KeychainsExcludePatternsOption(SupportsCapabilities): + @property + def keychains_exclude_patterns(self) -> Optional[str]: + """ + Keychains exclude patterns. + """ + return self.get_capability(KEYCHAINS_EXCLUDE_PATTERNS) + + @keychains_exclude_patterns.setter + def keychains_exclude_patterns(self, value: str) -> None: + """ + This capability accepts comma-separated path patterns, + which are going to be excluded from keychains restore while + full reset is being performed on Simulator. It might be + useful if you want to exclude only particular keychain types + from being restored, like the applications keychain. This + feature has no effect on real devices. E.g. "*keychain*.db*" + to exclude applications keychain from being restored + """ + self.set_capability(KEYCHAINS_EXCLUDE_PATTERNS, value) diff --git a/appium/options/ios/xcuitest/simulator/permissions_option.py b/appium/options/ios/xcuitest/simulator/permissions_option.py new file mode 100644 index 00000000..6146e382 --- /dev/null +++ b/appium/options/ios/xcuitest/simulator/permissions_option.py @@ -0,0 +1,50 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +import json +from typing import Dict, Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +PERMISSIONS = 'permissions' + + +class PermissionsOption(SupportsCapabilities): + @property + def permissions(self) -> Optional[Dict[str, Dict[str, str]]]: + """ + Get Simulator permissions. + """ + value = self.get_capability(PERMISSIONS) + return None if value is None else json.loads(value) + + @permissions.setter + def permissions(self, value: Dict[str, Dict[str, str]]) -> None: + """ + Allows setting of permissions for the specified application bundle on + Simulator only. + + Since Xcode SDK 11.4 Apple provides native APIs to interact with + application settings. Check the output of `xcrun simctl privacy booted` + command to get the list of available permission names. Use yes, no + and unset as values in order to grant, revoke or reset the corresponding + permission. Below Xcode SDK 11.4 it is required that applesimutils package + is installed and available in PATH. The list of available service names + and statuses can be found at https://github.com/wix/AppleSimulatorUtils. + For example: {"com.apple.mobilecal": {"calendar": "YES"}} + """ + self.set_capability(PERMISSIONS, json.dumps(value, ensure_ascii=False)) diff --git a/appium/options/ios/xcuitest/simulator/reduce_motion_option.py b/appium/options/ios/xcuitest/simulator/reduce_motion_option.py new file mode 100644 index 00000000..89dbe877 --- /dev/null +++ b/appium/options/ios/xcuitest/simulator/reduce_motion_option.py @@ -0,0 +1,40 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +REDUCE_MOTION = 'reduceMotion' + + +class ReduceMotionOption(SupportsCapabilities): + @property + def reduce_motion(self) -> Optional[bool]: + """ + Whether to reduce motion accessibility preference. + """ + return self.get_capability(REDUCE_MOTION) + + @reduce_motion.setter + def reduce_motion(self, value: bool) -> None: + """ + Allows to turn on/off reduce motion accessibility preference. + Setting reduceMotion on helps to reduce flakiness during tests. + Only on simulators. + """ + self.set_capability(REDUCE_MOTION, value) diff --git a/appium/options/ios/xcuitest/simulator/reset_on_session_start_only_option.py b/appium/options/ios/xcuitest/simulator/reset_on_session_start_only_option.py new file mode 100644 index 00000000..294a7211 --- /dev/null +++ b/appium/options/ios/xcuitest/simulator/reset_on_session_start_only_option.py @@ -0,0 +1,41 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +RESET_ON_SESSION_START_ONLY = 'resetOnSessionStartOnly' + + +class ResetOnSessionStartOnlyOption(SupportsCapabilities): + @property + def reset_on_session_start_only(self) -> Optional[bool]: + """ + Whether to perform Simulator reset on test session finish (false) or not (true). + """ + return self.get_capability(RESET_ON_SESSION_START_ONLY) + + @reset_on_session_start_only.setter + def reset_on_session_start_only(self, value: bool) -> None: + """ + Whether to perform reset on test session finish (false) or not (true). + Keeping this variable set to true and Simulator running (the default + behaviour since version 1.6.4) may significantly shorten the duration of + test session initialization. + """ + self.set_capability(RESET_ON_SESSION_START_ONLY, value) diff --git a/appium/options/ios/xcuitest/simulator/scale_factor_option.py b/appium/options/ios/xcuitest/simulator/scale_factor_option.py new file mode 100644 index 00000000..8b7e6e03 --- /dev/null +++ b/appium/options/ios/xcuitest/simulator/scale_factor_option.py @@ -0,0 +1,44 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +SCALE_FACTOR = 'scaleFactor' + + +class ScaleFactorOption(SupportsCapabilities): + @property + def scale_factor(self) -> Optional[str]: + """ + Simulator scale factor. + """ + return self.get_capability(SCALE_FACTOR) + + @scale_factor.setter + def scale_factor(self, value: str) -> None: + """ + Simulator scale factor. This is useful to have if the default resolution + of simulated device is greater than the actual display resolution. + So you can scale the simulator to see the whole device screen without scrolling. + Acceptable values for simulators running Xcode SDK 8 and older are: '1.0', + '0.75', '0.5', '0.33' and '0.25', where '1.0' means 100% scale. + For simulators running Xcode SDK 9 and above the value could be any valid + positive float number. + """ + self.set_capability(SCALE_FACTOR, value) diff --git a/appium/options/ios/xcuitest/simulator/shutdown_other_simulators_option.py b/appium/options/ios/xcuitest/simulator/shutdown_other_simulators_option.py new file mode 100644 index 00000000..a7c5edc5 --- /dev/null +++ b/appium/options/ios/xcuitest/simulator/shutdown_other_simulators_option.py @@ -0,0 +1,44 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +SHUTDOWN_OTHER_SIMULATORS = 'shutdownOtherSimulators' + + +class ShutdownOtherSimulatorsOption(SupportsCapabilities): + @property + def shutdown_other_simulators(self) -> Optional[bool]: + """ + Whether to shut down of other booted simulators except of the current one. + """ + return self.get_capability(SHUTDOWN_OTHER_SIMULATORS) + + @shutdown_other_simulators.setter + def shutdown_other_simulators(self, value: bool) -> None: + """ + If this capability set to true and the current device under test is an iOS + Simulator then Appium will try to shut down all the other running Simulators + before to start a new session. This might be useful while executing webview + tests on different devices, since only one device can be debugged remotely + at once due to an Apple bug. The capability only has an effect if + --relaxed-security command line argument is provided to the server. + Defaults to false. + """ + self.set_capability(SHUTDOWN_OTHER_SIMULATORS, value) diff --git a/appium/options/ios/xcuitest/simulator/simulator_devices_set_path_option.py b/appium/options/ios/xcuitest/simulator/simulator_devices_set_path_option.py new file mode 100644 index 00000000..84557535 --- /dev/null +++ b/appium/options/ios/xcuitest/simulator/simulator_devices_set_path_option.py @@ -0,0 +1,41 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +SIMULATOR_DEVICES_SET_PATH = 'simulatorDevicesSetPath' + + +class SimulatorDevicesSetPathOption(SupportsCapabilities): + @property + def simulator_devices_set_path(self) -> Optional[str]: + """ + Alternative path to the simulator devices set. + """ + return self.get_capability(SIMULATOR_DEVICES_SET_PATH) + + @simulator_devices_set_path.setter + def simulator_devices_set_path(self, value: str) -> None: + """ + This capability allows to set an alternative path to the simulator devices + set in case you have multiple sets deployed on your local system. Such + feature could be useful if you, for example, would like to save disk space + on the main system volume. + """ + self.set_capability(SIMULATOR_DEVICES_SET_PATH, value) diff --git a/appium/options/ios/xcuitest/simulator/simulator_pasteboard_automatic_sync_option.py b/appium/options/ios/xcuitest/simulator/simulator_pasteboard_automatic_sync_option.py new file mode 100644 index 00000000..a1258df4 --- /dev/null +++ b/appium/options/ios/xcuitest/simulator/simulator_pasteboard_automatic_sync_option.py @@ -0,0 +1,42 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +SIMULATOR_PASTEBOARD_AUTOMATIC_SYNC = 'simulatorPasteboardAutomaticSync' + + +class SimulatorPasteboardAutomaticSyncOption(SupportsCapabilities): + @property + def simulator_pasteboard_automatic_sync(self) -> Optional[bool]: + """ + Pasteboard automation sync state. + """ + return self.get_capability(SIMULATOR_PASTEBOARD_AUTOMATIC_SYNC) + + @simulator_pasteboard_automatic_sync.setter + def simulator_pasteboard_automatic_sync(self, value: bool) -> None: + """ + Handle the -PasteboardAutomaticSync flag when simulator process launches. + It could improve launching simulator performance not to sync pasteboard with + the system when this value is off. on forces the flag enabled. system does + not provide the flag to the launching command. on, off, or system is available. + They are case-insensitive. Defaults to off. + """ + self.set_capability(SIMULATOR_PASTEBOARD_AUTOMATIC_SYNC, value) diff --git a/appium/options/ios/xcuitest/simulator/simulator_startup_timeout_option.py b/appium/options/ios/xcuitest/simulator/simulator_startup_timeout_option.py new file mode 100644 index 00000000..ad14462d --- /dev/null +++ b/appium/options/ios/xcuitest/simulator/simulator_startup_timeout_option.py @@ -0,0 +1,46 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from datetime import timedelta +from typing import Optional, Union + +from appium.options.common.supports_capabilities import SupportsCapabilities + +SIMULATOR_STARTUP_TIMEOUT = 'simulatorStartupTimeout' + + +class SimulatorStartupTimeoutOption(SupportsCapabilities): + @property + def simulator_startup_timeout(self) -> Optional[timedelta]: + """ + Simulator startup timeout. + """ + value = self.get_capability(SIMULATOR_STARTUP_TIMEOUT) + return None if value is None else timedelta(milliseconds=value) + + @simulator_startup_timeout.setter + def simulator_startup_timeout(self, value: Union[timedelta, int]) -> None: + """ + Allows to change the default timeout for Simulator startup. + By default, this value is set to 120000ms (2 minutes), + although the startup could take longer on a weak hardware + or if other concurrent processes use much system resources + during the boot up procedure. + """ + self.set_capability( + SIMULATOR_STARTUP_TIMEOUT, value.microseconds // 1000 if isinstance(value, timedelta) else value + ) diff --git a/appium/options/ios/xcuitest/simulator/simulator_trace_pointer_option.py b/appium/options/ios/xcuitest/simulator/simulator_trace_pointer_option.py new file mode 100644 index 00000000..d5f5d1fd --- /dev/null +++ b/appium/options/ios/xcuitest/simulator/simulator_trace_pointer_option.py @@ -0,0 +1,41 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +SIMULATOR_TRACE_POINTER = 'simulatorTracePointer' + + +class SimulatorTracePointerOption(SupportsCapabilities): + @property + def simulator_trace_pointer(self) -> Optional[bool]: + """ + Whether to highlight pointer moves in the Simulator window. + """ + return self.get_capability(SIMULATOR_TRACE_POINTER) + + @simulator_trace_pointer.setter + def simulator_trace_pointer(self, value: bool) -> None: + """ + Set whether to highlight pointer moves in the Simulator window. + The Simulator UI client must be shut down before the session + startup in order for this capability to be applied properly. + false by default. + """ + self.set_capability(SIMULATOR_TRACE_POINTER, value) diff --git a/appium/options/ios/xcuitest/simulator/simulator_window_center_option.py b/appium/options/ios/xcuitest/simulator/simulator_window_center_option.py new file mode 100644 index 00000000..1f8b2d8b --- /dev/null +++ b/appium/options/ios/xcuitest/simulator/simulator_window_center_option.py @@ -0,0 +1,41 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +SIMULATOR_WINDOW_CENTER = 'simulatorWindowCenter' + + +class SimulatorWindowCenterOption(SupportsCapabilities): + @property + def simulator_window_center(self) -> Optional[str]: + """ + Simulator window center coordinates. + """ + return self.get_capability(SIMULATOR_WINDOW_CENTER) + + @simulator_window_center.setter + def simulator_window_center(self, value: str) -> None: + """ + Allows to explicitly set the coordinates of Simulator window center + for Xcode9+ SDK. This capability only has an effect if Simulator + window has not been opened yet for the current session before it started. + e.g. "{-100.0,100.0}" or "{500,500}", spaces are not allowed + """ + self.set_capability(SIMULATOR_WINDOW_CENTER, value) diff --git a/appium/options/ios/xcuitest/wda/__init__.py b/appium/options/ios/xcuitest/wda/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/appium/options/ios/xcuitest/wda/allow_provisioning_device_regitration_option.py b/appium/options/ios/xcuitest/wda/allow_provisioning_device_regitration_option.py new file mode 100644 index 00000000..c88124b4 --- /dev/null +++ b/appium/options/ios/xcuitest/wda/allow_provisioning_device_regitration_option.py @@ -0,0 +1,40 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +ALLOW_PROVISIONING_DEVICE_REGISTRATION = 'allowProvisioningDeviceRegistration' + + +class AllowProvisioningDeviceRegistrationOption(SupportsCapabilities): + @property + def allow_provisioning_device_registration(self) -> Optional[bool]: + """ + Whether to allow xcodebuild to register your destination device on the developer portal. + """ + return self.get_capability(ALLOW_PROVISIONING_DEVICE_REGISTRATION) + + @allow_provisioning_device_registration.setter + def allow_provisioning_device_registration(self, value: bool) -> None: + """ + Allow xcodebuild to register your destination device on the developer portal + if necessary. Requires a developer account to have been added in Xcode's Accounts + preference pane. Defaults to false. + """ + self.set_capability(ALLOW_PROVISIONING_DEVICE_REGISTRATION, value) diff --git a/appium/options/ios/xcuitest/wda/auto_accept_alerts_option.py b/appium/options/ios/xcuitest/wda/auto_accept_alerts_option.py new file mode 100644 index 00000000..05c55943 --- /dev/null +++ b/appium/options/ios/xcuitest/wda/auto_accept_alerts_option.py @@ -0,0 +1,39 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +AUTO_ACCEPT_ALERTS = 'autoAcceptAlerts' + + +class AutoAcceptAlertsOption(SupportsCapabilities): + @property + def auto_accept_alerts(self) -> Optional[bool]: + """ + Whether to accept all alerts automatically. + """ + return self.get_capability(AUTO_ACCEPT_ALERTS) + + @auto_accept_alerts.setter + def auto_accept_alerts(self, value: bool) -> None: + """ + Accept all iOS alerts automatically if they pop up. This includes privacy + access permission alerts (e.g., location, contacts, photos). Default is false. + """ + self.set_capability(AUTO_ACCEPT_ALERTS, value) diff --git a/appium/options/ios/xcuitest/wda/auto_disimiss_alerts_option.py b/appium/options/ios/xcuitest/wda/auto_disimiss_alerts_option.py new file mode 100644 index 00000000..61a28414 --- /dev/null +++ b/appium/options/ios/xcuitest/wda/auto_disimiss_alerts_option.py @@ -0,0 +1,39 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +AUTO_DISMISS_ALERTS = 'autoDismissAlerts' + + +class AutoDismissAlertsOption(SupportsCapabilities): + @property + def auto_dismiss_alerts(self) -> Optional[bool]: + """ + Whether to dismiss all alerts automatically. + """ + return self.get_capability(AUTO_DISMISS_ALERTS) + + @auto_dismiss_alerts.setter + def auto_dismiss_alerts(self, value: bool) -> None: + """ + Dismiss all iOS alerts automatically if they pop up. This includes privacy + access permission alerts (e.g., location, contacts, photos). Default is false. + """ + self.set_capability(AUTO_DISMISS_ALERTS, value) diff --git a/appium/options/ios/xcuitest/wda/derived_data_path_option.py b/appium/options/ios/xcuitest/wda/derived_data_path_option.py new file mode 100644 index 00000000..ffa40a68 --- /dev/null +++ b/appium/options/ios/xcuitest/wda/derived_data_path_option.py @@ -0,0 +1,41 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +DERIVED_DATA_PATH = 'derivedDataPath' + + +class DerivedDataPathOption(SupportsCapabilities): + @property + def derived_data_path(self) -> Optional[str]: + """ + Path to the derived data WDA folder. + """ + return self.get_capability(DERIVED_DATA_PATH) + + @derived_data_path.setter + def derived_data_path(self, value: str) -> None: + """ + Use along with usePrebuiltWDA capability and choose where to search for the existing WDA app. + If the capability is not set then Xcode will store the derived data in the default root + taken from preferences. + It also makes sense to choose different folders for parallel WDA sessions. + """ + self.set_capability(DERIVED_DATA_PATH, value) diff --git a/appium/options/ios/xcuitest/wda/disable_automatic_screenshots_option.py b/appium/options/ios/xcuitest/wda/disable_automatic_screenshots_option.py new file mode 100644 index 00000000..ac76af33 --- /dev/null +++ b/appium/options/ios/xcuitest/wda/disable_automatic_screenshots_option.py @@ -0,0 +1,40 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +DISABLE_AUTOMATIC_SCREENSHOTS = 'disableAutomaticScreenshots' + + +class DisableAutomaticScreenshotsOption(SupportsCapabilities): + @property + def disable_automatic_screenshots(self) -> Optional[bool]: + """ + Whether to disable automatic XCTest screenshots. + """ + return self.get_capability(DISABLE_AUTOMATIC_SCREENSHOTS) + + @disable_automatic_screenshots.setter + def disable_automatic_screenshots(self, value: bool) -> None: + """ + Disable automatic screenshots taken by XCTest at every interaction. + Default is up to WebDriverAgent's config to decide, which currently + defaults to true. + """ + self.set_capability(DISABLE_AUTOMATIC_SCREENSHOTS, value) diff --git a/appium/options/ios/xcuitest/wda/force_app_launch_option.py b/appium/options/ios/xcuitest/wda/force_app_launch_option.py new file mode 100644 index 00000000..364133d0 --- /dev/null +++ b/appium/options/ios/xcuitest/wda/force_app_launch_option.py @@ -0,0 +1,42 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +FORCE_APP_LAUNCH = 'forceAppLaunch' + + +class ForceAppLaunchOption(SupportsCapabilities): + @property + def force_app_launch(self) -> Optional[bool]: + """ + Whether to enforce app restart on session startup. + """ + return self.get_capability(FORCE_APP_LAUNCH) + + @force_app_launch.setter + def force_app_launch(self, value: bool) -> None: + """ + Specify if the app should be forcefully restarted if it is already + running on session startup. This capability only has an effect if an + application identifier has been passed to the test session (either + explicitly, by setting bundleId, or implicitly, by providing app). + Default is true unless noReset capability is set to true. + """ + self.set_capability(FORCE_APP_LAUNCH, value) diff --git a/appium/options/ios/xcuitest/wda/keychain_password_option.py b/appium/options/ios/xcuitest/wda/keychain_password_option.py new file mode 100644 index 00000000..5514519f --- /dev/null +++ b/appium/options/ios/xcuitest/wda/keychain_password_option.py @@ -0,0 +1,39 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +KEYCHAIN_PASSWORD = 'keychainPassword' + + +class KeychainPasswordOption(SupportsCapabilities): + @property + def keychain_password(self) -> Optional[str]: + """ + Custom keychain password. + """ + return self.get_capability(KEYCHAIN_PASSWORD) + + @keychain_password.setter + def keychain_password(self, value: str) -> None: + """ + Custom keychain password. The keychain is expected to + contain the private development key. + """ + self.set_capability(KEYCHAIN_PASSWORD, value) diff --git a/appium/options/ios/xcuitest/wda/keychain_path_option.py b/appium/options/ios/xcuitest/wda/keychain_path_option.py new file mode 100644 index 00000000..5cf39742 --- /dev/null +++ b/appium/options/ios/xcuitest/wda/keychain_path_option.py @@ -0,0 +1,39 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +KEYCHAIN_PATH = 'keychainPath' + + +class KeychainPathOption(SupportsCapabilities): + @property + def keychain_path(self) -> Optional[str]: + """ + Path to a custom keychain. + """ + return self.get_capability(KEYCHAIN_PATH) + + @keychain_path.setter + def keychain_path(self, value: str) -> None: + """ + Path to a custom keychain, which + contains the private development key. + """ + self.set_capability(KEYCHAIN_PATH, value) diff --git a/appium/options/ios/xcuitest/wda/max_typing_frequency_option.py b/appium/options/ios/xcuitest/wda/max_typing_frequency_option.py new file mode 100644 index 00000000..d5ea8dea --- /dev/null +++ b/appium/options/ios/xcuitest/wda/max_typing_frequency_option.py @@ -0,0 +1,40 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +MAX_TYPING_FREQUENCY = 'maxTypingFrequency' + + +class MaxTypingFrequencyOption(SupportsCapabilities): + @property + def max_typing_frequency(self) -> Optional[int]: + """ + The number of keystrokes per minute. + """ + return self.get_capability(MAX_TYPING_FREQUENCY) + + @max_typing_frequency.setter + def max_typing_frequency(self, value: int) -> None: + """ + Maximum frequency of keystrokes for typing and clear. If your tests + are failing because of typing errors, you may want to adjust this. + Defaults to 60 keystrokes per minute. + """ + self.set_capability(MAX_TYPING_FREQUENCY, value) diff --git a/appium/options/ios/xcuitest/wda/mjpeg_server_port_option.py b/appium/options/ios/xcuitest/wda/mjpeg_server_port_option.py new file mode 100644 index 00000000..679c1af4 --- /dev/null +++ b/appium/options/ios/xcuitest/wda/mjpeg_server_port_option.py @@ -0,0 +1,42 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +MJPEG_SERVER_PORT = 'mjpegServerPort' + + +class MjpegServerPortOption(SupportsCapabilities): + @property + def mjpeg_server_port(self) -> Optional[int]: + """ + Port number on which WDA broadcasts screenshots stream encoded into MJPEG + format from the device under test. + """ + return self.get_capability(MJPEG_SERVER_PORT) + + @mjpeg_server_port.setter + def mjpeg_server_port(self, value: int) -> None: + """ + Port number on which WDA broadcasts screenshots stream encoded into MJPEG + format from the device under test. It might be necessary to change this value + if the default port is busy because of other tests running in parallel. + Default value: 9100. + """ + self.set_capability(MJPEG_SERVER_PORT, value) diff --git a/appium/options/ios/xcuitest/wda/process_arguments_option.py b/appium/options/ios/xcuitest/wda/process_arguments_option.py new file mode 100644 index 00000000..5b169a94 --- /dev/null +++ b/appium/options/ios/xcuitest/wda/process_arguments_option.py @@ -0,0 +1,42 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Dict, List, Optional, Union + +from appium.options.common.supports_capabilities import SupportsCapabilities + +PROCESS_ARGUMENTS = 'processArguments' + + +class ProcessArgumentsOption(SupportsCapabilities): + @property + def process_arguments(self) -> Optional[Dict[str, Union[List[str], Dict[str, str]]]]: + """ + Command line arguments and/or environment variables of the application under test. + """ + return self.get_capability(PROCESS_ARGUMENTS) + + @process_arguments.setter + def process_arguments(self, value: Dict[str, Union[List[str], Dict[str, str]]]) -> None: + """ + Provides process arguments and environment which will be sent + to the WebDriverAgent server. Acceptable dictionary keys are 'env' + and 'args'. The value of 'args' should be a list of app command line + arguments represented as strings and the value of 'env' is expected to + be a dictionary of environment variable names and their values (also strings). + """ + self.set_capability(PROCESS_ARGUMENTS, value) diff --git a/appium/options/ios/xcuitest/wda/result_bundle_path_option.py b/appium/options/ios/xcuitest/wda/result_bundle_path_option.py new file mode 100644 index 00000000..5cf7ec09 --- /dev/null +++ b/appium/options/ios/xcuitest/wda/result_bundle_path_option.py @@ -0,0 +1,42 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +RESULT_BUNDLE_PATH = 'resultBundlePath' + + +class ResultBundlePathOption(SupportsCapabilities): + @property + def result_bundle_path(self) -> Optional[str]: + """ + Path where the resulting XCTest bundle should be stored. + """ + return self.get_capability(RESULT_BUNDLE_PATH) + + @result_bundle_path.setter + def result_bundle_path(self, value: str) -> None: + """ + Specify the path to the result bundle path as xcodebuild argument for + WebDriverAgent build under a security flag. WebDriverAgent process must + start/stop every time to pick up changed value of this property. + Specifying useNewWDA to true may help there. Please read 'man xcodebuild' + for more details. + """ + self.set_capability(RESULT_BUNDLE_PATH, value) diff --git a/appium/options/ios/xcuitest/wda/screenshot_quality_option.py b/appium/options/ios/xcuitest/wda/screenshot_quality_option.py new file mode 100644 index 00000000..d808db9d --- /dev/null +++ b/appium/options/ios/xcuitest/wda/screenshot_quality_option.py @@ -0,0 +1,42 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +SCREENSHOT_QUALITY = 'screenshotQuality' + + +class ScreenshotQualityOption(SupportsCapabilities): + @property + def screenshot_quality(self) -> Optional[int]: + """ + Screenshot quality value. + """ + return self.get_capability(SCREENSHOT_QUALITY) + + @screenshot_quality.setter + def screenshot_quality(self, value: int) -> None: + """ + Changes the quality of phone display screenshots following + xctest/xctimagequality Default value is 1. 0 is the highest and + 2 is the lowest quality. You can also change it via settings + command. 0 might cause OutOfMemory crash on high-resolution + devices like iPad Pro. + """ + self.set_capability(SCREENSHOT_QUALITY, value) diff --git a/appium/options/ios/xcuitest/wda/should_terminate_app_option.py b/appium/options/ios/xcuitest/wda/should_terminate_app_option.py new file mode 100644 index 00000000..8550627c --- /dev/null +++ b/appium/options/ios/xcuitest/wda/should_terminate_app_option.py @@ -0,0 +1,42 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +SHOULD_TERMINATE_APP = 'shouldTerminateApp' + + +class ShouldTerminateAppOption(SupportsCapabilities): + @property + def should_terminate_app(self) -> Optional[bool]: + """ + Whether to enforce app termination on session quit. + """ + return self.get_capability(SHOULD_TERMINATE_APP) + + @should_terminate_app.setter + def should_terminate_app(self, value: bool) -> None: + """ + Specify if the app should be terminated on session end. + This capability only has an effect if an application identifier + has been passed to the test session (either explicitly, + by setting bundleId, or implicitly, by providing app). + Default is true unless noReset capability is set to true. + """ + self.set_capability(SHOULD_TERMINATE_APP, value) diff --git a/appium/options/ios/xcuitest/wda/should_use_singleton_test_manager_option.py b/appium/options/ios/xcuitest/wda/should_use_singleton_test_manager_option.py new file mode 100644 index 00000000..56923681 --- /dev/null +++ b/appium/options/ios/xcuitest/wda/should_use_singleton_test_manager_option.py @@ -0,0 +1,39 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +SHOULD_USE_SINGLETON_TEST_MANAGER = 'shouldUseSingletonTestManager' + + +class ShouldUseSingletonTestManagerOption(SupportsCapabilities): + @property + def should_use_singleton_test_manager(self) -> Optional[bool]: + """ + Whether to use the default proxy for test management within WebDriverAgent. + """ + return self.get_capability(SHOULD_USE_SINGLETON_TEST_MANAGER) + + @should_use_singleton_test_manager.setter + def should_use_singleton_test_manager(self, value: bool) -> None: + """ + Use default proxy for test management within WebDriverAgent. Setting this to false + sometimes helps with socket hangup problems. Defaults to true. + """ + self.set_capability(SHOULD_USE_SINGLETON_TEST_MANAGER, value) diff --git a/appium/options/ios/xcuitest/wda/show_xcode_log_option.py b/appium/options/ios/xcuitest/wda/show_xcode_log_option.py new file mode 100644 index 00000000..0e435b71 --- /dev/null +++ b/appium/options/ios/xcuitest/wda/show_xcode_log_option.py @@ -0,0 +1,40 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +SHOW_XCODE_LOG = 'showXcodeLog' + + +class ShowXcodeLogOption(SupportsCapabilities): + @property + def show_xcode_log(self) -> Optional[bool]: + """ + Whether to display the output of the Xcode command used to run the tests. + """ + return self.get_capability(SHOW_XCODE_LOG) + + @show_xcode_log.setter + def show_xcode_log(self, value: bool) -> None: + """ + Whether to display the output of the Xcode command used to run the tests in + server logs. If this is true, there will be lots of extra logging at startup. + Defaults to false. + """ + self.set_capability(SHOW_XCODE_LOG, value) diff --git a/appium/options/ios/xcuitest/wda/simple_is_visible_check_option.py b/appium/options/ios/xcuitest/wda/simple_is_visible_check_option.py new file mode 100644 index 00000000..694ed574 --- /dev/null +++ b/appium/options/ios/xcuitest/wda/simple_is_visible_check_option.py @@ -0,0 +1,42 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +SIMPLE_IS_VISIBLE_CHECK = 'simpleIsVisibleCheck' + + +class SimpleIsVisibleCheckOption(SupportsCapabilities): + @property + def simple_is_visible_check(self) -> Optional[bool]: + """ + Whether to use native methods for determining visibility of elements. + """ + return self.get_capability(SIMPLE_IS_VISIBLE_CHECK) + + @simple_is_visible_check.setter + def simple_is_visible_check(self, value: bool) -> None: + """ + Use native methods for determining visibility of elements. + In some cases this takes a long time. Setting this capability to false will + cause the system to use the position and size of elements to make sure they + are visible on the screen. This can, however, lead to false results in some + situations. Defaults to false, except iOS 9.3, where it defaults to true. + """ + self.set_capability(SIMPLE_IS_VISIBLE_CHECK, value) diff --git a/appium/options/ios/xcuitest/wda/updated_wda_bundle_id_option.py b/appium/options/ios/xcuitest/wda/updated_wda_bundle_id_option.py new file mode 100644 index 00000000..b799c949 --- /dev/null +++ b/appium/options/ios/xcuitest/wda/updated_wda_bundle_id_option.py @@ -0,0 +1,39 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +UPDATED_WDA_BUNDLE_ID = 'updatedWDABundleId' + + +class UpdatedWdaBundleIdOption(SupportsCapabilities): + @property + def updated_wda_bundle_id(self) -> Optional[str]: + """ + WDA bundle identifier. + """ + return self.get_capability(UPDATED_WDA_BUNDLE_ID) + + @updated_wda_bundle_id.setter + def updated_wda_bundle_id(self, value: str) -> None: + """ + Bundle id to update WDA to before building and launching on real devices. + This bundle id must be associated with a valid provisioning profile. + """ + self.set_capability(UPDATED_WDA_BUNDLE_ID, value) diff --git a/appium/options/ios/xcuitest/wda/use_native_caching_strategy_option.py b/appium/options/ios/xcuitest/wda/use_native_caching_strategy_option.py new file mode 100644 index 00000000..a3e30de1 --- /dev/null +++ b/appium/options/ios/xcuitest/wda/use_native_caching_strategy_option.py @@ -0,0 +1,41 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +USE_NATIVE_CACHING_STRATEGY = 'useNativeCachingStrategy' + + +class UseNativeCachingStrategyOption(SupportsCapabilities): + @property + def use_native_caching_strategy(self) -> Optional[bool]: + """ + Whether to use the native caching strategy. + """ + return self.get_capability(USE_NATIVE_CACHING_STRATEGY) + + @use_native_caching_strategy.setter + def use_native_caching_strategy(self, value: bool) -> None: + """ + Set this capability to false in order to use the custom elements caching + strategy. This might help to avoid stale element exception on property + change. By default, the native XCTest cache resolution is used (true) + for all native locators (e.g. all, but xpath). + """ + self.set_capability(USE_NATIVE_CACHING_STRATEGY, value) diff --git a/appium/options/ios/xcuitest/wda/use_new_wda_option.py b/appium/options/ios/xcuitest/wda/use_new_wda_option.py new file mode 100644 index 00000000..f52684a6 --- /dev/null +++ b/appium/options/ios/xcuitest/wda/use_new_wda_option.py @@ -0,0 +1,51 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +USE_NEW_WDA = 'useNewWDA' + + +class UseNewWdaOption(SupportsCapabilities): + @property + def use_new_wda(self) -> Optional[bool]: + """ + Whether whether to uninstall of any existing WebDriverAgent app + on the device under test. + """ + return self.get_capability(USE_NEW_WDA) + + @use_new_wda.setter + def use_new_wda(self, value: bool) -> None: + """ + If true, forces uninstall of any existing WebDriverAgent app on device. + Set it to true if you want to apply different startup options for WebDriverAgent + for each session. Although, it is only guaranteed to work stable on Simulator. + Real devices require WebDriverAgent client to run for as long as possible without + reinstall/restart to avoid issues like + https://github.com/facebook/WebDriverAgent/issues/507. The false value + (the default behaviour since driver version 2.35.0) will try to + detect currently running WDA listener executed by previous testing session(s) + and reuse it if possible, which is highly recommended for real device testing + and to speed up suites of multiple tests in general. A new WDA session will be + triggered at the default URL (http://localhost:8100) if WDA is not listening and + webDriverAgentUrl capability is not set. The negative/unset value of useNewWDA + capability has no effect prior to xcuitest driver version 2.35.0. + """ + self.set_capability(USE_NEW_WDA, value) diff --git a/appium/options/ios/xcuitest/wda/use_prebuilt_wda_option.py b/appium/options/ios/xcuitest/wda/use_prebuilt_wda_option.py new file mode 100644 index 00000000..76fd5163 --- /dev/null +++ b/appium/options/ios/xcuitest/wda/use_prebuilt_wda_option.py @@ -0,0 +1,39 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +USE_PREBUILT_WDA = 'usePrebuiltWDA' + + +class UsePrebuiltWdaOption(SupportsCapabilities): + @property + def use_prebuilt_wda(self) -> Optional[bool]: + """ + Whether to skip the build phase of running the WDA app. + """ + return self.get_capability(USE_PREBUILT_WDA) + + @use_prebuilt_wda.setter + def use_prebuilt_wda(self, value: bool) -> None: + """ + Skips the build phase of running the WDA app. Building is then the responsibility + of the user. Only works for Xcode 8+. Defaults to false. + """ + self.set_capability(USE_PREBUILT_WDA, value) diff --git a/appium/options/ios/xcuitest/wda/use_simple_build_test_option.py b/appium/options/ios/xcuitest/wda/use_simple_build_test_option.py new file mode 100644 index 00000000..516e08cb --- /dev/null +++ b/appium/options/ios/xcuitest/wda/use_simple_build_test_option.py @@ -0,0 +1,40 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +USE_SIMPLE_BUILD_TEST = 'useSimpleBuildTest' + + +class UseSimpleBuildTestOption(SupportsCapabilities): + @property + def use_simple_build_test(self) -> Optional[bool]: + """ + Whether to enforce app termination on session quit. + """ + return self.get_capability(USE_SIMPLE_BUILD_TEST) + + @use_simple_build_test.setter + def use_simple_build_test(self, value: bool) -> None: + """ + Build with 'build' and run test with 'test' in xcodebuild for all Xcode versions if + this is true, or build with 'build-for-testing' and run tests with + 'test-without-building' for over Xcode 8 if this is false. Defaults to false. + """ + self.set_capability(USE_SIMPLE_BUILD_TEST, value) diff --git a/appium/options/ios/xcuitest/wda/use_xctestrun_file_option.py b/appium/options/ios/xcuitest/wda/use_xctestrun_file_option.py new file mode 100644 index 00000000..0d1a3c64 --- /dev/null +++ b/appium/options/ios/xcuitest/wda/use_xctestrun_file_option.py @@ -0,0 +1,49 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +USE_XCTESTRUN_FILE = 'useXctestrunFile' + + +class UseXctestrunFileOption(SupportsCapabilities): + @property + def use_xctestrun_file(self) -> Optional[bool]: + """ + Whether to use of .xctestrun file to launch WDA. + """ + return self.get_capability(USE_XCTESTRUN_FILE) + + @use_xctestrun_file.setter + def use_xctestrun_file(self, value: bool) -> None: + """ + Use Xctestrun file to launch WDA. It will search for such file in bootstrapPath. + Expected name of file is WebDriverAgentRunner_iphoneos<sdkVersion>-arm64.xctestrun for + real device and WebDriverAgentRunner_iphonesimulator<sdkVersion>-x86_64.xctestrun for + simulator. One can do build-for-testing for WebDriverAgent project for simulator and + real device and then you will see Product Folder like this and you need to copy content + of this folder at bootstrapPath location. Since this capability expects that you have + already built WDA project, it neither checks whether you have necessary dependencies to + build WDA nor will it try to build project. Defaults to false. Tips: Xcodebuild builds for the + target platform version. We'd recommend you to build with minimal OS version which you'd + like to run as the original WDA module. e.g. If you build WDA for 12.2, the module cannot + run on iOS 11.4 because of loading some module error on simulator. A module built with 11.4 + can work on iOS 12.2. (This is xcodebuild's expected behaviour.) + """ + self.set_capability(USE_XCTESTRUN_FILE, value) diff --git a/appium/options/ios/xcuitest/wda/wait_for_idle_timeout_option.py b/appium/options/ios/xcuitest/wda/wait_for_idle_timeout_option.py new file mode 100644 index 00000000..3cf75ec4 --- /dev/null +++ b/appium/options/ios/xcuitest/wda/wait_for_idle_timeout_option.py @@ -0,0 +1,45 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from datetime import timedelta +from typing import Optional, Union + +from appium.options.common.supports_capabilities import SupportsCapabilities + +WAIT_FOR_IDLE_TIMEOUT = 'waitForIdleTimeout' + + +class WaitForIdleTimeoutOption(SupportsCapabilities): + @property + def wait_for_idle_timeout(self) -> Optional[timedelta]: + """ + Maximum timeout to wait until WDA responds to HTTP requests. + """ + value = self.get_capability(WAIT_FOR_IDLE_TIMEOUT) + return None if value is None else timedelta(seconds=value) + + @wait_for_idle_timeout.setter + def wait_for_idle_timeout(self, value: Union[timedelta, float]) -> None: + """ + The time to wait until the application under test is idling. + XCTest requires the app's main thread to be idling in order to execute any action on it, + so WDA might not even start/freeze if the app under test is constantly hogging the main + thread. The default value is 10 (seconds). Setting it to zero disables idling checks completely + (not recommended) and has the same effect as setting waitForQuiescence to false. + Available since Appium 1.20.0. + """ + self.set_capability(WAIT_FOR_IDLE_TIMEOUT, value.seconds if isinstance(value, timedelta) else value) diff --git a/appium/options/ios/xcuitest/wda/wait_for_quiescence_option.py b/appium/options/ios/xcuitest/wda/wait_for_quiescence_option.py new file mode 100644 index 00000000..b8be7f32 --- /dev/null +++ b/appium/options/ios/xcuitest/wda/wait_for_quiescence_option.py @@ -0,0 +1,42 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from datetime import timedelta +from typing import Optional, Union + +from appium.options.common.supports_capabilities import SupportsCapabilities + +WAIT_FOR_QUIESCENCE = 'waitForQuiescence' + + +class WaitForQuiescenceOption(SupportsCapabilities): + @property + def wait_for_quiescence(self) -> Optional[bool]: + """ + Whether to wait for application quiescence. + """ + return self.get_capability(WAIT_FOR_QUIESCENCE) + + @wait_for_quiescence.setter + def wait_for_quiescence(self, value: Union[timedelta, float]) -> None: + """ + It allows to turn on/off waiting for application quiescence in WebDriverAgent, + while performing queries. The default value is true. You can avoid this kind + of issues if you turn it off. Consider using waitForIdleTimeout capability + instead for this purpose since Appium 1.20.0. + """ + self.set_capability(WAIT_FOR_QUIESCENCE, value) diff --git a/appium/options/ios/xcuitest/wda/wda_base_url_option.py b/appium/options/ios/xcuitest/wda/wda_base_url_option.py new file mode 100644 index 00000000..c2ca5cd8 --- /dev/null +++ b/appium/options/ios/xcuitest/wda/wda_base_url_option.py @@ -0,0 +1,41 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +WDA_BASE_URL = 'wdaBaseUrl' + + +class WdaBaseUrlOption(SupportsCapabilities): + @property + def wda_base_url(self) -> Optional[str]: + """ + Prefix to build a custom WebDriverAgent URL. + """ + return self.get_capability(WDA_BASE_URL) + + @wda_base_url.setter + def wda_base_url(self, value: str) -> None: + """ + This value, if specified, will be used as a prefix to build a custom + WebDriverAgent url. It is different from webDriverAgentUrl, because + if the latter is set then it expects WebDriverAgent to be already + listening and skips the building phase. Defaults to http://localhost. + """ + self.set_capability(WDA_BASE_URL, value) diff --git a/appium/options/ios/xcuitest/wda/wda_connection_timeout_option.py b/appium/options/ios/xcuitest/wda/wda_connection_timeout_option.py new file mode 100644 index 00000000..09364f58 --- /dev/null +++ b/appium/options/ios/xcuitest/wda/wda_connection_timeout_option.py @@ -0,0 +1,43 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from datetime import timedelta +from typing import Optional, Union + +from appium.options.common.supports_capabilities import SupportsCapabilities + +WDA_CONNECTION_TIMEOUT = 'wdaConnectionTimeout' + + +class WdaConnectionTimeoutOption(SupportsCapabilities): + @property + def wda_connection_timeout(self) -> Optional[timedelta]: + """ + Maximum timeout to wait until WDA responds to HTTP requests. + """ + value = self.get_capability(WDA_CONNECTION_TIMEOUT) + return None if value is None else timedelta(milliseconds=value) + + @wda_connection_timeout.setter + def wda_connection_timeout(self, value: Union[timedelta, int]) -> None: + """ + Connection timeout to wait for a response from WebDriverAgent. + Defaults to 240000ms. + """ + self.set_capability( + WDA_CONNECTION_TIMEOUT, value.microseconds // 1000 if isinstance(value, timedelta) else value + ) diff --git a/appium/options/ios/xcuitest/wda/wda_eventloop_idle_delay_option.py b/appium/options/ios/xcuitest/wda/wda_eventloop_idle_delay_option.py new file mode 100644 index 00000000..aa1a134d --- /dev/null +++ b/appium/options/ios/xcuitest/wda/wda_eventloop_idle_delay_option.py @@ -0,0 +1,46 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from datetime import timedelta +from typing import Optional, Union + +from appium.options.common.supports_capabilities import SupportsCapabilities + +WDA_EVENTLOOP_IDLE_DELAY = 'wdaEventloopIdleDelay' + + +class WdaEventloopIdleDelayOption(SupportsCapabilities): + @property + def wda_eventloop_idle_delay(self) -> Optional[timedelta]: + """ + Event loop idle delay. + """ + value = self.get_capability(WDA_EVENTLOOP_IDLE_DELAY) + return None if value is None else timedelta(seconds=value) + + @wda_eventloop_idle_delay.setter + def wda_eventloop_idle_delay(self, value: Union[timedelta, float]) -> None: + """ + Delays the invocation of -[XCUIApplicationProcess setEventLoopHasIdled:] by the + duration specified with this capability. This can help quiescence apps + that fail to do so for no obvious reason (and creating a session fails for + that reason). This increases the time for session creation + because -[XCUIApplicationProcess setEventLoopHasIdled:] is called multiple times. + If you enable this capability start with at least 3 seconds and try increasing it, + if creating the session still fails. Defaults to 0. + """ + self.set_capability(WDA_EVENTLOOP_IDLE_DELAY, value.seconds if isinstance(value, timedelta) else value) diff --git a/appium/options/ios/xcuitest/wda/wda_launch_timeout_option.py b/appium/options/ios/xcuitest/wda/wda_launch_timeout_option.py new file mode 100644 index 00000000..62a029ec --- /dev/null +++ b/appium/options/ios/xcuitest/wda/wda_launch_timeout_option.py @@ -0,0 +1,41 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from datetime import timedelta +from typing import Optional, Union + +from appium.options.common.supports_capabilities import SupportsCapabilities + +WDA_LAUNCH_TIMEOUT = 'wdaLaunchTimeout' + + +class WdaLaunchTimeoutOption(SupportsCapabilities): + @property + def wda_launch_timeout(self) -> Optional[timedelta]: + """ + Maximum timeout to wait until WDA is listening. + """ + value = self.get_capability(WDA_LAUNCH_TIMEOUT) + return None if value is None else timedelta(milliseconds=value) + + @wda_launch_timeout.setter + def wda_launch_timeout(self, value: Union[timedelta, int]) -> None: + """ + Timeout to wait for WebDriverAgent to be pingable, + after its building is finished. Defaults to 60000ms. + """ + self.set_capability(WDA_LAUNCH_TIMEOUT, value.microseconds // 1000 if isinstance(value, timedelta) else value) diff --git a/appium/options/ios/xcuitest/wda/wda_local_port_option.py b/appium/options/ios/xcuitest/wda/wda_local_port_option.py new file mode 100644 index 00000000..1af241a3 --- /dev/null +++ b/appium/options/ios/xcuitest/wda/wda_local_port_option.py @@ -0,0 +1,41 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +WDA_LOCAL_PORT = 'wdaLocalPort' + + +class WdaLocalPortOption(SupportsCapabilities): + @property + def wda_local_port(self) -> Optional[int]: + """ + Local port number where the WDA traffic is being forwarded. + """ + return self.get_capability(WDA_LOCAL_PORT) + + @wda_local_port.setter + def wda_local_port(self, value: int) -> None: + """ + This value, if specified, will be used to forward traffic from + Mac host to real ios devices over USB. + Default value is the same as the port number used by WDA on + the device under test (8100). + """ + self.set_capability(WDA_LOCAL_PORT, value) diff --git a/appium/options/ios/xcuitest/wda/wda_startup_retries_option.py b/appium/options/ios/xcuitest/wda/wda_startup_retries_option.py new file mode 100644 index 00000000..a7099962 --- /dev/null +++ b/appium/options/ios/xcuitest/wda/wda_startup_retries_option.py @@ -0,0 +1,39 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +WDA_STARTUP_RETRIES = 'wdaStartupRetries' + + +class WdaStartupRetriesOption(SupportsCapabilities): + @property + def wda_startup_retries(self) -> Optional[int]: + """ + Number of retries before to fail WDA deployment. + """ + return self.get_capability(WDA_STARTUP_RETRIES) + + @wda_startup_retries.setter + def wda_startup_retries(self, value: int) -> None: + """ + Number of times to try to build and launch WebDriverAgent onto the device. + Defaults to 2. + """ + self.set_capability(WDA_STARTUP_RETRIES, value) diff --git a/appium/options/ios/xcuitest/wda/wda_startup_retry_interval_option.py b/appium/options/ios/xcuitest/wda/wda_startup_retry_interval_option.py new file mode 100644 index 00000000..b033f878 --- /dev/null +++ b/appium/options/ios/xcuitest/wda/wda_startup_retry_interval_option.py @@ -0,0 +1,43 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from datetime import timedelta +from typing import Optional, Union + +from appium.options.common.supports_capabilities import SupportsCapabilities + +WDA_STARTUP_RETRY_INTERVAL = 'wdaStartupRetryInterval' + + +class WdaStartupRetryIntervalOption(SupportsCapabilities): + @property + def wda_startup_retry_interval(self) -> Optional[timedelta]: + """ + Interval to wait between tries to build and launch WebDriverAgent. + """ + value = self.get_capability(WDA_STARTUP_RETRY_INTERVAL) + return None if value is None else timedelta(milliseconds=value) + + @wda_startup_retry_interval.setter + def wda_startup_retry_interval(self, value: Union[timedelta, int]) -> None: + """ + Time interval to wait between tries to build and launch WebDriverAgent. + Defaults to 10000ms. + """ + self.set_capability( + WDA_STARTUP_RETRY_INTERVAL, value.microseconds // 1000 if isinstance(value, timedelta) else value + ) diff --git a/appium/options/ios/xcuitest/wda/web_driver_agent_url_option.py b/appium/options/ios/xcuitest/wda/web_driver_agent_url_option.py new file mode 100644 index 00000000..5dd89f2c --- /dev/null +++ b/appium/options/ios/xcuitest/wda/web_driver_agent_url_option.py @@ -0,0 +1,39 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +WEB_DRIVER_AGENT_URL = 'webDriverAgentUrl' + + +class WebDriverAgentUrlOption(SupportsCapabilities): + @property + def web_driver_agent_url(self) -> Optional[str]: + """ + WedDriverAgent URL. + """ + return self.get_capability(WEB_DRIVER_AGENT_URL) + + @web_driver_agent_url.setter + def web_driver_agent_url(self, value: str) -> None: + """ + If provided, Appium will connect to an existing WebDriverAgent + instance at this URL instead of starting a new one. + """ + self.set_capability(WEB_DRIVER_AGENT_URL, value) diff --git a/appium/options/ios/xcuitest/wda/xcode_org_id_option.py b/appium/options/ios/xcuitest/wda/xcode_org_id_option.py new file mode 100644 index 00000000..d5c51793 --- /dev/null +++ b/appium/options/ios/xcuitest/wda/xcode_org_id_option.py @@ -0,0 +1,39 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +XCODE_ORG_ID = 'xcodeOrgId' + + +class XcodeOrgIdOption(SupportsCapabilities): + @property + def xcode_org_id(self) -> Optional[str]: + """ + Signing certificate organization id for WebDriverAgent compilation. + """ + return self.get_capability(XCODE_ORG_ID) + + @xcode_org_id.setter + def xcode_org_id(self, value: str) -> None: + """ + Provides a signing certificate organization id for WebDriverAgent compilation. + If signing id is not provided then it defaults to "iPhone Developer" + """ + self.set_capability(XCODE_ORG_ID, value) diff --git a/appium/options/ios/xcuitest/wda/xcode_signing_id_option.py b/appium/options/ios/xcuitest/wda/xcode_signing_id_option.py new file mode 100644 index 00000000..08ba1855 --- /dev/null +++ b/appium/options/ios/xcuitest/wda/xcode_signing_id_option.py @@ -0,0 +1,39 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +XCODE_SIGNING_ID = 'xcodeSigningId' + + +class XcodeSigningIdOption(SupportsCapabilities): + @property + def xcode_signing_id(self) -> Optional[str]: + """ + Signing certificate for WebDriverAgent compilation. + """ + return self.get_capability(XCODE_SIGNING_ID) + + @xcode_signing_id.setter + def xcode_signing_id(self, value: str) -> None: + """ + Provides a signing certificate for WebDriverAgent compilation. + If signing id is not provided then it defaults to "iPhone Developer" + """ + self.set_capability(XCODE_SIGNING_ID, value) diff --git a/appium/options/ios/xcuitest/webview/__init__.py b/appium/options/ios/xcuitest/webview/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/appium/options/ios/xcuitest/webview/absolute_web_locations_option.py b/appium/options/ios/xcuitest/webview/absolute_web_locations_option.py new file mode 100644 index 00000000..114c737d --- /dev/null +++ b/appium/options/ios/xcuitest/webview/absolute_web_locations_option.py @@ -0,0 +1,42 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +ABSOLUTE_WEB_LOCATIONS = 'absoluteWebLocations' + + +class AbsoluteWebLocationsOption(SupportsCapabilities): + @property + def absolute_web_locations(self) -> Optional[bool]: + """ + Whether Get Element Location returns coordinates + relative to the page origin for web view elements. + """ + return self.get_capability(ABSOLUTE_WEB_LOCATIONS) + + @absolute_web_locations.setter + def absolute_web_locations(self, value: bool) -> None: + """ + This capability will direct the Get Element Location command, when used + within webviews, to return coordinates which are relative to the origin of + the page, rather than relative to the current scroll offset. This capability + has no effect outside of webviews. Defaults to false. + """ + self.set_capability(ABSOLUTE_WEB_LOCATIONS, value) diff --git a/appium/options/ios/xcuitest/webview/additional_webview_bundle_ids_option.py b/appium/options/ios/xcuitest/webview/additional_webview_bundle_ids_option.py new file mode 100644 index 00000000..6546c548 --- /dev/null +++ b/appium/options/ios/xcuitest/webview/additional_webview_bundle_ids_option.py @@ -0,0 +1,40 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import List, Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +ADDITIONAL_WEBVIEW_BUNDLE_IDS = 'additionalWebviewBundleIds' + + +class AdditionalWebviewBundleIdsOption(SupportsCapabilities): + @property + def additional_webview_bundle_ids(self) -> Optional[List[str]]: + """ + Array of possible bundle identifiers for webviews. + """ + return self.get_capability(ADDITIONAL_WEBVIEW_BUNDLE_IDS) + + @additional_webview_bundle_ids.setter + def additional_webview_bundle_ids(self, value: List[str]) -> None: + """ + Array of possible bundle identifiers for webviews. This is sometimes + necessary if the Web Inspector is found to be returning a modified + bundle identifier for the app. Defaults to []. + """ + self.set_capability(ADDITIONAL_WEBVIEW_BUNDLE_IDS, value) diff --git a/appium/options/ios/xcuitest/webview/enable_async_execute_from_https_option.py b/appium/options/ios/xcuitest/webview/enable_async_execute_from_https_option.py new file mode 100644 index 00000000..ae2a3dcc --- /dev/null +++ b/appium/options/ios/xcuitest/webview/enable_async_execute_from_https_option.py @@ -0,0 +1,39 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +ENABLE_ASYNC_EXECUTE_FROM_HTTPS = 'enableAsyncExecuteFromHttps' + + +class EnableAsyncExecuteFromHttpsOption(SupportsCapabilities): + @property + def enable_async_execute_from_https(self) -> Optional[bool]: + """ + Whether to allow simulators to execute async JavaScript on pages using HTTPS. + """ + return self.get_capability(ENABLE_ASYNC_EXECUTE_FROM_HTTPS) + + @enable_async_execute_from_https.setter + def enable_async_execute_from_https(self, value: bool) -> None: + """ + Capability to allow simulators to execute asynchronous JavaScript + on pages using HTTPS. Defaults to false. + """ + self.set_capability(ENABLE_ASYNC_EXECUTE_FROM_HTTPS, value) diff --git a/appium/options/ios/xcuitest/webview/full_context_list_option.py b/appium/options/ios/xcuitest/webview/full_context_list_option.py new file mode 100644 index 00000000..7bdd3102 --- /dev/null +++ b/appium/options/ios/xcuitest/webview/full_context_list_option.py @@ -0,0 +1,42 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +FULL_CONTEXT_LIST = 'fullContextList' + + +class FullContextListOption(SupportsCapabilities): + @property + def full_context_list(self) -> Optional[bool]: + """ + Whether to return the detailed information on contexts for the get available + context command. + """ + return self.get_capability(FULL_CONTEXT_LIST) + + @full_context_list.setter + def full_context_list(self, value: bool) -> None: + """ + Sets to return the detailed information on contexts for the get available + context command. If this capability is enabled, then each item in the returned + contexts list would additionally include WebView title, full URL and the bundle + identifier. Defaults to false. + """ + self.set_capability(FULL_CONTEXT_LIST, value) diff --git a/appium/options/ios/xcuitest/webview/include_safari_in_webviews_option.py b/appium/options/ios/xcuitest/webview/include_safari_in_webviews_option.py new file mode 100644 index 00000000..c21cb141 --- /dev/null +++ b/appium/options/ios/xcuitest/webview/include_safari_in_webviews_option.py @@ -0,0 +1,41 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +INCLUDE_SAFARI_IN_WEBVIEWS = 'includeSafariInWebviews' + + +class IncludeSafariInWebviewsOption(SupportsCapabilities): + @property + def include_safari_in_webviews(self) -> Optional[bool]: + """ + Whether to add Safari web views to the list of contexts available + during a native/webview app test. + """ + return self.get_capability(INCLUDE_SAFARI_IN_WEBVIEWS) + + @include_safari_in_webviews.setter + def include_safari_in_webviews(self, value: bool) -> None: + """ + Add Safari web contexts to the list of contexts available during a + native/webview app test. This is useful if the test opens Safari and + needs to be able to interact with it. Defaults to false. + """ + self.set_capability(INCLUDE_SAFARI_IN_WEBVIEWS, value) diff --git a/appium/options/ios/xcuitest/webview/native_web_tap_option.py b/appium/options/ios/xcuitest/webview/native_web_tap_option.py new file mode 100644 index 00000000..02a40b98 --- /dev/null +++ b/appium/options/ios/xcuitest/webview/native_web_tap_option.py @@ -0,0 +1,40 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +NATIVE_WEB_TAP = 'nativeWebTap' + + +class NativeWebTapOption(SupportsCapabilities): + @property + def native_web_tap(self) -> Optional[bool]: + """ + Whether to enable native taps in web view mode. + """ + return self.get_capability(NATIVE_WEB_TAP) + + @native_web_tap.setter + def native_web_tap(self, value: bool) -> None: + """ + Enable native, non-javascript-based taps being in web context mode. Defaults + to false. Warning: sometimes the preciseness of native taps could be broken, + because there is no reliable way to map web element coordinates to native ones. + """ + self.set_capability(NATIVE_WEB_TAP, value) diff --git a/appium/options/ios/xcuitest/webview/safari_garbage_collect_option.py b/appium/options/ios/xcuitest/webview/safari_garbage_collect_option.py new file mode 100644 index 00000000..63aefc4c --- /dev/null +++ b/appium/options/ios/xcuitest/webview/safari_garbage_collect_option.py @@ -0,0 +1,39 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +SAFARI_GARBAGE_COLLECT = 'safariGarbageCollect' + + +class SafariGarbageCollectOption(SupportsCapabilities): + @property + def safari_garbage_collect(self) -> Optional[bool]: + """ + Whether to turn on garbage collection when executing scripts on Safari. + """ + return self.get_capability(SAFARI_GARBAGE_COLLECT) + + @safari_garbage_collect.setter + def safari_garbage_collect(self, value: bool) -> None: + """ + Turns on/off Web Inspector garbage collection when executing scripts on Safari. + Turning on may improve performance. Defaults to false. + """ + self.set_capability(SAFARI_GARBAGE_COLLECT, value) diff --git a/appium/options/ios/xcuitest/webview/safari_ignore_fraud_warning_option.py b/appium/options/ios/xcuitest/webview/safari_ignore_fraud_warning_option.py new file mode 100644 index 00000000..c600285d --- /dev/null +++ b/appium/options/ios/xcuitest/webview/safari_ignore_fraud_warning_option.py @@ -0,0 +1,39 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +SAFARI_IGNORE_FRAUD_WARNING = 'safariIgnoreFraudWarning' + + +class SafariIgnoreFraudWarningOption(SupportsCapabilities): + @property + def safari_ignore_fraud_warning(self) -> Optional[bool]: + """ + Whether to prevent Safari from showing a fraudulent website warning. + """ + return self.get_capability(SAFARI_IGNORE_FRAUD_WARNING) + + @safari_ignore_fraud_warning.setter + def safari_ignore_fraud_warning(self, value: bool) -> None: + """ + Prevent Safari from showing a fraudulent website warning. + Default keeps current sim setting.. + """ + self.set_capability(SAFARI_IGNORE_FRAUD_WARNING, value) diff --git a/appium/options/ios/xcuitest/webview/safari_ignore_web_hostnames_option.py b/appium/options/ios/xcuitest/webview/safari_ignore_web_hostnames_option.py new file mode 100644 index 00000000..9f48f8cf --- /dev/null +++ b/appium/options/ios/xcuitest/webview/safari_ignore_web_hostnames_option.py @@ -0,0 +1,42 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +SAFARI_IGNORE_WEB_HOSTNAMES = 'safariIgnoreWebHostnames' + + +class SafariIgnoreWebHostnamesOption(SupportsCapabilities): + @property + def safari_ignore_web_hostnames(self) -> Optional[str]: + """ + Comma-separated list of host names to be ignored. + """ + return self.get_capability(SAFARI_IGNORE_WEB_HOSTNAMES) + + @safari_ignore_web_hostnames.setter + def safari_ignore_web_hostnames(self, value: str) -> None: + """ + Provide a list of hostnames (comma-separated) that the Safari automation + tools should ignore. This is to provide a workaround to prevent a webkit + bug where the web context is unintentionally changed to a 3rd party website + and the test gets stuck. The common culprits are search engines (yahoo, bing, + google) and about:blank. + """ + self.set_capability(SAFARI_IGNORE_WEB_HOSTNAMES, value) diff --git a/appium/options/ios/xcuitest/webview/safari_initial_url_option.py b/appium/options/ios/xcuitest/webview/safari_initial_url_option.py new file mode 100644 index 00000000..79dc14fe --- /dev/null +++ b/appium/options/ios/xcuitest/webview/safari_initial_url_option.py @@ -0,0 +1,38 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +SAFARI_INITIAL_URL = 'safariInitialUrl' + + +class SafariInitialUrlOption(SupportsCapabilities): + @property + def safari_initial_url(self) -> Optional[str]: + """ + The initial safari url. + """ + return self.get_capability(SAFARI_INITIAL_URL) + + @safari_initial_url.setter + def safari_initial_url(self, value: str) -> None: + """ + Set initial safari url, default is a local welcome page. + """ + self.set_capability(SAFARI_INITIAL_URL, value) diff --git a/appium/options/ios/xcuitest/webview/safari_log_all_communication_hex_dump_option.py b/appium/options/ios/xcuitest/webview/safari_log_all_communication_hex_dump_option.py new file mode 100644 index 00000000..03b2e28c --- /dev/null +++ b/appium/options/ios/xcuitest/webview/safari_log_all_communication_hex_dump_option.py @@ -0,0 +1,43 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +SAFARI_LOG_ALL_COMMUNICATION_HEX_DUMP = 'safariLogAllCommunicationHexDump' + + +class SafariLogAllCommunicationHexDumpOption(SupportsCapabilities): + @property + def safari_log_all_communication_hex_dump(self) -> Optional[bool]: + """ + Whether to log of plists sent to and received from the Web Inspector + in hex dump format. + """ + return self.get_capability(SAFARI_LOG_ALL_COMMUNICATION_HEX_DUMP) + + @safari_log_all_communication_hex_dump.setter + def safari_log_all_communication_hex_dump(self, value: bool) -> None: + """ + Log all communication sent to and received from the Web Inspector, as raw + hex dump and printable characters. This logging is done before any data + manipulation, and so can elucidate some communication issues. Like + appium:safariLogAllCommunication, this can produce a lot of data in some cases, + so it is recommended to be used only when necessary. Defaults to false. + """ + self.set_capability(SAFARI_LOG_ALL_COMMUNICATION_HEX_DUMP, value) diff --git a/appium/options/ios/xcuitest/webview/safari_log_all_communication_option.py b/appium/options/ios/xcuitest/webview/safari_log_all_communication_option.py new file mode 100644 index 00000000..b022dba3 --- /dev/null +++ b/appium/options/ios/xcuitest/webview/safari_log_all_communication_option.py @@ -0,0 +1,40 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +SAFARI_LOG_ALL_COMMUNICATION = 'safariLogAllCommunication' + + +class SafariLogAllCommunicationOption(SupportsCapabilities): + @property + def safari_log_all_communication(self) -> Optional[bool]: + """ + Whether to log of plists sent to and received from the Web Inspector. + """ + return self.get_capability(SAFARI_LOG_ALL_COMMUNICATION) + + @safari_log_all_communication.setter + def safari_log_all_communication(self, value: bool) -> None: + """ + Log all plists sent to and received from the Web Inspector, as plain text. + For some operations this can be a lot of data, so it is recommended to + be used only when necessary. Defaults to false. + """ + self.set_capability(SAFARI_LOG_ALL_COMMUNICATION, value) diff --git a/appium/options/ios/xcuitest/webview/safari_open_links_in_background_option.py b/appium/options/ios/xcuitest/webview/safari_open_links_in_background_option.py new file mode 100644 index 00000000..2ebb4801 --- /dev/null +++ b/appium/options/ios/xcuitest/webview/safari_open_links_in_background_option.py @@ -0,0 +1,39 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +SAFARI_OPEN_LINKS_IN_BACKGROUND = 'safariOpenLinksInBackground' + + +class SafariOpenLinksInBackgroundOption(SupportsCapabilities): + @property + def safari_open_links_in_background(self) -> Optional[bool]: + """ + Whether Safari should allow links to open in new windows. + """ + return self.get_capability(SAFARI_OPEN_LINKS_IN_BACKGROUND) + + @safari_open_links_in_background.setter + def safari_open_links_in_background(self, value: bool) -> None: + """ + Whether Safari should allow links to open in new windows. + Default keeps current sim setting. + """ + self.set_capability(SAFARI_OPEN_LINKS_IN_BACKGROUND, value) diff --git a/appium/options/ios/xcuitest/webview/safari_socket_chunk_size_option.py b/appium/options/ios/xcuitest/webview/safari_socket_chunk_size_option.py new file mode 100644 index 00000000..c33ea61d --- /dev/null +++ b/appium/options/ios/xcuitest/webview/safari_socket_chunk_size_option.py @@ -0,0 +1,41 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +SAFARI_SOCKET_CHUNK_SIZE = 'safariSocketChunkSize' + + +class SafariSocketChunkSizeOption(SupportsCapabilities): + @property + def safari_socket_chunk_size(self) -> Optional[int]: + """ + Get the size of a single remote debugger socket chunk. + """ + return self.get_capability(SAFARI_SOCKET_CHUNK_SIZE) + + @safari_socket_chunk_size.setter + def safari_socket_chunk_size(self, value: int) -> None: + """ + The size, in bytes, of the data to be sent to the Web Inspector on + iOS 11+ real devices. Some devices hang when sending large amounts of + data to the Web Inspector, and breaking them into smaller parts can be + helpful in those cases. Defaults to 16384 (also the maximum possible). + """ + self.set_capability(SAFARI_SOCKET_CHUNK_SIZE, value) diff --git a/appium/options/ios/xcuitest/webview/safari_web_inspector_max_frame_length_option.py b/appium/options/ios/xcuitest/webview/safari_web_inspector_max_frame_length_option.py new file mode 100644 index 00000000..d92fb2d4 --- /dev/null +++ b/appium/options/ios/xcuitest/webview/safari_web_inspector_max_frame_length_option.py @@ -0,0 +1,41 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +SAFARI_WEB_INSPECTOR_MAX_FRAME_LENGTH = 'safariWebInspectorMaxFrameLength' + + +class SafariWebInspectorMaxFrameLengthOption(SupportsCapabilities): + @property + def safari_web_inspector_max_frame_length(self) -> Optional[int]: + """ + Maximum size in bytes of a single data frame for the Web Inspector. + """ + return self.get_capability(SAFARI_WEB_INSPECTOR_MAX_FRAME_LENGTH) + + @safari_web_inspector_max_frame_length.setter + def safari_web_inspector_max_frame_length(self, value: int) -> None: + """ + The maximum size in bytes of a single data frame for the Web Inspector. + Too high values could introduce slowness and/or memory leaks. + Too low values could introduce possible buffer overflow exceptions. + Defaults to 20MiB (20*1024*1024). + """ + self.set_capability(SAFARI_WEB_INSPECTOR_MAX_FRAME_LENGTH, value) diff --git a/appium/options/ios/xcuitest/webview/webkit_response_timeout_option.py b/appium/options/ios/xcuitest/webview/webkit_response_timeout_option.py new file mode 100644 index 00000000..8c09117c --- /dev/null +++ b/appium/options/ios/xcuitest/webview/webkit_response_timeout_option.py @@ -0,0 +1,43 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from datetime import timedelta +from typing import Optional, Union + +from appium.options.common.supports_capabilities import SupportsCapabilities + +WEBKIT_RESPONSE_TIMEOUT = 'webkitResponseTimeout' + + +class WebkitResponseTimeoutOption(SupportsCapabilities): + @property + def webkit_response_timeout(self) -> Optional[timedelta]: + """ + Time to wait for a response from WebKit in a Safari session. + """ + value = self.get_capability(WEBKIT_RESPONSE_TIMEOUT) + return None if value is None else timedelta(milliseconds=value) + + @webkit_response_timeout.setter + def webkit_response_timeout(self, value: Union[timedelta, int]) -> None: + """ + (Real device only) Set the time to wait for a response from + WebKit in a Safari session. Defaults to 5000ms. + """ + self.set_capability( + WEBKIT_RESPONSE_TIMEOUT, value.microseconds // 1000 if isinstance(value, timedelta) else value + ) diff --git a/appium/options/ios/xcuitest/webview/webview_connect_retries_option.py b/appium/options/ios/xcuitest/webview/webview_connect_retries_option.py new file mode 100644 index 00000000..7792f15b --- /dev/null +++ b/appium/options/ios/xcuitest/webview/webview_connect_retries_option.py @@ -0,0 +1,40 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from typing import Optional + +from appium.options.common.supports_capabilities import SupportsCapabilities + +WEBVIEW_CONNECT_RETRIES = 'webviewConnectRetries' + + +class WebviewConnectRetriesOption(SupportsCapabilities): + @property + def webview_connect_retries(self) -> Optional[int]: + """ + Number of retries to send connection message to remote debugger, + to get a webview. + """ + return self.get_capability(WEBVIEW_CONNECT_RETRIES) + + @webview_connect_retries.setter + def webview_connect_retries(self, value: int) -> None: + """ + Number of times to send connection message to remote debugger, + to get a webview. Default: 8. + """ + self.set_capability(WEBVIEW_CONNECT_RETRIES, value) diff --git a/appium/options/ios/xcuitest/webview/webview_connect_timeout_option.py b/appium/options/ios/xcuitest/webview/webview_connect_timeout_option.py new file mode 100644 index 00000000..c0915afc --- /dev/null +++ b/appium/options/ios/xcuitest/webview/webview_connect_timeout_option.py @@ -0,0 +1,43 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. 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. + +from datetime import timedelta +from typing import Optional, Union + +from appium.options.common.supports_capabilities import SupportsCapabilities + +WEBVIEW_CONNECT_TIMEOUT = 'webviewConnectTimeout' + + +class WebviewConnectTimeoutOption(SupportsCapabilities): + @property + def webview_connect_timeout(self) -> Optional[timedelta]: + """ + Timeout to wait for the initial presence of webviews. + """ + value = self.get_capability(WEBVIEW_CONNECT_TIMEOUT) + return None if value is None else timedelta(milliseconds=value) + + @webview_connect_timeout.setter + def webview_connect_timeout(self, value: Union[timedelta, int]) -> None: + """ + The time to wait for the initial presence of webviews in + MobileSafari or hybrid apps. Defaults to 0ms. + """ + self.set_capability( + WEBVIEW_CONNECT_TIMEOUT, value.microseconds // 1000 if isinstance(value, timedelta) else value + ) diff --git a/appium/options/mac/mac2/base.py b/appium/options/mac/mac2/base.py index 3b44aa91..36077e52 100644 --- a/appium/options/mac/mac2/base.py +++ b/appium/options/mac/mac2/base.py @@ -17,6 +17,8 @@ from typing import Dict +from options.common.bundle_id_option import BundleIdOption + from appium.options.common.automation_name_option import AUTOMATION_NAME from appium.options.common.base import PLATFORM_NAME, AppiumOptions from appium.options.common.postrun_option import PostrunOption @@ -26,7 +28,6 @@ from .arguments_option import ArgumentsOption from .bootstrap_root_option import BootstrapRootOption -from .bundle_id_option import BundleIdOption from .environment_option import EnvironmentOption from .server_startup_timeout_option import ServerStartupTimeoutOption from .show_server_logs_option import ShowServerLogsOption @@ -90,6 +91,19 @@ def system_host(self, value: str) -> None: """ SystemHostOption.system_host.fset(self, value) # type: ignore + @BundleIdOption.bundle_id.setter # type: ignore + def bundle_id(self, value: str) -> None: + """ + Set the bundle identifier of the application to automate, for example + com.apple.TextEdit. This is an optional capability. If it is not provided + then the session will be started without an application under test + (actually, it will be Finder). If the application with the given + identifier is not installed then an error will be thrown on session + startup. If the application is already running then it will be moved to + the foreground. + """ + BundleIdOption.bundle_id.fset(self, value) # type: ignore + @property def default_capabilities(self) -> Dict: return { diff --git a/setup.cfg b/setup.cfg index 4f910ac4..347162f5 100644 --- a/setup.cfg +++ b/setup.cfg @@ -16,4 +16,4 @@ follow_imports = skip ignore_missing_imports = True strict_optional = True warn_redundant_casts = True -warn_unused_ignores = True +warn_unused_ignores = False