Skip to content

Commit d7bd4b4

Browse files
authored
cred-init flow fix (#25)
1 parent 694b9e9 commit d7bd4b4

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

mac/common-utils.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ handle_app_upload() {
128128
}
129129

130130
upload_sample_app() {
131-
log_msg_to "⬆️ Uploading sample app to BrowserStack..."
131+
log_info "Uploading sample app to BrowserStack"
132132
local upload_response
133133
upload_response=$(curl -s -u "$BROWSERSTACK_USERNAME:$BROWSERSTACK_ACCESS_KEY" \
134134
-X POST "https://api-cloud.browserstack.com/app-automate/upload" \
@@ -182,11 +182,11 @@ upload_custom_app() {
182182
elif [[ "$file_path" == *.apk ]]; then
183183
app_platform="android"
184184
else
185-
log_msg_to "❌ Invalid file type. Must be .apk or .ipa"
186-
return 1
185+
log_error "❌ Invalid file type. Must be .apk or .ipa"
186+
exit 1
187187
fi
188188

189-
log_msg_to "⬆️ Uploading app to BrowserStack..."
189+
log_info "Uploading app to BrowserStack"
190190
local upload_response
191191
upload_response=$(curl -s -u "$BROWSERSTACK_USERNAME:$BROWSERSTACK_ACCESS_KEY" \
192192
-X POST "https://api-cloud.browserstack.com/app-automate/upload" \
@@ -195,8 +195,8 @@ upload_custom_app() {
195195
local app_url
196196
app_url=$(echo "$upload_response" | grep -o '"app_url":"[^"]*' | cut -d'"' -f4)
197197
if [ -z "$app_url" ]; then
198-
log_msg_to "❌ Failed to upload app"
199-
return 1
198+
log_error "❌ Failed to upload app: $upload_response"
199+
exit 1
200200
fi
201201

202202
export BROWSERSTACK_APP=$app_url

mac/run.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ log_section "🧭 Setup Summary – BrowserStack NOW"
3131
log_info "Timestamp: $(date '+%Y-%m-%d %H:%M:%S')"
3232

3333
detect_os
34+
setup_workspace
35+
get_browserstack_credentials "$RUN_MODE"
3436

3537
log_file=""
3638
if [[ "$RUN_MODE" == *"--silent"* || "$RUN_MODE" == *"--debug"* ]]; then
@@ -47,8 +49,7 @@ fi
4749

4850
log_info "Log file path: $log_file"
4951
export NOW_RUN_LOG_FILE="$log_file"
50-
setup_workspace
51-
get_browserstack_credentials "$RUN_MODE"
52+
5253

5354
log_section "⚙️ Platform & Tech Stack"
5455
log_info "Platform: ${TEST_TYPE:-N/A}"

mac/user-interaction.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ get_browserstack_credentials() {
1111
log_info "BrowserStack credentials loaded from environment variables for user: $username"
1212
else
1313
if [[ "$NOW_OS" == "macos" ]]; then
14-
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"' \
14+
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"' \
1515
-e 'text returned of result')
1616
else
1717
echo "Please enter your BrowserStack Username."
@@ -25,7 +25,7 @@ get_browserstack_credentials() {
2525
fi
2626

2727
if [[ "$NOW_OS" == "macos" ]]; then
28-
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"' \
28+
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"' \
2929
-e 'text returned of result')
3030
else
3131
echo "Please enter your BrowserStack Access Key."
@@ -55,7 +55,7 @@ get_tech_stack() {
5555
log_msg_to "✅ Selected Tech Stack from environment: $tech_stack"
5656
else
5757
if [[ "$NOW_OS" == "macos" ]]; then
58-
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"' \
58+
tech_stack=$(osascript -e 'display dialog "Select installed tech stack:" buttons {"java", "python", "nodejs"} default button "java" with title "Testing Framework Technology Stack"' \
5959
-e 'button returned of result')
6060
else
6161
echo "Select installed tech stack:"
@@ -80,7 +80,7 @@ get_test_url() {
8080
local test_url=$DEFAULT_TEST_URL
8181

8282
if [[ "$NOW_OS" == "macos" ]]; then
83-
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"' \
83+
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"' \
8484
-e 'text returned of result')
8585
else
8686
echo "Enter the URL you want to test with BrowserStack:"
@@ -109,7 +109,7 @@ get_test_type() {
109109
log_msg_to "✅ Selected Testing Type from environment: $TEST_TYPE"
110110
else
111111
if [[ "$NOW_OS" == "macos" ]]; then
112-
test_type=$(osascript -e 'Tell application "System Events" to display dialog "Select testing type:" buttons {"web", "app"} default button "web" with title "Testing Type"' \
112+
test_type=$(osascript -e 'display dialog "Select testing type:" buttons {"web", "app"} default button "web" with title "Testing Type"' \
113113
-e 'button returned of result')
114114
else
115115
echo "Select testing type:"

0 commit comments

Comments
 (0)