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

70 lines
2.3 KiB
YAML

# User app: search for the product the admin flow just created, add it to the
# cart, and order it (then cancel, so the round leaves no live orders).
#
# The catalog the app searches comes from a versioned products.json on the CDN
# (`/products/v-<cacheVersion>/products.json`), and the backend bumps that
# version when a product is created, so the app only sees it after a refresh —
# hence the pull-to-refresh and the generous wait below.
#
# Env (see e2e/run.sh): PRODUCT_NAME, TEST_IDENTIFIER, TEST_PASSWORD, ADDRESS_*
appId: in.freshyo.app
---
- launchApp:
clearState: false
# The app resumes wherever the last run left it; the Home tab is always there.
- tapOn:
text: "^Home$"
optional: true
- extendedWaitUntil:
visible:
id: "add-to-cart-icon"
timeout: 90000
# --- Pull to refresh so the newly created product is in the catalog ---------
- swipe:
start: "50%,30%"
end: "50%,80%"
- waitForAnimationToEnd:
timeout: 10000
- extendedWaitUntil:
visible:
id: "add-to-cart-icon"
timeout: 60000
# --- Search ------------------------------------------------------------------
# The home search bar is not editable — tapping it opens the search screen.
- tapOn: "Search fresh meat..."
- extendedWaitUntil:
visible: "All Products"
timeout: 30000
- inputText: ${PRODUCT_NAME}
- hideKeyboard
- extendedWaitUntil:
visible: "${PRODUCT_NAME}.*"
timeout: 120000
# --- Add the result to the cart ---------------------------------------------
# Search results render the full-width "Add to Cart" button on the card (they
# don't use the small cart icon the home grid uses). An item already in the cart
# shows a quantifier instead, so the add is conditional — a cart carried over
# from a previous run still ends up ordered.
- runFlow:
when:
visible: "Add to Cart"
commands:
- tapOn: "Add to Cart"
- extendedWaitUntil:
visible: "Select Delivery Slot"
timeout: 30000
- tapOn:
id: "slot-option"
index: 0
- tapOn:
id: "add-to-cart-confirm"
- tapOn:
id: "go-to-cart"
index: 0
# --- Checkout -> place -> glimpse -> cancel ---------------------------------
- runFlow: ../subflows/checkout-and-place-order.yaml
- runFlow: ../subflows/glimpse-and-cancel.yaml