diff --git a/e2e/config.yaml b/e2e/config.yaml new file mode 100644 index 000000000..cf1076dc2 --- /dev/null +++ b/e2e/config.yaml @@ -0,0 +1,4 @@ +platform: + ios: + # Lets Maestro inspect elements presented inside iOS checkout modal views. + snapshotKeyHonorModalViews: true diff --git a/e2e/flows/app/bootstrap-cart-from-link.yaml b/e2e/flows/app/bootstrap-cart-from-link.yaml new file mode 100644 index 000000000..3e86ee2e8 --- /dev/null +++ b/e2e/flows/app/bootstrap-cart-from-link.yaml @@ -0,0 +1,13 @@ +appId: ${APP_ID} +--- +- stopApp +- openLink: "${CART_BOOTSTRAP_LINK}" +- runFlow: + when: + visible: "Open" + commands: + - tapOn: "Open" +- extendedWaitUntil: + visible: + id: checkout-button + timeout: 30000 diff --git a/e2e/flows/app/launch.yaml b/e2e/flows/app/launch.yaml new file mode 100644 index 000000000..d6bad2273 --- /dev/null +++ b/e2e/flows/app/launch.yaml @@ -0,0 +1,12 @@ +appId: ${APP_ID} +--- +- launchApp: + clearState: true + arguments: + # iOS-only launch arguments; Android ignores them. + AppleLocale: en_US + AppleLanguages: "(en)" +- extendedWaitUntil: + visible: + id: checkout-kit-sample-ready + timeout: 60000 diff --git a/e2e/flows/checkout/assert-complete.yaml b/e2e/flows/checkout/assert-complete.yaml new file mode 100644 index 000000000..6d079365f --- /dev/null +++ b/e2e/flows/checkout/assert-complete.yaml @@ -0,0 +1,5 @@ +appId: ${APP_ID} +--- +- extendedWaitUntil: + visible: "${POST_SUBMIT_RESULT_PATTERN}" + timeout: 60000 diff --git a/e2e/flows/checkout/assert-returned-to-empty-cart.yaml b/e2e/flows/checkout/assert-returned-to-empty-cart.yaml new file mode 100644 index 000000000..597361a8f --- /dev/null +++ b/e2e/flows/checkout/assert-returned-to-empty-cart.yaml @@ -0,0 +1,14 @@ +appId: ${APP_ID} +--- +- tapOn: "Close Checkout" +- runFlow: + when: + visible: + id: catalog-tab + commands: + - tapOn: + id: cart-tab +- extendedWaitUntil: + visible: + id: cart-empty-message + timeout: 15000 diff --git a/e2e/flows/checkout/fill-contact.yaml b/e2e/flows/checkout/fill-contact.yaml new file mode 100644 index 000000000..5944e22ca --- /dev/null +++ b/e2e/flows/checkout/fill-contact.yaml @@ -0,0 +1,40 @@ +appId: ${APP_ID} +--- +- tapOn: + text: "^Email( or mobile phone number)?$" +- inputText: "${EMAIL}" +- runFlow: + when: + visible: "selected" + commands: + - tapOn: "selected" +- extendedWaitUntil: + visible: "^${EMAIL}$" +- scrollUntilVisible: + element: + text: "^First name( \\(optional\\))?$" + direction: DOWN + visibilityPercentage: 100 + centerElement: true +- tapOn: + text: "^First name( \\(optional\\))?$" +- inputText: "${FIRST_NAME}" +- runFlow: + when: + visible: "selected" + commands: + - tapOn: "selected" +- scrollUntilVisible: + element: + text: "^Last name$" + direction: DOWN + visibilityPercentage: 100 + centerElement: true +- tapOn: + text: "^Last name$" +- inputText: "${LAST_NAME}" +- runFlow: + when: + visible: "selected" + commands: + - tapOn: "selected" diff --git a/e2e/flows/checkout/fill-payment-card.yaml b/e2e/flows/checkout/fill-payment-card.yaml new file mode 100644 index 000000000..cfa4e44e5 --- /dev/null +++ b/e2e/flows/checkout/fill-payment-card.yaml @@ -0,0 +1,51 @@ +appId: ${APP_ID} +--- +- scrollUntilVisible: + element: + text: "^Card number$" + direction: DOWN + centerElement: true +- tapOn: + text: "^Card number$" + index: -1 +- inputText: "${CARD_NUMBER}" +- runFlow: + when: + visible: "selected" + commands: + - tapOn: "selected" +- scrollUntilVisible: + element: + text: "^Expiration date \\(MM / YY\\)$" + direction: DOWN + centerElement: true +- tapOn: + text: "^Expiration date \\(MM / YY\\)$" + index: -1 +- inputText: "1" +- waitForAnimationToEnd +- inputText: "2" +- waitForAnimationToEnd +- inputText: "3" +- waitForAnimationToEnd +- inputText: "0" +- runFlow: + when: + visible: "selected" + commands: + - tapOn: "selected" +- scrollUntilVisible: + element: + text: "^Security code$" + direction: DOWN + centerElement: true +- tapOn: + text: "^Security code$" + index: -1 +- inputText: "${CARD_SECURITY_CODE}" +- runFlow: + when: + visible: "selected" + commands: + - tapOn: "selected" +- waitForAnimationToEnd diff --git a/e2e/flows/checkout/fill-shipping-address.yaml b/e2e/flows/checkout/fill-shipping-address.yaml new file mode 100644 index 000000000..4c91c94be --- /dev/null +++ b/e2e/flows/checkout/fill-shipping-address.yaml @@ -0,0 +1,112 @@ +appId: ${APP_ID} +--- +- scrollUntilVisible: + element: + text: "Country/Region" + direction: DOWN +- tapOn: + text: "Country/Region" + index: 1 +- waitForAnimationToEnd +- scrollUntilVisible: + element: + text: "^${COUNTRY_LABEL}$" + direction: UP + visibilityPercentage: 10 + optional: true +- scrollUntilVisible: + element: + text: "^${COUNTRY_LABEL}$" + direction: DOWN + visibilityPercentage: 10 + optional: true +- tapOn: + text: "^${COUNTRY_LABEL}$" +- waitForAnimationToEnd +- scrollUntilVisible: + element: + text: "Address" + direction: DOWN +- tapOn: + text: "Address" + index: -1 +- eraseText: 80 +- inputText: "${ADDRESS_LINE1}" +- runFlow: + when: + visible: "selected" + commands: + - tapOn: "selected" +- runFlow: + when: + visible: "Close suggestions" + commands: + - tapOn: "Close suggestions" + - waitForAnimationToEnd +- scrollUntilVisible: + element: + text: "^City$" + direction: DOWN + centerElement: true +- tapOn: + text: "^City$" + index: -1 +- eraseText: 80 +- inputText: "${CITY}" +- runFlow: + when: + visible: "selected" + commands: + - tapOn: "selected" +- tapOn: "^Delivery$" +- waitForAnimationToEnd +- scrollUntilVisible: + element: + text: "^${STATE_FIELD_LABEL}$" + direction: DOWN + centerElement: true +- runFlow: + when: + notVisible: "^${STATE_LABEL}$" + commands: + - tapOn: + containsChild: + text: "^${STATE_FIELD_LABEL}$" + - waitForAnimationToEnd +- scrollUntilVisible: + element: + text: "^${STATE_LABEL}$" + direction: UP + visibilityPercentage: 100 + optional: true +- scrollUntilVisible: + element: + text: "^${STATE_LABEL}$" + direction: DOWN + visibilityPercentage: 100 + optional: true +- tapOn: + text: "^${STATE_LABEL}$" +- waitForAnimationToEnd +- extendedWaitUntil: + notVisible: "Select a state" +- extendedWaitUntil: + visible: "^${STATE_LABEL}$" +- scrollUntilVisible: + element: + text: "^${POSTAL_FIELD_LABEL}$" + direction: DOWN + centerElement: true +- tapOn: + text: "^${POSTAL_FIELD_LABEL}$" + index: -1 +- eraseText: 80 +- inputText: "${POSTAL_CODE}" +- runFlow: + when: + visible: "selected" + commands: + - tapOn: "selected" +- extendedWaitUntil: + visible: "^${POSTAL_CODE}$" +- waitForAnimationToEnd diff --git a/e2e/flows/checkout/present.yaml b/e2e/flows/checkout/present.yaml new file mode 100644 index 000000000..1adae5e3f --- /dev/null +++ b/e2e/flows/checkout/present.yaml @@ -0,0 +1,9 @@ +appId: ${APP_ID} +--- +- tapOn: + id: checkout-button + enabled: true +- extendedWaitUntil: + visible: + text: "^Email( or mobile phone number)?$" + timeout: 60000 diff --git a/e2e/flows/checkout/submit.yaml b/e2e/flows/checkout/submit.yaml new file mode 100644 index 000000000..bcb82d884 --- /dev/null +++ b/e2e/flows/checkout/submit.yaml @@ -0,0 +1,10 @@ +appId: ${APP_ID} +--- +- scrollUntilVisible: + element: + text: "^(Pay now|Complete order)$" + direction: DOWN + visibilityPercentage: 90 +- tapOn: + text: "^(Pay now|Complete order)$" + enabled: true diff --git a/e2e/tests/react-native/full-guest-checkout.yaml b/e2e/tests/react-native/full-guest-checkout.yaml new file mode 100644 index 000000000..ed667b929 --- /dev/null +++ b/e2e/tests/react-native/full-guest-checkout.yaml @@ -0,0 +1,34 @@ +appId: ${APP_ID} +name: React Native full guest checkout + +env: + # Checkout contact fixture + EMAIL: "maestro.e2e@shopify.com" + FIRST_NAME: "Maestro" + LAST_NAME: "Shopify" + + # Checkout shipping fixture + COUNTRY_LABEL: "United States" + ADDRESS_LINE1: "700 S Flower St" + CITY: "Los Angeles" + STATE_FIELD_LABEL: "State" + STATE_LABEL: "California" + POSTAL_CODE: "90017" + POSTAL_FIELD_LABEL: "ZIP code" + + # 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/bootstrap-cart-from-link.yaml +- runFlow: ../../flows/checkout/present.yaml +- runFlow: ../../flows/checkout/fill-contact.yaml +- runFlow: ../../flows/checkout/fill-shipping-address.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