Sitelet https://github.com/appium/python-client/pull/731/files
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions appium/options/ios/safari/automatic_inspection_option.py
Original file line number Diff line number Diff line change
@@ -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

AUTOMATIC_INSPECTION = 'safari:automaticInspection'


class AutomaticInspectionOption(SupportsCapabilities):
@property
def automatic_inspection(self) -> Optional[bool]:
"""
:Returns: Whether to use automatic inspection.
"""
return self.get_capability(AUTOMATIC_INSPECTION)

@automatic_inspection.setter
def automatic_inspection(self, value: bool) -> None:
"""
This capability instructs Safari to preload the Web Inspector and JavaScript
debugger in the background prior to returning a newly-created window.
To pause the test's execution in JavaScript and bring up Web Inspector's
Debugger tab, you can simply evaluate a debugger statement in the test page.
"""
self.set_capability(AUTOMATIC_INSPECTION, value)
41 changes: 41 additions & 0 deletions appium/options/ios/safari/automatic_profiling_option.py
Original file line number Diff line number Diff line change
@@ -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

AUTOMATIC_PROFILING = 'safari:automaticProfiling'


class AutomaticProfilingOption(SupportsCapabilities):
@property
def automatic_profiling(self) -> Optional[bool]:
"""
:Returns: Whether to use automatic profiling.
"""
return self.get_capability(AUTOMATIC_PROFILING)

@automatic_profiling.setter
def automatic_profiling(self, value: bool) -> None:
"""
This capability instructs Safari to preload the Web Inspector and start
a Timeline recording in the background prior to returning a newly-created
window. To view the recording, open the Web Inspector through Safari's
Develop menu.
"""
self.set_capability(AUTOMATIC_PROFILING, value)
23 changes: 21 additions & 2 deletions appium/options/ios/safari/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,34 @@
from typing import Dict

from appium.options.common.automation_name_option import AUTOMATION_NAME
from appium.options.common.base import AppiumOptions
from appium.options.common.base import PLATFORM_NAME, AppiumOptions

from .automatic_inspection_option import AutomaticInspectionOption
from .automatic_profiling_option import AutomaticProfilingOption
from .device_name_option import DeviceNameOption
from .device_type_option import DeviceTypeOption
from .device_udid_option import DeviceUdidOption
from .platform_build_version_option import PlatformBuildVersionOption
from .platform_version_option import PlatformVersionOption
from .use_simulator_option import UseSimulatorOption
from .webkit_webrtc_option import WebkitWebrtcOption


class SafariOptions(
AppiumOptions,
AutomaticInspectionOption,
AutomaticProfilingOption,
DeviceNameOption,
DeviceTypeOption,
DeviceUdidOption,
PlatformBuildVersionOption,
PlatformVersionOption,
UseSimulatorOption,
WebkitWebrtcOption,
):
@property
def default_capabilities(self) -> Dict:
return {
AppiumOptions.PLATFORM_NAME: 'iOS',
PLATFORM_NAME: 'iOS',
AUTOMATION_NAME: 'Safari',
}
43 changes: 43 additions & 0 deletions appium/options/ios/safari/device_name_option.py
Original file line number Diff line number Diff line change
@@ -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

DEVICE_NAME = 'safari:deviceName'


class DeviceNameOption(SupportsCapabilities):
@property
def device_name(self) -> Optional[str]:
"""
:Returns: String representing the name of the device.
"""
return self.get_capability(DEVICE_NAME)

@device_name.setter
def device_name(self, value: str) -> None:
"""
safaridriver will only create a session using hosts whose device name
matches the value of safari:deviceName. Device names are compared
case-insensitively. NOTE: Device names for connected devices are shown in
iTunes. If Xcode is installed, device names for connected devices are available
via the output of instruments(1) and in the Devices and Simulators window
(accessed in Xcode via "Window -> Devices and Simulators").
"""
self.set_capability(DEVICE_NAME, value)
41 changes: 41 additions & 0 deletions appium/options/ios/safari/device_type_option.py
Original file line number Diff line number Diff line change
@@ -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

DEVICE_TYPE = 'safari:deviceType'


class DeviceTypeOption(SupportsCapabilities):
@property
def device_type(self) -> Optional[str]:
"""
:Returns: String representing the type of the device.
"""
return self.get_capability(DEVICE_TYPE)

@device_type.setter
def device_type(self, value: str) -> None:
"""
If the value of safari:deviceType is 'iPhone', safaridriver will only create a session
using an iPhone device or iPhone simulator. If the value of safari:deviceType is 'iPad',
safaridriver will only create a session using an iPad device or iPad simulator.
Values of safari:deviceType are compared case-insensitively.
"""
self.set_capability(DEVICE_TYPE, value)
43 changes: 43 additions & 0 deletions appium/options/ios/safari/device_udid_option.py
Original file line number Diff line number Diff line change
@@ -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

DEVICE_UDID = 'safari:deviceUDID'


class DeviceUdidOption(SupportsCapabilities):
@property
def device_udid(self) -> Optional[str]:
"""
:Returns: String representing the UDID of the device.
"""
return self.get_capability(DEVICE_UDID)

@device_udid.setter
def device_udid(self, value: str) -> None:
"""
safaridriver will only create a session using hosts whose device UDID
matches the value of safari:deviceUDID. Device UDIDs are compared
case-insensitively. NOTE: If Xcode is installed, UDIDs for connected
devices are available via the output of instruments(1) and in the
Devices and Simulators window (accessed in Xcode via
"Window -> Devices and Simulators").
"""
self.set_capability(DEVICE_UDID, value)
41 changes: 41 additions & 0 deletions appium/options/ios/safari/platform_build_version_option.py
Original file line number Diff line number Diff line change
@@ -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

PLATFORM_BUILD_VERSION = 'safari:platformBuildVersion'


class PlatformBuildVersionOption(SupportsCapabilities):
@property
def platform_build_version(self) -> Optional[str]:
"""
:Returns: String representing the platform build version.
"""
return self.get_capability(PLATFORM_BUILD_VERSION)

@platform_build_version.setter
def platform_build_version(self, value: str) -> None:
"""
safaridriver will only create a session using hosts whose OS build
version matches the value of safari:platformBuildVersion. Example
of a macOS build version is '18E193'. On macOS, the OS build version
can be determined by running the sw_vers(1) utility.
"""
self.set_capability(PLATFORM_BUILD_VERSION, value)
41 changes: 41 additions & 0 deletions appium/options/ios/safari/platform_version_option.py
Original file line number Diff line number Diff line change
@@ -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

PLATFORM_VERSION = 'safari:platformVersion'


class PlatformVersionOption(SupportsCapabilities):
@property
def platform_version(self) -> Optional[str]:
"""
:Returns: String representing the platform version.
"""
return self.get_capability(PLATFORM_VERSION)

@platform_version.setter
def platform_version(self, value: str) -> None:
"""
safaridriver will only create a session using hosts whose OS
version matches the value of safari:platformVersion. OS version
numbers are prefix-matched. For example, if the value of safari:platformVersion
is '12', this will allow hosts with an OS version of '12.0' or '12.1' but not '10.12'.
"""
self.set_capability(PLATFORM_VERSION, value)
41 changes: 41 additions & 0 deletions appium/options/ios/safari/use_simulator_option.py
Original file line number Diff line number Diff line change
@@ -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_SIMULATOR = 'safari:useSimulator'


class UseSimulatorOption(SupportsCapabilities):
@property
def use_simulator(self) -> Optional[bool]:
"""
:Returns: Whether to use iOS Simulator.
"""
return self.get_capability(USE_SIMULATOR)

@use_simulator.setter
def use_simulator(self, value: bool) -> None:
"""
If the value of safari:useSimulator is true, safaridriver will only use
iOS Simulator hosts. If the value of safari:useSimulator is false, safaridriver
will not use iOS Simulator hosts. NOTE: An Xcode installation is required
in order to run WebDriver tests on iOS Simulator hosts.
"""
self.set_capability(USE_SIMULATOR, value)
Loading