Skip to content

Commit bf5c6eb

Browse files
tune server startup
1 parent bd5e01e commit bf5c6eb

File tree

2 files changed

+48
-8
lines changed

2 files changed

+48
-8
lines changed

.github/workflows/functional-test.yml

Lines changed: 45 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ name: Functional Tests
33
on:
44
# Run by manual at this time
55
workflow_dispatch:
6-
push:
7-
branches: [ master ]
86
pull_request:
97
branches: [ master ]
108

@@ -29,6 +27,9 @@ jobs:
2927
XCODE_VERSION: 16.4
3028
IOS_VERSION: 18.5
3129
IPHONE_MODEL: iPhone 16 Plus
30+
PREBUILT_WDA_PATH: ${{ github.workspace }}/wda/WebDriverAgentRunner-Runner.app
31+
APPIUM_TEST_SERVER_PORT: '4723'
32+
APPIUM_TEST_SERVER_HOST: '127.0.0.1'
3233

3334
steps:
3435
- uses: actions/checkout@v4
@@ -51,12 +52,44 @@ jobs:
5152
os_version: ${{ env.IOS_VERSION }}
5253

5354
# Start Appium
54-
- run: npm install -g appium
5555
- run: |
56+
npm install -g appium
5657
appium driver install xcuitest
57-
nohup appium --use-plugins=images,execute-driver --relaxed-security --log-timestamp --log-no-colors > appium.log &
58+
nohup appium server \
59+
--port=$APPIUM_TEST_SERVER_PORT \
60+
--address=$APPIUM_TEST_SERVER_HOST \
61+
--relaxed-security \
62+
--log-no-colors \
63+
--log-timestamp \
64+
--keep-alive-timeout 1200 \
65+
2>&1 > appium.log &
66+
67+
TIMEOUT_SEC=15
68+
INTERVAL_SEC=1
69+
70+
start_time=$(date +%s)
71+
while true; do
72+
current_time=$(date +%s)
73+
elapsed=$((current_time - start_time))
74+
75+
if nc -z $APPIUM_TEST_SERVER_HOST $APPIUM_TEST_SERVER_PORT; then
76+
echo "Appium server is running after $elapsed seconds"
77+
popd
78+
cat appium.log
79+
exit 0
80+
fi
81+
82+
if [[ "$elapsed" -ge "$TIMEOUT_SEC" ]]; then
83+
echo "${elapsed} seconds timeout reached: Appium server is NOT running"
84+
exit 1
85+
fi
86+
87+
echo "Waiting $elapsed seconds for Appium server to start..."
88+
sleep "$INTERVAL_SEC"
89+
done
5890
59-
- run: appium driver run xcuitest download-wda-sim --platform=ios --outdir=${{ github.workspace }}/wda
91+
- run: |
92+
appium driver run xcuitest download-wda-sim --platform=ios --outdir=$(dirname "$PREBUILT_WDA_PATH")
6093
name: Downloading prebuilt WDA
6194
6295
- name: Set up Python
@@ -69,9 +102,14 @@ jobs:
69102

70103
- name: Run Tests
71104
run: |
72-
uv run pytest ${{ matrix.test_targets.target}} --doctest-modules --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html
105+
uv run pytest ${{ matrix.test_targets.target}} \
106+
--doctest-modules \
107+
--junitxml=junit/test-results.xml \
108+
--cov=com \
109+
--cov-report=xml \
110+
--cov-report=html
73111
env:
74-
LOCAL_PREBUILT_WDA: ${{ github.workspace }}/wda/WebDriverAgentRunner-Runner.app
112+
LOCAL_PREBUILT_WDA: ${{ env.PREBUILT_WDA_PATH }}
75113

76114
- name: Save server output
77115
if: ${{ always() }}

test/helpers/constants.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
SERVER_URL_BASE = 'http://127.0.0.1:4723'
1+
import os
2+
3+
SERVER_URL_BASE = f'http://{os.getenv("APPIUM_TEST_SERVER_HOST", "127.0.0.1")}:{os.getenv("APPIUM_TEST_SERVER_PORT", "4723")}'

0 commit comments

Comments
 (0)