Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions bin/bs_android
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ set -uo pipefail
BS_CREDENTIALS="${BS_CREDENTIALS:-}"
BS_PROJECT="${BS_PROJECT:-}"
BS_ANDROID_DEVICES="${BS_ANDROID_DEVICES:-}"
BS_BUILD_NAME="${BS_BUILD_NAME:-}"
BS_SKIP_BUILD="${BS_SKIP_BUILD:-0}"
BS_IDLE_TIMEOUT="${BS_IDLE_TIMEOUT:-900}"

Expand Down Expand Up @@ -111,6 +112,12 @@ echo 1>&2 "Uploaded test instrumentation app, url: $test_url"

# https://www.browserstack.com/docs/app-automate/api-reference/espresso/builds#execute-a-build
printf 1>&2 "Will schedule test execution\n\n"

custom_build_name_field=""
if [ -n "$BS_BUILD_NAME" ]; then
custom_build_name_field="\"customBuildName\": \"$BS_BUILD_NAME\","
fi

if ! run_response="$(
curl --fail-with-body --user "$BS_CREDENTIALS" \
--request POST "https://api-cloud.browserstack.com/app-automate/espresso/v2/build" \
Expand All @@ -120,6 +127,7 @@ if ! run_response="$(
"app": "$app_url",
"testSuite": "$test_url",
"project": "$BS_PROJECT",
$custom_build_name_field
"devices": $BS_ANDROID_DEVICES,
"singleRunnerInvocation": "true",
"useOrchestrator": "true",
Expand Down
11 changes: 9 additions & 2 deletions bin/bs_ios
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ set -uo pipefail
BS_CREDENTIALS="${BS_CREDENTIALS:-}"
BS_PROJECT="${BS_PROJECT:-}"
BS_IOS_DEVICES="${BS_IOS_DEVICES:-}"
# BrowserStack's xcuitest v2 endpoint has no field for a custom build name, so this is used to set the ipa filename
# instead. BrowserStack builds the build name based on the ipa name + app version: e.g. `BS_BUILD_NAME.ipa v1.0.0"
BS_BUILD_NAME="${BS_BUILD_NAME:-}"
BS_SKIP_BUILD="${BS_SKIP_BUILD:-0}"
BS_IDLE_TIMEOUT="${BS_IDLE_TIMEOUT:-900}"

Expand Down Expand Up @@ -81,7 +84,11 @@ cd build/ios_integ/Build/Products || exit 1

rm -rf Payload && mkdir -p Payload
cp -r "Release${FLAVOR_SUFFIXED}iphoneos/Runner.app" Payload
zip -r Runner.ipa Payload >/dev/null

# The ipa filename doubles as the "build name" shown by BrowserStack, see BS_BUILD_NAME above.
ipa_filename="${BS_BUILD_NAME//\//-}"
ipa_filename="${ipa_filename:-Runner}.ipa"
zip -r "$ipa_filename" Payload >/dev/null

cd - >/dev/null || exit 1

Expand All @@ -97,7 +104,7 @@ cd - >/dev/null || exit 1

echo 1>&2 "Created zip archive"

app_path="$PWD/build/ios_integ/Build/Products/Runner.ipa"
app_path="$PWD/build/ios_integ/Build/Products/$ipa_filename"
if [ ! -f "$app_path" ]; then
echo 1>&2 "Error: app under test not found at $app_path"
exit 1
Expand Down