test(ssr): Phase 4 parity gate — seed + characterization spec for Sales Summary edit

Establishes the behavior-parity safety net required before migrating the POS
Sales Summary edit modal off the wizard (the modal had zero test coverage and the
test server seeded no POS data).

- test_server.clj: seed a balanced sales summary ($500 credit = $500 debit) with
  two auto items referencing the existing test client + accounts; surface its id
  via /test-info (`salesSummaryId`).
- e2e/sales-summary-edit.spec.ts: characterization spec (6 tests) capturing current
  behavior — open modal (debit/credit columns, categories, resolved account names,
  amounts), balanced state, inline account editor (pencil -> typeahead editor ->
  cancel restores / save re-renders the cell), and Save (PUT round-trip closes the
  modal + keeps the grid row). Exercises the edit-wizard, edit/save/cancel-item-account,
  and edit-wizard-submit routes.

Notable finding: the "New Summary Item" button is currently BROKEN (its Alpine
handler throws "newRowIndex is not defined" and hx-target="closest .new-row"
matches no ancestor, so the new-summary-item route never fires). The spec documents
this as inert rather than asserting it works; the migration will decide fix-vs-preserve.

Full Playwright suite 45/45 (39 prior + 6 new).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-24 21:15:28 -07:00
parent 03620e9d42
commit a289ff2557
2 changed files with 149 additions and 1 deletions

View File

@@ -29,6 +29,7 @@
(def test-transaction-id (atom nil))
(def test-account-ids (atom {}))
(def test-client-ids (atom {}))
(def test-sales-summary-id (atom nil))
(defn admin-identity []
(case @test-identity-mode
@@ -160,7 +161,26 @@
:invoice/invoice-number "UNPAID-001"
:invoice/expense-accounts [{:invoice-expense-account/account "account-id"
:invoice-expense-account/amount 150.0
:invoice-expense-account/location "DT"}])])
:invoice-expense-account/location "DT"}])
;; Sales summary for the POS sales-summary edit modal e2e
;; (balanced: $500 credit = $500 debit).
{:db/id "sales-summary-id"
:sales-summary/client "client-id"
:sales-summary/date #inst "2026-06-20T00:00:00Z"
:sales-summary/items [{:db/id "ss-item-credit"
:sales-summary-item/category "Food Sales"
:sales-summary-item/sort-order 0
:sales-summary-item/manual? false
:ledger-mapped/ledger-side :ledger-side/credit
:ledger-mapped/amount 500.0
:ledger-mapped/account "account-id"}
{:db/id "ss-item-debit"
:sales-summary-item/category "Cash Deposit"
:sales-summary-item/sort-order 1
:sales-summary-item/manual? false
:ledger-mapped/ledger-side :ledger-side/debit
:ledger-mapped/amount 500.0
:ledger-mapped/account "account-id-2"}]}])
tempids (:tempids tx-result)
tx-entity-id (get tempids "transaction-id")]
(println "Test transaction entity ID:" tx-entity-id)
@@ -174,6 +194,7 @@
(reset! test-client-ids
{:test (get tempids "client-id")
:test2 (get tempids "client-id-2")})
(reset! test-sales-summary-id (get tempids "sales-summary-id"))
tx-entity-id))
(defn test-info-handler [request]
@@ -183,6 +204,7 @@
{:transactionId @test-transaction-id
:accounts @test-account-ids
:clientMode @test-identity-mode
:salesSummaryId @test-sales-summary-id
:clients (mapv :client/code (:clients request))})})
(defn test-set-client-mode-handler [request]