Skip to content

Commit c2e52bb

Browse files
committed
win mac merge init commit
1 parent 03c380b commit c2e52bb

File tree

5 files changed

+37
-37
lines changed

5 files changed

+37
-37
lines changed

common/win/common-utils.ps1

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -316,9 +316,9 @@ function Fetch-Plan-Details {
316316
$resp = Invoke-RestMethod -Method Get -Uri "https://api.browserstack.com/automate/plan.json" -Headers $headers
317317
$script:WEB_PLAN_FETCHED = $true
318318
$script:TEAM_PARALLELS_MAX_ALLOWED_WEB = [int]$resp.parallel_sessions_max_allowed
319-
Log-Line "Web Testing Plan fetched: Team max parallel sessions = $script:TEAM_PARALLELS_MAX_ALLOWED_WEB" $global:NOW_RUN_LOG_FILE
319+
Log-Line "Web Testing Plan fetched: Team max parallel sessions = $script:TEAM_PARALLELS_MAX_ALLOWED_WEB" $global:NOW_RUN_LOG_FILE
320320
} catch {
321-
Log-Line "Web Testing Plan fetch failed ($($_.Exception.Message))" $global:NOW_RUN_LOG_FILE
321+
Log-Line "Web Testing Plan fetch failed ($($_.Exception.Message))" $global:NOW_RUN_LOG_FILE
322322
}
323323
if (-not $script:WEB_PLAN_FETCHED) {
324324
throw "Unable to fetch Web Testing plan details."
@@ -329,9 +329,9 @@ function Fetch-Plan-Details {
329329
$resp2 = Invoke-RestMethod -Method Get -Uri "https://api-cloud.browserstack.com/app-automate/plan.json" -Headers $headers
330330
$script:MOBILE_PLAN_FETCHED = $true
331331
$script:TEAM_PARALLELS_MAX_ALLOWED_MOBILE = [int]$resp2.parallel_sessions_max_allowed
332-
Log-Line "Mobile App Testing Plan fetched: Team max parallel sessions = $script:TEAM_PARALLELS_MAX_ALLOWED_MOBILE" $global:NOW_RUN_LOG_FILE
332+
Log-Line "Mobile App Testing Plan fetched: Team max parallel sessions = $script:TEAM_PARALLELS_MAX_ALLOWED_MOBILE" $global:NOW_RUN_LOG_FILE
333333
} catch {
334-
Log-Line "Mobile App Testing Plan fetch failed ($($_.Exception.Message))" $global:NOW_RUN_LOG_FILE
334+
Log-Line "Mobile App Testing Plan fetch failed ($($_.Exception.Message))" $global:NOW_RUN_LOG_FILE
335335
}
336336
if (-not $script:MOBILE_PLAN_FETCHED) {
337337
throw "Unable to fetch Mobile App Testing plan details."
@@ -347,7 +347,7 @@ function Fetch-Plan-Details {
347347
$script:TEAM_PARALLELS_MAX_ALLOWED_MOBILE = 5
348348
Log-Line "Silent mode: Plan summary: Web $WEB_PLAN_FETCHED ($TEAM_PARALLELS_MAX_ALLOWED_WEB max), Mobile $MOBILE_PLAN_FETCHED ($TEAM_PARALLELS_MAX_ALLOWED_MOBILE max)" $global:NOW_RUN_LOG_FILE
349349
} else {
350-
Log-Line "ℹ️ Plan summary: Web fetched=$script:WEB_PLAN_FETCHED (team max=$script:TEAM_PARALLELS_MAX_ALLOWED_WEB), Mobile fetched=$script:MOBILE_PLAN_FETCHED (team max=$script:TEAM_PARALLELS_MAX_ALLOWED_MOBILE)" $global:NOW_RUN_LOG_FILE
350+
Log-Line "Plan summary: Web fetched=$script:WEB_PLAN_FETCHED (team max=$script:TEAM_PARALLELS_MAX_ALLOWED_WEB), Mobile fetched=$script:MOBILE_PLAN_FETCHED (team max=$script:TEAM_PARALLELS_MAX_ALLOWED_MOBILE)" $global:NOW_RUN_LOG_FILE
351351
}
352352

353353
}
@@ -366,13 +366,13 @@ function Invoke-SampleAppUpload {
366366
if ([string]::IsNullOrWhiteSpace($url)) {
367367
throw "Sample app upload failed (empty URL)"
368368
}
369-
Log-Line "App uploaded successfully: $url" $global:NOW_RUN_LOG_FILE
369+
Log-Success "App uploaded successfully: $url" $global:NOW_RUN_LOG_FILE
370370
return @{
371371
Url = $url
372372
Platform = "android"
373373
}
374374
} catch {
375-
Log-Line "Upload failed: $($_.Exception.Message)" $global:NOW_RUN_LOG_FILE
375+
Log-Error "Upload failed: $($_.Exception.Message)" $global:NOW_RUN_LOG_FILE
376376
throw
377377
}
378378
}
@@ -389,7 +389,7 @@ function Invoke-CustomAppUpload {
389389
default { throw "Unsupported app file (only .apk/.ipa)" }
390390
}
391391

392-
Log-Line "⬆️ Uploading app to BrowserStack..." $global:NOW_RUN_LOG_FILE
392+
Log-Line "Uploading app to BrowserStack..." $global:NOW_RUN_LOG_FILE
393393

394394
$boundary = [System.Guid]::NewGuid().ToString()
395395
$LF = "`r`n"
@@ -421,7 +421,7 @@ function Invoke-CustomAppUpload {
421421
Platform = $platform
422422
}
423423
} catch {
424-
Log-Line "Upload failed: $($_.Exception.Message)" $global:NOW_RUN_LOG_FILE
424+
Log-Error "Upload failed: $($_.Exception.Message)" $global:NOW_RUN_LOG_FILE
425425
throw
426426
}
427427
}
@@ -431,7 +431,7 @@ function Identify-Run-Status-Java {
431431

432432
$content = Get-Content -Path $LogFile -Raw -ErrorAction SilentlyContinue
433433
if (-not $content) {
434-
Log-Warn "No test summary line found."
434+
Log-Warn "No test summary line found."
435435
return $false
436436
}
437437

@@ -452,7 +452,7 @@ function Identify-Run-Status-Java {
452452
}
453453
}
454454

455-
Log-Warn "No test summary line found."
455+
Log-Warn "No test summary line found."
456456
return $false
457457
}
458458

@@ -472,7 +472,7 @@ function Identify-Run-Status-Python {
472472
$passedSum += [int]$m.Groups[1].Value
473473
}
474474

475-
Write-Host "Total Passed: $passedSum" -ForegroundColor Green
475+
Write-Host "Total Passed: $passedSum" -ForegroundColor Green
476476

477477
if ($passedSum -gt 0) {
478478
Log-Success "Success: $passedSum test(s) completed"
@@ -488,7 +488,7 @@ function Identify-Run-Status-NodeJS {
488488

489489
$content = Get-Content -Path $LogFile -Raw -ErrorAction SilentlyContinue
490490
if (-not $content) {
491-
Log-Warn "No test summary line found."
491+
Log-Warn "No test summary line found."
492492
return $false
493493
}
494494

common/win/env-prequisite-checks.ps1

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,16 @@ function Set-ProxyInEnv {
4343
try {
4444
$resp = Invoke-WebRequest -Uri $PROXY_TEST_URL -Proxy $proxy -Headers @{ Authorization = "Basic $auth" } -Method Head -ErrorAction Stop
4545
$statusCode = $resp.StatusCode
46-
Log-Line "✅ Reachable. HTTP $statusCode" $global:NOW_RUN_LOG_FILE
46+
Log-Line "Endpoint reachable. HTTP $statusCode" $global:NOW_RUN_LOG_FILE
4747
Log-Line "Exporting PROXY_HOST=$script:PROXY_HOST" $global:NOW_RUN_LOG_FILE
4848
Log-Line "Exporting PROXY_PORT=$script:PROXY_PORT" $global:NOW_RUN_LOG_FILE
4949

5050
$env:PROXY_HOST = $script:PROXY_HOST
5151
$env:PROXY_PORT = $script:PROXY_PORT
5252
Log-Success "Connected to BrowserStack from proxy: $script:PROXY_HOST:$script:PROXY_PORT"
5353
} catch {
54-
Log-Warn "⚠️ Could not connect to BrowserStack using proxy. Using direct connection."
55-
Log-Line "Not reachable ($($_.Exception.Message)). Clearing variables." $global:NOW_RUN_LOG_FILE
54+
Log-Error "Could not connect to BrowserStack using proxy. Using direct connection."
55+
Log-Warn "Not reachable ($($_.Exception.Message)). Clearing variables." $global:NOW_RUN_LOG_FILE
5656
$script:PROXY_HOST = ""
5757
$script:PROXY_PORT = ""
5858
$env:PROXY_HOST = ""
@@ -105,33 +105,33 @@ function Check-Python-Installation {
105105
function Check-NodeJS-Installation {
106106
Log-Line "🔍 Checking if 'node' command exists..." $global:NOW_RUN_LOG_FILE
107107
if (-not (Get-Command node -ErrorAction SilentlyContinue)) {
108-
Log-Line "Node.js command not found in PATH." $global:NOW_RUN_LOG_FILE
108+
Log-Warn "Node.js command not found in PATH." $global:NOW_RUN_LOG_FILE
109109
return $false
110110
}
111111

112-
Log-Line "🔍 Checking if 'npm' command exists..." $global:NOW_RUN_LOG_FILE
112+
Log-Line "Checking if 'npm' command exists..." $global:NOW_RUN_LOG_FILE
113113
if (-not (Get-Command npm -ErrorAction SilentlyContinue)) {
114-
Log-Line "npm command not found in PATH." $global:NOW_RUN_LOG_FILE
114+
Log-Warn "npm command not found in PATH." $global:NOW_RUN_LOG_FILE
115115
return $false
116116
}
117117

118-
Log-Line "🔍 Checking if Node.js runs correctly..." $global:NOW_RUN_LOG_FILE
118+
Log-Line "Checking if Node.js runs correctly..." $global:NOW_RUN_LOG_FILE
119119
try {
120120
$nodeVer = node -v 2>&1 | Out-String
121121
$npmVer = npm -v 2>&1 | Out-String
122122
Log-Success "Node.js installed: $nodeVer"
123123
Log-Success "npm installed: $npmVer"
124124
return $true
125125
} catch {
126-
Log-Line "Node.js/npm exists but failed to run." $global:NOW_RUN_LOG_FILE
126+
Log-Warn "Node.js/npm exists but failed to run." $global:NOW_RUN_LOG_FILE
127127
return $false
128128
}
129129
}
130130

131131
function Validate-Tech-Stack {
132132
param([string]$TechStack)
133133

134-
Log-Section "🧩 System Prerequisites Check"
134+
Log-Section "System Prerequisites Check"
135135
Log-Info "Checking prerequisites for $TechStack"
136136

137137
$valid = $false
@@ -146,7 +146,7 @@ function Validate-Tech-Stack {
146146
}
147147

148148
if ($valid) {
149-
Log-Line "Prerequisites validated for $TechStack" $global:NOW_RUN_LOG_FILE
149+
Log-Line "Prerequisites validated for $TechStack" $global:NOW_RUN_LOG_FILE
150150
return $true
151151
} else {
152152
return $false

common/win/env-setup-run.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function Setup-Environment {
5757
"app_nodejs" { $result = Setup-App-NodeJS -TargetDir $targetDir -Parallels $totalParallels }
5858
}
5959

60-
Log-Section "Results"
60+
Log-Section "Results"
6161

6262
Log-Info "${SetupType} setup completed with exit code: $result"
6363

common/win/logging-utils.ps1

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,22 @@ function Log-Section {
1616

1717
function Log-Info {
1818
param([string]$Message)
19-
Write-Host "ℹ️ $Message" -ForegroundColor Gray
19+
Write-Host "$Message" -ForegroundColor Gray
2020
}
2121

2222
function Log-Success {
2323
param([string]$Message)
24-
Write-Host "$Message" -ForegroundColor Green
24+
Write-Host "$Message" -ForegroundColor Green
2525
}
2626

2727
function Log-Warn {
2828
param([string]$Message)
29-
Write-Host "⚠️ $Message" -ForegroundColor Yellow
29+
Write-Host "$Message" -ForegroundColor Yellow
3030
}
3131

3232
function Log-Error {
3333
param([string]$Message)
34-
Write-Host "$Message" -ForegroundColor Red
34+
Write-Host "$Message" -ForegroundColor Red
3535
}
3636

3737
function Log-Line {
@@ -40,7 +40,7 @@ function Log-Line {
4040
[string]$LogFile
4141
)
4242
#$ts = (Get-Date).ToString("yyyy-MM-dd HH:mm:ss")
43-
$line = "$Message"
43+
$line = $Message
4444

4545
# Print to console if debug mode (or always, depending on usage in bash)
4646
# Bash version: prints to console if RUN_MODE contains --debug

common/win/user-interaction.ps1

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -175,12 +175,12 @@ function Ask-BrowserStack-Credentials {
175175

176176
$script:BROWSERSTACK_USERNAME = Show-InputBox -Title "BrowserStack Setup" -Prompt "Enter your BrowserStack Username:`n`nLocate it on https://www.browserstack.com/accounts/profile/details" -DefaultText ""
177177
if ([string]::IsNullOrWhiteSpace($script:BROWSERSTACK_USERNAME)) {
178-
Log-Line "Username empty" $global:NOW_RUN_LOG_FILE
178+
Log-Error "Username empty" $global:NOW_RUN_LOG_FILE
179179
throw "Username is required"
180180
}
181181
$script:BROWSERSTACK_ACCESS_KEY = Show-PasswordBox -Title "BrowserStack Setup" -Prompt "Enter your BrowserStack Access Key:`n`nLocate it on https://www.browserstack.com/accounts/profile/details"
182182
if ([string]::IsNullOrWhiteSpace($script:BROWSERSTACK_ACCESS_KEY)) {
183-
Log-Line "❌ Access Key empty" $global:NOW_RUN_LOG_FILE
183+
Log-Error "❌ Access Key empty" $global:NOW_RUN_LOG_FILE
184184
throw "Access Key is required"
185185
}
186186

@@ -255,16 +255,16 @@ function Ask-User-TestUrl {
255255

256256
if (-not [string]::IsNullOrWhiteSpace($CliValue)) {
257257
$script:CX_TEST_URL = $CliValue
258-
Log-Line "🌐 Using custom test URL from CLI: $CliValue" $global:NOW_RUN_LOG_FILE
258+
Log-Line "Using custom test URL from CLI: $CliValue" $global:NOW_RUN_LOG_FILE
259259
return
260260
}
261261

262262
$testUrl = Show-InputBox -Title "Test URL Setup" -Prompt "Enter the URL you want to test with BrowserStack:`n(Leave blank for default: $script:DEFAULT_TEST_URL)" -DefaultText ""
263263
if ([string]::IsNullOrWhiteSpace($testUrl)) {
264264
$testUrl = $script:DEFAULT_TEST_URL
265-
Log-Line "⚠️ No URL entered. Falling back to default: $testUrl" $global:NOW_RUN_LOG_FILE
265+
Log-Line "No URL entered. Falling back to default: $testUrl" $global:NOW_RUN_LOG_FILE
266266
} else {
267-
Log-Line "🌐 Using custom test URL: $testUrl" $global:NOW_RUN_LOG_FILE
267+
Log-Line "Using custom test URL: $testUrl" $global:NOW_RUN_LOG_FILE
268268
}
269269
$script:CX_TEST_URL = $testUrl
270270
}
@@ -292,7 +292,7 @@ function Ask-And-Upload-App {
292292
return
293293
}
294294
$result = Invoke-SampleAppUpload
295-
Log-Line "⚠️ Using auto-uploaded sample app: $($result.Url)" $global:NOW_RUN_LOG_FILE
295+
Log-Line "Using auto-uploaded sample app: $($result.Url)" $global:NOW_RUN_LOG_FILE
296296
$script:BROWSERSTACK_APP = $result.Url
297297
$script:APP_PLATFORM = $result.Platform
298298
return
@@ -308,7 +308,7 @@ function Ask-And-Upload-App {
308308
$choice = Show-OpenOrSampleAppDialog
309309
if ([string]::IsNullOrWhiteSpace($choice) -or $choice -eq "Sample App") {
310310
$result = Invoke-SampleAppUpload
311-
Log-Line "⚠️ Using sample app: $($result.Url)" $global:NOW_RUN_LOG_FILE
311+
Log-Line "Using sample app: $($result.Url)" $global:NOW_RUN_LOG_FILE
312312
$script:BROWSERSTACK_APP = $result.Url
313313
$script:APP_PLATFORM = $result.Platform
314314
return
@@ -326,7 +326,7 @@ function Ask-And-Upload-App {
326326
$result = Invoke-CustomAppUpload -FilePath $path
327327
$script:BROWSERSTACK_APP = $result.Url
328328
$script:APP_PLATFORM = $result.Platform
329-
Log-Line "App uploaded successfully: $($result.Url)" $global:NOW_RUN_LOG_FILE
329+
Log-Line "App uploaded successfully: $($result.Url)" $global:NOW_RUN_LOG_FILE
330330
}
331331

332332
function Perform-NextSteps-BasedOnTestType {

0 commit comments

Comments
 (0)