freshyo/tests/e2e/basic-sanity.yaml
2026-10-22 19:39:12 +05:30

377 lines
9.3 KiB
YAML

# Basic-sanity user-side E2E.
# See tests/e2e/basic-sanity.md for full instructions and troubleshooting.
#
# Prerequisites:
# - Expo Go is already logged in as the test user.
# - The test user has the saved address ADDRESS_ID (defaults to 899).
# - Metro is serving exp://127.0.0.1:8081 and the dev backend is reachable.
#
# Fixtures are created by tests/e2e/basic-sanity-setup.sh. Run
# tests/e2e/run-basic-sanity.sh to execute setup -> this flow -> admin updates ->
# the post-admin flow. If you run this flow directly, pass every env value:
#
# maestro test \
# -e PRODUCT_NAME=SANITY-...-A \
# -e COMBO_NAME=SANITY-...-COMBO \
# -e SKU_500G=123 -e SKU_1KG=124 -e SKU_COMBO=125 \
# -e TAG_ID=12 -e SLOT_ID=2120 -e ADDRESS_ID=899 \
# tests/e2e/basic-sanity.yaml
#
# The flow uses testIDs only for taps. No hard-coded screen percentages.
appId: host.exp.Exponent
name: basic-sanity
tags:
- e2e
- basic-sanity
---
# ---------------------------------------------------------------------------
# Launch
# ---------------------------------------------------------------------------
- stopApp
- openLink: exp://127.0.0.1:8081
- extendedWaitUntil:
visible:
id: "location-address-name-${ADDRESS_ID}"
timeout: 60000
optional: true
- runFlow:
when:
visible:
id: "location-address-name-${ADDRESS_ID}"
commands:
- tapOn:
id: "location-address-name-${ADDRESS_ID}"
- extendedWaitUntil:
visible:
id: "tab-home"
timeout: 90000
- extendedWaitUntil:
visible:
id: "home-search"
timeout: 60000
- waitForAnimationToEnd:
timeout: 3000
# ---------------------------------------------------------------------------
# Phase 1: Offers tab, Show More, combo detail
# ---------------------------------------------------------------------------
- tapOn:
id: "tab-offers"
- extendedWaitUntil:
visible:
id: "offers-section"
timeout: 30000
- waitForAnimationToEnd:
timeout: 3000
- scrollUntilVisible:
element:
id: "combos-show-more"
direction: DOWN
timeout: 20000
# The button is the last child and initially sits behind the floating cart bar
# and the tab bar. One more scroll lifts it into the tappable area.
- scroll
- waitForAnimationToEnd:
timeout: 1000
- tapOn:
id: "combos-show-more"
waitToSettleTimeoutMs: 2000
- waitForAnimationToEnd:
timeout: 2000
- scrollUntilVisible:
element:
id: "product-card-${SKU_COMBO}"
direction: DOWN
timeout: 30000
# The last combo card reaches the bottom edge behind the floating cart bar.
- scroll
- waitForAnimationToEnd:
timeout: 1000
- tapOn:
id: "product-card-${SKU_COMBO}"
- scrollUntilVisible:
element:
id: "product-combo-items"
direction: DOWN
timeout: 30000
- assertVisible:
id: "combo-item-${SKU_500G}"
- assertVisible:
id: "combo-item-${SKU_1KG}"
- scrollUntilVisible:
element:
id: "product-flash-price"
direction: UP
timeout: 10000
- assertVisible:
id: "product-flash-price"
# Relaunch to return to Home deterministically (the native stack header back
# button has no testID).
- stopApp
- openLink: exp://127.0.0.1:8081
- extendedWaitUntil:
visible:
id: "location-address-name-${ADDRESS_ID}"
timeout: 60000
optional: true
- runFlow:
when:
visible:
id: "location-address-name-${ADDRESS_ID}"
commands:
- tapOn:
id: "location-address-name-${ADDRESS_ID}"
- extendedWaitUntil:
visible:
id: "tab-home"
timeout: 90000
- extendedWaitUntil:
visible:
id: "home-search"
timeout: 60000
- waitForAnimationToEnd:
timeout: 3000
# ---------------------------------------------------------------------------
# Phase 2: dashboard tag is visible and contains both products
# ---------------------------------------------------------------------------
# New dashboard tags are appended to the end of the horizontal strip.
- swipe:
from:
id: "home-tag-strip"
direction: LEFT
- swipe:
from:
id: "home-tag-strip"
direction: LEFT
- swipe:
from:
id: "home-tag-strip"
direction: LEFT
- extendedWaitUntil:
visible:
id: "tag-tab-${TAG_ID}"
timeout: 10000
- tapOn:
id: "tag-tab-${TAG_ID}"
- extendedWaitUntil:
visible:
id: "tag-grid-${TAG_ID}"
timeout: 15000
- assertVisible:
id: "tag-product-${SKU_500G}"
- assertVisible:
id: "tag-product-${SKU_1KG}"
- assertVisible:
id: "tag-product-${SKU_COMBO}"
# ---------------------------------------------------------------------------
# Phase 3: search, regular order
# ---------------------------------------------------------------------------
- tapOn:
id: "home-search"
- extendedWaitUntil:
visible:
id: "search-input"
timeout: 20000
- tapOn:
id: "search-input"
- inputText: "${PRODUCT_NAME}"
- hideKeyboard
- extendedWaitUntil:
visible:
id: "product-card-${SKU_500G}"
timeout: 20000
- tapOn:
id: "product-card-${SKU_500G}"
- extendedWaitUntil:
visible:
id: "product-add-to-cart"
timeout: 20000
- assertVisible:
id: "product-flash-badge"
- tapOn:
id: "product-add-to-cart"
- extendedWaitUntil:
visible:
id: "add-to-cart-confirm"
timeout: 20000
- scrollUntilVisible:
element:
id: "slot-option-${SLOT_ID}"
direction: DOWN
timeout: 15000
- tapOn:
id: "slot-option-${SLOT_ID}"
- tapOn:
id: "add-to-cart-confirm"
- extendedWaitUntil:
visible:
id: "go-to-cart"
timeout: 20000
- tapOn:
id: "go-to-cart"
- extendedWaitUntil:
visible:
id: "cart-sku-${SKU_500G}"
timeout: 20000
- scrollUntilVisible:
element:
id: "checkout-button"
direction: DOWN
timeout: 20000
# The checkout button sits at the bottom edge behind the floating cart bar.
- scroll
- waitForAnimationToEnd:
timeout: 1000
- tapOn:
id: "checkout-button"
- scrollUntilVisible:
element:
id: "place-order-button"
direction: DOWN
timeout: 30000
- tapOn:
id: "place-order-button"
- extendedWaitUntil:
visible:
id: "order-success-details"
timeout: 40000
- assertVisible:
id: "order-success-order-id"
- assertVisible:
id: "order-success-total"
# `order-success-view-orders` calls dismissAll() then push(), which can race
# when the success screen was pushed from checkout. Continue + Me is stable.
- tapOn:
id: "order-success-continue"
- extendedWaitUntil:
visible:
id: "home-search"
timeout: 30000
- tapOn:
id: "tab-me"
- extendedWaitUntil:
visible:
id: "me-menu-my-orders"
timeout: 20000
- tapOn:
id: "me-menu-my-orders"
- extendedWaitUntil:
visible:
id: "orders-list"
timeout: 30000
- assertVisible:
text: ".*${PRODUCT_NAME}.*"
# ---------------------------------------------------------------------------
# Phase 4: flash order
# ---------------------------------------------------------------------------
- tapOn:
id: "tab-flash"
# The fixture is appended near the end of the flash catalogue, and the last
# rows sit behind the floating cart bar unless centred.
- scrollUntilVisible:
element:
id: "flash-product-${SKU_500G}"
direction: DOWN
timeout: 120000
speed: 90
visibilityPercentage: 50
centerElement: true
- tapOn:
id: "flash-product-${SKU_500G}"
- extendedWaitUntil:
visible:
id: "product-add-to-cart"
timeout: 20000
- tapOn:
id: "product-add-to-cart"
- extendedWaitUntil:
visible:
id: "go-to-cart"
timeout: 20000
- tapOn:
id: "go-to-cart"
- extendedWaitUntil:
visible:
id: "cart-sku-${SKU_500G}"
timeout: 20000
- scrollUntilVisible:
element:
id: "checkout-button"
direction: DOWN
timeout: 20000
# The checkout button sits at the bottom edge behind the floating cart bar.
- scroll
- waitForAnimationToEnd:
timeout: 1000
- tapOn:
id: "checkout-button"
- scrollUntilVisible:
element:
id: "place-order-button"
direction: DOWN
timeout: 30000
- tapOn:
id: "place-order-button"
- extendedWaitUntil:
visible:
id: "order-success-details"
timeout: 40000
- assertVisible:
id: "order-success-order-id"
- assertVisible:
id: "order-success-total"
- tapOn:
id: "order-success-continue"
# The flash stack has no bottom tab bar; it returns to the flash catalogue.
- extendedWaitUntil:
visible:
id: "flash-product-search-input"
timeout: 30000
# ---------------------------------------------------------------------------
# Phase 5: both orders are in My Orders
# ---------------------------------------------------------------------------
# The flash stack has no bottom tab bar. Relaunch to return to the main tabs,
# then open My Orders from Me.
- stopApp
- openLink: exp://127.0.0.1:8081
- extendedWaitUntil:
visible:
id: "location-address-name-${ADDRESS_ID}"
timeout: 60000
optional: true
- runFlow:
when:
visible:
id: "location-address-name-${ADDRESS_ID}"
commands:
- tapOn:
id: "location-address-name-${ADDRESS_ID}"
- extendedWaitUntil:
visible:
id: "tab-home"
timeout: 90000
- extendedWaitUntil:
visible:
id: "home-search"
timeout: 60000
- tapOn:
id: "tab-me"
- extendedWaitUntil:
visible:
id: "me-menu-my-orders"
timeout: 20000
- tapOn:
id: "me-menu-my-orders"
- extendedWaitUntil:
visible:
id: "orders-list"
timeout: 30000
- assertVisible:
text: ".*${PRODUCT_NAME}.*"