Skip to content

Commit f2710a2

Browse files
committed
Add focused rn e2e scenario flags
1 parent 29c2688 commit f2710a2

4 files changed

Lines changed: 94 additions & 8 deletions

File tree

dev.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff 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]

e2e/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@ React Native Android:
2626
dev rn e2e android
2727
```
2828

29+
Run one React Native scenario by passing a focused flag:
30+
31+
```bash
32+
dev rn e2e ios --guest
33+
dev rn e2e ios --hardcoded-buyer-identity
34+
dev rn e2e android --guest
35+
dev rn e2e android --hardcoded-buyer-identity
36+
```
37+
2938
The React Native commands start Metro if needed, build and launch the target
3039
sample app, then run Maestro. They require the standard storefront `.env` setup,
3140
but the E2E flows seed their own carts through the bootstrap deep link. The

platforms/react-native/scripts/e2e_maestro_android

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,43 @@ METRO_LOG="${TMPDIR:-/tmp}/checkout-kit-rn-android-metro.log"
99
METRO_PID=""
1010
APP_ID="com.shopify.checkoutkit.reactnativedemo"
1111
CART_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+
20+
Options:
21+
--guest Run only the guest checkout smoke flow.
22+
--hardcoded-buyer-identity Run only the hardcoded buyer identity smoke flow.
23+
EOF
24+
}
25+
26+
for arg in "$@"; do
27+
case "$arg" in
28+
--guest)
29+
MAESTRO_FLOWS+=("tests/react-native/checkout-guest.yaml")
30+
;;
31+
--hardcoded-buyer-identity)
32+
MAESTRO_FLOWS+=("tests/react-native/checkout-hardcoded-buyer-identity.yaml")
33+
;;
34+
-h|--help)
35+
usage
36+
exit 0
37+
;;
38+
*)
39+
usage
40+
echo "Unknown option: $arg" >&2
41+
exit 1
42+
;;
43+
esac
44+
done
45+
46+
if [ "${#MAESTRO_FLOWS[@]}" -eq 0 ]; then
47+
MAESTRO_FLOWS=(".")
48+
fi
1249

1350
metro_running() {
1451
curl --silent --fail http://localhost:8081/status | grep -q "packager-status:running"
@@ -58,5 +95,5 @@ pnpm sample android --local --extra-params "--refresh-dependencies"
5895
maestro --platform android test --config config.yaml \
5996
-e "APP_ID=${APP_ID}" \
6097
-e "CART_BOOTSTRAP_BASE_LINK=${CART_BOOTSTRAP_BASE_LINK}" \
61-
.
98+
"${MAESTRO_FLOWS[@]}"
6299
)

platforms/react-native/scripts/e2e_maestro_ios

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,43 @@ METRO_LOG="${TMPDIR:-/tmp}/checkout-kit-rn-ios-metro.log"
99
METRO_PID=""
1010
APP_ID="com.shopify.checkoutkit.reactnativedemo"
1111
CART_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+
20+
Options:
21+
--guest Run only the guest checkout smoke flow.
22+
--hardcoded-buyer-identity Run only the hardcoded buyer identity smoke flow.
23+
EOF
24+
}
25+
26+
for arg in "$@"; do
27+
case "$arg" in
28+
--guest)
29+
MAESTRO_FLOWS+=("tests/react-native/checkout-guest.yaml")
30+
;;
31+
--hardcoded-buyer-identity)
32+
MAESTRO_FLOWS+=("tests/react-native/checkout-hardcoded-buyer-identity.yaml")
33+
;;
34+
-h|--help)
35+
usage
36+
exit 0
37+
;;
38+
*)
39+
usage
40+
echo "Unknown option: $arg" >&2
41+
exit 1
42+
;;
43+
esac
44+
done
45+
46+
if [ "${#MAESTRO_FLOWS[@]}" -eq 0 ]; then
47+
MAESTRO_FLOWS=(".")
48+
fi
1249

1350
metro_running() {
1451
curl --silent --fail http://localhost:8081/status | grep -q "packager-status:running"
@@ -58,5 +95,5 @@ pnpm sample ios --local
5895
maestro --platform ios test --config config.yaml \
5996
-e "APP_ID=${APP_ID}" \
6097
-e "CART_BOOTSTRAP_BASE_LINK=${CART_BOOTSTRAP_BASE_LINK}" \
61-
.
98+
"${MAESTRO_FLOWS[@]}"
6299
)

0 commit comments

Comments
 (0)