Skip to content

Commit b66a32f

Browse files
authored
Merge pull request #13 from BrowserStackCE/py_web_wa
pytest web working with selenium 4 - wa added
2 parents 93a20a6 + 9e4cd94 commit b66a32f

File tree

3 files changed

+22
-16
lines changed

3 files changed

+22
-16
lines changed

.github/workflows/test-scripts.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ jobs:
2020
steps:
2121
- name: Checkout code
2222
uses: actions/checkout@v4
23-
- name: Set up Python 3.13
23+
- name: Set up Python 3.12
2424
uses: actions/setup-python@v5
2525
with:
26-
python-version: '3.13'
26+
python-version: '3.12'
2727
- name: Set up Bash
2828
run: |
2929
echo "Bash version:"
@@ -179,10 +179,10 @@ jobs:
179179
# steps:
180180
# - name: Checkout code
181181
# uses: actions/checkout@v4
182-
# - name: Set up Python 3.13
182+
# - name: Set up Python 3.12
183183
# uses: actions/setup-python@v5
184184
# with:
185-
# python-version: '3.13'
185+
# python-version: '3.12'
186186
# - name: Check PowerShell version
187187
# run: |
188188
# $PSVersionTable.PSVersion
@@ -322,10 +322,10 @@ jobs:
322322
steps:
323323
- name: Checkout code
324324
uses: actions/checkout@v4
325-
- name: Set up Python 3.13
325+
- name: Set up Python 3.12
326326
uses: actions/setup-python@v5
327327
with:
328-
python-version: '3.13'
328+
python-version: '3.12'
329329
- name: Set up Bash
330330
run: |
331331
echo "Bash version:"

mac/device-machine-allocation.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ pick_terminal_devices() {
119119
bVersionLiteral=""
120120
mod=$(( i % 4 ))
121121

122+
local hardcodedBVersion=140 # python doesn't support dynamic latest versioning yet
123+
122124
if [ $((i % 4)) -ne 0 ]; then
123125
bVersionLiteral="-$mod"
124126
else
@@ -133,7 +135,7 @@ pick_terminal_devices() {
133135
else
134136
yaml+=" - osVersion: $prefixEntry
135137
browserName: $suffixEntry
136-
browserVersion: $bVersion
138+
browserVersion: $(( hardcodedBVersion-i ))
137139
"
138140
fi
139141

mac/env-setup-run.sh

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ setup_web_python() {
203203
detect_setup_python_env
204204

205205
pip3 install -r requirements.txt >> "$NOW_RUN_LOG_FILE" 2>&1
206+
pip3 uninstall -y pytest-html pytest-rerunfailures >> "$NOW_RUN_LOG_FILE" 2>&1
206207
log_success "Dependencies installed"
207208

208209
# Update YAML at root level (browserstack.yml)
@@ -262,14 +263,21 @@ setup_app_python() {
262263
detect_setup_python_env
263264

264265
# Install dependencies
265-
pip install -r requirements.txt >> "$NOW_RUN_LOG_FILE" 2>&1
266+
pip3 install -r requirements.txt >> "$NOW_RUN_LOG_FILE" 2>&1
266267
log_success "Dependencies installed"
267268

268269
local app_url=$BROWSERSTACK_APP
269270
local platform_yaml
270271

271272
export BSTACK_PARALLELS=1
272-
export BROWSERSTACK_CONFIG_FILE="./android/browserstack.yml"
273+
274+
# Decide which directory to run based on APP_PLATFORM (default to android)
275+
local run_dir="android"
276+
if [ "$APP_PLATFORM" = "ios" ]; then
277+
run_dir="ios"
278+
fi
279+
280+
export BROWSERSTACK_CONFIG_FILE="./$run_dir/browserstack.yml"
273281
platform_yaml=$(generate_mobile_platforms "$TEAM_PARALLELS_MAX_ALLOWED_MOBILE" "yaml")
274282

275283
cat >> "$BROWSERSTACK_CONFIG_FILE" <<EOF
@@ -278,12 +286,6 @@ platforms:
278286
$platform_yaml
279287
EOF
280288

281-
# Decide which directory to run based on APP_PLATFORM (default to android)
282-
local run_dir="android"
283-
if [ "$APP_PLATFORM" = "ios" ]; then
284-
run_dir="ios"
285-
fi
286-
287289
export BSTACK_PLATFORMS=$platform_yaml
288290
export BROWSERSTACK_LOCAL=true
289291
export BROWSERSTACK_BUILD_NAME="now-$NOW_OS-app-python-pytest"
@@ -301,7 +303,9 @@ EOF
301303
# Run pytest with BrowserStack SDK from the chosen platform directory
302304
log_msg_to "🚀 Running 'cd $run_dir && browserstack-sdk pytest -s bstack_sample.py'"
303305
(
304-
cd "$run_dir" && browserstack-sdk pytest -s bstack_sample.py >> "$NOW_RUN_LOG_FILE" 2>&1 || return 1
306+
cd "$run_dir" && browserstack-sdk pytest -s bstack_sample.py >> "$NOW_RUN_LOG_FILE" 2>&1 || return 1 & cmd_pid=$!|| return 1
307+
show_spinner "$cmd_pid"
308+
wait "$cmd_pid"
305309
)
306310

307311
deactivate

0 commit comments

Comments
 (0)