# Places whatever is in the cart, from the cart page through to the success # screen. Shared by place-order.yaml (add from home) and user-search-order.yaml # (add from search). # # Starts on the cart page and ends on "Order Placed Successfully!". appId: in.freshyo.app --- - assertVisible: "Scheduled Delivery Cart" # The Checkout button sits under the bill details, below the fold. - scrollUntilVisible: element: id: "checkout-button" direction: DOWN - tapOn: id: "checkout-button" # --- Sign in --------------------------------------------------------------- # Checkout is behind useAuthenticatedRoute, so a guest is bounced to the login # screen here. Let the redirect settle before the conditional check, otherwise # the login screen hasn't rendered yet and the subflow is skipped. # login.yaml is a no-op when a session already exists (OTP login can't be # automated, so a password must be set on the test account). - waitForAnimationToEnd: timeout: 15000 - runFlow: login.yaml # Login lands back on Home, so once we're authenticated head to the cart again. # (Skipped when a session already existed and we're still on the checkout page.) - runFlow: when: visible: id: "add-to-cart-icon" commands: - tapOn: id: "go-to-cart" - scrollUntilVisible: element: id: "checkout-button" direction: DOWN - tapOn: id: "checkout-button" - extendedWaitUntil: visible: "Scheduled Delivery Checkout" timeout: 45000 # --- Add an address only if the account has none ---------------------------- # The selector renders "No addresses found" both when the account has none and # while the addresses query is still loading, so settle and check again before # creating one — otherwise we open the add-address form for an account that # already has an address. - runFlow: when: visible: "No addresses found" commands: - waitForAnimationToEnd: timeout: 10000 - runFlow: when: visible: "No addresses found" commands: - tapOn: "Add Address" - tapOn: id: "address-name" - inputText: ${ADDRESS_NAME} - tapOn: id: "address-phone" - inputText: ${ADDRESS_PHONE} - tapOn: id: "address-line1" - inputText: ${ADDRESS_LINE1} - hideKeyboard - tapOn: id: "address-submit" - assertVisible: "Delivery Address" # --- Pay (COD is preselected) and place the order --------------------------- # The payment section sits below the address block; scrolling also lifts the # button clear of the dev-warning toast that overlays the bottom of the screen. - scrollUntilVisible: element: text: "Cash on Delivery" direction: DOWN - assertVisible: "Cash on Delivery" - scrollUntilVisible: element: id: "place-order-button" direction: DOWN centerElement: true - tapOn: id: "place-order-button" # --- Confirmation ----------------------------------------------------------- # The checkout shows a "Placing your order..." dialog first; give the API time. - extendedWaitUntil: visible: "Order Placed Successfully!" timeout: 60000 - assertVisible: "Continue Shopping"