Skip to content

fix(test): #163 add data-payment-item hook so payment-isolation E2E scopes on rendered rows#164

Merged
TortoiseWolfe merged 1 commit into
mainfrom
fix/163-payment-item-hook
Jul 3, 2026
Merged

fix(test): #163 add data-payment-item hook so payment-isolation E2E scopes on rendered rows#164
TortoiseWolfe merged 1 commit into
mainfrom
fix/163-payment-item-hook

Conversation

@TortoiseWolfe

Copy link
Copy Markdown
Owner

Closes #163. Un-reds main.

Root cause (from the failure trace, not a guess)

The payment-isolation "shows only own payments" E2E (tests/e2e/security/payment-isolation.spec.ts:157) asserts hasNoPayments || hasPayments, where the list branch counts [data-payment-item]. PaymentHistory never emitted that attribute — it renders payments as plain <tr> table rows and mobile cards. So the assertion could only pass through the "No payment history" empty state.

The test went red the moment the shared fixture user acquired a seeded payment_results row (there's currently 1). At that point the component correctly renders the payment table, but neither hasNoPayments (empty state gone) nor hasPayments ([data-payment-item] count still 0) is true → expect(false || false).toBe(true) fails.

Verified via the captured Playwright trace: the payment_results query returned 200 with one correctly-scoped row for the primary user, the component rendered the desktop table (not the error or loading state), and there was no auth leak. So this is a stale-selector test gap, not a data, auth, or component fault.

Not a regression from #156

Because the failure correlated in time with #156 (auth-redirect basePath fix), I first suspected that PR. Ruled it out with a controlled experiment: re-ran the E2E suite on the pre-#156 commit (b31a8d0) today — it fails the identical assertion on all three browsers. The test was always latently broken; it only passed while the fixture user happened to have zero payments. #156 is exonerated.

The fix

Add data-payment-item to the rendered payment rows (desktop table <tr> and mobile card <div>), so the list branch matches actual rendered payments regardless of the fixture user's payment count.

🤖 Generated with Claude Code

…copes on rendered rows

The payment-isolation "shows only own payments" E2E asserts
`hasNoPayments || hasPayments`, counting `[data-payment-item]` for the
list branch. PaymentHistory never emitted that attribute, so the test
only passed via the empty-state — it went red the moment the shared
fixture user acquired a seeded payment row (verified via the failure
trace: query returned 200 with one row, component rendered the table,
neither test branch matched). Not flake, not a regression from #156 —
a latent test-selector gap. Confirmed pre-existing by re-running E2E on
the pre-#156 commit (also red).

Adds data-payment-item to the desktop table rows and mobile cards so
the list branch matches actual rendered payments.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@TortoiseWolfe TortoiseWolfe merged commit 2565774 into main Jul 3, 2026
18 checks passed
@TortoiseWolfe TortoiseWolfe deleted the fix/163-payment-item-hook branch July 3, 2026 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flaky E2E: payment-isolation 'shows only own payments' intermittently fails on the empty-state assertion

1 participant