enh
This commit is contained in:
parent
8e4e3752a6
commit
8017b27eb1
6 changed files with 649 additions and 9 deletions
|
|
@ -242,12 +242,14 @@ export const commonApiRouter = router({
|
|||
return effective
|
||||
}),
|
||||
|
||||
// The active bound for a region: the least-priority bound among the user's
|
||||
// addresses in that region, else the region's effective (least-priority) bound.
|
||||
activeBound: protectedProcedure
|
||||
// The active bound for a region: for a signed-in user it is the least-priority
|
||||
// bound among their addresses in that region; signed-out users get the
|
||||
// region's effective (least-priority) bound.
|
||||
activeBound: publicProcedure
|
||||
.input(z.object({ regionId: z.number().int().positive() }))
|
||||
.query(async ({ ctx, input }): Promise<{ regionId: number; boundId: number | null }> => {
|
||||
const addresses = await getUserAddresses(ctx.user.userId)
|
||||
const userId = ctx?.user?.userId
|
||||
const addresses = userId ? await getUserAddresses(userId) : []
|
||||
const boundIds = new Set(
|
||||
addresses
|
||||
.filter((address) => address.regionId === input.regionId && address.boundId != null)
|
||||
|
|
|
|||
30
apps/user-ui/ios/.gitignore
vendored
Normal file
30
apps/user-ui/ios/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# OSX
|
||||
#
|
||||
.DS_Store
|
||||
|
||||
# Xcode
|
||||
#
|
||||
build/
|
||||
*.pbxuser
|
||||
!default.pbxuser
|
||||
*.mode1v3
|
||||
!default.mode1v3
|
||||
*.mode2v3
|
||||
!default.mode2v3
|
||||
*.perspectivev3
|
||||
!default.perspectivev3
|
||||
xcuserdata
|
||||
*.xccheckout
|
||||
*.moved-aside
|
||||
DerivedData
|
||||
*.hmap
|
||||
*.ipa
|
||||
*.xcuserstate
|
||||
project.xcworkspace
|
||||
.xcode.env.local
|
||||
|
||||
# Bundle artifacts
|
||||
*.jsbundle
|
||||
|
||||
# CocoaPods
|
||||
/Pods/
|
||||
|
|
@ -98,7 +98,7 @@ export function useRegion(): UseRegionResult {
|
|||
// does not know bound priorities).
|
||||
const activeBoundQuery = trpc.common.activeBound.useQuery(
|
||||
{ regionId: regionId ?? 0 },
|
||||
{ enabled: hydrated && regionId != null && isAuthenticated, staleTime: 60000 }
|
||||
{ enabled: hydrated && regionId != null, staleTime: 60000 }
|
||||
)
|
||||
const activeBoundId = activeBoundQuery.data?.boundId ?? region?.effectiveBoundId ?? null
|
||||
|
||||
|
|
@ -155,10 +155,15 @@ export function useRegion(): UseRegionResult {
|
|||
// Respect a manual pick made before the fix resolved.
|
||||
const userChangedRegion =
|
||||
startupLaunchRegionId !== undefined && startupLaunchRegionId !== regionId
|
||||
if (resolved?.region && !userChangedRegion && resolved.region.id !== regionId) {
|
||||
// New region -> full switch (clears carts, refreshes regional data). The
|
||||
// active bound is derived separately from the user's addresses.
|
||||
void confirmRegionSwitch(resolved.region, queryClient)
|
||||
if (resolved?.region && !userChangedRegion) {
|
||||
if (resolved.region.id !== regionId) {
|
||||
// New region -> full switch (clears carts, refreshes regional data).
|
||||
void confirmRegionSwitch(resolved.region, queryClient, resolved.bound?.id ?? null)
|
||||
} else if (resolved.bound && resolved.bound.id !== boundId) {
|
||||
// Same region -> refresh the active bound from the location resolve
|
||||
// (signed-out users get their bound from here; no cart clear).
|
||||
setRegion(resolved.region, resolved.bound.id)
|
||||
}
|
||||
}
|
||||
}, [
|
||||
hydrated,
|
||||
|
|
@ -168,6 +173,8 @@ export function useRegion(): UseRegionResult {
|
|||
resolution.isError,
|
||||
locationStatus,
|
||||
regionId,
|
||||
boundId,
|
||||
setRegion,
|
||||
queryClient,
|
||||
])
|
||||
|
||||
|
|
|
|||
|
|
@ -1329,3 +1329,30 @@ user-ui
|
|||
brand icon, semibold text).
|
||||
|
||||
[2026-10-09 13:30:00] user-ui checkout: add a "Back to Cart" button above the Place Order button.
|
||||
|
||||
[2026-10-09 13:40:00] BUG B02 fix: signed-out users had no active bound (consts/products empty).
|
||||
- common.activeBound publicProcedure: signed-in -> least-priority address bound; signed-out -> region effective bound.
|
||||
- useRegion: propagate the location-resolved bound again (same-region -> setRegion(region,bound.id);
|
||||
region change -> confirmRegionSwitch(region,qc,resolved.bound.id)); activeBound query no longer auth-gated.
|
||||
|
||||
[2026-10-10 12:35:00] Testing session round 1 (docs/test-cases-multi-region.md).
|
||||
- Verified: superadmin login + regions editors (SU-1..SU-3), user-app fresh-start region resolve,
|
||||
me-tab login wall, wall -> login navigation (U-1, U-6 Me-tab, U-7 up to credentials).
|
||||
- Found + fixed B02 (signed-out users had no active bound -> no consts/products; activeBound now
|
||||
public + location bound propagated). Verified products + free-delivery threshold on device.
|
||||
- Blocked: password typing into the secure field on the iOS simulator never lands (harness quirk);
|
||||
password login could not be automated -> cart/checkout cases pending a manual sign-in or OTP.
|
||||
- Environment notes: openLink required for chromium flows; scrollUntilVisible on the admin regions
|
||||
page; text-node assertions unreliable on the RN app -> driven by point-taps + screenshots.
|
||||
|
||||
[2026-10-10 00:20:52 +0530] Added docs/e2e-sanity-test-plan.md following workflow/code inspection.
|
||||
- Cross-app journey checklist covering configuration, auth, catalog publication, slots, carts,
|
||||
addresses/bounds, bill parity, coupons, COD fulfillment, flash, vendors, support and recovery.
|
||||
- Separate API authorization/invariant release gates and future payment/refund readiness cases.
|
||||
- Recommended daily sanity subset, staging fixtures, bounded cache waits, evidence and policy gaps.
|
||||
- No application source changed; no tests, migrations or git commands executed.
|
||||
|
||||
[2026-10-10 00:31:41 +0530] Updated docs/e2e-sanity-test-plan.md per user request.
|
||||
- All login/setup flows are password-only; OTP/SMS testing explicitly excluded.
|
||||
- Replaced OTP authentication and OTP-created-account cases with password identifier
|
||||
coverage and password-change/re-login coverage, preserving existing case IDs.
|
||||
|
|
|
|||
364
docs/e2e-sanity-test-plan.md
Normal file
364
docs/e2e-sanity-test-plan.md
Normal file
|
|
@ -0,0 +1,364 @@
|
|||
# Freshyo cross-app E2E sanity and regression plan
|
||||
|
||||
Status: proposed checklist from code inspection; these cases have NOT been executed as part of this review.
|
||||
|
||||
## Scope and approach
|
||||
|
||||
This plan follows the customer-facing and operational flows in `apps/admin-ui`,
|
||||
`apps/admin-web`, `apps/user-ui`, `apps/web-ui`, `apps/superadmin-ui`, the vendor
|
||||
page in `apps/fallback-ui`, the backend tRPC routers, SQLite helpers, schema,
|
||||
regional cache generation, and existing E2E flows. It is a workflow review, not
|
||||
a claim that every source/generated/dependency file has been read line by line.
|
||||
|
||||
The important E2E chain is:
|
||||
|
||||
**Superadmin configuration → admin changes → DB/cache publication → customer
|
||||
discovery → cart/checkout → persisted order → admin/vendor fulfillment → customer status.**
|
||||
|
||||
A success toast alone is not proof. Check the result in the other app, and for
|
||||
money/ownership tests also check authoritative API data. Do not mock the backend
|
||||
in these E2E journeys. Mocked screen/component tests remain a separate layer.
|
||||
|
||||
### Test fixtures
|
||||
|
||||
- Dedicated staging backend, DB, KV, assets, queues and notification destinations.
|
||||
Never point mutation, account-deletion, notification or payment tests at production.
|
||||
- Two regions, A and B, each with its own admin and store. Customer identity is
|
||||
global; catalog, slots, orders and operational access are region-sensitive.
|
||||
- A has two bounds A1/A2 with priorities 1/2 and deliberately different charges.
|
||||
B has B1. Include an overlapping polygon and a point outside every polygon.
|
||||
- Customers U1/U2 plus a fresh customer with no addresses or orders. Use disposable
|
||||
accounts for suspension, password changes, first-order and deletion cases.
|
||||
- Product P with two SKU variants; product Q; an offer; a combo with a combo-only
|
||||
component; one regular-only SKU; one flash SKU with a distinct flash price.
|
||||
- Two active scheduled slots S1/S2 with future freeze times, plus an inactive slot,
|
||||
a frozen slot and a full-capacity slot. Assign SKUs explicitly.
|
||||
- Unique run prefix for product/tag/coupon/snippet names. Product and tag duplicate
|
||||
checks are currently global; do not assume the same name is allowed in B.
|
||||
- Freeze/delivery times relative to run start with generous margins. Separately
|
||||
exercise midnight/IST transitions; do not rely on hardcoded dates or slot IDs.
|
||||
|
||||
### How to run this plan eventually
|
||||
|
||||
- All login flows use password authentication only. OTP login, OTP delivery and
|
||||
OTP verification are out of scope; do not trigger SMS as part of test setup.
|
||||
- Provision test customers with passwords and read credentials from test
|
||||
environment variables, not hardcoded flow files.
|
||||
- Maestro: admin/customer native apps; Playwright or Maestro Chromium: web apps.
|
||||
A coordinator should carry region/product/SKU/slot/order IDs between app flows.
|
||||
- Use UI setup when testing creation itself. For independent checkout/edge cases,
|
||||
use a sanctioned staging fixture API so every test does not recreate all data.
|
||||
- Reusable flows: sign in, select region, create product, create slot, add address,
|
||||
add item, place COD order, find order by ID, cancel disposable order.
|
||||
- Prefer stable `testID`/accessible labels, including dynamic IDs based on entity
|
||||
IDs. Avoid percentage taps and matching the first product/address in a list.
|
||||
- Wait for business state with a bounded deadline. Catalog regeneration is
|
||||
debounced by roughly 30 seconds (`CacheCreator`), and constants polling is
|
||||
60 seconds; allow a configurable staging deadline, initially 120 seconds.
|
||||
Refresh discovery/catalog when appropriate; do not replace checks with sleeps.
|
||||
- Run publication assertions on both a fresh customer session and an already-open
|
||||
session. Do not clear customer storage before a persistence/recovery test.
|
||||
- Record run ID, input fixtures, expected/actual totals, entity IDs, screenshots,
|
||||
and failure step. Harness errors are BLOCKED, not PASS or proven app defects.
|
||||
- Cleanup only this run's disposable data using approved fixture tooling. Keep
|
||||
screenshots and failing fixtures for diagnosis. Do not run migrations as setup.
|
||||
|
||||
## Recommended daily sanity subset
|
||||
|
||||
Start with these 20 cases, reusing safe baseline fixtures where possible:
|
||||
|
||||
`RG-01`, `RG-03`, `RG-06`, `AU-01`, `AU-02`, `PD-01`, `PD-02`, `PD-05`,
|
||||
`DS-01`, `SL-01`, `SL-05`, `CT-01`, `CT-04`, `AD-01`, `AD-05`, `BL-01`,
|
||||
`CP-01`, `OR-01`, `OR-04`, `FL-01`.
|
||||
|
||||
These cover startup, authentication, publication, region isolation, availability,
|
||||
cart persistence, addresses/bounds, money, coupons, COD, fulfillment and flash.
|
||||
Run the full checklist before release; mandatory API security checks should also
|
||||
be a release gate. High-risk financial cases deserve priority even if slower.
|
||||
|
||||
## A. Regions, bounds and configuration
|
||||
|
||||
| ID | Steps / journey | Required result |
|
||||
|---|---|---|
|
||||
| RG-01 | Superadmin creates region A with a valid bound → assigns an admin → customer opens region selector and selects A. | A is discoverable; configuration/cache loads without undefined amounts or broken asset requests. An empty catalog has an intentional empty state. |
|
||||
| RG-02 | Try creating a region without bounds; add malformed GeoJSON or duplicate bound priorities. | Validation explains the error; no half-created region/configuration remains. |
|
||||
| RG-03 | Fresh customer launch with GPS inside A, first signed out and then signed in. | A resolves once; catalog and delivery threshold load without needing login. |
|
||||
| RG-04 | Deny GPS, return an outside-service point, or make resolution time out; repeat with/without a saved region. | Saved region survives when location is unusable; otherwise a usable manual chooser appears, not an endless spinner. |
|
||||
| RG-05 | Delay GPS resolution → manually select B before the response → let A's GPS response arrive. | Late startup response does not undo the customer's manual choice. |
|
||||
| RG-06 | Create distinct products/stores/slots/tags/banners in A/B → browse A, then B, then A. | Each region shows only its own content; no cached content/prices from the previous region leak. |
|
||||
| RG-07 | Add regular and flash items in A → request switch to B → cancel, then repeat and confirm. | Cancel preserves A and both carts; confirm clears both carts and address/slot selections and loads B. |
|
||||
| RG-08 | Keep the app open → move GPS from A to B → later cold-launch from B. | No continuous automatic switching while open; cold launch performs the one-shot resolution and resets regional state if changing region. |
|
||||
| RG-09 | Give U1 addresses in A1/A2 → sign in/browse A; remove an eligible nondefault address and refresh; repeat with no A addresses. | Active browsing bound is lowest numeric priority among U1's A address bounds, else A's effective bound. B addresses do not participate. |
|
||||
| RG-10 | Superadmin changes A1/A2 priorities, then edits A1 charge; separately edit A's support/welcome/flash settings and global app version. | Effective bound changes as specified; bound edit affects that bound, region edit affects A's bounds, global edit affects all regions; B's regional settings stay unchanged. |
|
||||
| RG-11 | Resolve GPS in overlapping bounds and on a polygon edge → compare with active-bound selection from addresses. | Geo-resolution follows numeric priority within a region; browsing prices follow address/effective-bound rules, not an accidental GPS-bound override. Define cross-region overlap policy separately. |
|
||||
|
||||
## B. Authentication and account lifecycle
|
||||
|
||||
| ID | Steps / journey | Required result |
|
||||
|---|---|---|
|
||||
| AU-01 | Signed-out customer browses/searches/products → opens Cart and Me. | Public browsing works; Cart and Me show login walls without forced redirects; other tabs remain usable. |
|
||||
| AU-02 | From Cart wall, use password login → repeat from Me wall. | Correct credentials sign in and return to the originating screen; cart contents survive the sign-in. No OTP is sent by the password shortcut. |
|
||||
| AU-03 | Submit wrong password, malformed mobile and unaccepted terms → correct them and retry. | Clear validation/auth error; no authenticated state from a failure; retry succeeds. |
|
||||
| AU-04 | Password-login using each supported identifier (mobile/email) on a password-provisioned customer; try an unknown identifier and then valid credentials. | Supported identifiers authenticate the same account; unknown credentials fail cleanly; no SMS is triggered. |
|
||||
| AU-05 | Register a disposable customer → try duplicate mobile/email and invalid inputs → sign in using supported identifiers. | Registration persists exactly once; duplicates/errors do not create incomplete accounts. |
|
||||
| AU-06 | Sign in → cold-launch → log out → sign in as U2. | Session persistence is correct; logout restores walls; U2 cannot see U1's addresses/orders/coupons or submit with U1's checkout selections. Explicitly decide local cart behavior on account switch. |
|
||||
| AU-07 | Edit name/profile fields and profile image → relaunch → inspect customer in admin. | Saved values/images agree across profile and admin customer details. |
|
||||
| AU-08 | Password-authenticated disposable customer changes password → signs out → tries old password → signs in with new password. | New password works, old password fails, and the customer can recover from the failed attempt without losing account data. |
|
||||
| AU-09 | Admin suspends U1 while U1 has a populated cart → U1 attempts order → admin unsuspends → retry. | Suspended user cannot place order, including with an existing token; unsuspension restores allowed behavior. |
|
||||
| AU-10 | Disposable customer requests account deletion with wrong mobile, then correct mobile → relaunch/re-authenticate. | Wrong confirmation is rejected; successful deletion logs out and leaves no access to the deleted account. Verify order-retention policy without damaging shared fixtures. |
|
||||
|
||||
## C. Stores, products, variants, offers and combos
|
||||
|
||||
| ID | Steps / journey | Required result |
|
||||
|---|---|---|
|
||||
| PD-01 | Admin A creates a store with image → creates P with two SKUs/images/features/prices → creates active future slot with those SKUs → customer selects A and searches P. | Correct variants, price, unit/features, store, images and delivery slot appear; item can be added. Also inspect store detail, not only Home. |
|
||||
| PD-02 | With P published in A, customer selects B; admin B opens product/store/slot lists and selectors. | P/A's store and slot do not appear anywhere in B. |
|
||||
| PD-03 | Admin edits P's name/descriptions/features/variant image → customer refreshes list and detail. | Latest content is consistent in Home/search/store/detail; replaced images do not stay stale or break other variants. |
|
||||
| PD-04 | Create duplicate product name, missing SKU features, missing store or nonpositive price → then submit valid product. | Invalid save is rejected without partial product/SKU rows; valid retry creates exactly one product. |
|
||||
| PD-05 | Put P in customer cart → admin marks its SKU out of stock → customer refreshes → admin restores stock. | Unavailable state propagates, blocked item is not ordered/charged; restoration makes the SKU usable without reinstalling. |
|
||||
| PD-06 | Admin suspends or soft-deletes one SKU of multi-SKU P → browse/search/detail and existing cart. | Removed SKU is no longer purchasable; sibling SKU remains usable; no phantom payable cart line or crash. |
|
||||
| PD-07 | Admin adds a third SKU → assigns it to a slot → later removes that SKU. | New variant is discoverable and orderable; removal does not corrupt old orders or remaining variants. |
|
||||
| PD-08 | Admin changes regular/MRP/flash prices via Prices Overview → customer with P already in cart refreshes. | Availability-only publication updates card/detail/cart prices; flash uses flash price; B is unchanged. |
|
||||
| PD-09 | Admin toggles P's Offer flag → customer opens Offers tab and detail → remove flag. | SKU appears/disappears in Offers correctly, with working Add to Cart and price. The `order-again` route is currently this Offers screen. |
|
||||
| PD-10 | Admin creates combo C with component SKUs → schedules C → customer opens Combos, detail and purchases C. | Correct components/features/images and combo price; ordered line is the intended combo SKU, not duplicate component charges. |
|
||||
| PD-11 | Mark a component combo-only → publish C → search Home/store/Offers and open C. | Component is hidden as a standalone purchasable SKU but remains represented inside C. |
|
||||
| PD-12 | Make combo component unavailable/suspended/deleted → inspect C and attempt checkout; restore component. | Agreed combo availability policy is enforced consistently, without silently selling invalid components. This policy needs explicit confirmation. |
|
||||
| PD-13 | Admin edits store name/image → customer refreshes Stores and P detail; try deleting a store with products. | Store changes propagate; deletion is either safely rejected or follows an explicit dependency policy, never orphaning a broken customer catalog. |
|
||||
|
||||
## D. Discovery, tags, groups, ordering and banners
|
||||
|
||||
| ID | Steps / journey | Required result |
|
||||
|---|---|---|
|
||||
| DS-01 | Admin creates dashboard tag with image, P/Q and related store → customer opens its Home section. | Correct category/image/products/store links; no unrelated regional SKUs. |
|
||||
| DS-02 | Edit tag membership and product order → customer refreshes → delete tag. | Membership/order propagate; deleted tag disappears without hiding products from unrelated sections. |
|
||||
| DS-03 | Admin reorders dashboard tags (`tagsOrder`) in A → browse A and B. | A follows its saved order; B retains its own order. No global tag-order override. |
|
||||
| DS-04 | Admin sets Popular Items and All Items Order → refresh customer Home. | Configured visible SKUs appear in intended order; removed/unavailable IDs do not crash the section. |
|
||||
| DS-05 | Create product group containing P/Q → attach group to slot → edit group's membership → inspect customer slot view. | Intended group-to-slot behavior holds for additions/removals. Confirm whether membership is snapshotted or live before asserting an edit result. |
|
||||
| DS-06 | Create banner with image/P/Q → first inspect while inactive → activate → tap it. | Inactive banner is not presented as active; active banner routes to intended products/content with matching image. |
|
||||
| DS-07 | Edit banner image/link/order → deactivate or delete → customer refreshes. | New content/navigation/order propagate; removed/inactive banners no longer produce broken navigable content. Verify serial/order and active-flag semantics. |
|
||||
| DS-08 | Search exact/partial product and SKU names, no-match text, and a B-only product while in A; navigate result to detail and add. | Results and details are region-correct; no-match state is useful; selected result is the SKU actually added. |
|
||||
|
||||
## E. Scheduled slots and capacity
|
||||
|
||||
| ID | Steps / journey | Required result |
|
||||
|---|---|---|
|
||||
| SL-01 | Admin creates active S1 with future freeze/delivery and P/Q → customer opens slot view and add-item dialog. | Only assigned SKUs offer S1; shown delivery/close times match admin values in local time. |
|
||||
| SL-02 | Admin adds/removes a SKU on S1 and edits delivery/freeze time → customer refreshes. | Membership and timing update on all entry points; removed SKU cannot retain a purchasable S1 assignment. |
|
||||
| SL-03 | Create inactive, past-delivery and past-freeze slots → customer checks dialog/cart/slot view. | They cannot be selected for a new order; deliberate existing-order history still renders. |
|
||||
| SL-04 | Add P to S1 → let freeze time pass before checkout → refresh or submit directly from stale checkout. | Customer is prompted to choose a valid alternative or blocked; backend must not accept a closed slot merely because the UI was stale. |
|
||||
| SL-05 | Admin marks S1 full → customer checks P's slot choices; repeat while customer's checkout is already open. | Full slot is removed/disabled and stale submission is rejected without creating an order. |
|
||||
| SL-06 | Admin reopens S1 capacity → customer refreshes and places order. | S1 becomes selectable and orderable again. |
|
||||
| SL-07 | P has S1/S2 → add using S1 → make S1 invalid → relaunch or open cart. | Valid fallback is selected consistently without deleting P or changing its quantity; if none remain, line is unavailable and not charged. |
|
||||
| SL-08 | Create slot across midnight/IST boundary → compare admin, customer selection, checkout and saved order. | Exact date/instant is preserved, not yesterday/tomorrow due to timezone conversion. |
|
||||
|
||||
## F. Cart, quantities and checkout summary
|
||||
|
||||
| ID | Steps / journey | Required result |
|
||||
|---|---|---|
|
||||
| CT-01 | Add P from Home → add Q from Search/Store → inspect floating bar, expanded bar and full Cart. | Same SKU identities/quantities/subtotals everywhere; no duplicate or missing line from entry-point differences. |
|
||||
| CT-02 | Add existing P again, then use Update Item → inspect quantity and totals. | Duplicate add merges by SKU as intended; explicit update sets quantity instead of accidentally adding twice. |
|
||||
| CT-03 | Increase/decrease quantity in dialog, floating bar and cart; test product increment step and zero removal/cancel-removal. | Consistent allowed quantities and totals; zero removes only after confirmed UI behavior. Fractional increments need an explicit contract because order input currently requires integers. |
|
||||
| CT-04 | Add multiple lines → cold-launch without clearing storage → open Cart before/after catalog loads. | Lines appear automatically as stores load; no permanent empty cart, manual-refresh dependency or lost quantities. |
|
||||
| CT-05 | Assign P/Q different slots → change cart slot → leave/re-enter Cart and go to Checkout. | Slot selection remains as promised by product policy; no silent reversion or extra quantity from reconciliation. |
|
||||
| CT-06 | Keep both regular and flash carts populated → edit/remove one → navigate back and forth. | Carts remain independent; no conversion, duplicated additions or unexpected deletion of the other cart. |
|
||||
| CT-07 | Admin makes one of several cart items unavailable → customer proceeds; repeat with all unavailable. | Partial checkout clearly identifies actual ordered/charged items; all-invalid cart blocks checkout. Verify whether remaining invalid lines should survive successful checkout. |
|
||||
| CT-08 | Enter instructions on Cart → select address/coupon → go to Checkout → Back to Cart → edit instructions → return. | Instructions survive and the latest value is submitted; Checkout is read-only for items/slots/address/coupon/instructions. |
|
||||
| CT-09 | Inspect Cart layout → Checkout layout → use Back to Cart. | Address selector is above Bill Details, instructions editor is on Cart, hidden “Go to 1 Hr Delivery” switcher stays absent; Checkout shows grouped summary and valid back navigation. |
|
||||
| CT-10 | Rapidly add two different SKUs and repeatedly tap quantity controls → reload Cart. | No lost storage updates, duplicate local IDs, negative quantities or stale floating count. |
|
||||
| CT-11 | Change quantity/coupon/slot on Cart after visiting Checkout → reopen Checkout; try stale/direct checkout URL. | Latest valid selection is summarized and submitted; malformed/stale route parameters do not order a different or empty cart. |
|
||||
|
||||
## G. Addresses, location attachment and selected-bound rules
|
||||
|
||||
| ID | Steps / journey | Required result |
|
||||
|---|---|---|
|
||||
| AD-01 | Fresh customer adds first address while browsing A, without checking Default → inspect Me and Cart. | Address belongs to A and becomes default; Cart can select it and Checkout shows correct contact/address. |
|
||||
| AD-02 | Add second address → make it default → edit contact/address → relaunch. | Exactly one default persists; edits do not accidentally unset the only default or select an unrelated address. |
|
||||
| AD-03 | Submit missing fields, bad phone/pincode and no region → correct and save. | Clear validation; no partial saved address; retry succeeds once. |
|
||||
| AD-04 | Add address without coordinates → inspect “No Location is attached to address” → attach GPS location; repeat denying permission and using a supported Maps link. | Missing-location notice is accurate; successful attachment persists; denied/invalid-link path is recoverable without overwriting address data. Define whether missing coordinates block ordering. |
|
||||
| AD-05 | U1 has A1/A2 addresses → select A2 on Cart → compare fee before/after selection → place order. | Selected address's bound overrides browsing active bound; catalog remains A; saved order total agrees with A2 config. |
|
||||
| AD-06 | While browsing A, explicitly choose B as a new address's region; separately edit an existing B address while browsing A. | Address region and bound are coherent; editing preserves/derives the correct bound, never borrowing A's current browsing bound for B. |
|
||||
| AD-07 | A cart populated, default address in B → load address selector → explicitly tap B address → cancel, then confirm. | No automatic foreign-default selection; cancel retains A/cart; confirm switches B, clears both carts and returns Home. |
|
||||
| AD-08 | Delete nondefault unused address → try default and address attached to ongoing order → cancel/finish order, change default and retry. | Allowed deletion persists; protected deletions explain how to proceed; selected deleted address cannot remain usable at checkout. |
|
||||
| AD-09 | Add/edit/delete address whose bound controls active-bound choice → refresh discovery and relaunch. | Active bound recalculates and prices/fees update without stale user/address cache. Selected-address override remains internally consistent. |
|
||||
|
||||
## H. Bill arithmetic and bound-specific fees
|
||||
|
||||
Use different `minRegularOrderValue` and `freeDeliveryThreshold` values, distinct
|
||||
regular/flash prices, and at least one two-slot cart. Equal fixture values can hide bugs.
|
||||
|
||||
| ID | Steps / journey | Required result |
|
||||
|---|---|---|
|
||||
| BL-01 | Set bound delivery threshold T and fee D → order subtotal T−1, T and T+1 without coupon. | Same fee rule in floating bar, Cart, Checkout, success, persisted order and admin details; exact threshold boundary is correct. |
|
||||
| BL-02 | Set regular minimum M different from free threshold T → try totals below M, between M/T and above both. | Intended minimum-order policy is explicit and enforced; free-delivery threshold is not accidentally replaced by minimum order. |
|
||||
| BL-03 | Coupon lowers subtotal from above T to below T → repeat with post-coupon total exactly T. | Agreed pre/post-discount fee policy holds on client and backend, including boundary. |
|
||||
| BL-04 | P/Q in S1/S2, paid delivery and coupon → place order → sum all generated order totals and fees. | One checkout creates expected slot suborders; total fee is charged only once, coupon is allocated correctly, summed total equals displayed To Pay. |
|
||||
| BL-05 | Use noninteger prices/percentage discounts and several quantities → compare previews and persisted amounts. | Consistent rounding/currency precision; truncation in labels does not conceal overcharge or contradictory success totals. |
|
||||
| BL-06 | Select A1 then A2, with visibly different charges/thresholds → repeat regular and flash checkout. | Correct bound's fees and nudges are used, including free crossed-out fee; no undefined/NaN/negative totals. |
|
||||
| BL-07 | Customer opens Checkout → admin changes SKU price or selected-bound fee → submit. | No silent difference between quoted and authoritative total; agreed reprice/refresh/confirmation policy is followed. |
|
||||
|
||||
## I. Coupons and offers on orders
|
||||
|
||||
| ID | Steps / journey | Required result |
|
||||
|---|---|---|
|
||||
| CP-01 | Admin A creates general percentage coupon → eligible customer adds P → applies coupon → places COD order → admin checks total. | Correct discount and cap; saved total equals preview; usage recorded once. |
|
||||
| CP-02 | Create flat coupon with/without max cap → test small/large carts → remove coupon. | Discount never creates negative payable amount; removal restores correct subtotal/fee. |
|
||||
| CP-03 | Create coupon with minimum spend → test below/exactly/above; change quantities after selection. | Eligibility recalculates; invalid selected coupon cannot silently stay applied or bypass backend validation. |
|
||||
| CP-04 | Create U1-specific coupon → compare U1/U2 eligible and My Coupons screens → place U1 order. | Only U1 can see/apply it; usage belongs to U1. Direct U2 application must also be denied (API check). |
|
||||
| CP-05 | Create SKU-restricted coupon for P → cart P-only, Q-only and P+Q → place each eligible scenario. | Product-scope/exclusive rules match the configured contract and are enforced server-side, not just displayed in admin. |
|
||||
| CP-06 | Set maximum uses per customer to one → place order → try second use and two simultaneous first uses. | Limit is enforced, including concurrent requests; one multi-slot checkout counts as one use as intended. |
|
||||
| CP-07 | Create first-order-only coupon → fresh customer uses it → tries again; separately cancel first order. | Eligibility matches defined first-order/cancellation policy, not inconsistent tracker/order-count behavior. |
|
||||
| CP-08 | Admin expires/invalidates/edits coupon while customer has it selected at Checkout → submit. | Invalid stale coupon is rejected; changed valid coupon cannot produce unnoticed quote mismatch. |
|
||||
| CP-09 | Admin creates reserved coupon → U1 redeems secret code in My Coupons → applies personal coupon → U2 retries secret. | Redemption produces correct personal coupon; one-time secret cannot be claimed by both customers. Test simultaneous redemption too. |
|
||||
| CP-10 | Redeem malformed, expired or first-order-ineligible reserved code → then valid code. | Correct rejection without burning valid codes or leaving half-created coupons; valid retry works. |
|
||||
| CP-11 | Create coupon in A → customer browses B and attempts redemption/application. | Region policy is explicit: if region-scoped, A coupon cannot discount B orders; global exceptions must be deliberate. Current user coupon fetches are not region-filtered. |
|
||||
|
||||
## J. Orders, fulfillment, cancellation and after-order edits
|
||||
|
||||
| ID | Steps / journey | Required result |
|
||||
|---|---|---|
|
||||
| OR-01 | Customer orders P/Q in A using COD/address/instructions/coupon → checks success and My Orders → admin A finds same order ID → admin B searches it. | Matching SKUs/quantities/slot/address/notes/coupon/total in customer and A admin; B cannot access it. Ordered cart is cleared according to agreed policy. |
|
||||
| OR-02 | Order items in S1/S2 → check success, history and admin lists. | Each generated slot order is discoverable, correctly grouped and dated; success does not obscure the second order. Total/fee parity follows BL-04. |
|
||||
| OR-03 | Place order → edit instructions from customer order menu → admin refreshes; admin adds internal notes. | User notes propagate; admin notes remain correctly distinguished from customer instructions. Editing delivered/cancelled order notes is rejected. |
|
||||
| OR-04 | Admin packages one item then all items, verifies packaging and marks Delivered → customer refreshes tracking. | Item and aggregate packaging state agree across admin lists/details; customer sees correct fulfillment/delivery status. |
|
||||
| OR-05 | Admin reverses an accidental packaged/delivered toggle where supported → refresh both apps. | Supported reversal is consistent; forbidden transitions show clear errors. No cancelled order resurrected accidentally. |
|
||||
| OR-06 | Customer cancels pending COD order with reason → admin list/detail and vendor page refresh. | Cancelled status/reason/actor persist; cancelled order is not fulfillable or included in vendor production totals; COD refund is not shown as cash owed. |
|
||||
| OR-07 | Admin cancels pending order with reason → customer history/detail and next-order glimpse refresh. | Cancellation is attributed to admin and visible to customer; next-order summary no longer treats it as upcoming. |
|
||||
| OR-08 | Try blank reason, second cancellation and cancellation after Delivered; cancel one of two slot suborders. | Invalid cancellations reject without duplicate refund records; other suborder stays intact. |
|
||||
| OR-09 | Admin removes delivery charge from order → customer/admin details refresh. | Saved payable total and fee update together, exactly once; unrelated suborders stay unchanged. |
|
||||
| OR-10 | Place order → admin changes prices → verify old order unchanged → run explicit Rebalance on chosen slot(s). | Normal catalog edits do not reprice historical orders; explicit rebalance affects only intended orders and preserves agreed fees/coupon allocations. Define eligibility for delivered/cancelled orders. |
|
||||
| OR-11 | Create many A/B orders → exercise admin filters and pagination and customer My Orders pagination. | No missing/duplicate A orders due to B's high IDs; filters match actual statuses; customer sees own orders across regions with region labels. |
|
||||
| OR-12 | Double-tap Place Order; simulate response loss after server commit → relaunch and retry only after checking history. | Exactly one intended order group; no duplicates or lost order; loading lock and reconciliation work. Backend idempotency is a requirement to verify, not assumed. |
|
||||
|
||||
## K. Flash delivery
|
||||
|
||||
| ID | Steps / journey | Required result |
|
||||
|---|---|---|
|
||||
| FL-01 | Enable flash in A → create flash-eligible SKU with price different from regular → customer adds to flash cart → selects A address → places COD order → admin opens Flash orders. | Flash price/fees are consistent, order has flash flag and no scheduled slot, delivery summary is correct and only flash cart is cleared. |
|
||||
| FL-02 | Regular-only, out-of-stock and suspended SKUs → browse/add via flash entry points. | Noneligible items cannot be ordered through Flash or a regular dialog shortcut. |
|
||||
| FL-03 | Disable flash in A while B remains enabled → customer refreshes A/B; submit stale A flash checkout. | Correct regional UI availability; backend rejects disabled flash orders, B remains available. |
|
||||
| FL-04 | Admin removes flash eligibility or changes flash price while SKU is in flash cart. | Eligibility/price refresh everywhere; stale order cannot silently sell a disallowed SKU or use regular price unexpectedly. |
|
||||
| FL-05 | Use coupons with minimum/cap on flash subtotal near free-delivery threshold. | Eligibility and discounts use the intended flash price basis; all bill surfaces and saved order agree. |
|
||||
| FL-06 | Trigger staging flash enable/disable scheduled jobs → inspect all configured regions and customer app. | Expected schedule and regional values publish to KV; UI transitions without restart. This is a scheduled-job integration test, not a real-time daily wait. |
|
||||
|
||||
## L. Vendor, delivery operations, support and notifications
|
||||
|
||||
| ID | Steps / journey | Required result |
|
||||
|---|---|---|
|
||||
| OP-01 | Admin creates slot-specific snippet for P → customer orders P+Q → vendor opens snippet URL. | Only attached SKU lines from matching noncancelled slot orders appear; quantities/summary agree; Q is not exposed by P's snippet. |
|
||||
| OP-02 | Vendor toggles P packaging → admin refreshes order details/list → reverse toggle. | Same order-item packaging state persists; other vendor/customer items remain unchanged. |
|
||||
| OP-03 | Create permanent snippet → vendor selects S1/S2 → expire/delete a slot-specific snippet and retry old link. | Permanent mode functions without failing initial metadata lookup; selected slot is valid for snippet/region; expired/deleted links no longer access orders. |
|
||||
| OP-04 | Admin edits delivery sequence and address map coordinates → reopen delivery view and order detail. | Sequence/map changes persist and stay within region; operational coordinate override does not silently mutate customer's region/bound identity. |
|
||||
| OP-05 | Customer raises complaint on own order with photo → admin A views and resolves → customer views response. | Correct order/customer/photo/body/response/status across apps; admin B cannot resolve A complaint. Repeat with general complaint without an order. |
|
||||
| OP-06 | Customer creates product review/rating/photo → admin opens matching review and responds → customer refreshes detail. | Product/review identity, rating and both messages/images agree; reviews survive pagination. No review mistakenly attached using SKU ID as product ID. |
|
||||
| OP-07 | Admin records customer incident/negativity note → reopen customer details/order operational display. | Incident belongs to intended customer/order, score persists and regional access follows policy; do not assume it automatically suspends the user. |
|
||||
| OP-08 | In isolated staging destinations, send targeted notification, place order for admin push/deep link, cancel for Telegram, and resolve complaint for customer push. | Correct payload/recipient/navigation; unrelated customers receive no targeted push. Verify intended regional recipient policy. Include queue retries and physical-device receipt separately from queue acceptance. |
|
||||
|
||||
## M. Recovery, cross-platform and configuration robustness
|
||||
|
||||
| ID | Steps / journey | Required result |
|
||||
|---|---|---|
|
||||
| RC-01 | Customer already open while admin rapidly edits product/price/slot in A and B → wait/refetch discovery and catalog. | Final changes publish for both regions; one pending region does not overwrite another; clients do not mix catalog/availability/slot versions. |
|
||||
| RC-02 | Cold-launch with saved cart/config and slow catalog/availability/slot responses; temporarily fail asset requests then restore network. | Recoverable loading/error state, no permanent zero-priced items, cart deletion or endless spinner. No offline order submission. |
|
||||
| RC-03 | In controlled staging, remove a bound's KV payload or return corrupt local config → customer opens region. | Backend rebuild/backfill and client cache recovery work; foreign bound's cached config is never reused. |
|
||||
| RC-04 | Disconnect during product/image/address save and before/during order request → reconnect and inspect stored result before retry. | Error is recoverable; no half-uploaded published image, duplicate address/product/order, or false success. Distinguish precommit from postcommit request loss. |
|
||||
| RC-05 | Run critical customer/admin flows on iOS and Android; admin-web/customer-web in Chromium, including refresh/direct links/back. | Same business results with platform-specific storage, permissions, pickers and routing. Web is a separate implementation, not assumed equivalent because APIs are shared. |
|
||||
| RC-06 | Superadmin changes supported internal version/store URLs → open older/newer app builds; cancel image/location permissions and retry. | Update behavior matches version policy and OS URL; permission denial is recoverable. Verify regional support/welcome text rather than hardcoded Mahabubnagar copy in B. |
|
||||
|
||||
## N. Mandatory API-backed security and invariant checks
|
||||
|
||||
These supplement the UI journeys. UI visibility alone cannot prove authorization.
|
||||
Use staging requests with distinct identities and verify both response and absence
|
||||
of unintended writes. Expected denials below are requirements, not claims about
|
||||
the present implementation.
|
||||
|
||||
| ID | Steps / journey | Required result |
|
||||
|---|---|---|
|
||||
| SEC-01 | Customer token/anonymous request calls staff CRUD; staff token calls superadmin region/staff/global-config APIs; try legacy admin global-config mutation too. | Unauthorized identities are denied; hiding an admin screen is not the access control. |
|
||||
| SEC-02 | Admin B supplies A IDs to product/store/slot/tag/group/banner/coupon/snippet/order/complaint reads and mutations; mix A/B relation IDs in an otherwise valid save. | No cross-region reads/mutations/associations; rejected mixed save leaves no partial state. |
|
||||
| SEC-03 | U2 supplies U1 address/order/complaint/payment IDs to read/edit/cancel/delete operations. | Ownership is enforced, not only authentication; U1's data is unchanged. |
|
||||
| SEC-04 | Order request mixes A region with B SKU/slot/bound/address, or a SKU not assigned to that slot. | All submitted identities/relations are validated server-side; no foreign or incoherent order accepted. |
|
||||
| SEC-05 | Submit empty items, zero/negative/fractional quantities, invalid/null regular slot, deleted/suspended/OOS SKU, frozen/inactive slot and full slot. | Backend enforces actual purchasability/quantity/slot rules; bypassing UI guards cannot create an invalid order. |
|
||||
| SEC-06 | U2 applies U1 coupon directly; apply expired/invalid/foreign-region/SKU-ineligible coupon; race usage and reserved redemption. | Eligibility and one-time limits are authoritative and atomic; no unauthorized discount or multiple claims. |
|
||||
| SEC-07 | Vendor request edits packaging using an unrelated item ID; expired snippet queries another slot; anonymous caller tries same mutation without valid snippet authority. | Vendor access is constrained to authorized snippet/region/items. A public vendor URL is not authority to edit every order item. |
|
||||
| SEC-08 | Reuse revoked/deleted staff identity/token → attempt region-bound mutation; change staff region in superadmin then retry old session. | Access reflects current staff assignment/existence, not a stale token's region. |
|
||||
|
||||
## O. Payment/refund readiness (not current COD sanity)
|
||||
|
||||
`PaymentAndOrderComponent` currently disables online payment as “Coming Soon”;
|
||||
`RazorpayPaymentService` methods are commented-out stubs. Do not report live
|
||||
online payment/refund journeys as supported or passing today.
|
||||
|
||||
| ID | Steps / journey | Required result |
|
||||
|---|---|---|
|
||||
| PAY-01 | Current customer Checkout attempts selecting online payment. | It remains clearly disabled; COD works without any gateway call. |
|
||||
| PAY-02 | Once implemented, single- and multi-slot sandbox online checkout → verify callback → inspect customer/admin orders. | Correct discounted group amount and INR minor units; one payment covers intended suborders, all become paid exactly once. |
|
||||
| PAY-03 | Sandbox declines/cancels/times out payment → retry, double callback and late success/webhook. | No duplicate payment/order, accurate pending/failed/success state, consistent cart and retry behavior. |
|
||||
| PAY-04 | Paid customer order cancellation → admin partial/full refund → gateway settles → customer views status; retry refund. | Amount never exceeds collected payment, authorization enforced and no duplicate refund; COD does not enter online-refund flow. |
|
||||
| PAY-05 | Forged signature, another customer's merchant order ID, duplicate callback and mismatched amount/currency. | Backend rejects forged/foreign payment, verifies authoritative ownership/amount and handles callbacks idempotently. |
|
||||
|
||||
## Code observations that should influence priority
|
||||
|
||||
These are static observations, not executed bug reports. Where desired behavior
|
||||
is not yet defined, agree the contract rather than write a test that endorses a bug.
|
||||
|
||||
1. **Money parity is a high-risk gap.** Cart uses `freeDeliveryThreshold` against
|
||||
post-coupon `finalTotal`; `placeOrderUtil` uses `minRegularOrderValue` for
|
||||
regular delivery against pre-discount `totalAmount`. Backend percentage
|
||||
discount receives a suborder total including its delivery fee. See `BL-01`–`BL-04`:
|
||||
`apps/user-ui/components/cart-page.tsx` and
|
||||
`apps/backend/src/trpc/apis/user-apis/apis/order.ts`.
|
||||
2. **Global-config restriction must be tested at API level.**
|
||||
`admin.const.updateGlobalConstants` still uses `protectedProcedure` in the
|
||||
inspected code. That common guard permits either customer or staff identity;
|
||||
removing the UI is not enough. See `SEC-01` and
|
||||
`apps/backend/src/trpc/apis/admin-apis/apis/const.ts` / `trpc-index.ts`.
|
||||
3. **Order validation needs negative requests.** The inspected order path fetches
|
||||
SKU by ID and checks slot capacity/flash eligibility, but does not visibly
|
||||
validate every submitted region/SKU/slot relation, frozen state, suspension or
|
||||
OOS flag. See `SEC-04`/`SEC-05`; do not assume UI filtering is protection.
|
||||
4. **Address identity can drift.** `AddressForm` submits current browsing bound
|
||||
even when the form selects another region or edits a foreign-region address.
|
||||
See `AD-06` and `apps/user-ui/src/components/AddressForm.tsx`.
|
||||
5. **Coupon UI and backend eligibility differ.** User coupon retrieval is not
|
||||
region-filtered; checkout validation checks expiry/minimum/usage/first-order,
|
||||
but does not visibly enforce all user/product/region restrictions. See
|
||||
`CP-04`/`CP-05`/`CP-11`/`SEC-06` and the user coupon/order DB helpers.
|
||||
6. **Vendor authority needs a release gate.** Packaging mutation is public and
|
||||
accepts an item ID without snippet code; the selected-slot snippet query does
|
||||
not visibly enforce expiration like the other snippet query. Permanent-link
|
||||
UI initially calls a metadata endpoint that requires a slot. See `OP-03` and
|
||||
`SEC-07`, `vendor-snippets.ts` and fallback `vendor-order-list.tsx`.
|
||||
7. **Persistence tests must use current code.** Older cart documentation describes
|
||||
mount-only remove/re-add reconciliation; current `useReconcileCartSlots`
|
||||
preserves lines and updates their slot. Do not derive expected behavior from
|
||||
historical docs alone. See `CT-04`/`SL-07`, current `cart-query-hooks.tsx`.
|
||||
8. **Existing E2E is a starting point, not complete coverage.**
|
||||
`tests/e2e/add-product.yaml`, `add-slot-with-product.yaml` and `user-order.yaml`
|
||||
cover part of the main chain. The user-order flow assumes older auth/address
|
||||
placement (automatic login route and checkout address selection), and needs
|
||||
alignment with current Cart/Me login walls and read-only Checkout. Add
|
||||
regional selection and persisted-order/admin assertions.
|
||||
|
||||
## Policies to settle before turning every row into a hard assertion
|
||||
|
||||
- Is `minRegularOrderValue` a hard order minimum or only informational? Which
|
||||
subtotal controls free delivery: pre- or post-coupon?
|
||||
- Which SKU-level coupons are exclusive, and can coupons cross regions?
|
||||
- Should unavailable lines survive a successful partial checkout? Should cart
|
||||
instructions reset after success/region switch/logout? Current shared notes
|
||||
store is not explicitly cleared in those paths.
|
||||
- Are fractional quantity steps supported? Dialog/cart stepping and order input
|
||||
validation must agree.
|
||||
- Should combo availability depend on all components, and are slot-group
|
||||
memberships live or snapshots?
|
||||
- Which orders may be explicitly rebalanced, and how do fees, prior coupons and
|
||||
multi-slot allocations survive repricing?
|
||||
- Do cancelled first orders restore first-order coupon eligibility?
|
||||
- Are customer/admin notifications regional or intentionally global? Current
|
||||
broadcast/admin-notify paths should not be assumed regional by UI labels.
|
||||
- How are missing address coordinates, overlapping regions and legacy null
|
||||
region/bound addresses handled?
|
||||
|
||||
Keep these as explicitly named policy checks; do not silently mark ambiguous
|
||||
behavior PASS. Recommended report columns: **case, platform, run ID, status
|
||||
(PASS/FAIL/BLOCKED/NOT RUN), expected/actual, evidence, entity IDs, follow-up**.
|
||||
210
docs/test-cases-multi-region.md
Normal file
210
docs/test-cases-multi-region.md
Normal file
|
|
@ -0,0 +1,210 @@
|
|||
# Test Plan — Region consts model + active bound + login walls
|
||||
|
||||
Verification plan for the consts three-table model, the active-bound model, and the
|
||||
user-app flows built in this session. Uses **Maestro MCP**.
|
||||
|
||||
## Environments
|
||||
|
||||
| Env | Where | Id / URL |
|
||||
|---|---|---|
|
||||
| Backend | `wrangler dev` (local) | http://localhost:8787 (tunnel `devbackend.freshyo.in`) |
|
||||
| Superadmin UI | Chromium (Maestro web) | http://localhost:4175 |
|
||||
| User app (customer) | iOS simulator — `iphone 16 pr max - iOS 18.6` (`B1F98A94-9733-46A6-9EB2-76F33C15240D`) | appId `com.freshyotrial.app` |
|
||||
|
||||
## Fixtures
|
||||
|
||||
| Thing | Value |
|
||||
|---|---|
|
||||
| Region 1 | Mahabubnagar, bounds `Mbnr-1` (priority 1), `Mbnr-2` (priority 2) |
|
||||
| Region 2 / 3 | Test regions as configured in dev (e.g. `Testnagar`, `Test-1`) |
|
||||
| Staff (admin-ui, out of scope) | `uitest` / `uitest2`, password `test1234` |
|
||||
| Superadmin | username `superadmin`, password **BLOCKER — unknown** |
|
||||
|
||||
## Blockers / prerequisites
|
||||
|
||||
| Id | Item | Status |
|
||||
|---|---|---|
|
||||
| P-1 | Superadmin password needed for every superadmin-UI case | blocker (must ask) |
|
||||
| P-2 | Customer login = SMS OTP to a real phone — needs the physical device to read the OTP, or an already-logged-in test user on the simulator | blocker / workaround |
|
||||
| P-3 | Metro dev server (`npx expo start`) must be running for the dev app; port 8081 was down | prereq |
|
||||
| P-4 | User app must be installed on the simulator | to verify |
|
||||
| P-5 | Migration `0007_addresses_bound_id` applied to the dev DB | user runs it |
|
||||
|
||||
---
|
||||
|
||||
## A. Superadmin UI (Chromium @ :4175)
|
||||
|
||||
### SU-1 Login with superadmin credentials
|
||||
- Steps: open `/login` → username `superadmin` + password → submit.
|
||||
- Expected: lands on the dashboard; no UNAUTHORIZED errors anywhere.
|
||||
|
||||
### SU-2 Regions page — region constants editor
|
||||
- Steps: Regions → pick a region.
|
||||
- Expected: **Region settings** editor shows the region keys (`Popular Items`, `All Items Order`,
|
||||
`Tags Order`, `Enable Flash Delivery`, `Support Mobile`, `Support Email`, `Welcome Message`)
|
||||
with the 3 version counters **hidden**.
|
||||
|
||||
### SU-3 Regions page — bound constants editor + effective badge
|
||||
- Steps: select each bound tab.
|
||||
- Expected: **Bound settings** editor shows ONLY the 5 bound keys
|
||||
(`minRegularOrderValue`, `freeDeliveryThreshold`, `deliveryCharge`,
|
||||
`flashFreeDeliveryThreshold`, `flashDeliveryCharge`); the lowest-priority bound shows the
|
||||
**EFFECTIVE** badge.
|
||||
|
||||
### SU-4 Update bound settings → KV refreshed
|
||||
- Steps: change `deliveryCharge` on a bound → Save.
|
||||
- Expected: success; KV key `essentialConsts_{boundId}` reflects the new value
|
||||
(`npx wrangler kv:key get "essentialConsts_1" --namespace-id <gen-ns>`).
|
||||
|
||||
### SU-5 Constants page — Global + Legacy (superadmin token)
|
||||
- Steps: Constants → check Global section shows the 4 global keys and Legacy shows the 7 leftover
|
||||
keys → change one global and one legacy value → Save each.
|
||||
- Expected: saves succeed with a superadmin token (this was previously UNAUTHORIZED via
|
||||
`admin.const.*`); entries persist after reload.
|
||||
|
||||
### SU-6 Update region constants (superadmin) → KV refreshed
|
||||
- Steps: Regions → region editor → toggle `isFlashDeliveryEnabled` → Save region settings.
|
||||
- Expected: success; `essentialConsts_{boundId}` for that region reflects it.
|
||||
|
||||
---
|
||||
|
||||
## B. User app (iOS simulator)
|
||||
|
||||
### U-1 Startup resolve — location granted
|
||||
- Setup: app state cleared, location permission allowed, device fix inside bound **Mbnr-1**.
|
||||
- Expected: spinner **"Finding your region..."** → app renders; location bar shows `Mahabubnagar`;
|
||||
a (now commented-out) `<user-ui> essentialConsts boundId` log would have printed the containing bound.
|
||||
|
||||
### U-2 Startup resolve — location denied
|
||||
- Setup: app state cleared, location permission **denied**.
|
||||
- Expected: full-screen **region chooser** (`RegionSelector` gate) — pick `Mahabubnagar` → app renders.
|
||||
|
||||
### U-3 Active bound = least-priority bound of the user's addresses
|
||||
- Setup: signed in, user has an address in region 1 with `bound_id` = the least-priority bound.
|
||||
- Expected: consts (delivery charge / threshold) come from that address's bound — **not** the
|
||||
device-location bound.
|
||||
|
||||
### U-3b No address in the region → effective bound
|
||||
- Setup: signed in, user has **no** address in region 1.
|
||||
- Expected: active bound = region's effective (least-priority) bound.
|
||||
|
||||
### U-4 Region switch clears the cart
|
||||
- Steps: add items to cart → location bar → choose another region → confirm.
|
||||
- Expected: confirmation dialog; on confirm the cart is emptied (both types) and the app shows the new region.
|
||||
|
||||
### U-5 Same-region bound change does NOT clear the cart
|
||||
- Setup: cart with items; user in region 1.
|
||||
- Expected: changing only the bound (where supported) keeps the cart.
|
||||
|
||||
### U-6 Cart login wall
|
||||
- Setup: sign out.
|
||||
- Steps: open the cart (regular and 1-hr variants).
|
||||
- Expected: inline **"Please log in"** wall, no cart content; **Back** navigates out; **Log In** → login screen.
|
||||
|
||||
### U-7 Post-login returns to the gated page
|
||||
- Steps: from the cart wall → Log In → sign in.
|
||||
- Expected: lands back on the **cart** page (not home). Same for the **Me** tab wall → lands on Me.
|
||||
|
||||
### U-8 Cart items behaviour
|
||||
- Expected: quantity stepper works; 0 shows a remove confirmation; per item, out-of-stock / no-slot /
|
||||
not-flash-eligible warnings render; delete button removes the item.
|
||||
|
||||
### U-9 Delivery slot picking (regular, cart)
|
||||
- Expected: slot dropdown lists slots; the **Delivery Slot Summary** sits right after items, groups by
|
||||
slot with counts, and offers a merge suggestion when feasible.
|
||||
|
||||
### U-10 Coupons (cart)
|
||||
- Expected: dropdown lists eligible coupons with savings labels; ineligible disabled; applied coupon
|
||||
shows under Bill Details and can be removed.
|
||||
|
||||
### U-11 Delivery instructions input (cart)
|
||||
- Expected: **Delivery Instructions** input exists **above** the address selector, above Bill Details;
|
||||
the typed text is carried into the order (`userNotes`).
|
||||
|
||||
### U-12 Address selector position (cart)
|
||||
- Expected: the selector renders **just above the Bill Details** section.
|
||||
|
||||
### U-13 Addresses: data model + first address default
|
||||
- Steps: from the cart selector → add an address for a user with none → save.
|
||||
- Expected: it becomes the user's **default** address automatically.
|
||||
|
||||
### U-14 "No Location is attached to address" + attach
|
||||
- Steps: select an address with no coordinates.
|
||||
- Expected: small text **"No Location is attached to address"** above **+ Attach Current Location**;
|
||||
granting permission sets `latitude`/`longitude`.
|
||||
|
||||
### U-15 Checkout = read-only summary
|
||||
- Setup: cart with items (regular), at least 2 different slots, a coupon, an address.
|
||||
- Expected: checkout shows — **Items** grouped by slot with the **slot time pill** above each group,
|
||||
**Coupon** card, **Address** card, **Bill** — and NO editable controls (no steppers, no slot
|
||||
dropdowns, no coupon dropdown).
|
||||
|
||||
### U-16 Delivery charge vs. displayed bound
|
||||
- Expected: the delivery charge / free-delivery threshold shown is the **active bound's** value, and
|
||||
the order is charged the same (client sends `boundId = constsData.boundId`).
|
||||
|
||||
### U-17 Back to Cart
|
||||
- Steps: on checkout tap **Back to Cart**.
|
||||
- Expected: returns to the cart; nothing lost.
|
||||
|
||||
### U-18 Place order (COD)
|
||||
- Steps: checkout → Place Order.
|
||||
- Expected: order placed; redirected to order-success; cart cleared.
|
||||
|
||||
### U-19 Flash delivery flow
|
||||
- Steps: flash section → add a flash-eligible item → flash cart → flash checkout → place.
|
||||
- Expected: no slot summary in the cart; checkout groups items without slot headers; min-order uses
|
||||
the flash constants (`flashFreeDeliveryThreshold` / `flashDeliveryCharge`).
|
||||
|
||||
### U-20 Cross-region checkout address
|
||||
- Setup: user has an address in a **different** region than the browsing region.
|
||||
- Steps: select it on the cart.
|
||||
- Expected: confirmation dialog ("Switch region? ... clears your entire cart") → on confirm the region
|
||||
switches, carts cleared, and the app lands on home.
|
||||
|
||||
### U-21 isFlashDeliveryEnabled gate (region consts)
|
||||
- Setup: `isFlashDeliveryEnabled = false` for the active bound's region.
|
||||
- Expected: flash delivery unavailable (403 from the backend; the app marks flash delivery off).
|
||||
|
||||
---
|
||||
|
||||
## C. Admin apps (admin-ui / admin-web)
|
||||
|
||||
Out of scope for this run (the admin mobile app is not installed; `apps/admin-ui` dev server is
|
||||
stopped). Flagging for a later pass:
|
||||
- customize-app: Region + Bound tabs only (no Global), region/bound saves reach the right tables,
|
||||
region-scoped popular/all-items ordering, region-scoped `tagsOrder`, region-scoped `welcomeMessage`.
|
||||
|
||||
---
|
||||
|
||||
## Reporting
|
||||
|
||||
Each case gets: PASS / FAIL / BLOCKED / SKIPPED, with evidence (screenshot, Maestro Viewer link, KV
|
||||
output, or backend log line).
|
||||
|
||||
## Results (2026-10-09)
|
||||
|
||||
| Case | Result | Evidence |
|
||||
|---|---|---|
|
||||
| SU-1 | ✅ PASS | Logged in as superadmin; Dashboard (Regions / Admin Users / App Constants) rendered |
|
||||
| SU-2 | ✅ PASS | Region settings editor shows Popular Items / Tags Order / Enable Flash Delivery; "Availability Cache Version" NOT visible (counters hidden) |
|
||||
| SU-3 | ✅ PASS | Bound settings editor shows only the 5 bound keys (Minimum Regular Order Value, Delivery Charge…); **EFFECTIVE** badge on the lowest-priority bound |
|
||||
| SU-4 | 🔜 Partial | Verified server-side: `activeBound` returns boundId for region 1; KV UI-edit round-trip not driven from the browser (Maestro web can't target the inputs) |
|
||||
| SU-5/SU-6 | 🔜 Same as above | Server-side `activeBound` sanity verified; UI drive pending |
|
||||
| U-1 | ✅ PASS | Fresh install + GPS set to 16.7489,77.9856 (inside Mbnr-1) → Home shows "DELIVER TO Mahabubnagar", no gate needed; region auto-resolved |
|
||||
| U-6 (Me tab wall) | ✅ PASS | Me tab renders the **Please log in** wall (lock, title, message, Log In) while tabs stay navigable |
|
||||
| U-7 (login navigation) | ✅ PASS (up to credentials) | Wall → Log In → login screen (mobile step) → "other ways to login" → password step with the username prefilled; all navigation works |
|
||||
| U-6/U-7 sign-in completion | 🚫 BLOCKED (test harness) | Maestro `inputText` does not land in the **secure** password field on the iOS Simulator (characters dispatched but RN state never updates; the non-secure mobile field typed fine). Simulator hardware-keyboard/secure-field quirk — manual typing on the simulator works; password login via device was NOT automated |
|
||||
| — | 🔍 **B01** | (pre-B02) Home showed "No products available" + "Shop for ₹+" (threshold undefined) |
|
||||
| — | ✅ **B02 root-cause + fix** | `common.activeBound` was protected + auth-gated, and the location-resolved bound was not propagated → signed-out users had `boundId = null` → consts disabled. Fixed: `activeBound` is now public (signed-out → effective bound) and `useRegion` propagates the location bound again. Verified: products + "₹300 more for FREE Delivery" on Home |
|
||||
| U-10/U-11/U-13/U-15/U-18/U-19/U-20 | ⏳ Not run yet | Needs the sign-in round-trip (blocked above) and further flow driving |
|
||||
|
||||
### Notable environment findings
|
||||
- `inspect_screen` / screenshot capture give blank or depth-overflow payloads once the screen has real
|
||||
content on BOTH devices, so verification relied on `run` + `assertVisible` flows, simulator
|
||||
screenshots, and point-tap driving.
|
||||
- Chromium web flows must start with `openLink` (the `url:` header alone doesn't navigate).
|
||||
- `scrollUntilVisible` is required on the admin Regions page: the region cards live below the fold.
|
||||
- On the user app, text-node assertions (`assertVisible "Home"` etc.) failed even on clearly-rendered
|
||||
screens; driving worked via `tapOn: { point: "x%, y%" }` coordinates taken from the screenshots.
|
||||
- `launchApp` permission auto-grants are not supported for `location` on this Maestro build.
|
||||
Loading…
Add table
Reference in a new issue