riyadhafraa 9b3e320c78 Add Playwright tests for the My Orders cancel/delete undo toast
Original task (#103): cover the 7-second "Undo" action that appears after
cancelling or deleting an order on /my-orders, since the existing
order-place-cancel spec only verified the post-cancel state and never
exercised the undo path.

What was added:
- New spec at artifacts/tx-os/tests/order-undo-toast.spec.mjs with two cases:
  1. English: place a fresh pending order via the services modal, cancel it
     from the in-card confirm dialog, click "Undo" inside the toast within
     the 7-second window, then assert the restore PATCH /api/orders/:id/status
     succeeds, the timeline + Cancel button reappear in the card, and the DB
     row is back to "pending".
  2. Arabic: seed a "completed" order directly in the DB, click the trash
     icon + "نعم، احذف", then click "تراجع" in the toast. Verifies that NO
     DELETE /api/orders/:id ever fires (page-level request listener), the
     order row still exists in the DB after the original 7s window has
     elapsed, and the card stays visible with the مكتمل status pill.
- Both English and Arabic toast labels are exercised, satisfying the
  bilingual requirement.

Implementation notes / deviations:
- The spec is automatically picked up by the existing test:e2e config
  (testMatch: /.*\.spec\.mjs$/), so no playwright.config or package.json
  changes were needed.
- DB seeding/cleanup mirrors the conventions in
  artifacts/tx-os/tests/order-place-cancel.spec.mjs (same bcrypt hash for
  TestPass123!, same afterAll teardown of orders/notifications/user_roles/users).
- While wiring the test I discovered the shadcn Toaster's <li> root has no
  role="status" on this Radix version, so role-based selectors miss it.
  The spec uses `li[data-state="open"]` (Radix's data attribute) scoped to
  the most recent toast — explained in a comment in the file.

Verification:
- pnpm exec playwright test tests/order-undo-toast.spec.mjs → 2 passed.
- Re-ran together with the existing order-place-cancel spec → 4 passed,
  no regressions.

Follow-ups proposed (#157, #158): bulk "Clear N finished" + undo coverage,
and the unmount-flushes-pending-deletes path.

Replit-Task-Id: bd1c5067-e994-4299-b3a6-855ffb45ed71
2026-04-29 14:28:30 +00:00
2026-04-29 13:24:16 +00:00
2026-04-21 12:16:59 +00:00
2026-04-18 02:00:09 +00:00
2026-04-28 20:58:08 +00:00
2026-04-18 02:00:09 +00:00
2026-04-18 02:00:09 +00:00
S
Description
No description provided
139 MiB
Languages
TypeScript 69.4%
JavaScript 29%
CSS 0.6%
Shell 0.6%
Dockerfile 0.2%
Other 0.2%