From fc37cc35cc680c268c9c8b6437e5878d17ad7019 Mon Sep 17 00:00:00 2001 From: Samiran Saha Date: Tue, 9 Dec 2025 00:54:16 +0530 Subject: [PATCH 1/3] print_env_common --- mac/env-setup-run.sh | 77 +++++++++++++++++--------------------------- 1 file changed, 30 insertions(+), 47 deletions(-) diff --git a/mac/env-setup-run.sh b/mac/env-setup-run.sh index 398ce24..08577c7 100644 --- a/mac/env-setup-run.sh +++ b/mac/env-setup-run.sh @@ -103,14 +103,7 @@ EOF mvn install -DskipTests >> "$NOW_RUN_LOG_FILE" 2>&1 || return 1 log_success "Dependencies installed" - - log_section "Validate Environment Variables" - log_info "BrowserStack Username: $BROWSERSTACK_USERNAME" - log_info "BrowserStack Build: $BROWSERSTACK_BUILD_NAME" - log_info "Web Application Endpoint: $CX_TEST_URL" - log_info "BrowserStack Local Flag: $BROWSERSTACK_LOCAL" - log_info "Parallels per platform: $BSTACK_PARALLELS" - log_info "Platforms: \n$BSTACK_PLATFORMS" + print_env_vars print_tests_running_log_section "mvn test -P sample-test" @@ -170,13 +163,7 @@ EOF fi log_success "Dependencies installed" - log_section "Validate Environment Variables" - log_info "BrowserStack Username: $BROWSERSTACK_USERNAME" - log_info "BrowserStack Build: $BROWSERSTACK_BUILD_NAME" - log_info "Native App Endpoint: $BROWSERSTACK_APP" - log_info "BrowserStack Local Flag: $BROWSERSTACK_LOCAL" - log_info "Parallels per platform: $BSTACK_PARALLELS" - log_info "Platforms: \n$BSTACK_PLATFORMS" + print_env_vars log_msg_to "🚀 Running 'mvn test -P sample-test'. This could take a few minutes. Follow the Automaton build here: https://automation.browserstack.com/" print_tests_running_log_section "mvn test -P sample-test" @@ -200,7 +187,7 @@ setup_web_python() { clone_repository "$REPO" "$TARGET_DIR" "" - # detect_setup_python_env + detect_setup_python_env pip3 install --only-binary grpcio -r requirements.txt >> "$NOW_RUN_LOG_FILE" 2>&1 pip3 uninstall -y pytest-html pytest-rerunfailures >> "$NOW_RUN_LOG_FILE" 2>&1 @@ -229,15 +216,8 @@ EOF export BROWSERSTACK_PROJECT_NAME="now-$NOW_OS-web" report_bstack_local_status "$local_flag" - - log_section "Validate Environment Variables" - log_info "BrowserStack Username: $BROWSERSTACK_USERNAME" - log_info "BrowserStack Build: $BROWSERSTACK_BUILD_NAME" - log_info "Web Application Endpoint: $CX_TEST_URL" - log_info "BrowserStack Local Flag: $BROWSERSTACK_LOCAL" - log_info "Parallels per platform: $BSTACK_PARALLELS" - log_info "Platforms: \n$BSTACK_PLATFORMS" - + + print_env_vars print_tests_running_log_section "browserstack-sdk pytest -s tests/*.py" log_msg_to "🚀 Running 'browserstack-sdk pytest -s tests/*.py'. This could take a few minutes. Follow the Automaton build here: https://automation.browserstack.com/" @@ -260,7 +240,7 @@ setup_app_python() { clone_repository "$REPO" "$TARGET_DIR" - # detect_setup_python_env + detect_setup_python_env # Install dependencies pip install --only-binary grpcio -r requirements.txt >> "$NOW_RUN_LOG_FILE" 2>&1 @@ -291,13 +271,7 @@ EOF export BROWSERSTACK_BUILD_NAME="now-$NOW_OS-app-python-pytest" export BROWSERSTACK_PROJECT_NAME="now-$NOW_OS-app" - log_section "Validate Environment Variables" - log_info "BrowserStack Username: $BROWSERSTACK_USERNAME" - log_info "BrowserStack Build: $BROWSERSTACK_BUILD_NAME" - log_info "Native App Endpoint: $BROWSERSTACK_APP" - log_info "BrowserStack Local Flag: $BROWSERSTACK_LOCAL" - log_info "Parallels per platform: $BSTACK_PARALLELS" - log_info "Platforms: \n$BSTACK_PLATFORMS" + print_env_vars print_tests_running_log_section "cd $run_dir && browserstack-sdk pytest -s bstack-sample.py" # Run pytest with BrowserStack SDK from the chosen platform directory @@ -346,13 +320,7 @@ setup_web_nodejs() { report_bstack_local_status "$local_flag" - log_section "Validate Environment Variables" - log_info "BrowserStack Username: $BROWSERSTACK_USERNAME" - log_info "BrowserStack Build: $BROWSERSTACK_BUILD_NAME" - log_info "Web Application Endpoint: $CX_TEST_URL" - log_info "BrowserStack Local Flag: $BROWSERSTACK_LOCAL" - log_info "Parallels per platform: $BSTACK_PARALLELS" - log_info "Platforms: \n$BSTACK_CAPS_JSON" + print_env_vars # === 8ī¸âƒŖ Run Tests === log_msg_to "🚀 Running 'npm run test'. This could take a few minutes. Follow the Automaton build here: https://automation.browserstack.com/" @@ -400,13 +368,7 @@ setup_app_nodejs() { export BROWSERSTACK_BUILD_NAME="now-$NOW_OS-app-nodejs-wdio" export BROWSERSTACK_PROJECT_NAME="now-$NOW_OS-app" - log_section "Validate Environment Variables" - log_info "BrowserStack Username: $BROWSERSTACK_USERNAME" - log_info "BrowserStack Build: $BROWSERSTACK_BUILD_NAME" - log_info "Native App Endpoint: $BROWSERSTACK_APP" - log_info "BrowserStack Local Flag: $BROWSERSTACK_LOCAL" - log_info "Parallels per platform: $BSTACK_PARALLELS" - log_info "Platforms: \n$BSTACK_CAPS_JSON" + print_env_vars # === 8ī¸âƒŖ Run Tests === log_msg_to "🚀 Running 'npm run test'. This could take a few minutes. Follow the Automaton build here: https://automation.browserstack.com/" @@ -545,4 +507,25 @@ detect_setup_python_env() { source .venv/bin/activate fi log_success "Virtual environment created and activated." +} + +print_env_vars() { + log_section "✅ Environment Variables" + log_info "BrowserStack Username: $BROWSERSTACK_USERNAME" + log_info "BrowserStack Project Name: $BROWSERSTACK_PROJECT_NAME" + log_info "BrowserStack Build: $BROWSERSTACK_BUILD_NAME" + log_info "BrowserStack Local Flag: $BROWSERSTACK_LOCAL" + log_info "Parallels per platform: $BSTACK_PARALLELS" + + if [ "$tech_stack" = "nodejs" ]; then + log_info "Capabilities JSON: \n$BSTACK_CAPS_JSON" + else + log_info "Platforms: \n$BSTACK_PLATFORMS" + fi + + if [ "$test_type" = "app" ]; then + log_info "Native App Endpoint: $BROWSERSTACK_APP" + else + log_info "Web Application Endpoint: $CX_TEST_URL" + fi } \ No newline at end of file From 1be88a205480f982983842bfcffbbdd1135af533 Mon Sep 17 00:00:00 2001 From: Samiran Saha Date: Tue, 9 Dec 2025 11:25:07 +0530 Subject: [PATCH 2/3] pip3 fix --- mac/env-setup-run.sh | 2 +- win/env-setup-run.ps1 | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mac/env-setup-run.sh b/mac/env-setup-run.sh index 08577c7..e679ff2 100644 --- a/mac/env-setup-run.sh +++ b/mac/env-setup-run.sh @@ -243,7 +243,7 @@ setup_app_python() { detect_setup_python_env # Install dependencies - pip install --only-binary grpcio -r requirements.txt >> "$NOW_RUN_LOG_FILE" 2>&1 + pip3 install --only-binary grpcio -r requirements.txt >> "$NOW_RUN_LOG_FILE" 2>&1 log_success "Dependencies installed" local app_url=$BROWSERSTACK_APP diff --git a/win/env-setup-run.ps1 b/win/env-setup-run.ps1 index 982bd1b..32adf2c 100644 --- a/win/env-setup-run.ps1 +++ b/win/env-setup-run.ps1 @@ -98,7 +98,7 @@ function Setup-Web-Python { $venvPy = Get-VenvPython -VenvDir $venv Log-Line "â„šī¸ Installing dependencies" $GLOBAL_LOG - [void](Invoke-External -Exe $venvPy -Arguments @("-m","pip","install","-r","requirements.txt") -LogFile $LogFile -WorkingDirectory $TARGET) + [void](Invoke-External -Exe $venvPy -Arguments @("-m","pip3","install","-r","requirements.txt") -LogFile $LogFile -WorkingDirectory $TARGET) Log-Line "✅ Dependencies installed" $GLOBAL_LOG $env:PATH = (Join-Path $venv 'Scripts') + ";" + $env:PATH @@ -314,7 +314,7 @@ function Setup-Mobile-Python { $venvPy = Get-VenvPython -VenvDir $venv Log-Line "â„šī¸ Installing dependencies" $GLOBAL_LOG - [void](Invoke-External -Exe $venvPy -Arguments @("-m","pip","install","-r","requirements.txt") -LogFile $LogFile -WorkingDirectory $TARGET) + [void](Invoke-External -Exe $venvPy -Arguments @("-m","pip3","install","-r","requirements.txt") -LogFile $LogFile -WorkingDirectory $TARGET) Log-Line "✅ Dependencies installed" $GLOBAL_LOG $env:PATH = (Join-Path $venv 'Scripts') + ";" + $env:PATH From 8625dee4602a1967cb448afdd6f6245b6c89ea9f Mon Sep 17 00:00:00 2001 From: Samiran Saha Date: Tue, 9 Dec 2025 11:26:52 +0530 Subject: [PATCH 3/3] pip3 fix --- mac/env-setup-run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mac/env-setup-run.sh b/mac/env-setup-run.sh index e679ff2..0dd3f29 100644 --- a/mac/env-setup-run.sh +++ b/mac/env-setup-run.sh @@ -240,7 +240,7 @@ setup_app_python() { clone_repository "$REPO" "$TARGET_DIR" - detect_setup_python_env + # detect_setup_python_env # Install dependencies pip3 install --only-binary grpcio -r requirements.txt >> "$NOW_RUN_LOG_FILE" 2>&1