test(ssr): Phase 6b parity gate — characterization spec for Transaction Rule wizard
Behavior-parity safety net before migrating the Transaction Rule modal onto the session-backed wizard engine. The modal had no e2e coverage; the test server seeded no rules. - test_server.clj: seed a transaction rule (under client TEST2, in a SEPARATE transaction so the first transaction's tempid->entity-id allocation — and thus the TEST transaction grid order the other specs depend on — is byte-identical); surface its id via /test-info (ruleId). - e2e/transaction-rule.spec.ts (4 tests): the new-rule edit step renders (description, account grid, approval radios, Test control), the edit dialog pre-populates the seeded rule, advancing to the test step renders the matching-transactions preview, and saving from the test step creates the rule + closes the modal. Covers both entry points (new/edit), both steps (edit + test), and save. Note: deliberately NOT seeding a recent matching transaction — a date-NOW txn perturbs an unrelated transaction-edit save spec (pre-existing fragility), and the test-table query/render is reused unchanged by the migration, so characterizing that the preview renders is sufficient parity. Full Playwright suite 55/55 (51 prior + 4 new). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
(def test-account-ids (atom {}))
|
||||
(def test-client-ids (atom {}))
|
||||
(def test-sales-summary-id (atom nil))
|
||||
(def test-rule-id (atom nil))
|
||||
|
||||
(defn admin-identity []
|
||||
(case @test-identity-mode
|
||||
@@ -182,6 +183,25 @@
|
||||
:ledger-mapped/amount 500.0
|
||||
:ledger-mapped/account "account-id-2"}]}])
|
||||
tempids (:tempids tx-result)
|
||||
;; A pre-existing transaction rule (for the wizard edit flow), in a SEPARATE
|
||||
;; transaction so the first one's tempid->entity-id allocation (and thus the TEST
|
||||
;; transaction grid order other specs depend on) is byte-identical to before.
|
||||
;; Under client TEST2 so it stays out of the single-client TEST views. We do NOT
|
||||
;; seed a recent matching transaction: a date-NOW txn perturbs an unrelated
|
||||
;; transaction-edit save spec, and the rule test step's query/render is reused
|
||||
;; unchanged by the migration, so characterizing that the preview table renders is
|
||||
;; sufficient parity (the specific match count is not what the migration risks).
|
||||
rule-tx (:tempids
|
||||
@(dc/transact conn
|
||||
[{:db/id "rule-id"
|
||||
:transaction-rule/client (get tempids "client-id-2")
|
||||
:transaction-rule/description "ZZRULEMATCH"
|
||||
:transaction-rule/note "ZZRULEMATCH"
|
||||
:transaction-rule/transaction-approval-status :transaction-approval-status/approved
|
||||
:transaction-rule/accounts [{:db/id "rule-acct"
|
||||
:transaction-rule-account/account (get tempids "account-id")
|
||||
:transaction-rule-account/location "Shared"
|
||||
:transaction-rule-account/percentage 1.0}]}]))
|
||||
tx-entity-id (get tempids "transaction-id")]
|
||||
(println "Test transaction entity ID:" tx-entity-id)
|
||||
(reset! test-account-ids
|
||||
@@ -195,6 +215,7 @@
|
||||
{:test (get tempids "client-id")
|
||||
:test2 (get tempids "client-id-2")})
|
||||
(reset! test-sales-summary-id (get tempids "sales-summary-id"))
|
||||
(reset! test-rule-id (get rule-tx "rule-id"))
|
||||
tx-entity-id))
|
||||
|
||||
(defn test-info-handler [request]
|
||||
@@ -205,6 +226,7 @@
|
||||
:accounts @test-account-ids
|
||||
:clientMode @test-identity-mode
|
||||
:salesSummaryId @test-sales-summary-id
|
||||
:ruleId @test-rule-id
|
||||
:clients (mapv :client/code (:clients request))})})
|
||||
|
||||
(defn test-set-client-mode-handler [request]
|
||||
|
||||
Reference in New Issue
Block a user