freshyo/e2e/flows/admin-attach-product.yaml
2026-09-14 23:34:10 +05:30

92 lines
2.8 KiB
YAML

# Admin: attach the product created in admin-product.yaml to the slot created in
# admin-slot.yaml.
#
# The slot is found by its delivery label (SLOT_DELIVERY_LABEL) rather than by
# id, because the id is only known at runtime. Tapping the row opens Slot
# Details; the edit FAB there reopens the same SlotForm used to create it.
#
# Env (see e2e/run.sh): ADMIN_NAME, ADMIN_PASSWORD, PRODUCT_NAME,
# SLOT_DELIVERY_LABEL (e.g. "15 Oct, 6:00 PM")
appId: in.freshyo.adminui
---
- launchApp:
clearState: false
- runFlow: ../subflows/dismiss-dev-toast.yaml
- runFlow: ../subflows/admin-login.yaml
- extendedWaitUntil:
visible: "Dashboard"
timeout: 90000
# --- Slots list: find our slot ----------------------------------------------
- tapOn:
id: "delivery-slots-menu-item"
- extendedWaitUntil:
visible:
id: "add-slot-fab"
timeout: 40000
- runFlow:
when:
notVisible: ${SLOT_DELIVERY_LABEL}
commands:
- scrollUntilVisible:
element:
text: ${SLOT_DELIVERY_LABEL}
direction: DOWN
centerElement: true
timeout: 40000
- tapOn: ${SLOT_DELIVERY_LABEL}
# The details screen keeps the "Slots" header and titles itself "Slot #<id>",
# so anchor on a section that only exists there.
- extendedWaitUntil:
visible: "Vendor Snippets"
timeout: 40000
# --- Slot Details -> edit form ----------------------------------------------
- runFlow: ../subflows/dismiss-dev-toast.yaml
- tapOn:
id: "edit-slot-fab"
- extendedWaitUntil:
visible: "Edit Slot"
timeout: 40000
# --- Attach the product in the multi-select dropdown ------------------------
# Target the trigger by id: once the slot has any products it renders the
# selected labels instead of its placeholder text.
- tapOn:
id: "slot-products-selector"
- extendedWaitUntil:
visible: "Select Products"
timeout: 30000
- tapOn:
id: "slot-products-selector-search"
- inputText: ${PRODUCT_NAME}
- hideKeyboard
- waitForAnimationToEnd:
timeout: 5000
# The option label is the SKU label — "<product name> <feature values>". The
# pattern must require that trailing part: it stops it matching the search input
# itself (which holds exactly the product name), and tapping the input just
# re-opens the keyboard instead of selecting the option.
- extendedWaitUntil:
visible: "${PRODUCT_NAME} .+"
timeout: 30000
- tapOn: "${PRODUCT_NAME} .+"
- waitForAnimationToEnd:
timeout: 3000
- tapOn:
id: "slot-products-selector-done"
# --- Save -------------------------------------------------------------------
- scrollUntilVisible:
element:
id: "create-slot-button"
direction: DOWN
centerElement: true
timeout: 30000
- runFlow: ../subflows/dismiss-dev-toast.yaml
- tapOn:
id: "create-slot-button"
- extendedWaitUntil:
visible: "Slot updated successfully!"
timeout: 40000
- tapOn: "OK"