Fix trade-book Edit E2E: stale cancel-copy assertion (blocks #292 smoke) #338

Closed
opened 2026-06-08 08:14:04 +00:00 by PlasticDigits · 14 comments
PlasticDigits commented 2026-06-08 08:14:04 +00:00 (Migrated from gitlab.com)

Summary

Smoke E2E trade-book-edit-178.spec.ts fails because it asserts copy that is not present in the UI (cancel the resting order before placing a replacement). Pair deep-link resolution for the seeded EMBER/CORAL pair was fixed in !836; the remaining failure is a stale / incorrect Playwright assertion (and possibly missing coverage of the real edit-context UX).

Discovered as a #292 acceptance-criterion-3 blocker (smoke 105/106).


Current codebase

Edit UX (shipped — GitLab #247 / #178)

Failing smoke spec

  • frontend-dapp/e2e/trade-book-edit-178.spec.ts:
    • Desktop test opens seeded pair SEEDED_PAIR (EMBER/CORAL), waits for trade-desktop-workspace, then before any Edit click asserts:
      await expect(page.getByText(/cancel the resting order before placing a replacement/i)).toBeVisible()
      
    • That regex matches no string in the repo (only this spec and a docs paraphrase).
    • Subsequent steps (Edit → prefill → cancel) are otherwise aligned with product behavior.
  • Vitest already covers edit prefill via mocked book (TradePage.test.tsx, OrderBookPanel.test.tsx).

Pair resolution fix (!836 — merged)


Why this is needed

Gap Impact
Stale assertion make test-e2e smoke phase fails on desktop Edit spec even when Edit/cancel flows work — blocks strict CI and leaves #292 criterion 3 open.
Misleading copy expectation Test implies always-visible banner text; product intentionally shows edit guidance only after Edit (and non-price block only after field drift).
Regression blind spot Without fixing assertions, future copy/UX regressions on trade-limit-edit-context won't be caught reliably.

Constraints / guardrails

  • Do not change on-chain edit semantics — price-only UpdateLimitOrderPrice vs cancel-then-place for size/side/expiry (#247).
  • Prefer data-testid over brittle full-string regex — use trade-limit-edit-context and structured sub-assertions.
  • Keep smoke fast — no new on-chain txs in this spec (Edit alone must not POST; already asserted).
  • Desktop + sub-desktop — both tests in the file must pass; sub-desktop test currently skips the bad assertion.
  • Do not weaken strict E2E — no test.skip for chain-present environments (#201).
  • Copy changes — if product copy is updated, update LIMIT_EDIT_NON_PRICE_CHANGE_MESSAGE + Vitest in limitOrderPriceEdit.test.ts in the same MR.

Relevant files

Area Files
Failing E2E frontend-dapp/e2e/trade-book-edit-178.spec.ts
Edit UX TradeOrderTicket.tsx, OrderBookPanel.tsx, limitOrderPriceEdit.ts
Limits parity LimitOrdersPage.tsx
E2E helpers e2e/helpers/limit-e2e.ts, e2e/helpers/lcd.ts
Unit tests TradePage.test.tsx, LimitOrdersPage.test.tsx, OrderBookPanel.test.tsx, limitOrderPriceEdit.test.ts
Docs / skills docs/frontend.md, skills/AGENTS_FRONTEND_ORDER_BOOK_ROW_ACTIONS.md, frontend-dapp/e2e/README.md

  1. Remove or relocate the line-62 assertion — it should not run before Edit.
  2. After editBtn.click(), assert trade-limit-edit-context is visible and contains order id + price-update hint (default state: only price changed path available).
  3. Optional second scenario (same spec or Vitest-only): change escrow amount → assert LIMIT_EDIT_NON_PRICE_CHANGE_MESSAGE (or /cancel this order first/i) and that trade-limit-submit is disabled.
  4. Align docs if any doc still references the old "cancel the resting order before placing a replacement" phrase.
  5. Re-run smoke: npx playwright test e2e/trade-book-edit-178.spec.ts --project=e2e-smoke.

Acceptance criteria

  • trade-book-edit-178.spec.ts passes on LocalTerra + indexer + deploy + global setup (both viewport tests).
  • No assertion for copy that is not rendered by the app.
  • Edit click shows trade-limit-edit-context with correct order id and prefill (limit-order-price-input, limit-order-escrow-amount-input).
  • Edit alone emits zero POST requests (existing invariant preserved).
  • Cancel from book still succeeds with tx alert.
  • make test-frontend unchanged or improved (no new failures).

Test plan — functional paths

  • Desktop ≥1440px: open seeded pair → owned bid Edit visible → Edit → limit tab selected → fields prefilled → no POST → cancel → success alert.
  • Sub-desktop <1024px: same prefill path on trade-sub-lg-workspace.
  • After Edit, change price only → Update price CTA enabled (optional smoke extension or rely on Vitest).
  • After Edit, change amount → non-price message visible; Place/Update blocked.
  • Vitest: limitOrderPriceEdit + OrderBookPanel edit handler still green.

Test plan — attack / abuse / abuse vectors

  • Edit must not broadcast — spec continues to fail if Edit triggers wasm execute (prevents accidental "free amend" UX).
  • Non-price bypass — UI must not allow place/update tx when editNonPriceChanged (user cannot skip cancel for size/side/expiry changes).
  • Foreign orders — Edit button only on own rows (existing owner === wallet gate); E2E uses dev-wallet seeded bids only.
  • Indexer stale book — if edit targets missing order, ticket should not silently submit (document expected behavior; no flaky pass).

Verification criteria

  • bash scripts/with-node.sh --cwd frontend-dapp -- npx playwright test e2e/trade-book-edit-178.spec.ts --project=e2e-smoke — 2/2 pass.
  • CI=1 make test-e2e smoke phase includes this spec green.
  • npm test — related Vitest files pass.
  • Manual: Edit on /trade and /limits shows consistent trade-limit-edit-context copy.

## Summary Smoke E2E `trade-book-edit-178.spec.ts` fails because it asserts copy that is **not present** in the UI (`cancel the resting order before placing a replacement`). Pair deep-link resolution for the seeded EMBER/CORAL pair was fixed in [!836](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/merge_requests/118); the remaining failure is a **stale / incorrect Playwright assertion** (and possibly missing coverage of the real edit-context UX). Discovered as a **#292** acceptance-criterion-3 blocker (smoke **105/106**). --- ## Current codebase ### Edit UX (shipped — GitLab #247 / #178) - **Order book row actions:** [`frontend-dapp/src/components/trade/OrderBookPanel.tsx`](frontend-dapp/src/components/trade/OrderBookPanel.tsx) — `trade-book-edit-{side}-{order_id}` / `trade-book-cancel-{side}-{order_id}`. - **Ticket prefill:** [`frontend-dapp/src/components/trade/TradeOrderTicket.tsx`](frontend-dapp/src/components/trade/TradeOrderTicket.tsx) — `editContext` state; **Edit** prefills limit tab without network POST. - **Price-only vs non-price edits:** [`frontend-dapp/src/utils/limitOrderPriceEdit.ts`](frontend-dapp/src/utils/limitOrderPriceEdit.ts): - `isPriceOnlyLimitEdit` → **Update price** (`trade-limit-update-price-submit`). - Non-price changes → submit disabled + copy from `LIMIT_EDIT_NON_PRICE_CHANGE_MESSAGE`: > *To change size, side, or expiry, cancel this order first, then place a new limit.* - **Edit context banner** (only when `editContext` is set): `data-testid="trade-limit-edit-context"` — shows order id and one of three branches (price-only hint, non-price block message, default price-adjust hint). - **Limits page parity:** [`frontend-dapp/src/pages/LimitOrdersPage.tsx`](frontend-dapp/src/pages/LimitOrdersPage.tsx) — same `LIMIT_EDIT_NON_PRICE_CHANGE_MESSAGE` pattern. - **Docs:** [`docs/frontend.md`](docs/frontend.md) § Edit UX (#247); skill [`skills/AGENTS_FRONTEND_ORDER_BOOK_ROW_ACTIONS.md`](skills/AGENTS_FRONTEND_ORDER_BOOK_ROW_ACTIONS.md). ### Failing smoke spec - [`frontend-dapp/e2e/trade-book-edit-178.spec.ts`](frontend-dapp/e2e/trade-book-edit-178.spec.ts): - Desktop test opens seeded pair `SEEDED_PAIR` (EMBER/CORAL), waits for `trade-desktop-workspace`, then **before any Edit click** asserts: ```ts await expect(page.getByText(/cancel the resting order before placing a replacement/i)).toBeVisible() ``` - That regex matches **no string** in the repo (only this spec and a docs paraphrase). - Subsequent steps (Edit → prefill → cancel) are otherwise aligned with product behavior. - **Vitest** already covers edit prefill via mocked book ([`TradePage.test.tsx`](frontend-dapp/src/pages/TradePage.test.tsx), [`OrderBookPanel.test.tsx`](frontend-dapp/src/components/trade/__tests__/OrderBookPanel.test.tsx)). ### Pair resolution fix (!836 — merged) - Helpers [`gotoAndCaptureFactoryPairsPage`](frontend-dapp/e2e/helpers/lcd.ts), [`requireLimitTxPair`](frontend-dapp/e2e/helpers/limit-e2e.ts) — ensure `/trade/:pair` lands on factory-known pair before book polling. - Global hybrid seed [`scripts/e2e-seed-hybrid-book.sh`](scripts/e2e-seed-hybrid-book.sh) places dev-wallet bids on `SEEDED_PAIR`. --- ## Why this is needed | Gap | Impact | |-----|--------| | **Stale assertion** | `make test-e2e` smoke phase fails on desktop Edit spec even when Edit/cancel flows work — blocks strict CI and leaves **#292** criterion 3 open. | | **Misleading copy expectation** | Test implies always-visible banner text; product intentionally shows edit guidance **only after Edit** (and non-price block only after field drift). | | **Regression blind spot** | Without fixing assertions, future copy/UX regressions on `trade-limit-edit-context` won't be caught reliably. | --- ## Constraints / guardrails - **Do not change on-chain edit semantics** — price-only `UpdateLimitOrderPrice` vs cancel-then-place for size/side/expiry ([#247](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/issues/247)). - **Prefer `data-testid` over brittle full-string regex** — use `trade-limit-edit-context` and structured sub-assertions. - **Keep smoke fast** — no new on-chain txs in this spec (Edit alone must not POST; already asserted). - **Desktop + sub-desktop** — both tests in the file must pass; sub-desktop test currently skips the bad assertion. - **Do not weaken strict E2E** — no `test.skip` for chain-present environments ([#201](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/issues/201)). - **Copy changes** — if product copy is updated, update `LIMIT_EDIT_NON_PRICE_CHANGE_MESSAGE` + Vitest in [`limitOrderPriceEdit.test.ts`](frontend-dapp/src/utils/__tests__/limitOrderPriceEdit.test.ts) in the same MR. --- ## Relevant files | Area | Files | |------|-------| | Failing E2E | `frontend-dapp/e2e/trade-book-edit-178.spec.ts` | | Edit UX | `TradeOrderTicket.tsx`, `OrderBookPanel.tsx`, `limitOrderPriceEdit.ts` | | Limits parity | `LimitOrdersPage.tsx` | | E2E helpers | `e2e/helpers/limit-e2e.ts`, `e2e/helpers/lcd.ts` | | Unit tests | `TradePage.test.tsx`, `LimitOrdersPage.test.tsx`, `OrderBookPanel.test.tsx`, `limitOrderPriceEdit.test.ts` | | Docs / skills | `docs/frontend.md`, `skills/AGENTS_FRONTEND_ORDER_BOOK_ROW_ACTIONS.md`, `frontend-dapp/e2e/README.md` | --- ## Recommended solution direction 1. **Remove or relocate** the line-62 assertion — it should not run before Edit. 2. **After `editBtn.click()`**, assert `trade-limit-edit-context` is visible and contains order id + price-update hint (default state: only price changed path available). 3. **Optional second scenario** (same spec or Vitest-only): change escrow amount → assert `LIMIT_EDIT_NON_PRICE_CHANGE_MESSAGE` (or `/cancel this order first/i`) and that `trade-limit-submit` is disabled. 4. **Align docs** if any doc still references the old "cancel the resting order before placing a replacement" phrase. 5. Re-run smoke: `npx playwright test e2e/trade-book-edit-178.spec.ts --project=e2e-smoke`. --- ## Acceptance criteria - [ ] `trade-book-edit-178.spec.ts` passes on LocalTerra + indexer + deploy + global setup (both viewport tests). - [ ] No assertion for copy that is not rendered by the app. - [ ] Edit click shows `trade-limit-edit-context` with correct order id and prefill (`limit-order-price-input`, `limit-order-escrow-amount-input`). - [ ] Edit alone emits zero POST requests (existing invariant preserved). - [ ] Cancel from book still succeeds with tx alert. - [ ] `make test-frontend` unchanged or improved (no new failures). --- ## Test plan — functional paths - [ ] Desktop ≥1440px: open seeded pair → owned bid Edit visible → Edit → limit tab selected → fields prefilled → no POST → cancel → success alert. - [ ] Sub-desktop <1024px: same prefill path on `trade-sub-lg-workspace`. - [ ] After Edit, change price only → **Update price** CTA enabled (optional smoke extension or rely on Vitest). - [ ] After Edit, change amount → non-price message visible; Place/Update blocked. - [ ] Vitest: `limitOrderPriceEdit` + `OrderBookPanel` edit handler still green. --- ## Test plan — attack / abuse / abuse vectors - [ ] **Edit must not broadcast** — spec continues to fail if Edit triggers wasm execute (prevents accidental "free amend" UX). - [ ] **Non-price bypass** — UI must not allow place/update tx when `editNonPriceChanged` (user cannot skip cancel for size/side/expiry changes). - [ ] **Foreign orders** — Edit button only on own rows (existing `owner === wallet` gate); E2E uses dev-wallet seeded bids only. - [ ] **Indexer stale book** — if edit targets missing order, ticket should not silently submit (document expected behavior; no flaky pass). --- ## Verification criteria - [ ] `bash scripts/with-node.sh --cwd frontend-dapp -- npx playwright test e2e/trade-book-edit-178.spec.ts --project=e2e-smoke` — **2/2** pass. - [ ] `CI=1 make test-e2e` smoke phase includes this spec green. - [ ] `npm test` — related Vitest files pass. - [ ] Manual: Edit on `/trade` and `/limits` shows consistent `trade-limit-edit-context` copy. --- ## Related - Parent umbrella: [GitLab #292](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/issues/292) (SDK 53 — E2E blocker) - Original Edit UX: [GitLab #178](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/issues/178) (closed), [#247](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/issues/247) - Pair resolution: [!836](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/merge_requests/118)
PlasticDigits commented 2026-06-08 08:14:37 +00:00 (Migrated from gitlab.com)

mentioned in issue #292

mentioned in issue #292
ghost1 commented 2026-06-08 13:22:39 +00:00 (Migrated from gitlab.com)

mentioned in commit d3fb2824a3b2c53c142a3260e838d11c73c23ba9

mentioned in commit d3fb2824a3b2c53c142a3260e838d11c73c23ba9
PlasticDigits commented 2026-06-08 13:42:30 +00:00 (Migrated from gitlab.com)

mentioned in commit e6a225c09bea23a7c1416f0ac60b5ea6ee77ae82

mentioned in commit e6a225c09bea23a7c1416f0ac60b5ea6ee77ae82
PlasticDigits commented 2026-06-08 13:44:53 +00:00 (Migrated from gitlab.com)

mentioned in commit 41008e0ce25c00013109936fd3986788147d8818

mentioned in commit 41008e0ce25c00013109936fd3986788147d8818
PlasticDigits commented 2026-06-08 13:55:33 +00:00 (Migrated from gitlab.com)

mentioned in commit e7083fbd86

mentioned in commit e7083fbd8607b45446eead09430bd079410ca34e
PlasticDigits commented 2026-06-09 06:52:28 +00:00 (Migrated from gitlab.com)

mentioned in commit fe2ba782a216931e48a8688504074662f5b2c7bf

mentioned in commit fe2ba782a216931e48a8688504074662f5b2c7bf
PlasticDigits commented 2026-06-09 06:53:34 +00:00 (Migrated from gitlab.com)

mentioned in merge request !849

mentioned in merge request !849
PlasticDigits commented 2026-06-09 06:53:47 +00:00 (Migrated from gitlab.com)

MR !849 opened (docs; code fix on main e7083fb)

Changes: E2E/agent doc crosslinks for trade-limit-edit-context invariants.

Verify

  • npx playwright test e2e/trade-book-edit-178.spec.ts --project=e2e-smoke — 2/2
  • Edit → context banner; amount drift → cancel-first copy; no POST on Edit alone
## MR !849 opened (docs; code fix on main e7083fb) **Changes:** E2E/agent doc crosslinks for `trade-limit-edit-context` invariants. ### Verify - [ ] `npx playwright test e2e/trade-book-edit-178.spec.ts --project=e2e-smoke` — 2/2 - [ ] Edit → context banner; amount drift → cancel-first copy; no POST on Edit alone
PlasticDigits commented 2026-06-09 07:00:14 +00:00 (Migrated from gitlab.com)

mentioned in commit 590594a9ac824a99f74d94cfaee31d7779392872

mentioned in commit 590594a9ac824a99f74d94cfaee31d7779392872
PlasticDigits commented 2026-06-09 07:00:42 +00:00 (Migrated from gitlab.com)

E2E verification: trade-book-edit-178.spec.ts 2/2 pass after reordering sub-desktop before desktop cancel (commit on !849 branch).

E2E verification: trade-book-edit-178.spec.ts **2/2** pass after reordering sub-desktop before desktop cancel (commit on !849 branch).
PlasticDigits commented 2026-06-09 07:46:22 +00:00 (Migrated from gitlab.com)

mentioned in commit 0ca0f482bc

mentioned in commit 0ca0f482bca245d9739a75c0f6dc8e615d98db8d
PlasticDigits commented 2026-06-09 07:46:22 +00:00 (Migrated from gitlab.com)

mentioned in commit 94214b0339

mentioned in commit 94214b0339ac4149fa83f09025fc0fb39deff918
PlasticDigits commented 2026-06-09 07:48:35 +00:00 (Migrated from gitlab.com)

mentioned in commit e689d83351

mentioned in commit e689d83351401b5873f092fdb49759dbe7b7af73
PlasticDigits commented 2026-06-09 08:14:47 +00:00 (Migrated from gitlab.com)

Verification complete — #338

All acceptance and verification criteria PASS on main (83dc192).

Results

Criterion Result Evidence
trade-book-edit-178.spec.ts smoke 2/2 PASS npx playwright test e2e/trade-book-edit-178.spec.ts --project=e2e-smoke
No stale unrendered copy assertion PASS Spec asserts trade-limit-edit-context after Edit click only
Edit → context banner + prefill PASS Both sub-desktop and desktop tests green
Edit alone emits zero POST PASS Desktop test preserves no-POST invariant
Cancel from book succeeds PASS Desktop cancel path green
Vitest edit UX PASS limitOrderPriceEdit, OrderBookPanel, TradePage — 28/28

Merged fix: !849 (94214b0 sub-desktop ordering + doc crosslinks).

Re-verify checklist

  • npx playwright test e2e/trade-book-edit-178.spec.ts --project=e2e-smoke — 2/2
  • Edit → trade-limit-edit-context; amount drift → cancel-first copy; no POST on Edit alone
## Verification complete — #338 All acceptance and verification criteria **PASS** on `main` (`83dc192`). ### Results | Criterion | Result | Evidence | |-----------|--------|----------| | `trade-book-edit-178.spec.ts` smoke 2/2 | **PASS** | `npx playwright test e2e/trade-book-edit-178.spec.ts --project=e2e-smoke` | | No stale unrendered copy assertion | **PASS** | Spec asserts `trade-limit-edit-context` after Edit click only | | Edit → context banner + prefill | **PASS** | Both sub-desktop and desktop tests green | | Edit alone emits zero POST | **PASS** | Desktop test preserves no-POST invariant | | Cancel from book succeeds | **PASS** | Desktop cancel path green | | Vitest edit UX | **PASS** | `limitOrderPriceEdit`, `OrderBookPanel`, `TradePage` — 28/28 | Merged fix: !849 (`94214b0` sub-desktop ordering + doc crosslinks). ### Re-verify checklist - [ ] `npx playwright test e2e/trade-book-edit-178.spec.ts --project=e2e-smoke` — 2/2 - [ ] Edit → `trade-limit-edit-context`; amount drift → cancel-first copy; no POST on Edit alone
PlasticDigits (Migrated from gitlab.com) closed this issue 2026-06-09 08:14:48 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
code/cl8y-dex-terraclassic#338
No description provided.