# add-slot: fill and submit the Add Slot form (apps/admin-ui). # Form-only: begins on the Add Slot screen - the orchestrator's job is to land # there (launch/login/deep-link). Two time modes: # - SLOT_PREFILL=true: the landing deep-link carried dts/fts ISO instant # params (slots/add.tsx parses them into SlotForm initial times); both # native-picker interactions are SKIPPED (exact delivery/freeze achieved, # e.g. freeze = delivery - 10 min). # - otherwise (native-only): freeze picker runs FIRST, then delivery; both # take the sim-clock time-of-day; committing delivery last guarantees # freeze < delivery. # Up to # 5 products (PRODUCT_1..PRODUCT_5, dropdown option names) are selected in the # slot-products-selector; groups are skipped for now. # # NOTE: each option is found via SEARCH-then-select: the sheet's autofocused # search field is typed with the product name (keyboard stays OPEN and is # used), ProductsSelector filters its list client-side on the fly, and the # filtered option row is then tapped by its id. No scrolling inside the sheet: # every scrolling attempt (screen-level scrollUntilVisible, coordinate swipes) # ended up moving the page behind the sheet instead of the option rows. # BottomDialog clears the search when it closes, so queries don't leak # between products. # # Known native-picker limitation: exact time-of-day is not settable (see # subflows/set-slot-time-ios.yaml header). SLOT_*_TIME is accepted but unused. # Run from the admin-ui folder or via runFlow from an orchestrator flow. appId: in.freshyo.adminui env: SLOT_DELIVERY_DATE: ${SLOT_DELIVERY_DATE || ""} SLOT_DELIVERY_TIME: ${SLOT_DELIVERY_TIME || ""} SLOT_FREEZE_DATE: ${SLOT_FREEZE_DATE || ""} SLOT_FREEZE_TIME: ${SLOT_FREEZE_TIME || ""} SLOT_PREFILL: ${SLOT_PREFILL || ""} PRODUCT_1: ${PRODUCT_1 || ""} PRODUCT_2: ${PRODUCT_2 || ""} PRODUCT_3: ${PRODUCT_3 || ""} PRODUCT_4: ${PRODUCT_4 || ""} PRODUCT_5: ${PRODUCT_5 || ""} --- # Fail fast: all four required SLOT_* values must be provided. - assertTrue: condition: ${SLOT_DELIVERY_DATE != "" && SLOT_DELIVERY_TIME != "" && SLOT_FREEZE_DATE != "" && SLOT_FREEZE_TIME != ""} label: "add-slot: SLOT_DELIVERY_DATE, SLOT_DELIVERY_TIME, SLOT_FREEZE_DATE and SLOT_FREEZE_TIME are required (e.g. -e SLOT_DELIVERY_DATE=2026-10-08 -e SLOT_DELIVERY_TIME=20:00)." # Option ids are slot-products-selector-option--; slug = # lowercased label with every non-alnum run collapsed to '-'. The slug is # computed inline in each matcher: evalScript-assigned output.* vars do NOT # reach nested runFlow.when.commands when this flow runs as a subflow. - extendedWaitUntil: visible: id: delivery-date-picker timeout: 30000 # ---- times ---- # With SLOT_PREFILL=true the landing deep-link already pre-filled both # instants (slots/add.tsx e2e hook) - skip all picker interaction. - runFlow: when: true: ${SLOT_PREFILL.trim().toLowerCase() != "true"} commands: # Native-only mode: freeze commits FIRST, then delivery (commit-order # trick; delivery lands later on the sim clock => freeze < delivery). - runFlow: file: subflows/set-slot-time-ios.yaml env: DATE_PICKER_ID: freeze-date-picker PICK_DATE: ${SLOT_FREEZE_DATE} - runFlow: file: subflows/set-slot-time-ios.yaml env: DATE_PICKER_ID: delivery-date-picker PICK_DATE: ${SLOT_DELIVERY_DATE} # ---- products (up to 5; groups skipped) ---- - scrollUntilVisible: element: id: slot-products-selector direction: DOWN speed: 100 - waitForAnimationToEnd - assertVisible: id: slot-products-selector - tapOn: id: slot-products-selector - waitForAnimationToEnd # the sheet's search field autofocused - put the keyboard away # hideKeyboard is unreliable on iOS here - tap the sheet's static title # (non-interactive text) instead, which blurs the focused search field - tapOn: text: Select Products - waitForAnimationToEnd - runFlow: when: true: ${PRODUCT_1 != ""} commands: # search-then-select: typing filters the list client-side, # so no scrolling inside the sheet is needed - tapOn: id: slot-products-selector-search - waitForAnimationToEnd - runFlow: when: visible: text: 'Clear text' commands: - tapOn: text: 'Clear text' - waitForAnimationToEnd - eraseText: 20 - inputText: ${PRODUCT_1} - waitForAnimationToEnd - tapOn: id: 'slot-products-selector-option-.*${PRODUCT_1.trim().toLowerCase().split(".").join("-").split(" ").join("-")}.*' - waitForAnimationToEnd - runFlow: when: true: ${PRODUCT_2 != ""} commands: # search-then-select: typing filters the list client-side, # so no scrolling inside the sheet is needed - tapOn: id: slot-products-selector-search - waitForAnimationToEnd - runFlow: when: visible: text: 'Clear text' commands: - tapOn: text: 'Clear text' - waitForAnimationToEnd - eraseText: 20 - inputText: ${PRODUCT_2} - waitForAnimationToEnd - tapOn: id: 'slot-products-selector-option-.*${PRODUCT_2.trim().toLowerCase().split(".").join("-").split(" ").join("-")}.*' - waitForAnimationToEnd - runFlow: when: true: ${PRODUCT_3 != ""} commands: # search-then-select: typing filters the list client-side, # so no scrolling inside the sheet is needed - tapOn: id: slot-products-selector-search - waitForAnimationToEnd - runFlow: when: visible: text: 'Clear text' commands: - tapOn: text: 'Clear text' - waitForAnimationToEnd - eraseText: 20 - inputText: ${PRODUCT_3} - waitForAnimationToEnd - tapOn: id: 'slot-products-selector-option-.*${PRODUCT_3.trim().toLowerCase().split(".").join("-").split(" ").join("-")}.*' - waitForAnimationToEnd - runFlow: when: true: ${PRODUCT_4 != ""} commands: # search-then-select: typing filters the list client-side, # so no scrolling inside the sheet is needed - tapOn: id: slot-products-selector-search - waitForAnimationToEnd - runFlow: when: visible: text: 'Clear text' commands: - tapOn: text: 'Clear text' - waitForAnimationToEnd - eraseText: 20 - inputText: ${PRODUCT_4} - waitForAnimationToEnd - tapOn: id: 'slot-products-selector-option-.*${PRODUCT_4.trim().toLowerCase().split(".").join("-").split(" ").join("-")}.*' - waitForAnimationToEnd - runFlow: when: true: ${PRODUCT_5 != ""} commands: # search-then-select: typing filters the list client-side, # so no scrolling inside the sheet is needed - tapOn: id: slot-products-selector-search - waitForAnimationToEnd - runFlow: when: visible: text: 'Clear text' commands: - tapOn: text: 'Clear text' - waitForAnimationToEnd - eraseText: 20 - inputText: ${PRODUCT_5} - waitForAnimationToEnd - tapOn: id: 'slot-products-selector-option-.*${PRODUCT_5.trim().toLowerCase().split(".").join("-").split(" ").join("-")}.*' - waitForAnimationToEnd - assertVisible: id: slot-products-selector-done - tapOn: id: slot-products-selector-done - waitForAnimationToEnd # centerElement dropped on purpose: with the button already visible it # re-nudges the scroll endlessly trying to center it. - scrollUntilVisible: element: id: create-slot-button direction: DOWN speed: 100 visibilityPercentage: 100 - waitForAnimationToEnd - assertVisible: id: create-slot-button - tapOn: id: create-slot-button - assertVisible: 'Slot created successfully!' - tapOn: 'OK'