Skip to content

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

Description

@TortoiseWolfe

tests/e2e/security/payment-isolation.spec.ts:157 (Payment history shows only own payments) fails intermittently on shard chromium-gen 4/6. Observed failing on two unrelated PRs the same evening (#156 auth-redirect fix, #161 messaging-RLS fix) — neither touches payment rendering — and passing on rerun both times, so it's flaky, not a real regression.

The assertion:

const hasNoPayments = await noPaymentsHeading.isVisible().catch(() => false);
const hasPayments = (await paymentList.count()) > 0;
expect(hasNoPayments || hasPayments).toBe(true);

It requires that EITHER the "No payment history" heading is visible OR at least one payment item is present. It fails when neither is true — i.e. the payment-history section is still mid-load (or in a third state) at the moment of the check. The preceding expect(getByText(/Loading payment history/i)).toBeHidden() is supposed to gate on load completion, but there's evidently a window where loading is hidden yet neither the empty-state heading nor a payment row has rendered.

Likely fix: replace the instantaneous isVisible()/count() snapshot with a Playwright web-first assertion that retries, e.g. await expect(noPaymentsHeading.or(paymentList.first())).toBeVisible(), so the check waits for one of the two terminal states instead of sampling once. Worth confirming the empty-state heading actually renders for a brand-new user with no payments (the storageState fixture user).

Low severity (rerun clears it) but it's a security-labeled test, and a flaky security test erodes trust in the gate — this is a stabilization item, not a feature.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions