diff --git a/e2e/README.md b/e2e/README.md index fc07ff97..cae5d1a7 100644 --- a/e2e/README.md +++ b/e2e/README.md @@ -4,8 +4,9 @@ This directory contains Maestro end-to-end smoke flows for Checkout Kit sample apps. The current runnable suite starts with React Native. It verifies a full guest -checkout from a seeded cart in the sample app, through Shopify checkout, and -back to the app after completion. +checkout from a seeded cart and a hardcoded buyer identity checkout created +through the sample app, through Shopify checkout, and back to the app after +completion. ## Run locally @@ -30,13 +31,15 @@ sample app, then run Maestro. - `config.yaml` configures Maestro for shared platform behavior. - `flows/` contains reusable Maestro subflows for app setup and checkout steps. -- `tests/react-native/full-guest-checkout.yaml` composes the React Native guest +- `tests/react-native/checkout-guest.yaml` composes the React Native guest checkout smoke test from those subflows. +- `tests/react-native/checkout-hardcoded-buyer-identity.yaml` verifies the RN + sample can create a checkout from a cart with hardcoded buyer identity. ## Scope This smoke flow is intended to catch regressions in the React Native sample app -integration surface: cart bootstrap, checkout presentation, checkout -completion, and return to the sample app. It is not a replacement for -checkout-web's browser-based coverage or for future native Swift and Android -sample-app E2E coverage. +integration surface: cart bootstrap, buyer identity configuration, checkout +presentation, checkout completion, and return to the sample app. It is not a +replacement for checkout-web's browser-based coverage or for future native +Swift and Android sample-app E2E coverage. diff --git a/e2e/flows/app/add-first-product-to-cart.yaml b/e2e/flows/app/add-first-product-to-cart.yaml new file mode 100644 index 00000000..7df52bed --- /dev/null +++ b/e2e/flows/app/add-first-product-to-cart.yaml @@ -0,0 +1,23 @@ +appId: ${APP_ID} +--- +- tapOn: + id: catalog-tab +- extendedWaitUntil: + visible: + id: product-0-grid-item + timeout: 30000 +- tapOn: + id: product-0-grid-item +- extendedWaitUntil: + visible: + id: add-to-cart-button + timeout: 30000 +- tapOn: + id: add-to-cart-button + enabled: true +- tapOn: + id: cart-tab +- extendedWaitUntil: + visible: + id: checkout-button + timeout: 30000 diff --git a/e2e/flows/app/dismiss-dev-warning.yaml b/e2e/flows/app/dismiss-dev-warning.yaml new file mode 100644 index 00000000..5ff44a5f --- /dev/null +++ b/e2e/flows/app/dismiss-dev-warning.yaml @@ -0,0 +1,9 @@ +appId: ${APP_ID} +--- +- runFlow: + when: + visible: "Open debugger to view warnings." + commands: + - tapOn: + point: "92%,92%" + - waitForAnimationToEnd diff --git a/e2e/flows/app/launch.yaml b/e2e/flows/app/launch.yaml index d6bad227..5a614844 100644 --- a/e2e/flows/app/launch.yaml +++ b/e2e/flows/app/launch.yaml @@ -10,3 +10,4 @@ appId: ${APP_ID} visible: id: checkout-kit-sample-ready timeout: 60000 +- runFlow: dismiss-dev-warning.yaml diff --git a/e2e/flows/app/select-buyer-identity.yaml b/e2e/flows/app/select-buyer-identity.yaml new file mode 100644 index 00000000..99da7cf1 --- /dev/null +++ b/e2e/flows/app/select-buyer-identity.yaml @@ -0,0 +1,20 @@ +appId: ${APP_ID} +--- +- tapOn: + id: settings-tab +- waitForAnimationToEnd +- runFlow: + when: + notVisible: + id: settings-section-authentication + commands: + - tapOn: + id: settings-tab + - waitForAnimationToEnd +- extendedWaitUntil: + visible: + id: settings-section-authentication + timeout: 10000 +- tapOn: + id: "settings-buyer-identity-option-${BUYER_IDENTITY_MODE}" +- waitForAnimationToEnd diff --git a/e2e/flows/checkout/present.yaml b/e2e/flows/checkout/present.yaml index 1adae5e3..010fc7f8 100644 --- a/e2e/flows/checkout/present.yaml +++ b/e2e/flows/checkout/present.yaml @@ -5,5 +5,5 @@ appId: ${APP_ID} enabled: true - extendedWaitUntil: visible: - text: "^Email( or mobile phone number)?$" + text: "^(Email( or mobile phone number)?|Delivery|Card number)$" timeout: 60000 diff --git a/e2e/tests/react-native/full-guest-checkout.yaml b/e2e/tests/react-native/checkout-guest.yaml similarity index 89% rename from e2e/tests/react-native/full-guest-checkout.yaml rename to e2e/tests/react-native/checkout-guest.yaml index ed667b92..a491077a 100644 --- a/e2e/tests/react-native/full-guest-checkout.yaml +++ b/e2e/tests/react-native/checkout-guest.yaml @@ -1,8 +1,9 @@ appId: ${APP_ID} -name: React Native full guest checkout +name: React Native checkout - guest env: # Checkout contact fixture + BUYER_IDENTITY_MODE: "guest" EMAIL: "maestro.e2e@shopify.com" FIRST_NAME: "Maestro" LAST_NAME: "Shopify" @@ -24,6 +25,7 @@ env: POST_SUBMIT_RESULT_PATTERN: ".*(Thank you|Your order|Order confirmed|confirmation).*" --- - runFlow: ../../flows/app/launch.yaml +- runFlow: ../../flows/app/select-buyer-identity.yaml - runFlow: ../../flows/app/bootstrap-cart-from-link.yaml - runFlow: ../../flows/checkout/present.yaml - runFlow: ../../flows/checkout/fill-contact.yaml diff --git a/e2e/tests/react-native/checkout-hardcoded-buyer-identity.yaml b/e2e/tests/react-native/checkout-hardcoded-buyer-identity.yaml new file mode 100644 index 00000000..90eab183 --- /dev/null +++ b/e2e/tests/react-native/checkout-hardcoded-buyer-identity.yaml @@ -0,0 +1,26 @@ +appId: ${APP_ID} +name: React Native checkout - hardcoded buyer identity + +env: + # Sample app buyer identity configuration + BUYER_IDENTITY_MODE: "hardcoded" + + # Checkout payment fixture + CARD_NUMBER: "1" + CARD_SECURITY_CODE: "123" + + # Accepted successful checkout states for this smoke test. + POST_SUBMIT_RESULT_PATTERN: ".*(Thank you|Your order|Order confirmed|confirmation).*" +--- +- runFlow: ../../flows/app/launch.yaml +- runFlow: ../../flows/app/select-buyer-identity.yaml +- extendedWaitUntil: + visible: + id: settings-buyer-identity-details + timeout: 5000 +- runFlow: ../../flows/app/add-first-product-to-cart.yaml +- runFlow: ../../flows/checkout/present.yaml +- runFlow: ../../flows/checkout/fill-payment-card.yaml +- runFlow: ../../flows/checkout/submit.yaml +- runFlow: ../../flows/checkout/assert-complete.yaml +- runFlow: ../../flows/checkout/assert-returned-to-empty-cart.yaml diff --git a/platforms/react-native/package.json b/platforms/react-native/package.json index 37015e77..dcf2e47b 100644 --- a/platforms/react-native/package.json +++ b/platforms/react-native/package.json @@ -39,8 +39,8 @@ "snapshot": "./scripts/create_snapshot", "compare-snapshot": "./scripts/compare_snapshot", "test": "jest", - "e2e:ios": "maestro --platform ios test --config ../../e2e/config.yaml -e APP_ID=com.shopify.checkoutkit.reactnativedemo -e 'CART_BOOTSTRAP_LINK=com.shopify.checkoutkit.reactnativedemo://cart?productIndex=0&quantity=1' ../../e2e/tests/react-native/full-guest-checkout.yaml", - "e2e:android": "maestro --platform android test --config ../../e2e/config.yaml -e APP_ID=com.shopify.checkoutkit.reactnativedemo -e 'CART_BOOTSTRAP_LINK=com.shopify.checkoutkit.reactnativedemo://cart?productIndex=0&quantity=1' ../../e2e/tests/react-native/full-guest-checkout.yaml" + "e2e:ios": "maestro --platform ios test --config ../../e2e/config.yaml -e APP_ID=com.shopify.checkoutkit.reactnativedemo -e 'CART_BOOTSTRAP_LINK=com.shopify.checkoutkit.reactnativedemo://cart?productIndex=0&quantity=1' ../../e2e/tests/react-native", + "e2e:android": "maestro --platform android test --config ../../e2e/config.yaml -e APP_ID=com.shopify.checkoutkit.reactnativedemo -e 'CART_BOOTSTRAP_LINK=com.shopify.checkoutkit.reactnativedemo://cart?productIndex=0&quantity=1' ../../e2e/tests/react-native" }, "devDependencies": { "@babel/core": "^7.29.7",