77 lines
3.5 KiB
YAML
77 lines
3.5 KiB
YAML
# set-slot-time-ios: one parameterized native date picker flow (iOS).
|
|
#
|
|
# HISTORY / KNOWN NATIVE LIMITATION:
|
|
# The modal closes only inside onChange, and RN's iOS DateTimePicker fires
|
|
# onChange ONLY when the picked value actually changes. Picking the date the
|
|
# picker already shows (today, the default when value is null) fires nothing:
|
|
# the modal stays open and the next field (e.g. freeze-date-picker) becomes
|
|
# unreachable. ALSO, exact TIME (hour/minute) cannot be set: the time wheels
|
|
# expose only the selected row to the a11y tree and close on first change.
|
|
# The committed time-of-day therefore = the simulator clock at the tap;
|
|
# freeze <= delivery holds whenever SLOT_FREEZE_DATE <= SLOT_DELIVERY_DATE.
|
|
# PICK_TIME is accepted for interface stability but not applied.
|
|
#
|
|
# MITIGATION (same-day branch): to commit "today", first tap a DIFFERENT day
|
|
# in the open month (forces onChange -> value commits -> modal closes), then
|
|
# reopen and tap the target day (now a real change -> closes again).
|
|
# Non-today dates keep the original month-navigation + single tap path.
|
|
appId: in.freshyo.adminui
|
|
env:
|
|
DATE_PICKER_ID: ${DATE_PICKER_ID || "delivery-date-picker"}
|
|
PICK_DATE: ${PICK_DATE || ""}
|
|
---
|
|
|
|
# ======== same-day branch (target = today: needs a force-change first) ========
|
|
- runFlow:
|
|
when:
|
|
true: ${PICK_DATE === (function(){var d=new Date();return d.getFullYear()+"-"+("0"+(d.getMonth()+1)).slice(-2)+"-"+("0"+d.getDate()).slice(-2)})()}
|
|
commands:
|
|
- tapOn:
|
|
id: ${DATE_PICKER_ID}
|
|
- waitForAnimationToEnd
|
|
- tapOn:
|
|
id: dateTimePicker
|
|
- waitForAnimationToEnd
|
|
# neighbor day = same month view, guaranteed different from today
|
|
# (day > 3 -> day-3, else day+3) forces the first change; closes the modal.
|
|
- tapOn:
|
|
text: "^${(function(){var d=new Date();var day=d.getDate();return String(day<=3?day+3:day-3)})()}$"
|
|
- waitForAnimationToEnd
|
|
# reopen and tap the target (today) - now a genuine change
|
|
- tapOn:
|
|
id: ${DATE_PICKER_ID}
|
|
- waitForAnimationToEnd
|
|
- tapOn:
|
|
id: dateTimePicker
|
|
- waitForAnimationToEnd
|
|
- tapOn:
|
|
text: "^${String((function(){var d=new Date();return d.getDate()})())}$"
|
|
- waitForAnimationToEnd
|
|
|
|
# ================= non-same-day path (original flow) ========================
|
|
- runFlow:
|
|
when:
|
|
true: ${PICK_DATE !== (function(){var d=new Date();return d.getFullYear()+"-"+("0"+(d.getMonth()+1)).slice(-2)+"-"+("0"+d.getDate()).slice(-2)})()}
|
|
commands:
|
|
# Derive the calendar target: month name + year ("November 2026").
|
|
- evalScript: ${output.targetMY = (function(){ var M = ["January","February","March","April","May","June","July","August","September","October","November","December"]; var p = PICK_DATE.split("-"); return M[parseInt(p[1], 10) - 1] + " " + parseInt(p[0], 10); })()}
|
|
- evalScript: ${output.day = String(parseInt(PICK_DATE.split("-")[2], 10))}
|
|
- tapOn:
|
|
id: ${DATE_PICKER_ID}
|
|
- waitForAnimationToEnd
|
|
- tapOn:
|
|
id: dateTimePicker
|
|
- waitForAnimationToEnd
|
|
# Navigate forward to the target month (current month is the start).
|
|
- repeat:
|
|
while:
|
|
notVisible:
|
|
text: ${output.targetMY}
|
|
commands:
|
|
- tapOn:
|
|
id: DatePicker.NextMonth
|
|
- waitForAnimationToEnd
|
|
# Tap the day cell (^$ anchors avoid 8/18/28 hits).
|
|
- tapOn:
|
|
text: '^${output.day}$'
|
|
- waitForAnimationToEnd
|