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
15 changes: 9 additions & 6 deletions dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -427,17 +427,20 @@ commands:
cd sample/android
USE_LOCAL_SDK=1 ./gradlew :shopify_checkout-kit-react-native:test --refresh-dependencies
e2e:
desc: Run React Native sample Maestro guest checkout smoke flows
desc: Run React Native sample Maestro checkout smoke flows
syntax: "{ios|android} [--guest] [--hardcoded-buyer-identity]"
run: |
echo "Usage: dev rn e2e {ios|android}" >&2
echo "Usage: dev rn e2e {ios|android} [--guest] [--hardcoded-buyer-identity]" >&2
exit 1
subcommands:
ios:
desc: Run the React Native iOS Maestro guest checkout smoke flow
run: cd platforms/react-native && ./scripts/e2e_maestro_ios
desc: Run the React Native iOS Maestro checkout smoke flows
syntax: "[--guest] [--hardcoded-buyer-identity]"
run: cd platforms/react-native && ./scripts/e2e_maestro_ios "$@"
android:
desc: Run the React Native Android Maestro guest checkout smoke flow
run: cd platforms/react-native && ./scripts/e2e_maestro_android
desc: Run the React Native Android Maestro checkout smoke flows
syntax: "[--guest] [--hardcoded-buyer-identity]"
run: cd platforms/react-native && ./scripts/e2e_maestro_android "$@"
lint:
desc: Run all React Native lint checks (Swift, module, sample)
aliases: [style]
Expand Down
11 changes: 11 additions & 0 deletions e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@ React Native Android:
dev rn e2e android
```

Run one or more focused React Native scenarios by passing scenario flags:

```bash
dev rn e2e ios --guest
dev rn e2e ios --hardcoded-buyer-identity
dev rn e2e ios --guest --hardcoded-buyer-identity
dev rn e2e android --guest
dev rn e2e android --hardcoded-buyer-identity
dev rn e2e android --guest --hardcoded-buyer-identity
```

The React Native commands start Metro if needed, build and launch the target
sample app, then run Maestro. They require the standard storefront `.env` setup,
but the E2E flows seed their own carts through the bootstrap deep link. The
Expand Down
54 changes: 53 additions & 1 deletion platforms/react-native/scripts/e2e_maestro_android
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,58 @@ METRO_LOG="${TMPDIR:-/tmp}/checkout-kit-rn-android-metro.log"
METRO_PID=""
APP_ID="com.shopify.checkoutkit.reactnativedemo"
CART_BOOTSTRAP_BASE_LINK="${APP_ID}://cart?productIndex=0&quantity=1"
MAESTRO_FLOWS=()

usage() {
cat <<EOF >&2
Usage: dev rn e2e android [--guest] [--hardcoded-buyer-identity]

Runs all React Native Android Maestro checkout smoke flows by default.
Pass one or more focused scenario flags to run only those flows.

Options:
--guest Run only the guest checkout smoke flow.
--hardcoded-buyer-identity Run only the hardcoded buyer identity smoke flow.
EOF
}

add_maestro_flow() {
local flow="$1"

if [ "${#MAESTRO_FLOWS[@]}" -gt 0 ]; then
for existing_flow in "${MAESTRO_FLOWS[@]}"; do
if [ "$existing_flow" = "$flow" ]; then
return
fi
done
fi

MAESTRO_FLOWS+=("$flow")
}

for arg in "$@"; do
case "$arg" in
--guest)
add_maestro_flow "tests/react-native/checkout-guest.yaml"
;;
--hardcoded-buyer-identity)
add_maestro_flow "tests/react-native/checkout-hardcoded-buyer-identity.yaml"
;;
-h|--help)
usage
exit 0
;;
*)
usage
echo "Unknown option: $arg" >&2
exit 1
;;
esac
done

if [ "${#MAESTRO_FLOWS[@]}" -eq 0 ]; then
MAESTRO_FLOWS=(".")
fi

metro_running() {
curl --silent --fail http://localhost:8081/status | grep -q "packager-status:running"
Expand Down Expand Up @@ -58,5 +110,5 @@ pnpm sample android --local --extra-params "--refresh-dependencies"
maestro --platform android test --config config.yaml \
-e "APP_ID=${APP_ID}" \
-e "CART_BOOTSTRAP_BASE_LINK=${CART_BOOTSTRAP_BASE_LINK}" \
.
"${MAESTRO_FLOWS[@]}"
)
54 changes: 53 additions & 1 deletion platforms/react-native/scripts/e2e_maestro_ios
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,58 @@ METRO_LOG="${TMPDIR:-/tmp}/checkout-kit-rn-ios-metro.log"
METRO_PID=""
APP_ID="com.shopify.checkoutkit.reactnativedemo"
CART_BOOTSTRAP_BASE_LINK="${APP_ID}://cart?productIndex=0&quantity=1"
MAESTRO_FLOWS=()

usage() {
cat <<EOF >&2
Usage: dev rn e2e ios [--guest] [--hardcoded-buyer-identity]

Runs all React Native iOS Maestro checkout smoke flows by default.
Pass one or more focused scenario flags to run only those flows.

Options:
--guest Run only the guest checkout smoke flow.
--hardcoded-buyer-identity Run only the hardcoded buyer identity smoke flow.
EOF
}

add_maestro_flow() {
local flow="$1"

if [ "${#MAESTRO_FLOWS[@]}" -gt 0 ]; then
for existing_flow in "${MAESTRO_FLOWS[@]}"; do
if [ "$existing_flow" = "$flow" ]; then
return
fi
done
fi

MAESTRO_FLOWS+=("$flow")
}

for arg in "$@"; do
case "$arg" in
--guest)
add_maestro_flow "tests/react-native/checkout-guest.yaml"
;;
--hardcoded-buyer-identity)
add_maestro_flow "tests/react-native/checkout-hardcoded-buyer-identity.yaml"
;;
-h|--help)
usage
exit 0
;;
*)
usage
echo "Unknown option: $arg" >&2
exit 1
;;
esac
done

if [ "${#MAESTRO_FLOWS[@]}" -eq 0 ]; then
MAESTRO_FLOWS=(".")
fi

metro_running() {
curl --silent --fail http://localhost:8081/status | grep -q "packager-status:running"
Expand Down Expand Up @@ -58,5 +110,5 @@ pnpm sample ios --local
maestro --platform ios test --config config.yaml \
-e "APP_ID=${APP_ID}" \
-e "CART_BOOTSTRAP_BASE_LINK=${CART_BOOTSTRAP_BASE_LINK}" \
.
"${MAESTRO_FLOWS[@]}"
)
Loading