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
39 changes: 39 additions & 0 deletions appium/options/mac/mac2/arguments_option.py
Original file line number Diff line number Diff line change
@@ -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 List, Optional

from appium.options.common.supports_capabilities import SupportsCapabilities

ARGUMENTS = 'arguments'


class ArgumentsOption(SupportsCapabilities):
@property
def arguments(self) -> Optional[List[str]]:
"""
:Returns: Array of application command line arguments.
"""
return self.get_capability(ARGUMENTS)

@arguments.setter
def arguments(self, value: List[str]) -> None:
"""
Set the array of application command line arguments. This capability is
only going to be applied if the application is not running on session startup.
"""
self.set_capability(ARGUMENTS, value)
21 changes: 21 additions & 0 deletions appium/options/mac/mac2/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,32 @@
from appium.options.common.postrun_option import PostrunOption
from appium.options.common.prerun_option import PrerunOption

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
from .skip_app_kill_option import SkipAppKillOption
from .system_host_option import SystemHostOption
from .system_port_option import SystemPortOption
from .web_driver_agent_mac_url_option import WebDriverAgentMacUrlOption


class Mac2Options(
AppiumOptions,
PrerunOption,
PostrunOption,
ArgumentsOption,
BootstrapRootOption,
BundleIdOption,
EnvironmentOption,
ServerStartupTimeoutOption,
ShowServerLogsOption,
SkipAppKillOption,
SystemHostOption,
SystemPortOption,
WebDriverAgentMacUrlOption,
):
@property
def default_capabilities(self) -> Dict:
Expand Down
41 changes: 41 additions & 0 deletions appium/options/mac/mac2/bootstrap_root_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

BOOTSTRAP_ROOT = 'bootstrapRoot'


class BootstrapRootOption(SupportsCapabilities):
@property
def bootstrap_root(self) -> Optional[str]:
"""
:Returns: The full path to WebDriverAgentMac root folder where Xcode project
of the server sources lives.
"""
return self.get_capability(BOOTSTRAP_ROOT)

@bootstrap_root.setter
def bootstrap_root(self, value: str) -> None:
"""
Set the full path to WebDriverAgentMac root folder where Xcode project
of the server sources lives. By default, this project is located in
the same folder where the corresponding driver Node.js module lives.
"""
self.set_capability(BOOTSTRAP_ROOT, value)
44 changes: 44 additions & 0 deletions appium/options/mac/mac2/bundle_id_option.py
Original file line number Diff line number Diff line change
@@ -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

BUNDLE_ID = 'bundleId'


class BundleIdOption(SupportsCapabilities):
@property
def bundle_id(self) -> Optional[str]:
"""
:Returns: The bundle identifier of the application to automate.
"""
return self.get_capability(BUNDLE_ID)

@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.
"""
self.set_capability(BUNDLE_ID, value)
41 changes: 41 additions & 0 deletions appium/options/mac/mac2/environment_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 Dict, Optional

from appium.options.common.supports_capabilities import SupportsCapabilities

ENVIRONMENT = 'environment'


class EnvironmentOption(SupportsCapabilities):
@property
def environment(self) -> Optional[Dict[str, str]]:
"""
:Returns: Application environment variables mapping.
"""
return self.get_capability(ENVIRONMENT)

@environment.setter
def environment(self, value: Dict[str, str]) -> None:
"""
Set the dictionary of environment variables (name->value) that are going to be passed
to the application under test on top of environment variables inherited from
the parent process. This option is only going to be applied if the application
is not running on session startup.
"""
self.set_capability(ENVIRONMENT, value)
44 changes: 44 additions & 0 deletions appium/options/mac/mac2/server_startup_timeout_option.py
Original file line number Diff line number Diff line change
@@ -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 datetime import timedelta
from typing import Optional, Union

from appium.options.common.supports_capabilities import SupportsCapabilities

SERVER_STARTUP_TIMEOUT = 'serverStartupTimeout'


class ServerStartupTimeoutOption(SupportsCapabilities):
@property
def server_startup_timeout(self) -> Optional[timedelta]:
"""
:Returns: Get the timeout to wait util the WebDriverAgentMac
project is built and started.
"""
value_ms = self.get_capability(SERVER_STARTUP_TIMEOUT)
return None if value_ms is None else timedelta(milliseconds=value_ms)

@server_startup_timeout.setter
def server_startup_timeout(self, value: Union[int, timedelta]) -> None:
"""
Set the timeout to wait util the WebDriverAgentMac
project is built and started.
"""
self.set_capability(
SERVER_STARTUP_TIMEOUT, value.microseconds // 1000 if isinstance(value, timedelta) else value
)
39 changes: 39 additions & 0 deletions appium/options/mac/mac2/show_server_logs_option.py
Original file line number Diff line number Diff line change
@@ -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_SERVER_LOGS = 'showServerLogs'


class ShowServerLogsOption(SupportsCapabilities):
@property
def show_server_logs(self) -> Optional[bool]:
"""
:Returns: Whether to show WDA server logs in the Appium log.
"""
return self.get_capability(SHOW_SERVER_LOGS)

@show_server_logs.setter
def show_server_logs(self, value: bool) -> None:
"""
Set it to true in order to include xcodebuild output to the Appium
server log. false by default.
"""
self.set_capability(SHOW_SERVER_LOGS, value)
40 changes: 40 additions & 0 deletions appium/options/mac/mac2/skip_app_kill_option.py
Original file line number Diff line number Diff line change
@@ -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

SKIP_APP_KILL = 'skipAppKill'


class SkipAppKillOption(SupportsCapabilities):
@property
def skip_app_kill(self) -> Optional[bool]:
"""
:Returns: Whether to skip the termination of the application under test.
"""
return self.get_capability(SKIP_APP_KILL)

@skip_app_kill.setter
def skip_app_kill(self, value: bool) -> None:
"""
Set whether to skip the termination of the application under test
when the testing session quits. false by default. This capability
is only going to be applied if bundleId is set.
"""
self.set_capability(SKIP_APP_KILL, value)
42 changes: 42 additions & 0 deletions appium/options/mac/mac2/system_host_option.py
Original file line number Diff line number Diff line change
@@ -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

SYSTEM_HOST = 'systemHost'


class SystemHostOption(SupportsCapabilities):
@property
def system_host(self) -> Optional[str]:
"""
:Returns: The name of the host for the internal server to listen on.
"""
return self.get_capability(SYSTEM_HOST)

@system_host.setter
def system_host(self, value: str) -> None:
"""
Set the name of the host for the internal server to listen on.
If not provided then Mac2Driver will use the default host
address 127.0.0.1. You could set it to 0.0.0.0 to make the
server listening on all available network interfaces.
It is also possible to set the particular interface name, for example en1.
"""
self.set_capability(SYSTEM_HOST, value)
Loading