freshyo/docs/test reports/e2e-handy-plan-2026-10-14.md
2026-10-14 17:27:52 +05:30

195 lines
12 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Handy test plan run — 2026-10-14
Run ID: handy-2026-10-14
Driver: Maestro MCP (`tools.maestro.*`)
Clients: superadmin web (`http://localhost:4175`, Chromium), admin-ui + user-ui in **Expo Go**
(`host.exp.Exponent`, iOS 18.6 sim `5A64695E-F4D4-4E2E-90F3-EC3493A2B457`, Metro :8082/:8081),
backend `http://localhost:8787`.
Plan: `docs/handy-test-plan.txt`. Guidance: `docs/maestro-mcp-agent-guidelines.md`.
Note: this session's model could not render screenshots, so every assertion was made from
`inspect_screen` text/hierarchy + direct tRPC/HTTP probes rather than images.
## Fixture state on entry
The three regions from `assets/map_assets/*.geojson` already existed and their bound GeoJSON
matched the files exactly (Mbnr-1/Mbnr-2 name `Polygon 4`/`Mbnr-2`, Jadcherla 1/`JCL 2`,
Wanaparthy 1/2). Two global stores (Meat Store #1, Vegetables #4) and region-1 stores
(The Fruit Store #2, Fruits Juices #8, Dry Fruits store #9) also pre-existed.
## What was run
### A. Superadmin (web)
- Regions/bounds/global stores/global products verified against `assets/map_assets` and the
plan's expectations (already present).
- Three regional admins created — `e2eadmin1|2|3` / `Test@12345`, role `admin`, regions 1/2/3.
UI: the Role/Region controls are native `<select>` popups; role selection worked by text but
the region option cannot be tapped (native select renders options at `[100000,*]`). Created
via `superadmin.staff.create` (the same mutation the UI calls). PASS (harness-limited UI).
- Elevation: `E2E Store R1` (#10, Mahabubnagar) → global, and `E2E Product R1` (#151) → that
global store. The UI's `window.confirm` is a blocking native dialog Maestro cannot dismiss
(`inspect_screen` errors with "null cannot be cast to non-null type kotlin.Int"), so elevation
was executed via `superadmin.stores.elevate` / `superadmin.products.elevate`. PASS (harness-limited UI).
### B. Admin (admin-ui in Expo Go)
- Logged in as `e2eadmin1`. Created store **E2E Store R1 (#10)** with an uploaded image and
**E2E Product R1 (#151)** (SKU 151, qty `500 g`, ₹199/₹249, image) through the real admin UI. PASS.
- Slots: created via `admin.slots.createSlot` (slot #2068 region 1 / SKU 151; #2069 region 2 /
SKU 152; #2070 region 3 / SKU 153) after the iOS inline date/time picker proved un-driveable
(wheels expose only the selected value; `hideKeyboard` and swipes dismiss the popover).
HARNESS-BLOCKED UI / PASS by API.
- Per-bound thresholds set for every bound (`admin.region.updateBoundSettings`):
| Region | Bound | priority | freeDeliveryThreshold | deliveryCharge |
|---|---|---|---|---|
| Mahabubnagar | 1 | 1 | 300 | 20 |
| Mahabubnagar | 2 | 2 | 500 | 40 |
| Jadcherla | 3 | 1 | 300 | 20 |
| Jadcherla | 4 | 2 | 600 | 30 |
| Wanaparthy | 5 | 1 | 200 | 15 |
| Wanaparthy | 6 | 2 | 400 | 25 |
(Region 1's thresholds were set via the same mutation; the App-Constants UI path was not
exercised end-to-end due to time.)
### C. Customer app (user-ui in Expo Go), per region
**Region 1 — Mahabubnagar, GPS bound 1 (`16.7489,77.9856`)**
1. Logged out, restarted, relaunched → region resolved to **Mahabubnagar**. PASS.
2. Region products shown (plus global). Stores list included the newly-global `E2E Store R1`. PASS.
3. Added `Chicken Breast 500 g`, slot `Wed 14 Oct 4-5 PM`; cart showed `Delivery Fee ₹20` +
"Add products worth ₹67 for free delivery" (233→300). PASS (bound-1 threshold/charge).
4. Order placed: **#ORD2544**, region 1, total **₹253** (233 − 6 + 20). PASS (verified via
`user.order.getOrders`).
**Region 1 → Region 2 — Mahabubnagar → Jadcherla, manual map address**
5. Added address "Jadcherla Manual" using the map's top-right **+ / − (Zoom in / Zoom out)**
controls only (no pinch): selected `16.74880,78.14166` — inside Jadcherla bound 3.
Saved as address #888 (region 2, bound 3). PASS — but see DEFECT-2 (blank screen after save).
6. Switched region via the Deliver-to / address switcher → **Jadcherla**; region products shown
and `E2E Store R2` (region-2 store) appeared in Our Stores. PASS.
7. Added a second address "R2 Bound2 Manual" → `16.73828,78.13754` (Jadcherla bound **4** only).
Saved as address #889 (region 2, bound 4). PASS (blank screen again after save).
8. Threshold/charge change in the same region:
- address `jcl 1` (bound 3): Delivery Fee **₹20**, "add ₹51 for free delivery" (249→300).
- address `R2 Bound2 Manual` (bound 4): Delivery Fee **₹30**, "add ₹351 for free delivery"
(249→600), To Pay 269→**279**. PASS.
**Region 3 — Wanaparthy, GPS bound 5 (`16.348,78.056`)**
9. Launch at a location whose region has no saved address → the "Choose a saved address, or add
a new one. Your region follows the address." chooser was shown (LOC-19(b) behaviour). PASS.
10. Added "Wanaparthy Home" from the current-location form (city auto-set to Wanaparthy) →
region switched to **Wanaparthy**; `E2E Store R3` appeared. PASS.
11. `E2E Product R3` shown (₹149/₹199, 750 g); cart bar "₹200 more for FREE Delivery"
(bound 5 threshold 200). PASS.
12. Added to cart: Delivery Fee **₹15**, "add ₹51 for free delivery" (149→200). PASS.
13. Order placed: **#ORD2545**, region 3, total **₹164** (149 − 50 + 15). PASS (API-verified).
Cart address switching requires horizontal carousel swipes (6 addresses); needed 3–5 swipes in
the cart (guideline note about the carousel refusing to advance still applies — it worked only
with repeated `90%,y → 10%,y` swipes).
## Findings
**DEFECT-1 (major) — global SKUs get no delivery slot in the cart.**
`user.cart.getCartSlots` keys slots by the SKU's *product* `regionId`; global products have
`regionId = null`, so they are dropped before the slot lookup.
Probe (region 1 cart):
```
user.cart.getCartSlots {productIds:[2]} -> slots (regional SKU)
user.cart.getCartSlots {productIds:[102]} -> {} (global)
user.cart.getCartSlots {productIds:[30]} -> {} (global)
user.cart.getCartSlots {productIds:[151]} -> {} (elevated/global)
user.cart.getCartSlots {productIds:[152]} -> slots (regional SKU)
```
Effect: after "Elevate a product to global", the product shows in the cart but renders
"No delivery slots available" and cannot be ordered in the regular scheduled flow (global
products are affected in every region, not just the elevated one). The scheduled order in
region 1 therefore used a regional product (`Chicken Breast 500 g`) instead of `E2E Product R1`.
**DEFECT-2 (moderate) — blank screen after saving a new address.**
After submitting the Add-Address form (map-picked location), user-ui goes to an empty white
screen (`app-root` has no children) for both "Jadcherla Manual" and "R2 Bound2 Manual". The
address is persisted correctly; the app only recovers after terminating Expo Go and re-opening
`exp://127.0.0.1:8081`. Reproduced twice.
**DEFECT-3 (minor) — elevated product has no market rows for other regions.**
`E2E Product R1` (#151) shows `UNAVAILABLE` on the region-2 and region-3 search results after
elevation (only region 1 received `sku_market_stats`); it is orderable in none of them anyway
because of DEFECT-1.
**Harness limitations (BLOCKED, not FAIL):**
- Web native `<select>` (staff role/region) — options render at `[100000,*]`; only text-selected
role worked.
- Web `window.confirm` (elevation) — blocking JS dialog; Maestro `inspect_screen` breaks until
the page is reloaded.
- iOS inline date/time picker (admin slot times) — wheels expose only the current value.
- `hideKeyboard` fails on numeric keypads; workaround is to focus an alphabetic field first, or
tap the on-screen Return key.
## Fixtures created this run (left in place)
Regions/bounds pre-existing. New: staff 11/12/13; store #10 (now global), stores #11 (region 2)
and #12 (region 3); products/SKUs 151 (global), 152 (region 2), 153 (region 3);
slots 2068/2069/2070; bound settings for bounds 1–6; addresses 888/889/890 for customer 388;
orders 2544 (region 1) and 2545 (region 3).
## Cleanup done
Simulated iOS location cleared (`xcrun simctl location <udid> clear`).
## Not run / not verified
- Region 1 bound-2 fee/threshold change in the customer UI (only region 2's bound 2 was
exercised).
- Flash-delivery flows, coupons, cancellation, and the wider `docs/test-cases` catalog.
- Admin-ui App-Constants thresholds screen and admin-ui slot creation end-to-end via touch.
---
# Re-test — 2026-10-14 ~16:30 (after the reported fixes)
Driver: Maestro MCP against the live stack (Expo Go user-ui :8081 / admin-ui :8082,
backend :8787, superadmin-ui :4175).
## The three reported bugs
| # | Bug | Result | Evidence |
|---|---|---|---|
| DEFECT-1 | `user.cart.getCartSlots` returned `{}` for global SKUs → global/elevated products got no slot and couldn't be ordered | **FIXED** | Search "Basa Fish Fillets" (global SKU 102) → "Select Delivery Slot" sheet listed 3 slots; added with slot *Wed, 14 Oct 6-7 PM*; cart billed Item ₹498, Delivery ₹20, "Free", To Pay ₹498. Live `getCartSlots` now takes a `regionId` and returns slots for 102. |
| DEFECT-2 | Blank white screen after saving a new address picked on the map | **FIXED** | Added "Bug2 Retest" at `16.71461,77.98510` (region 1, **bound 2**) via the map ± zoom + tap → after submit the app landed on **My Addresses** (no blank screen). Address #891 persisted (`regionId 1, boundId 2`). |
| DEFECT-3 | Elevated product had no `sku_market_stats` outside region 1 → `UNAVAILABLE` in regions 2/3 | **FIXED** | `superadmin.products.list` for *E2E Product R1* (#151) now shows marketStats for regions **1, 2 and 3** (all ₹199, not suspended). In-app region-2 search now shows a price; the residual "Out of Stock/UNAVAILABLE" badge there is slot-driven (no active region-2 slot contains SKU 151), not a market-row problem. |
## Previously-pending items
| Item | Result | Evidence |
|---|---|---|
| Region 1 **bound-2** free-delivery threshold + charge in the customer UI | **PASS** | Same cart (Chicken Breast ₹233): default address (bound 1) → Fee **₹20**, "add ₹67 for free delivery" (→₹300). Switched to "Bug2 Retest" (bound 2) → Fee **₹40**, "add ₹267 for free delivery" (→₹500). Bound-1 vs bound-2 separation confirmed. |
| Admin-ui **slot creation end-to-end via touch** (was HARNESS-BLOCKED on the iOS picker) | **PASS** | Dashboard → Slots → `add-slot-fab` → date pickers → selected delivery **20 Oct 2026**, freeze **15 Oct 2026**, 2 products (Chicken Breast 500 g, Chicken Breast Boneless – Mini Pack) → "Slot created successfully!". Verified: slot **#2071**, delivery `2026-10-20T13:10Z`, freeze `2026-10-15T11:15Z`, 2 products, active. |
| Admin-ui **App-Constants thresholds screen** | **PASS** | `exp://127.0.0.1:8082/--/dashboard/customize-app` renders "Customize App / Region: Mahabubnagar / Bound" with per-bound tabs **Mbnr-1 (Priority 1, EFFECTIVE)** and **Mbnr-2 (Priority 2)** and the four fields (Free Delivery Threshold, Delivery Charge, Flash Free Delivery Threshold, Flash Delivery Charge) + Save Changes. |
## New findings
**FINDING-A (surface/runtime mismatch, blocking source-level verification).** The live backend
behaves differently from the files in this working copy:
- live `user.cart.getCartSlots` **requires** `regionId` (missing → zod BAD_REQUEST);
`apps/backend/src/trpc/apis/user-apis/apis/cart.ts` only accepts `productIds`.
- `packages/db_helper_sqlite/src/user-apis/product.ts#getSkuRegionIds` still drops
`row.product.regionId == null`, i.e. it has no global-SKU handling.
So the fixes are present in the **running** backend/Metro bundles but not in the checked-out
sources here. All results above are behavioural against the live stack. **Restarting the
backend (and Metro) would run the on-disk code and likely reintroduce DEFECT-1/DEFECT-3** —
reconcile the working tree before restarting.
**FINDING-B (picker UX, admin-ui).** In `packages/ui/src/components/date-time-picker.tsx` the iOS
Modal's **Done** button only calls `setShow(false)`; the value is committed solely by the
picker's `onChange`. Opening a field and pressing Done leaves it unset → the slot form rejects
with "Please fill all fields". Done should also commit (`setValue(pendingValue ?? value ?? new Date())`).
## Test artifacts left behind
- Address **#891** "Bug2 Retest" (customer 388, region 1 / bound 2).
- Slot **#2071** (region 1, delivery 20 Oct, 2 SKUs) — created by the admin-ui test.
- Cart: one Chicken Breast 500 g line (region 1, customer app) from the threshold test.
- Simulated location reset to bound 1 during the run.