Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
62df07f
win mac merge init commit
samirans89 Dec 6, 2025
5a08fb8
win mac merge init commit
samirans89 Dec 6, 2025
03c380b
win mac merge init commit
samirans89 Dec 6, 2025
c2e52bb
win mac merge init commit
samirans89 Dec 6, 2025
2cf3e46
win mac merge init commit
samirans89 Dec 6, 2025
aaf5892
win mac merge init commit
samirans89 Dec 6, 2025
ba05a12
win mac merge init commit
samirans89 Dec 6, 2025
ac3b203
win mac merge init commit
samirans89 Dec 6, 2025
30b45ac
win mac merge init commit
samirans89 Dec 6, 2025
ba86f05
win mac merge init commit
samirans89 Dec 6, 2025
c229158
win mac merge init commit
samirans89 Dec 6, 2025
2e3dd13
win mac merge init commit
samirans89 Dec 6, 2025
6353344
win mac merge init commit
samirans89 Dec 6, 2025
8736b2c
win mac merge init commit
samirans89 Dec 6, 2025
87fd2fe
win mac merge init commit
samirans89 Dec 6, 2025
31a0ec5
win mac merge init commit
samirans89 Dec 6, 2025
52a1732
win mac merge init commit
samirans89 Dec 6, 2025
2541a2a
win mac merge init commit
samirans89 Dec 6, 2025
d6ce12c
win mac merge init commit
samirans89 Dec 6, 2025
b8cfde1
win mac merge init commit
samirans89 Dec 6, 2025
f09196b
win mac merge init commit
samirans89 Dec 6, 2025
d445397
win mac merge init commit
samirans89 Dec 6, 2025
4385fe6
win mac merge init commit
samirans89 Dec 6, 2025
f3d1267
win mac merge init commit
samirans89 Dec 6, 2025
c75c860
win mac merge init commit
samirans89 Dec 6, 2025
a5a7655
win mac merge init commit
samirans89 Dec 6, 2025
64a2e71
win mac merge init commit
samirans89 Dec 6, 2025
16bd696
win mac merge init commit
samirans89 Dec 6, 2025
0fe7dc6
win mac merge init commit
samirans89 Dec 6, 2025
b496873
win mac merge init commit
samirans89 Dec 6, 2025
0609a1e
win mac merge init commit
samirans89 Dec 6, 2025
ea595eb
win mac merge init commit
samirans89 Dec 6, 2025
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
82 changes: 44 additions & 38 deletions .github/workflows/test-scripts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,38 +34,40 @@ jobs:
run: |
echo "Validating mac/run.sh syntax..."
bash -n mac/run.sh
bash -n common/mac/run.sh
echo "✅ mac/run.sh syntax is valid"

- name: Validate supporting scripts syntax
run: |
echo "Validating supporting scripts..."
bash -n mac/common-utils.sh
bash -n mac/logging-utils.sh
bash -n mac/env-setup-run.sh
bash -n mac/user-interaction.sh
bash -n mac/env-prequisite-checks.sh
bash -n common/mac/common-utils.sh
bash -n common/mac/logging-utils.sh
bash -n common/mac/env-setup-run.sh
bash -n common/mac/user-interaction.sh
bash -n common/mac/env-prequisite-checks.sh
echo "✅ All supporting scripts are valid"

- name: Check if scripts are executable
run: |
chmod +x mac/run.sh
chmod +x mac/common-utils.sh
chmod +x mac/logging-utils.sh
chmod +x mac/env-setup-run.sh
chmod +x mac/user-interaction.sh
chmod +x mac/env-prequisite-checks.sh
chmod +x common/mac/common-utils.sh
chmod +x common/mac/logging-utils.sh
chmod +x common/mac/env-setup-run.sh
chmod +x common/mac/user-interaction.sh
chmod +x common/mac/env-prequisite-checks.sh
echo "✅ All scripts are executable"

- name: Run ShellCheck on mac scripts
run: |
brew install shellcheck
echo "Running ShellCheck on mac scripts..."
shellcheck -x mac/run.sh || true
shellcheck -x mac/common-utils.sh || true
shellcheck -x mac/logging-utils.sh || true
shellcheck -x mac/env-setup-run.sh || true
shellcheck -x mac/user-interaction.sh || true
shellcheck -x mac/env-prequisite-checks.sh || true
shellcheck -x common/mac/run.sh || true
shellcheck -x common/mac/common-utils.sh || true
shellcheck -x common/mac/logging-utils.sh || true
shellcheck -x common/mac/env-setup-run.sh || true
shellcheck -x common/mac/user-interaction.sh || true
shellcheck -x common/mac/env-prequisite-checks.sh || true
echo "✅ ShellCheck analysis complete"

- name: Verify required dependencies
Expand All @@ -81,7 +83,7 @@ jobs:
run: |
set -e
echo "Testing script sourcing..."
bash -c "source mac/common-utils.sh && echo '✅ common-utils.sh sourced successfully'"
bash -c "source common/mac/common-utils.sh && echo '✅ common-utils.sh sourced successfully'"
echo "✅ Script sourcing successful"

- name: Integration Test - Silent Mode Execution
Expand Down Expand Up @@ -205,18 +207,20 @@ jobs:
Write-Host "Validating win/run.ps1 syntax..."
$ScriptPath = "win/run.ps1"
$null = [System.Management.Automation.PSParser]::Tokenize((Get-Content -Raw $ScriptPath), [ref]$null)
$CommonScriptPath = "common/win/run.ps1"
$null = [System.Management.Automation.PSParser]::Tokenize((Get-Content -Raw $CommonScriptPath), [ref]$null)
Write-Host "✅ win/run.ps1 syntax is valid"

- name: Validate supporting PowerShell scripts syntax
run: |
Write-Host "Validating supporting PowerShell scripts..."
$Scripts = @(
"win/common-utils.ps1",
"win/logging-utils.ps1",
"win/env-prequisite-checks.ps1",
"win/user-interaction.ps1",
"win/env-setup-run.ps1",
"win/device-machine-allocation.ps1"
"common/win/common-utils.ps1",
"common/win/logging-utils.ps1",
"common/win/env-prequisite-checks.ps1",
"common/win/user-interaction.ps1",
"common/win/env-setup-run.ps1",
"common/win/device-machine-allocation.ps1"
)
foreach ($Script in $Scripts) {
$null = [System.Management.Automation.PSParser]::Tokenize((Get-Content -Raw $Script), [ref]$null)
Expand Down Expand Up @@ -400,26 +404,27 @@ jobs:
run: |
echo "Validating mac/run.sh syntax..."
bash -n mac/run.sh
bash -n common/mac/run.sh
echo "✅ mac/run.sh syntax is valid"

- name: Validate supporting scripts syntax
run: |
echo "Validating supporting scripts..."
bash -n mac/common-utils.sh
bash -n mac/logging-utils.sh
bash -n mac/env-setup-run.sh
bash -n mac/user-interaction.sh
bash -n mac/env-prequisite-checks.sh
bash -n common/mac/common-utils.sh
bash -n common/mac/logging-utils.sh
bash -n common/mac/env-setup-run.sh
bash -n common/mac/user-interaction.sh
bash -n common/mac/env-prequisite-checks.sh
echo "✅ All supporting scripts are valid"

- name: Check if scripts are executable
run: |
chmod +x mac/run.sh
chmod +x mac/common-utils.sh
chmod +x mac/logging-utils.sh
chmod +x mac/env-setup-run.sh
chmod +x mac/user-interaction.sh
chmod +x mac/env-prequisite-checks.sh
chmod +x common/mac/common-utils.sh
chmod +x common/mac/logging-utils.sh
chmod +x common/mac/env-setup-run.sh
chmod +x common/mac/user-interaction.sh
chmod +x common/mac/env-prequisite-checks.sh
echo "✅ All scripts are executable"

- name: Install ShellCheck
Expand All @@ -433,11 +438,12 @@ jobs:
run: |
echo "Running ShellCheck on mac scripts..."
shellcheck -x mac/run.sh || true
shellcheck -x mac/common-utils.sh || true
shellcheck -x mac/logging-utils.sh || true
shellcheck -x mac/env-setup-run.sh || true
shellcheck -x mac/user-interaction.sh || true
shellcheck -x mac/env-prequisite-checks.sh || true
shellcheck -x common/mac/run.sh || true
shellcheck -x common/mac/common-utils.sh || true
shellcheck -x common/mac/logging-utils.sh || true
shellcheck -x common/mac/env-setup-run.sh || true
shellcheck -x common/mac/user-interaction.sh || true
shellcheck -x common/mac/env-prequisite-checks.sh || true
echo "✅ ShellCheck analysis complete"

- name: Verify required dependencies
Expand All @@ -453,7 +459,7 @@ jobs:
run: |
set -e
echo "Testing script sourcing..."
bash -c "source mac/common-utils.sh && echo '✅ common-utils.sh sourced successfully'"
bash -c "source common/mac/common-utils.sh && echo '✅ common-utils.sh sourced successfully'"
echo "✅ Script sourcing successful"

- name: Integration Test - Silent Mode Execution
Expand Down
23 changes: 23 additions & 0 deletions common/config/devices.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Format: TYPE|PLATFORM|DEVICE_OR_BROWSER
# Web
WEB|Windows|Chrome
WEB|Windows|Firefox
WEB|Windows|Edge
MOBILE|ios|iPhone 1[234567]*
MOBILE|android|Samsung Galaxy S*
WEB|OS X|Chrome
WEB|OS X|Safari
WEB|OS X|Firefox
MOBILE|ios|iPad Air*
MOBILE|android|Samsung Galaxy Tab*
MOBILE|android|Samsung Galaxy M*
MOBILE|android|Google Pixel [56789]*
MOBILE|android|Vivo Y*
MOBILE|android|Oppo*
MOBILE|ios|iPad Pro*
MOBILE|android|Samsung Galaxy A*
MOBILE|android|Google Pixel 10*
MOBILE|android|OnePlus *
MOBILE|android|Vivo V*
MOBILE|android|Xiaomi *
MOBILE|android|Huawei *
6 changes: 6 additions & 0 deletions common/config/repos.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
web_java|now-testng-browserstack
app_java|now-testng-appium-app-browserstack
web_python|now-pytest-browserstack
app_python|now-pytest-appium-app-browserstack
web_nodejs|now-webdriverio-browserstack
app_nodejs|now-webdriverio-appium-app-browserstack
33 changes: 28 additions & 5 deletions mac/common-utils.sh → common/mac/common-utils.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
#!/bin/bash

# shellcheck source=/dev/null
# shellcheck source=/dev/null
source "$(dirname "$0")/device-machine-allocation.sh"

# # ===== Global Variables =====
WORKSPACE_DIR="$HOME/.browserstack"
PROJECT_FOLDER="NOW"
GUI_SCRIPT="$(dirname "${BASH_SOURCE[0]}")/windows-gui.ps1"


# URL handling
DEFAULT_TEST_URL="https://bstackdemo.com"
Expand Down Expand Up @@ -81,6 +84,11 @@ setup_workspace() {
# ===== App Upload Management =====
handle_app_upload() {
local app_platform=""
if [[ -n "$CLI_APP_PATH" ]]; then
upload_custom_app "$CLI_APP_PATH"
return
fi

if [[ "$RUN_MODE" == *"--silent"* || "$RUN_MODE" == *"--debug"* ]]; then
upload_sample_app
app_platform="android"
Expand All @@ -96,6 +104,8 @@ handle_app_upload() {
buttons {"Use Sample App", "Upload my App (.apk/.ipa)", "Cancel"} ¬
default button "Upload my App (.apk/.ipa)"
' 2>/dev/null)
elif [[ "$NOW_OS" == "windows" ]]; then
choice=$(powershell.exe -ExecutionPolicy Bypass -File "$GUI_SCRIPT" -Command "ClickChoice" -Title "BrowserStack App Upload" -Prompt "How would you like to select your app?" -Choices "Use Sample App,Upload my App (.apk/.ipa),Cancel" -DefaultChoice "Upload my App (.apk/.ipa)" | tr -d '\r')
else
echo "How would you like to select your app?"
select opt in "Use Sample App" "Upload my App (.apk/.ipa)" "Cancel"; do
Expand Down Expand Up @@ -144,21 +154,25 @@ upload_sample_app() {

upload_custom_app() {
local app_platform=""
local file_path
local file_path="$1"

# Convert to POSIX path
if [ -z "$file_path" ]; then
# Convert to POSIX path
# Convert to POSIX path
if [[ "$NOW_OS" == "macos" ]]; then
file_path=$(osascript -e \
'POSIX path of (choose file with prompt "Select your .apk or .ipa file:" of type {"apk", "ipa"})' \
2>/dev/null)
elif [[ "$NOW_OS" == "windows" ]]; then
file_path=$(powershell.exe -ExecutionPolicy Bypass -File "$GUI_SCRIPT" -Command "OpenFileDialog" -Title "Select your .apk or .ipa file" -Filter "App Files (*.apk;*.ipa)|*.apk;*.ipa|All files (*.*)|*.*" | tr -d '\r')
else
echo "Please enter the full path to your .apk or .ipa file:"
read -r file_path
# Remove quotes if user added them
file_path="${file_path%\"}"
file_path="${file_path#\"}"
fi
fi

# Trim whitespace
file_path="${file_path%"${file_path##*[![:space:]]}"}"
Expand Down Expand Up @@ -217,7 +231,7 @@ generate_mobile_platforms() {
local platformsListContentFormat=$2
local app_platform="$APP_PLATFORM"
local platformsList=""
platformsList=$(pick_terminal_devices "$app_platform" "$max_total_parallels", "$platformsListContentFormat")
platformsList=$(pick_terminal_devices "$app_platform" "$max_total_parallels" "$platformsListContentFormat")
echo "$platformsList"
}

Expand Down Expand Up @@ -277,7 +291,7 @@ fetch_plan_details() {
TEAM_PARALLELS_MAX_ALLOWED_MOBILE=5
export TEAM_PARALLELS_MAX_ALLOWED_MOBILE=5
fi
log_info "Resetting Plan summary: Web $WEB_PLAN_FETCHED ($TEAM_PARALLELS_MAX_ALLOWED_WEB max), Mobile $MOBILE_PLAN_FETCHED ($TEAM_PARALLELS_MAX_ALLOWED_MOBILE max)"
log_info "Silent mode: Plan summary: Web $WEB_PLAN_FETCHED ($TEAM_PARALLELS_MAX_ALLOWED_WEB max), Mobile $MOBILE_PLAN_FETCHED ($TEAM_PARALLELS_MAX_ALLOWED_MOBILE max)"
fi
}

Expand Down Expand Up @@ -340,6 +354,15 @@ resolve_ip() {
echo "$ip"
}

report_bstack_local_status() {
local local_flag=$1
if [ "$local_flag" == "true" ]; then
log_info "BrowserStack Local: ENABLED"
else
log_info "BrowserStack Local: DISABLED"
fi
}


identify_run_status_java() {
local log_file=$1
Expand Down Expand Up @@ -391,7 +414,7 @@ identify_run_status_nodejs() {
log_success "Success: $passed test(s) passed"
return 0
else
log_error "Error: No tests passed"
log_error "Error: No tests passed"
return 1
fi
}
Expand Down
Loading
Loading