Skip to content
Merged
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
6 changes: 4 additions & 2 deletions dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -457,16 +457,18 @@ commands:
USE_LOCAL_SDK=1 ./gradlew :shopify_checkout-kit-react-native:test --refresh-dependencies
e2e:
desc: Run React Native sample Maestro checkout smoke flows
syntax: "{ios|android}"
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 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 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)
Expand Down
11 changes: 11 additions & 0 deletions e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,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
46 changes: 40 additions & 6 deletions platforms/react-native/scripts/e2e_maestro_android
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,43 @@ METRO_PID=""
E2E_ENV_FILE=""
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
Usage: dev rn e2e android [--guest] [--hardcoded-buyer-identity]

Runs React Native Android Maestro checkout smoke flows against the released native SDK artifacts.
Runs all React Native Android Maestro checkout smoke flows against the released native SDK artifacts.
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
Expand All @@ -33,6 +59,12 @@ for arg in "$@"; do
esac
done

if [ "${#MAESTRO_FLOWS[@]}" -eq 0 ]; then
MAESTRO_FLOWS=(
"tests/react-native/checkout-guest.yaml"
"tests/react-native/checkout-hardcoded-buyer-identity.yaml"
)
fi

metro_running() {
curl --silent --fail http://localhost:8081/status | grep -q "packager-status:running"
Expand Down Expand Up @@ -96,8 +128,10 @@ ENVFILE="$E2E_ENV_FILE" pnpm sample android --extra-params "--refresh-dependenci

(
cd "$REPO_ROOT/e2e"
maestro --platform android test --config config.yaml \
-e "APP_ID=${APP_ID}" \
-e "CART_BOOTSTRAP_BASE_LINK=${CART_BOOTSTRAP_BASE_LINK}" \
tests/react-native
for flow in "${MAESTRO_FLOWS[@]}"; do
maestro --platform android test --config config.yaml \
-e "APP_ID=${APP_ID}" \
-e "CART_BOOTSTRAP_BASE_LINK=${CART_BOOTSTRAP_BASE_LINK}" \
"$flow"
done
)
46 changes: 40 additions & 6 deletions platforms/react-native/scripts/e2e_maestro_ios
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,43 @@ METRO_PID=""
E2E_ENV_FILE=""
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
Usage: dev rn e2e ios [--guest] [--hardcoded-buyer-identity]

Runs React Native iOS Maestro checkout smoke flows against the released native SDK artifacts.
Runs all React Native iOS Maestro checkout smoke flows against the released native SDK artifacts.
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
Expand All @@ -33,6 +59,12 @@ for arg in "$@"; do
esac
done

if [ "${#MAESTRO_FLOWS[@]}" -eq 0 ]; then
MAESTRO_FLOWS=(
"tests/react-native/checkout-guest.yaml"
"tests/react-native/checkout-hardcoded-buyer-identity.yaml"
)
fi

metro_running() {
curl --silent --fail http://localhost:8081/status | grep -q "packager-status:running"
Expand Down Expand Up @@ -96,8 +128,10 @@ ENVFILE="$E2E_ENV_FILE" pnpm sample ios

(
cd "$REPO_ROOT/e2e"
maestro --platform ios test --config config.yaml \
-e "APP_ID=${APP_ID}" \
-e "CART_BOOTSTRAP_BASE_LINK=${CART_BOOTSTRAP_BASE_LINK}" \
tests/react-native
for flow in "${MAESTRO_FLOWS[@]}"; do
maestro --platform ios test --config config.yaml \
-e "APP_ID=${APP_ID}" \
-e "CART_BOOTSTRAP_BASE_LINK=${CART_BOOTSTRAP_BASE_LINK}" \
"$flow"
done
)
Loading