@@ -33,25 +33,25 @@ $script:PY_CMD = @()
3333function Ensure-Workspace {
3434 if (! (Test-Path $GLOBAL_DIR )) {
3535 New-Item - ItemType Directory - Path $GLOBAL_DIR | Out-Null
36- Log- Line " ✅ Created Onboarding workspace: $GLOBAL_DIR " $GLOBAL_LOG
36+ Log- Line " ✅ Created Onboarding workspace: $GLOBAL_DIR " $NOW_RUN_LOG_FILE
3737 } else {
38- Log- Line " ✅ Onboarding workspace found at: $GLOBAL_DIR " $GLOBAL_LOG
38+ Log- Line " ✅ Onboarding workspace found at: $GLOBAL_DIR " $NOW_RUN_LOG_FILE
3939 }
4040}
4141
4242function Setup-Workspace {
43- Log- Section " ⚙️ Environment & Credentials" $GLOBAL_LOG
43+ Log- Section " ⚙️ Environment & Credentials" $NOW_RUN_LOG_FILE
4444 Ensure- Workspace
4545}
4646
4747function Clear-OldLogs {
4848 if (! (Test-Path $LOG_DIR )) {
4949 New-Item - ItemType Directory - Path $LOG_DIR | Out-Null
5050 }
51- ' ' | Out-File - FilePath $GLOBAL_LOG - Encoding UTF8
51+ ' ' | Out-File - FilePath $NOW_RUN_LOG_FILE - Encoding UTF8
5252 ' ' | Out-File - FilePath $WEB_LOG - Encoding UTF8
5353 ' ' | Out-File - FilePath $MOBILE_LOG - Encoding UTF8
54- Log- Line " ✅ Logs cleared and fresh run initiated." $GLOBAL_LOG
54+ Log- Line " ✅ Logs cleared and fresh run initiated." $NOW_RUN_LOG_FILE
5555}
5656
5757# ===== Git Clone =====
@@ -253,7 +253,7 @@ function Test-PrivateIP {
253253
254254function Test-DomainPrivate {
255255 $domain = $CX_TEST_URL -replace ' ^https?://' , ' ' -replace ' /.*$' , ' '
256- Log- Line " Website domain: $domain " $GLOBAL_LOG
256+ Log- Line " Website domain: $domain " $NOW_RUN_LOG_FILE
257257 $env: NOW_WEB_DOMAIN = $CX_TEST_URL
258258
259259 $IP_ADDRESS = " "
@@ -269,15 +269,15 @@ function Test-DomainPrivate {
269269 $IP_ADDRESS = $matches [1 ]
270270 }
271271 } catch {
272- Log- Line " ⚠️ Failed to resolve domain: $domain (assuming public domain)" $GLOBAL_LOG
272+ Log- Line " ⚠️ Failed to resolve domain: $domain (assuming public domain)" $NOW_RUN_LOG_FILE
273273 $IP_ADDRESS = " "
274274 }
275275 }
276276
277277 if ([string ]::IsNullOrWhiteSpace($IP_ADDRESS )) {
278- Log- Line " ⚠️ DNS resolution failed for: $domain (treating as public domain, BrowserStack Local will be DISABLED)" $GLOBAL_LOG
278+ Log- Line " ⚠️ DNS resolution failed for: $domain (treating as public domain, BrowserStack Local will be DISABLED)" $NOW_RUN_LOG_FILE
279279 } else {
280- Log- Line " ✅ Resolved IP: $IP_ADDRESS " $GLOBAL_LOG
280+ Log- Line " ✅ Resolved IP: $IP_ADDRESS " $NOW_RUN_LOG_FILE
281281 }
282282
283283 return (Test-PrivateIP - IP $IP_ADDRESS )
@@ -294,7 +294,7 @@ function Get-BasicAuthHeader {
294294function Fetch-Plan-Details {
295295 param ([string ]$TestType )
296296
297- Log- Line " ℹ️ Fetching BrowserStack plan for $TestType " $GLOBAL_LOG
297+ Log- Line " ℹ️ Fetching BrowserStack plan for $TestType " $NOW_RUN_LOG_FILE
298298 $auth = Get-BasicAuthHeader - User $BROWSERSTACK_USERNAME - Key $BROWSERSTACK_ACCESS_KEY
299299 $headers = @ { Authorization = $auth }
300300
@@ -303,30 +303,30 @@ function Fetch-Plan-Details {
303303 $resp = Invoke-RestMethod - Method Get - Uri " https://api.browserstack.com/automate/plan.json" - Headers $headers
304304 $script :WEB_PLAN_FETCHED = $true
305305 $script :TEAM_PARALLELS_MAX_ALLOWED_WEB = [int ]$resp.parallel_sessions_max_allowed
306- Log- Line " ✅ Web Testing Plan fetched: Team max parallel sessions = $TEAM_PARALLELS_MAX_ALLOWED_WEB " $GLOBAL_LOG
306+ Log- Line " ✅ Web Testing Plan fetched: Team max parallel sessions = $TEAM_PARALLELS_MAX_ALLOWED_WEB " $NOW_RUN_LOG_FILE
307307 } catch {
308- Log- Line " ❌ Web Testing Plan fetch failed ($ ( $_.Exception.Message ) )" $GLOBAL_LOG
308+ Log- Line " ❌ Web Testing Plan fetch failed ($ ( $_.Exception.Message ) )" $NOW_RUN_LOG_FILE
309309 }
310310 }
311311 if ($TestType -in @ (" App" , " Both" , " app" , " both" )) {
312312 try {
313313 $resp2 = Invoke-RestMethod - Method Get - Uri " https://api-cloud.browserstack.com/app-automate/plan.json" - Headers $headers
314314 $script :MOBILE_PLAN_FETCHED = $true
315315 $script :TEAM_PARALLELS_MAX_ALLOWED_MOBILE = [int ]$resp2.parallel_sessions_max_allowed
316- Log- Line " ✅ Mobile App Testing Plan fetched: Team max parallel sessions = $TEAM_PARALLELS_MAX_ALLOWED_MOBILE " $GLOBAL_LOG
316+ Log- Line " ✅ Mobile App Testing Plan fetched: Team max parallel sessions = $TEAM_PARALLELS_MAX_ALLOWED_MOBILE " $NOW_RUN_LOG_FILE
317317 } catch {
318- Log- Line " ❌ Mobile App Testing Plan fetch failed ($ ( $_.Exception.Message ) )" $GLOBAL_LOG
318+ Log- Line " ❌ Mobile App Testing Plan fetch failed ($ ( $_.Exception.Message ) )" $NOW_RUN_LOG_FILE
319319 }
320320 }
321321
322322 if ( ($TestType -match " ^Web$|^web$" -and -not $WEB_PLAN_FETCHED ) -or
323323 ($TestType -match " ^App$|^app$" -and -not $MOBILE_PLAN_FETCHED ) -or
324324 ($TestType -match " ^Both$|^both$" -and -not ($WEB_PLAN_FETCHED -or $MOBILE_PLAN_FETCHED )) ) {
325- Log- Line " ❌ Unauthorized to fetch required plan(s) or failed request(s). Exiting." $GLOBAL_LOG
325+ Log- Line " ❌ Unauthorized to fetch required plan(s) or failed request(s). Exiting." $NOW_RUN_LOG_FILE
326326 throw " Plan fetch failed"
327327 }
328328
329- Log- Line " ℹ️ Plan summary: Web $WEB_PLAN_FETCHED ($TEAM_PARALLELS_MAX_ALLOWED_WEB max), Mobile $MOBILE_PLAN_FETCHED ($TEAM_PARALLELS_MAX_ALLOWED_MOBILE max)" $GLOBAL_LOG
329+ Log- Line " ℹ️ Plan summary: Web $WEB_PLAN_FETCHED ($TEAM_PARALLELS_MAX_ALLOWED_WEB max), Mobile $MOBILE_PLAN_FETCHED ($TEAM_PARALLELS_MAX_ALLOWED_MOBILE max)" $NOW_RUN_LOG_FILE
330330}
331331
332332# ===== Dynamic config generators =====
0 commit comments