Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
14aa9eb
win changes init
samirans89 Nov 28, 2025
433d5d6
win changes compat checks
samirans89 Nov 28, 2025
9a19082
win changes compat checks
samirans89 Nov 28, 2025
3110393
win changes compat checks
samirans89 Nov 28, 2025
603992f
win changes gha
samirans89 Nov 28, 2025
b14cddc
win changes proxy
samirans89 Nov 28, 2025
a613829
win changes proxy test-scripts.yml
samirans89 Nov 28, 2025
bfa73b7
win changes gha win
samirans89 Nov 28, 2025
d75db8c
win changes gha win
samirans89 Nov 28, 2025
68736b3
updated windows setup
himanshu-02 Nov 28, 2025
dd69c9b
win changes cleanup
samirans89 Nov 29, 2025
2cd6601
win bug fixes
samirans89 Nov 29, 2025
da3d356
win bug fixes
samirans89 Nov 29, 2025
d18f9fa
win bug fixes
samirans89 Nov 29, 2025
e24a9ee
win bug fixes
samirans89 Nov 29, 2025
2f6ed7e
win bug fixes
samirans89 Nov 29, 2025
3bf0277
win bug fixes
samirans89 Nov 29, 2025
1570747
win bug fixes
samirans89 Nov 29, 2025
adb665e
win bug fixes
samirans89 Nov 29, 2025
154757e
win bug fixes
samirans89 Nov 29, 2025
9414667
win bug fixes
samirans89 Nov 29, 2025
781e260
win bug fixes
samirans89 Nov 29, 2025
acdedb8
win bug fixes
samirans89 Nov 29, 2025
85d9d49
win bug fixes
samirans89 Nov 29, 2025
d4dcd18
win bug fixes
samirans89 Nov 29, 2025
1a9452f
win bug fixes
samirans89 Nov 29, 2025
179ca5e
win bug fixes
samirans89 Nov 29, 2025
a0157b9
win bug fixes
samirans89 Nov 29, 2025
8ddf7fd
win bug fixes
samirans89 Nov 29, 2025
24cfe4f
win bug fixes
samirans89 Nov 29, 2025
fa02651
win bug fixes
samirans89 Nov 29, 2025
a7933cb
win bug fixes
samirans89 Nov 29, 2025
4a8ae7f
win bug fixes
samirans89 Nov 29, 2025
e6bbd48
win bug fixes
samirans89 Nov 29, 2025
b405f3c
win bug fixes
samirans89 Nov 29, 2025
e2ec608
win bug fixes
samirans89 Nov 29, 2025
5817250
win bug fixes
samirans89 Nov 29, 2025
b5afb08
win bug fixes
samirans89 Nov 29, 2025
908a416
win bug fixes
samirans89 Nov 29, 2025
952febf
win bug fixes
samirans89 Nov 29, 2025
a5afe88
win bug fixes
samirans89 Nov 29, 2025
e127597
win bug fixes
samirans89 Nov 29, 2025
196c8b5
win bug fixes
samirans89 Nov 29, 2025
338c93c
win bug fixes
samirans89 Nov 29, 2025
d8e206c
win bug fixes
samirans89 Nov 29, 2025
bcaed58
win bug fixes
samirans89 Nov 29, 2025
da6348a
win bug fixes
samirans89 Nov 29, 2025
08198e5
win bug fixes
samirans89 Nov 29, 2025
ac563de
win bug fixes
samirans89 Nov 29, 2025
7f733fa
win bug fixes
samirans89 Nov 29, 2025
0f6f758
win bug fixes
samirans89 Nov 29, 2025
5a08e0e
win bug fixes
samirans89 Nov 29, 2025
5522a1d
win bug fixes
samirans89 Nov 29, 2025
65812d5
win bug fixes
samirans89 Nov 29, 2025
682b098
win bug fixes
samirans89 Nov 29, 2025
2d8597f
win bug fixes
samirans89 Nov 29, 2025
facbdfa
win bug fixes
samirans89 Nov 29, 2025
e74055b
win bug fixes
samirans89 Nov 29, 2025
746b83e
win bug fixes
samirans89 Nov 29, 2025
7d46830
win bug fixes
samirans89 Nov 29, 2025
d6786a5
win bug fixes
samirans89 Nov 29, 2025
d86cc5f
win bug fixes
samirans89 Nov 29, 2025
2e8f365
win bug fixes
samirans89 Nov 29, 2025
e10f850
win bug fixes
samirans89 Nov 29, 2025
8ba397b
win bug fixes
samirans89 Nov 29, 2025
6965864
win bug fixes
samirans89 Nov 29, 2025
061ac93
win bug fixes
samirans89 Nov 29, 2025
3ea3d83
win bug fixes
samirans89 Nov 29, 2025
a29a0d2
win bug fixes
samirans89 Nov 29, 2025
25eb286
win bug fixes
samirans89 Nov 29, 2025
5a7a122
win bug fixes
samirans89 Nov 29, 2025
13f01d3
win bug fixes
samirans89 Nov 29, 2025
6d22762
win bug fixes
samirans89 Nov 29, 2025
53e5c85
win bug fixes
samirans89 Nov 29, 2025
f389d13
win bug fixes
samirans89 Nov 29, 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
310 changes: 165 additions & 145 deletions .github/workflows/test-scripts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ on:
jobs:
test-mac:
name: Test mac/run.sh on macOS
if: false
runs-on: macos-latest
timeout-minutes: 15
environment: BrowserStack
Expand Down Expand Up @@ -171,151 +172,169 @@ jobs:
retention-days: 30
if-no-files-found: ignore

# test-windows:
# name: Test win/run.ps1 on Windows
# runs-on: windows-latest
# timeout-minutes: 15
# environment: BrowserStack
# steps:
# - name: Checkout code
# uses: actions/checkout@v4
# - name: Set up Python 3.12
# uses: actions/setup-python@v5
# with:
# python-version: '3.12'
# - name: Check PowerShell version
# run: |
# $PSVersionTable.PSVersion
# 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 $ScriptPath), [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/proxy-check.ps1")
# foreach ($Script in $Scripts) {
# $null = [System.Management.Automation.PSParser]::Tokenize((Get-Content $Script), [ref]$null)
# Write-Host "✅ $Script syntax is valid"
# }
#
# - name: Run PSScriptAnalyzer
# run: |
# Write-Host "Installing PSScriptAnalyzer..."
# Install-Module -Name PSScriptAnalyzer -Force -SkipPublisherCheck -ErrorAction SilentlyContinue
# Write-Host "Running PSScriptAnalyzer..."
# Invoke-ScriptAnalyzer -Path "win/run.ps1" -Recurse -ReportSummary || $true
# Write-Host "✅ PSScriptAnalyzer analysis complete"
#
# - name: Check script file encoding
# run: |
# Write-Host "Checking PowerShell script encoding..."
# $ScriptPath = "win/run.ps1"
# $Encoding = (Get-Item $ScriptPath).EncodingInfo
# Write-Host "File encoding: $Encoding"
# 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" }
# if (Get-Command git.exe -ErrorAction SilentlyContinue) { Write-Host "✅ git found" }
# Write-Host "✅ PowerShell dependencies verified"
#
# - name: Integration Test - Silent Mode Execution
# if: success()
# env:
# BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
# BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
# TURL: https://bstackdemo.com
# run: |
# Write-Host "Running integration tests in silent mode..."
#
# # Set default values if secrets are not provided
# $BrowserStackUsername = if ($env:BROWSERSTACK_USERNAME) { $env:BROWSERSTACK_USERNAME } else { "test_user" }
# $BrowserStackAccessKey = if ($env:BROWSERSTACK_ACCESS_KEY) { $env:BROWSERSTACK_ACCESS_KEY } else { "test_key" }
# $TestUrl = $env:TURL
#
# # Export environment variables
# $env:BROWSERSTACK_USERNAME = $BrowserStackUsername
# $env:BROWSERSTACK_ACCESS_KEY = $BrowserStackAccessKey
# $env:TURL = $TestUrl
#
# # Test configurations
# $testConfigs = @(
# @("web", "java"),
# @("app", "java"),
# @("web", "python"),
# @("app", "python"),
# @("web", "nodejs"),
# @("app", "nodejs")
# )
#
# foreach ($config in $testConfigs) {
# $testType = $config[0]
# $techStack = $config[1]
#
# Write-Host "================================"
# Write-Host "Testing: .\win\run.ps1 --silent $testType $techStack"
# Write-Host "================================"
#
# # Create log file path
# $logPath = "C:\Temp\run_test_${testType}_${techStack}.log"
# New-Item -ItemType Directory -Path "C:\Temp" -Force -ErrorAction SilentlyContinue | Out-Null
#
# # Run with timeout (using job for timeout capability)
# $job = Start-Job -ScriptBlock {
# param($path, $testType, $techStack, $logPath)
# & $path --silent $testType $techStack 2>&1 | Tee-Object -FilePath $logPath -Append
# } -ArgumentList ".\win\run.ps1", $testType, $techStack, $logPath
#
# # Wait for job with 600 second timeout
# $timeout = New-TimeSpan -Seconds 600
# $completed = Wait-Job -Job $job -Timeout 600
#
# if ($completed) {
# $result = Receive-Job -Job $job
# if ($job.State -eq "Completed") {
# Write-Host "✅ .\win\run.ps1 --silent $testType $techStack completed successfully"
# } else {
# Write-Host "⚠️ .\win\run.ps1 --silent $testType $techStack exited with state: $($job.State)"
# if (Test-Path $logPath) {
# Write-Host "Log output (last 20 lines):"
# Get-Content -Path $logPath -Tail 20
# }
# }
# } else {
# Write-Host "⚠️ .\win\run.ps1 --silent $testType $techStack timed out after 600 seconds"
# Stop-Job -Job $job
# if (Test-Path $logPath) {
# Write-Host "Log output (last 20 lines):"
# Get-Content -Path $logPath -Tail 20
# }
# }
#
# Remove-Job -Job $job -Force
# }
#
# Write-Host "✅ All integration tests completed"
#
# - name: Upload BrowserStack Logs as Artifacts
# if: always()
# uses: actions/upload-artifact@v4
# with:
# name: browserstack-logs-windows
# path: |
# C:\Users\runneradmin\.browserstack\NOW\logs\
# C:\Temp\run_test_*.log
# retention-days: 30
# if-no-files-found: ignore
test-windows:
name: Test win/run.ps1 on Windows
runs-on: windows-latest
timeout-minutes: 20
environment: BrowserStack
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Check PowerShell version
run: |
$PSVersionTable.PSVersion
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 $ScriptPath), [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")
foreach ($Script in $Scripts) {
$null = [System.Management.Automation.PSParser]::Tokenize((Get-Content $Script), [ref]$null)
Write-Host "✅ $Script syntax is valid"
}

- name: Run PSScriptAnalyzer
run: |
Write-Host "Installing PSScriptAnalyzer..."
Install-Module -Name PSScriptAnalyzer -Force -SkipPublisherCheck -ErrorAction SilentlyContinue
Write-Host "Running PSScriptAnalyzer..."
Invoke-ScriptAnalyzer -Path "win/run.ps1" -Recurse -ReportSummary || $true
Write-Host "✅ PSScriptAnalyzer analysis complete"

- name: Check script file encoding
run: |
Write-Host "Checking PowerShell script encoding..."
$ScriptPath = "win/run.ps1"
$Encoding = (Get-Item $ScriptPath).EncodingInfo
Write-Host "File encoding: $Encoding"
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" }
if (Get-Command git.exe -ErrorAction SilentlyContinue) { Write-Host "✅ git found" }
Write-Host "✅ PowerShell dependencies verified"

- name: Integration Test - Silent Mode Execution
if: success()
env:
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
TURL: https://bstackdemo.com
run: |
Write-Host "Running integration tests in silent mode..."

# Set default values if secrets are not provided
$BrowserStackUsername = if ($env:BROWSERSTACK_USERNAME) { $env:BROWSERSTACK_USERNAME } else { "test_user" }
$BrowserStackAccessKey = if ($env:BROWSERSTACK_ACCESS_KEY) { $env:BROWSERSTACK_ACCESS_KEY } else { "test_key" }
$TestUrl = $env:TURL

# Export environment variables
$env:BROWSERSTACK_USERNAME = $BrowserStackUsername
$env:BROWSERSTACK_ACCESS_KEY = $BrowserStackAccessKey
$env:TURL = $TestUrl

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

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

Write-Host "================================"
Write-Host "Testing: .\win\run.ps1 --silent $testType $techStack"
Write-Host "================================"

# Create log file path
$logPath = "C:\Temp\run_test_${testType}_${techStack}.log"
New-Item -ItemType Directory -Path "C:\Temp" -Force -ErrorAction SilentlyContinue | Out-Null

# Run with timeout (using job for timeout capability)
$job = Start-Job -ScriptBlock {
param($path, $testType, $techStack, $logPath)
& $path --silent $testType $techStack 2>&1 | Tee-Object -FilePath $logPath -Append
} -ArgumentList ".\win\run.ps1", $testType, $techStack, $logPath

# Wait for job with 600 second timeout
$timeout = New-TimeSpan -Seconds 600
$completed = Wait-Job -Job $job -Timeout 600

if ($completed) {
$result = Receive-Job -Job $job
if ($job.State -eq "Completed") {
Write-Host "✅ .\win\run.ps1 --silent $testType $techStack completed successfully"
} else {
Write-Host "⚠️ .\win\run.ps1 --silent $testType $techStack exited with state: $($job.State)"
if (Test-Path $logPath) {
Write-Host "Log output (last 20 lines):"
Get-Content -Path $logPath -Tail 20
}
}
} else {
Write-Host "⚠️ .\win\run.ps1 --silent $testType $techStack timed out after 600 seconds"
Stop-Job -Job $job
if (Test-Path $logPath) {
Write-Host "Log output (last 20 lines):"
Get-Content -Path $logPath -Tail 20
}
}

Remove-Job -Job $job -Force
}

Write-Host "✅ All integration tests completed"

- name: Sync BrowserStack logs to workspace (Windows)
if: always()
run: |
$dest = Join-Path $env:GITHUB_WORKSPACE "bs-logs"
New-Item -ItemType Directory -Force -Path $dest | Out-Null

$logPath = Join-Path $env:USERPROFILE ".browserstack\NOW\logs"
$logPath3 = Join-Path "C:\Temp" "*.log"

if (Test-Path $logPath) {
Write-Host "Copying logs from $logPath"
Copy-Item -Path (Join-Path $logPath "*") -Destination $dest -Recurse -Force -ErrorAction SilentlyContinue
Copy-Item -Path (Join-Path $logPath3 "*") -Destination $dest -Recurse -Force -ErrorAction SilentlyContinue
}
else {
Write-Host "No logs found at $logPath"
}

- name: Upload BrowserStack Logs as Artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: browserstack-logs-windows
path: |
${{ github.workspace }}/bs-logs
retention-days: 30
if-no-files-found: ignore

test-linux:
name: Test mac/run.sh on Linux
if: false
runs-on: ubuntu-latest
timeout-minutes: 15
environment: BrowserStack
Expand Down Expand Up @@ -467,16 +486,17 @@ jobs:
test-summary:
name: Test Summary
runs-on: ubuntu-latest
needs: [test-mac, test-linux]
needs: [test-mac, test-linux, test-windows]
if: always()
steps:
- name: Check test results
run: |
echo "=== Test Results Summary ==="
echo "macOS Tests: ${{ needs.test-mac.result }}"
echo "Linux Tests: ${{ needs.test-linux.result }}"
echo "Windows Tests: ${{ needs.test-windows.result }}"

if [ "${{ needs.test-mac.result }}" = "failure" ] || [ "${{ needs.test-linux.result }}" = "failure" ]; then
if [ "${{ needs.test-mac.result }}" = "failure" ] || [ "${{ needs.test-linux.result }}" = "failure" ] || [ "${{ needs.test-windows.result }}" = "failure" ]; then
echo "❌ Some tests failed"
exit 1
fi
Expand All @@ -487,4 +507,4 @@ jobs:
run: |
echo "✅ All script validations passed successfully!"
echo "- mac/run.sh and supporting scripts validated on macOS and Linux"
echo "- win/run.ps1 and supporting scripts validated on Windows (temporarily disabled)"
echo "- win/run.ps1 and supporting scripts validated on Windows"
Loading
Loading