Sitelet https://github.com/appium/python-client/pull/734/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
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,5 @@ def system_host(self) -> Optional[str]:
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)
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,5 @@ def system_port(self) -> Optional[int]:
def system_port(self, value: int) -> None:
"""
Set the number of the port for the internal server to listen on.
If not provided then Mac2Driver will use the default port 10100.
"""
self.set_capability(SYSTEM_PORT, value)
45 changes: 43 additions & 2 deletions appium/options/mac/mac2/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
from appium.options.common.base import PLATFORM_NAME, AppiumOptions
from appium.options.common.postrun_option import PostrunOption
from appium.options.common.prerun_option import PrerunOption
from appium.options.common.system_host_option import SystemHostOption
from appium.options.common.system_port_option import SystemPortOption

from .arguments_option import ArgumentsOption
from .bootstrap_root_option import BootstrapRootOption
Expand All @@ -29,8 +31,6 @@
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


Expand All @@ -49,6 +49,47 @@ class Mac2Options(
SystemPortOption,
WebDriverAgentMacUrlOption,
):
@PrerunOption.prerun.setter # type: ignore
def prerun(self, value: Dict[str, str]) -> None:
"""
A mapping containing either 'script' or 'command' key. The value of
each key must be a valid AppleScript script or command to be
executed after before Mac2Driver session is started. See
https://github.com/appium/appium-mac2-driver#applescript-commands-execution
for more details.
"""
PrerunOption.prerun.fset(self, value) # type: ignore

@PostrunOption.postrun.setter # type: ignore
def postrun(self, value: Dict[str, str]) -> None:
"""
A mapping containing either 'script' or 'command' key. The value of
each key must be a valid AppleScript script or command to be
executed after Mac2Driver session is stopped. See
https://github.com/appium/appium-mac2-driver#applescript-commands-execution
for more details.
"""
PostrunOption.postrun.fset(self, value) # type: ignore

@SystemPortOption.system_port.setter # type: ignore
def system_port(self, value: int) -> None:
"""
Set the number of the port for the internal server to listen on.
If not provided then Mac2Driver will use the default port 10100.
"""
SystemPortOption.system_port.fset(self, value) # type: ignore

@SystemHostOption.system_host.setter # type: ignore
def system_host(self, value: str) -> None:
"""
Set the number of the port 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.
"""
SystemHostOption.system_host.fset(self, value) # type: ignore

@property
def default_capabilities(self) -> Dict:
return {
Expand Down
12 changes: 11 additions & 1 deletion appium/options/windows/windows/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
from appium.options.common.base import PLATFORM_NAME, AppiumOptions
from appium.options.common.postrun_option import PostrunOption
from appium.options.common.prerun_option import PrerunOption
from appium.options.common.system_port_option import SystemPortOption

from .app_top_level_window_option import AppTopLevelWindowOption
from .app_working_dir_option import AppWorkingDirOption
from .create_session_timeout_option import CreateSessionTimeoutOption
from .expreimental_web_driver_option import ExperimentalWebDriverOption
from .system_port_option import SystemPortOption
from .wait_for_app_launch_option import WaitForAppLaunchOption


Expand Down Expand Up @@ -77,6 +77,16 @@ def postrun(self, value: Dict[str, str]) -> None:
"""
PostrunOption.postrun.fset(self, value) # type: ignore

@SystemPortOption.system_port.setter # type: ignore
def system_port(self, value: int) -> None:
"""
The port number to execute Appium Windows Driver server listener on,
for example 5556. The port must not be occupied. The default starting port
number for a new Appium Windows Driver session is 4724. If this port is
already busy then the next free port will be automatically selected.
"""
SystemPortOption.system_port.fset(self, value) # type: ignore

@property
def default_capabilities(self) -> Dict:
return {
Expand Down
41 changes: 0 additions & 41 deletions appium/options/windows/windows/system_port_option.py

This file was deleted.

6 changes: 2 additions & 4 deletions ci-jobs/functional/run_android_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ jobs:
- script: bash ci-jobs/functional/start-emulator.sh
displayName: Create and run Emulator
- script: |
if [[ '${{ parameters.dontRunAppium }}' != true ]]; then
appium --relaxed-security > appium_log.txt 2>&1 &
sleep 2
fi
bash ci-jobs/scripts/start_server.sh

pushd "$(pwd)"
cd test/functional/android
python -m pytest ${{ parameters.testFiles}} ${{ parameters.pytestOpt }}
Expand Down
6 changes: 2 additions & 4 deletions ci-jobs/functional/run_ios_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@ jobs:
- script: appium driver install xcuitest
displayName: Install XCUITest driver
- script: |
if [[ '${{ parameters.dontRunAppium }}' != true ]]; then
appium --relaxed-security > appium_log.txt 2>&1 &
sleep 2
fi
bash ci-jobs/scripts/start_server.sh

pushd "$(pwd)"
cd test/functional/ios
python -m pytest ${{ parameters.testFiles}} ${{ parameters.pytestOpt }}
Expand Down
1 change: 1 addition & 0 deletions ci-jobs/functional/setup_appium.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ steps:
ffmpeg -version
appium --version
node --version
npm --version
displayName: Check versions
12 changes: 12 additions & 0 deletions ci-jobs/scripts/start_server.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

appium server --relaxed-security > appium_log.txt 2>&1 &
secondsStarted=$(date +%s)
while ! nc -z 127.0.0.1 4723; do
sleep 0.1
secondsElapsed=$(( $(date +%s) - secondsStarted ))
if [[ $secondsElapsed -gt 30 ]]; then
echo "Appium server was unable to start within 30 seconds timeout"
exit 1
fi
done