File tree Expand file tree Collapse file tree
platforms/react-native/scripts Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -427,17 +427,20 @@ commands:
427427 cd sample/android
428428 USE_LOCAL_SDK=1 ./gradlew :shopify_checkout-kit-react-native:test --refresh-dependencies
429429 e2e :
430- desc : Run React Native sample Maestro guest checkout smoke flows
430+ desc : Run React Native sample Maestro checkout smoke flows
431+ syntax : " {ios|android} [--guest] [--hardcoded-buyer-identity]"
431432 run : |
432- echo "Usage: dev rn e2e {ios|android}" >&2
433+ echo "Usage: dev rn e2e {ios|android} [--guest] [--hardcoded-buyer-identity] " >&2
433434 exit 1
434435 subcommands :
435436 ios :
436- desc : Run the React Native iOS Maestro guest checkout smoke flow
437- run : cd platforms/react-native && ./scripts/e2e_maestro_ios
437+ desc : Run the React Native iOS Maestro checkout smoke flows
438+ syntax : " [--guest] [--hardcoded-buyer-identity]"
439+ run : cd platforms/react-native && ./scripts/e2e_maestro_ios "$@"
438440 android :
439- desc : Run the React Native Android Maestro guest checkout smoke flow
440- run : cd platforms/react-native && ./scripts/e2e_maestro_android
441+ desc : Run the React Native Android Maestro checkout smoke flows
442+ syntax : " [--guest] [--hardcoded-buyer-identity]"
443+ run : cd platforms/react-native && ./scripts/e2e_maestro_android "$@"
441444 lint :
442445 desc : Run all React Native lint checks (Swift, module, sample)
443446 aliases : [style]
Original file line number Diff line number Diff line change @@ -26,6 +26,17 @@ React Native Android:
2626dev rn e2e android
2727```
2828
29+ Run one or more focused React Native scenarios by passing scenario flags:
30+
31+ ``` bash
32+ dev rn e2e ios --guest
33+ dev rn e2e ios --hardcoded-buyer-identity
34+ dev rn e2e ios --guest --hardcoded-buyer-identity
35+ dev rn e2e android --guest
36+ dev rn e2e android --hardcoded-buyer-identity
37+ dev rn e2e android --guest --hardcoded-buyer-identity
38+ ```
39+
2940The React Native commands start Metro if needed, build and launch the target
3041sample app, then run Maestro. They require the standard storefront ` .env ` setup,
3142but the E2E flows seed their own carts through the bootstrap deep link. The
Original file line number Diff line number Diff line change @@ -9,6 +9,58 @@ METRO_LOG="${TMPDIR:-/tmp}/checkout-kit-rn-android-metro.log"
99METRO_PID=" "
1010APP_ID=" com.shopify.checkoutkit.reactnativedemo"
1111CART_BOOTSTRAP_BASE_LINK=" ${APP_ID} ://cart?productIndex=0&quantity=1"
12+ MAESTRO_FLOWS=()
13+
14+ usage () {
15+ cat << EOF >&2
16+ Usage: dev rn e2e android [--guest] [--hardcoded-buyer-identity]
17+
18+ Runs all React Native Android Maestro checkout smoke flows by default.
19+ Pass one or more focused scenario flags to run only those flows.
20+
21+ Options:
22+ --guest Run only the guest checkout smoke flow.
23+ --hardcoded-buyer-identity Run only the hardcoded buyer identity smoke flow.
24+ EOF
25+ }
26+
27+ add_maestro_flow () {
28+ local flow=" $1 "
29+
30+ if [ " ${# MAESTRO_FLOWS[@]} " -gt 0 ]; then
31+ for existing_flow in " ${MAESTRO_FLOWS[@]} " ; do
32+ if [ " $existing_flow " = " $flow " ]; then
33+ return
34+ fi
35+ done
36+ fi
37+
38+ MAESTRO_FLOWS+=(" $flow " )
39+ }
40+
41+ for arg in " $@ " ; do
42+ case " $arg " in
43+ --guest)
44+ add_maestro_flow " tests/react-native/checkout-guest.yaml"
45+ ;;
46+ --hardcoded-buyer-identity)
47+ add_maestro_flow " tests/react-native/checkout-hardcoded-buyer-identity.yaml"
48+ ;;
49+ -h|--help)
50+ usage
51+ exit 0
52+ ;;
53+ * )
54+ usage
55+ echo " Unknown option: $arg " >&2
56+ exit 1
57+ ;;
58+ esac
59+ done
60+
61+ if [ " ${# MAESTRO_FLOWS[@]} " -eq 0 ]; then
62+ MAESTRO_FLOWS=(" ." )
63+ fi
1264
1365metro_running () {
1466 curl --silent --fail http://localhost:8081/status | grep -q " packager-status:running"
@@ -58,5 +110,5 @@ pnpm sample android --local --extra-params "--refresh-dependencies"
58110 maestro --platform android test --config config.yaml \
59111 -e " APP_ID=${APP_ID} " \
60112 -e " CART_BOOTSTRAP_BASE_LINK=${CART_BOOTSTRAP_BASE_LINK} " \
61- .
113+ " ${MAESTRO_FLOWS[@]} "
62114)
Original file line number Diff line number Diff line change @@ -9,6 +9,58 @@ METRO_LOG="${TMPDIR:-/tmp}/checkout-kit-rn-ios-metro.log"
99METRO_PID=" "
1010APP_ID=" com.shopify.checkoutkit.reactnativedemo"
1111CART_BOOTSTRAP_BASE_LINK=" ${APP_ID} ://cart?productIndex=0&quantity=1"
12+ MAESTRO_FLOWS=()
13+
14+ usage () {
15+ cat << EOF >&2
16+ Usage: dev rn e2e ios [--guest] [--hardcoded-buyer-identity]
17+
18+ Runs all React Native iOS Maestro checkout smoke flows by default.
19+ Pass one or more focused scenario flags to run only those flows.
20+
21+ Options:
22+ --guest Run only the guest checkout smoke flow.
23+ --hardcoded-buyer-identity Run only the hardcoded buyer identity smoke flow.
24+ EOF
25+ }
26+
27+ add_maestro_flow () {
28+ local flow=" $1 "
29+
30+ if [ " ${# MAESTRO_FLOWS[@]} " -gt 0 ]; then
31+ for existing_flow in " ${MAESTRO_FLOWS[@]} " ; do
32+ if [ " $existing_flow " = " $flow " ]; then
33+ return
34+ fi
35+ done
36+ fi
37+
38+ MAESTRO_FLOWS+=(" $flow " )
39+ }
40+
41+ for arg in " $@ " ; do
42+ case " $arg " in
43+ --guest)
44+ add_maestro_flow " tests/react-native/checkout-guest.yaml"
45+ ;;
46+ --hardcoded-buyer-identity)
47+ add_maestro_flow " tests/react-native/checkout-hardcoded-buyer-identity.yaml"
48+ ;;
49+ -h|--help)
50+ usage
51+ exit 0
52+ ;;
53+ * )
54+ usage
55+ echo " Unknown option: $arg " >&2
56+ exit 1
57+ ;;
58+ esac
59+ done
60+
61+ if [ " ${# MAESTRO_FLOWS[@]} " -eq 0 ]; then
62+ MAESTRO_FLOWS=(" ." )
63+ fi
1264
1365metro_running () {
1466 curl --silent --fail http://localhost:8081/status | grep -q " packager-status:running"
@@ -58,5 +110,5 @@ pnpm sample ios --local
58110 maestro --platform ios test --config config.yaml \
59111 -e " APP_ID=${APP_ID} " \
60112 -e " CART_BOOTSTRAP_BASE_LINK=${CART_BOOTSTRAP_BASE_LINK} " \
61- .
113+ " ${MAESTRO_FLOWS[@]} "
62114)
You can’t perform that action at this time.
0 commit comments