diff --git a/mac/common-utils.sh b/mac/common-utils.sh index d572770..71d97af 100644 --- a/mac/common-utils.sh +++ b/mac/common-utils.sh @@ -128,7 +128,7 @@ handle_app_upload() { } upload_sample_app() { - log_msg_to "⬆️ Uploading sample app to BrowserStack..." + log_info "Uploading sample app to BrowserStack" local upload_response upload_response=$(curl -s -u "$BROWSERSTACK_USERNAME:$BROWSERSTACK_ACCESS_KEY" \ -X POST "https://api-cloud.browserstack.com/app-automate/upload" \ @@ -182,11 +182,11 @@ upload_custom_app() { elif [[ "$file_path" == *.apk ]]; then app_platform="android" else - log_msg_to "❌ Invalid file type. Must be .apk or .ipa" - return 1 + log_error "❌ Invalid file type. Must be .apk or .ipa" + exit 1 fi - log_msg_to "⬆️ Uploading app to BrowserStack..." + log_info "Uploading app to BrowserStack" local upload_response upload_response=$(curl -s -u "$BROWSERSTACK_USERNAME:$BROWSERSTACK_ACCESS_KEY" \ -X POST "https://api-cloud.browserstack.com/app-automate/upload" \ @@ -195,8 +195,8 @@ upload_custom_app() { local app_url app_url=$(echo "$upload_response" | grep -o '"app_url":"[^"]*' | cut -d'"' -f4) if [ -z "$app_url" ]; then - log_msg_to "❌ Failed to upload app" - return 1 + log_error "❌ Failed to upload app: $upload_response" + exit 1 fi export BROWSERSTACK_APP=$app_url diff --git a/mac/run.sh b/mac/run.sh index fe98977..7c713a6 100755 --- a/mac/run.sh +++ b/mac/run.sh @@ -31,6 +31,8 @@ log_section "🧭 Setup Summary – BrowserStack NOW" log_info "Timestamp: $(date '+%Y-%m-%d %H:%M:%S')" detect_os +setup_workspace +get_browserstack_credentials "$RUN_MODE" log_file="" if [[ "$RUN_MODE" == *"--silent"* || "$RUN_MODE" == *"--debug"* ]]; then @@ -47,8 +49,7 @@ fi log_info "Log file path: $log_file" export NOW_RUN_LOG_FILE="$log_file" -setup_workspace -get_browserstack_credentials "$RUN_MODE" + log_section "⚙️ Platform & Tech Stack" log_info "Platform: ${TEST_TYPE:-N/A}" diff --git a/mac/user-interaction.sh b/mac/user-interaction.sh index d671e50..e5068ef 100644 --- a/mac/user-interaction.sh +++ b/mac/user-interaction.sh @@ -11,7 +11,7 @@ get_browserstack_credentials() { log_info "BrowserStack credentials loaded from environment variables for user: $username" else if [[ "$NOW_OS" == "macos" ]]; then - username=$(osascript -e 'Tell application "System Events" to display dialog "Please enter your BrowserStack Username.\n\nNote: Locate it in your BrowserStack account profile page.\nhttps://www.browserstack.com/accounts/profile/details" default answer "" with title "BrowserStack Setup" buttons {"OK"} default button "OK"' \ + username=$(osascript -e 'display dialog "Please enter your BrowserStack Username.\n\nNote: Locate it in your BrowserStack account profile page.\nhttps://www.browserstack.com/accounts/profile/details" default answer "" with title "BrowserStack Setup" buttons {"OK"} default button "OK"' \ -e 'text returned of result') else echo "Please enter your BrowserStack Username." @@ -25,7 +25,7 @@ get_browserstack_credentials() { fi if [[ "$NOW_OS" == "macos" ]]; then - access_key=$(osascript -e 'Tell application "System Events" to display dialog "Please enter your BrowserStack Access Key.\n\nNote: Locate it in your BrowserStack account page.\nhttps://www.browserstack.com/accounts/profile/details" default answer "" with hidden answer with title "BrowserStack Setup" buttons {"OK"} default button "OK"' \ + access_key=$(osascript -e 'display dialog "Please enter your BrowserStack Access Key.\n\nNote: Locate it in your BrowserStack account page.\nhttps://www.browserstack.com/accounts/profile/details" default answer "" with hidden answer with title "BrowserStack Setup" buttons {"OK"} default button "OK"' \ -e 'text returned of result') else echo "Please enter your BrowserStack Access Key." @@ -55,7 +55,7 @@ get_tech_stack() { log_msg_to "✅ Selected Tech Stack from environment: $tech_stack" else if [[ "$NOW_OS" == "macos" ]]; then - tech_stack=$(osascript -e 'Tell application "System Events" to display dialog "Select installed tech stack:" buttons {"java", "python", "nodejs"} default button "java" with title "Testing Framework Technology Stack"' \ + tech_stack=$(osascript -e 'display dialog "Select installed tech stack:" buttons {"java", "python", "nodejs"} default button "java" with title "Testing Framework Technology Stack"' \ -e 'button returned of result') else echo "Select installed tech stack:" @@ -80,7 +80,7 @@ get_test_url() { local test_url=$DEFAULT_TEST_URL if [[ "$NOW_OS" == "macos" ]]; then - test_url=$(osascript -e 'Tell application "System Events" to display dialog "Enter the URL you want to test with BrowserStack:\n(Leave blank for default: '"$DEFAULT_TEST_URL"')" default answer "" with title "Test URL Setup" buttons {"OK"} default button "OK"' \ + test_url=$(osascript -e 'display dialog "Enter the URL you want to test with BrowserStack:\n(Leave blank for default: '"$DEFAULT_TEST_URL"')" default answer "" with title "Test URL Setup" buttons {"OK"} default button "OK"' \ -e 'text returned of result') else echo "Enter the URL you want to test with BrowserStack:" @@ -109,7 +109,7 @@ get_test_type() { log_msg_to "✅ Selected Testing Type from environment: $TEST_TYPE" else if [[ "$NOW_OS" == "macos" ]]; then - test_type=$(osascript -e 'Tell application "System Events" to display dialog "Select testing type:" buttons {"web", "app"} default button "web" with title "Testing Type"' \ + test_type=$(osascript -e 'display dialog "Select testing type:" buttons {"web", "app"} default button "web" with title "Testing Type"' \ -e 'button returned of result') else echo "Select testing type:"