freshyo/e2e/flows/place-order.yaml
2026-09-14 23:34:10 +05:30

65 lines
2.3 KiB
YAML

# End-to-end: place an order (scheduled delivery, Cash on Delivery).
#
# Preconditions:
# - a running Android emulator with the user-ui dev build installed
# - a test account that has a password set (see e2e/README.md)
# - the catalog has at least one in-stock product with a future delivery slot
#
# Env (set in e2e/.env, see e2e/.env.example):
# TEST_IDENTIFIER, TEST_PASSWORD
# ADDRESS_NAME, ADDRESS_PHONE, ADDRESS_LINE1 (used only when no address exists)
#
# Android-only suite (Android package id).
appId: in.freshyo.app
---
- launchApp:
clearState: false
# The app can resume on whatever screen the previous run left open (product
# details, checkout, an order, ...). All of those still render the bottom tab
# bar, so tapping the Home tab is a reliable way back to the grid.
- tapOn:
text: "^Home$"
optional: true
# --- Home is ready ----------------------------------------------------------
# Anchor on the add button itself (present on every card that isn't already in
# the cart), so a cart carried over from a previous run doesn't matter.
- extendedWaitUntil:
visible:
id: "add-to-cart-icon"
timeout: 90000
# --- Add a product straight from the home card ------------------------------
# Use the card's cart icon instead of opening the product detail screen; on home
# that icon opens the Add-to-Cart dialog (useAddToCartDialog). The icon sits
# inside the card's touchable, so the tap can occasionally fall through to the
# card — when that happens we're on the detail page and add from there instead.
- tapOn:
id: "add-to-cart-icon"
index: 0
- runFlow:
when:
visible: "Product Details"
commands:
- extendedWaitUntil:
visible: "Add to Cart"
timeout: 30000
- tapOn: "Add to Cart"
# --- Choose a delivery slot in the dialog, then add -------------------------
- extendedWaitUntil:
visible: "Select Delivery Slot"
timeout: 30000
- tapOn:
id: "slot-option"
index: 0
- tapOn:
id: "add-to-cart-confirm"
# --- Cart -> checkout -> place -> glimpse -> cancel -------------------------
# Shared with user-search-order.yaml so both order paths stay in step.
- tapOn:
id: "go-to-cart"
- runFlow: ../subflows/checkout-and-place-order.yaml
- runFlow: ../subflows/glimpse-and-cancel.yaml