freshyo/e2e/subflows/glimpse-and-cancel.yaml
2026-09-14 23:34:10 +05:30

66 lines
2.2 KiB
YAML

# From the order-success screen: back to home, capture the Next Order glimpse
# card, open the order from it and cancel it — so a run leaves no live orders
# behind. Shared by place-order.yaml and user-search-order.yaml.
appId: in.freshyo.app
---
- tapOn: "Continue Shopping"
# --- Home glimpse -----------------------------------------------------------
# NextOrderGlimpse sits below "Our Stores" in the home header, so scroll to it.
- scrollUntilVisible:
element:
text: "Upcoming Order"
direction: DOWN
centerElement: true
timeout: 30000
- assertVisible: "Track Order"
- takeScreenshot: "home-upcoming-order-glimpse"
# --- Open it from the glimpse and cancel ------------------------------------
# The card sets the navigation target and replaces to /me, which forwards to
# /(drawer)/(tabs)/me/my-orders/{id}.
- tapOn: "Upcoming Order"
- extendedWaitUntil:
visible: "Order Items"
timeout: 30000
- scrollUntilVisible:
element:
text: "Cancel Order"
direction: DOWN
centerElement: true
- tapOn: "Cancel Order"
- extendedWaitUntil:
visible: "Reason for cancellation"
timeout: 20000
- tapOn:
id: "cancel-reason"
- inputText: "Ordered by mistake"
- hideKeyboard
# The sheet slides back down as the keyboard collapses, and a tap during that
# animation misses. Tap the sheet's (non-interactive) warning text to force the
# layout to settle before confirming.
- tapOn: "Are you sure you want to cancel this order\\?.*"
- waitForAnimationToEnd:
timeout: 8000
# Tapping this button right after the sheet settles can be swallowed (the JS
# thread is still busy finishing the navigation), so keep tapping until the
# request actually goes out — while it is in flight the label is replaced by a
# spinner, which is what ends the loop.
- repeat:
times: 5
commands:
- runFlow:
when:
visible: "Confirm Cancellation"
commands:
- waitForAnimationToEnd:
timeout: 3000
- tapOn: "Confirm Cancellation"
# Native success alert, then the detail page refetches with the cancellation.
- extendedWaitUntil:
visible: "Order cancelled successfully"
timeout: 20000
- tapOn: "OK"
- extendedWaitUntil:
visible: "Cancellation Reason"
timeout: 30000