Repository navigation
feat: add --install-only and --pick-device to Appium runners #65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
639b0bd
328f6c3
d99ae07
3897959
a8547f8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,10 @@ configure_runner() { | |
| SKIP_BUILD=false | ||
| SKIP_DEVICE=false | ||
| SKIP_RESET=false | ||
| INSTALL_ONLY=false | ||
| PICK_DEVICE=false | ||
| DEVICE_FLAG=false | ||
| UDID_FLAG=false | ||
| SPEC="" | ||
| QUIET=false | ||
| PODS_DEMO=false | ||
|
|
@@ -23,16 +27,18 @@ configure_runner() { | |
| case "$arg" in | ||
| --platform=*) PLATFORM="${arg#--platform=}" ;; | ||
| --sdk=*) SDK_TYPE="${arg#--sdk=}" ;; | ||
| --device=*) DEVICE="${arg#--device=}" ;; | ||
| --device=*) DEVICE="${arg#--device=}"; DEVICE_FLAG=true ;; | ||
| --pick-device) PICK_DEVICE=true ;; | ||
| --device-real) IOS_REAL_DEVICE=true; SKIP_DEVICE=true ;; | ||
| --udid=*) UDID="${arg#--udid=}" ;; | ||
| --udid=*) UDID="${arg#--udid=}"; UDID_FLAG=true ;; | ||
| --appium-port=*) APPIUM_PORT="${arg#--appium-port=}" ;; | ||
| --wda-local-port=*) WDA_LOCAL_PORT="${arg#--wda-local-port=}" ;; | ||
| --system-port=*) SYSTEM_PORT="${arg#--system-port=}" ;; | ||
| --skip) SKIP_BUILD=true; SKIP_DEVICE=true; SKIP_RESET=true ;; | ||
| --skip-build) SKIP_BUILD=true ;; | ||
| --skip-device) SKIP_DEVICE=true ;; | ||
| --skip-reset) SKIP_RESET=true ;; | ||
| --install-only) INSTALL_ONLY=true ;; | ||
| --wipe-emulator) WIPE_EMULATOR=true ;; | ||
| --pods) PODS_DEMO=true ;; | ||
| --release) RELEASE=true ;; | ||
|
|
@@ -57,6 +63,7 @@ Options: | |
| ios = native iOS (OneSignal-iOS-SDK/examples/demo); | ||
| skips with exit 0 when --platform=android. | ||
| --device=NAME Device/simulator/AVD name (default: iPhone 17 / Android 17) | ||
| --pick-device Prompt for which iOS simulator or Android emulator to use | ||
| --appium-port=N Appium server port (default: 4723). Use unique values when | ||
| running multiple sessions in parallel on the same host. | ||
| --system-port=N UiAutomator2 systemPort (Android only). Required when | ||
|
|
@@ -66,6 +73,8 @@ Options: | |
| --skip-build Skip app build (reuse existing) | ||
| --skip-device Skip simulator/emulator launch | ||
| --skip-reset Keep existing app data | ||
| --install-only Build, launch the device, reset, and install the app, | ||
| then exit without starting Appium or running tests | ||
| --wipe-emulator Wipe the Android AVD before launch. Deletes all emulator | ||
| apps and data; incompatible with --skip-device. | ||
| --pods Use examples/demo-pods instead of examples/demo for | ||
|
|
@@ -128,6 +137,16 @@ USAGE | |
| esac | ||
| done | ||
|
|
||
| # A CLI device beats device settings from .env/env. Without a pinned runtime, | ||
| # start_ios_simulator matches the name on the newest runtime that has it. | ||
| if [[ "$DEVICE_FLAG" == true ]]; then | ||
| AVD_NAME="" | ||
| IOS_SIMULATOR="" | ||
| IOS_RUNTIME="" | ||
| IOS_RUNTIME_ANY=true | ||
| [[ "$UDID_FLAG" == true ]] || UDID="" | ||
| fi | ||
|
|
||
| # Ensure values set via CLI flags propagate to wdio (which reads them as env). | ||
| export APPIUM_PORT | ||
| [[ -n "$WDA_LOCAL_PORT" ]] && export WDA_LOCAL_PORT | ||
|
|
@@ -176,6 +195,15 @@ USAGE | |
| error "--release and --main are mutually exclusive" | ||
| fi | ||
|
|
||
| if [[ "$PICK_DEVICE" == true ]]; then | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Small gap left over: this block unconditionally overwrites Minor follow-on from the new |
||
| [[ "$IOS_REAL_DEVICE" == false ]] || error "--pick-device cannot be combined with --device-real" | ||
| pick_device "$PLATFORM" || exit 1 | ||
| DEVICE="$PICKED_DEVICE" | ||
| AVD_NAME="" | ||
| IOS_SIMULATOR="" | ||
| [[ "$PLATFORM" == "ios" ]] && UDID="$PICKED_UDID" | ||
| fi | ||
|
|
||
| resolve_sdk_dir "$SDK_TYPE" | ||
|
|
||
| if [[ "$RELEASE" == true ]]; then | ||
|
|
@@ -198,6 +226,19 @@ USAGE | |
| # calls `vpx wdio run` directly on BrowserStack — so these checks are | ||
| # local-only by construction. | ||
| preflight() { | ||
| if [[ "$INSTALL_ONLY" != true ]]; then | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This still skips all of
Appium, the driver check, the Appium Suggestion: keep the |
||
| preflight_test_tooling | ||
| fi | ||
|
|
||
| if [[ -z "${ONESIGNAL_APP_ID:-}" || -z "${ONESIGNAL_API_KEY:-}" ]]; then | ||
| error "ONESIGNAL_APP_ID / ONESIGNAL_API_KEY not set. Use the OneSignal app | ||
| dedicated to Appium tests (not a general/shared app — its live in-app | ||
| marketing campaigns can cover the UI and cause misleading 'element not | ||
| displayed' failures). Set both in $SCRIPT_DIR/.env (cp .env.example .env)." | ||
| fi | ||
| } | ||
|
|
||
| preflight_test_tooling() { | ||
| command -v appium >/dev/null 2>&1 \ | ||
| || error "appium not found on PATH. Install it with: npm i -g appium" | ||
|
|
||
|
|
@@ -239,13 +280,6 @@ USAGE | |
| export WDIO_USE_NATIVE_FETCH=1 | ||
| info "Node $node_major detected — setting WDIO_USE_NATIVE_FETCH=1 (works around webdriverio's undici dispatcher being rejected by Node 26+ fetch)." | ||
| fi | ||
|
|
||
| if [[ -z "${ONESIGNAL_APP_ID:-}" || -z "${ONESIGNAL_API_KEY:-}" ]]; then | ||
| error "ONESIGNAL_APP_ID / ONESIGNAL_API_KEY not set. Use the OneSignal app | ||
| dedicated to Appium tests (not a general/shared app — its live in-app | ||
| marketing campaigns can cover the UI and cause misleading 'element not | ||
| displayed' failures). Set both in $SCRIPT_DIR/.env (cp .env.example .env)." | ||
| fi | ||
| } | ||
| preflight | ||
|
|
||
|
|
@@ -423,7 +457,7 @@ USAGE | |
| DEVICE="${DEVICE:-iPhone 17}" | ||
| OS_VERSION="${OS_VERSION:-26.5}" | ||
| IOS_SIMULATOR="${IOS_SIMULATOR:-$DEVICE}" | ||
| IOS_RUNTIME="${IOS_RUNTIME:-iOS-26-5}" | ||
| [[ "${IOS_RUNTIME_ANY:-false}" == true ]] || IOS_RUNTIME="${IOS_RUNTIME:-iOS-26-5}" | ||
| else | ||
| DEVICE="${DEVICE:-Android 17}" | ||
| OS_VERSION="${OS_VERSION:-17}" | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.