Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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
212 changes: 117 additions & 95 deletions .github/workflows/test-scripts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
jobs:
test-mac:
name: Test mac/run.sh on macOS
# if: false
if: false
runs-on: macos-latest
timeout-minutes: 15
environment: BrowserStack
Expand All @@ -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 @@ -198,29 +200,31 @@ jobs:
- name: Check PowerShell version
run: |
$PSVersionTable.PSVersion
Write-Host "PowerShell version check complete"
Write-Host "PowerShell version check complete"

- name: Validate PowerShell script syntax
run: |
Write-Host "Validating win/run.ps1 syntax..."
$ScriptPath = "win/run.ps1"
$null = [System.Management.Automation.PSParser]::Tokenize((Get-Content -Raw $ScriptPath), [ref]$null)
Write-Host "✅ win/run.ps1 syntax is valid"
$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)
Write-Host "$Script syntax is valid"
Write-Host "$Script syntax is valid"
}

- name: Run PSScriptAnalyzer
Expand All @@ -232,7 +236,7 @@ jobs:

Write-Host "Running PSScriptAnalyzer..."
Invoke-ScriptAnalyzer -Path "win" -Recurse -ReportSummary -ErrorAction Continue
Write-Host "PSScriptAnalyzer analysis complete (continuing even if issues are found)"
Write-Host "PSScriptAnalyzer analysis complete (continuing even if issues are found)"

- name: Check script file encoding
run: |
Expand All @@ -250,14 +254,14 @@ jobs:
}

Write-Host "Detected encoding (heuristic): $encoding"
Write-Host "Encoding check complete"
Write-Host "Encoding check complete"

- name: Verify required dependencies
run: |
Write-Host "Checking required dependencies..."
if (Get-Command curl.exe -ErrorAction SilentlyContinue) { Write-Host "curl found" } else { Write-Host "⚠️ curl not found" }
if (Get-Command git.exe -ErrorAction SilentlyContinue) { Write-Host "git found" } else { Write-Host "⚠️ git not found" }
Write-Host "PowerShell dependencies verified"
if (Get-Command curl.exe -ErrorAction SilentlyContinue) { Write-Host "curl found" } else { Write-Host "⚠️ curl not found" }
if (Get-Command git.exe -ErrorAction SilentlyContinue) { Write-Host "git found" } else { Write-Host "⚠️ git not found" }
Write-Host "PowerShell dependencies verified"

- name: Integration Test - Silent Mode Execution
if: success()
Expand All @@ -280,73 +284,89 @@ jobs:
# Absolute path is safer in CI
$scriptPath = Join-Path $env:GITHUB_WORKSPACE "win\run.ps1"

$testConfigs = @(
@("web", "java"),
@("app", "java"),
@("web", "python"),
@("app", "python"),
@("web", "nodejs"),
@("app", "nodejs")
)

$overallFailed = $false
$logRoot = Join-Path $env:TEMP "now-tests"
New-Item -ItemType Directory -Force -Path $logRoot | Out-Null
$logPath = Join-Path $logRoot "run_test_app_nodejs.log"
$logPath = Join-Path $logRoot "run_test_web_python.log"

Write-Host "================================"
Write-Host "Testing: $scriptPath --silent app nodejs"
Write-Host "Testing: $scriptPath --silent web python"
Write-Host "================================"

& $scriptPath --silent app nodejs 2>&1 | Tee-Object -FilePath $logPath -Append
& $scriptPath --silent web python 2>&1 | Tee-Object -FilePath $logPath -Append
$exitCode = $LASTEXITCODE

if ($exitCode -eq 0) {
Write-Host "✅ app / nodejs completed (exit code: $exitCode)"
Write-Host "web / python completed (exit code: $exitCode)"
} else {
Write-Host "⚠️ app / nodejs exited with code: $exitCode"
Write-Host "web / python exited with code: $exitCode"
if (Test-Path $logPath) {
Write-Host "Log output (last 20 lines):"
Get-Content -Path $logPath -Tail 20
}
exit 1
}

# $logRoot = Join-Path $env:TEMP "now-tests"
# New-Item -ItemType Directory -Force -Path $logRoot | Out-Null
$testConfigs = @(
@("web", "python"),
@("app", "python"),
@("web", "nodejs"),
@("app", "nodejs")
)

$overallFailed = $false

$logRoot = Join-Path $env:TEMP "now-tests"
New-Item -ItemType Directory -Force -Path $logRoot | Out-Null

# foreach ($config in $testConfigs) {
# $testType = $config[0]
# $techStack = $config[1]
foreach ($config in $testConfigs) {
$testType = $config[0]
$techStack = $config[1]

# Write-Host "================================"
# Write-Host "Testing: $scriptPath --silent $testType $techStack"
# Write-Host "================================"
Write-Host "================================"
Write-Host "Testing: $scriptPath --silent $testType $techStack"
Write-Host "================================"

# $logPath = Join-Path $logRoot "run_test_${testType}_${techStack}.log"
$logPath = Join-Path $logRoot "run_test_${testType}_${techStack}.log"
$logPathErr = Join-Path $logRoot "run_test_${testType}_${techStack}.err"

# & $scriptPath --silent $testType $techStack 2>&1 | Tee-Object -FilePath $logPath -Append
# $exitCode = $LASTEXITCODE
# Run with timeout (600 seconds)
$p = Start-Process -FilePath "pwsh" -ArgumentList "-File", $scriptPath, "--silent", $testType, $techStack -RedirectStandardOutput $logPath -RedirectStandardError $logPathErr -PassThru -NoNewWindow

# Wait for 600 seconds (600000 ms)
$exited = $p.WaitForExit(600000)

if (-not $exited) {
Write-Host "$testType / $techStack timed out after 600 seconds"
$p.Kill()
$exitCode = 124
} else {
$exitCode = $p.ExitCode
}

# if ($exitCode -eq 0) {
# Write-Host "$testType / $techStack completed (exit code: $exitCode)"
# } else {
# Write-Host "⚠️ $testType / $techStack exited with code: $exitCode"
# $overallFailed = $true
if ($exitCode -eq 0) {
Write-Host "$testType / $techStack completed (exit code: $exitCode)"
} else {
Write-Host "$testType / $techStack exited with code: $exitCode"
$overallFailed = $true

# if (Test-Path $logPath) {
# Write-Host "Log output (last 20 lines):"
# Get-Content -Path $logPath -Tail 20
# }
# }
# }
if (Test-Path $logPath) {
Write-Host "Log output (last 20 lines):"
Get-Content -Path $logPath -Tail 20
}
}

if (Test-Path $logPathErr) {
Write-Host "Error output (last 20 lines):"
Get-Content -Path $logPathErr -Tail 20
}
}

if ($overallFailed) {
Write-Error "One or more configurations failed."
exit 1
}

Write-Host "All integration tests completed successfully"
Write-Host "All integration tests completed successfully"

- name: Sync BrowserStack logs to workspace (Windows)
if: always()
Expand Down Expand Up @@ -380,7 +400,7 @@ jobs:

test-linux:
name: Test mac/run.sh on Linux
# if: false
if: false
runs-on: ubuntu-latest
timeout-minutes: 15
environment: BrowserStack
Expand All @@ -400,27 +420,28 @@ jobs:
run: |
echo "Validating mac/run.sh syntax..."
bash -n mac/run.sh
echo "✅ mac/run.sh syntax is valid"
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
echo "All supporting scripts are valid"
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
echo "All scripts are executable"
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
run: |
Expand All @@ -433,28 +454,29 @@ 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
echo "✅ ShellCheck analysis complete"
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
run: |
echo "Checking required dependencies..."
command -v bash && echo "bash found"
command -v curl && echo "curl found"
command -v git && echo "git found"
command -v bc && echo "bc found"
command -v bash && echo "bash found"
command -v curl && echo "curl found"
command -v git && echo "git found"
command -v bc && echo "bc found"
echo "All required dependencies are available"

- name: Test script sourcing (dry run)
run: |
set -e
echo "Testing script sourcing..."
bash -c "source mac/common-utils.sh && echo 'common-utils.sh sourced successfully'"
echo "Script sourcing successful"
bash -c "source common/mac/common-utils.sh && echo 'common-utils.sh sourced successfully'"
echo "Script sourcing successful"

- name: Integration Test - Silent Mode Execution
if: success()
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|
Loading
Loading