Commit d6020be
test(billing): cover deterministic billing workflows (#14810)
## Summary
Adds deterministic browser coverage for the current-main partner-node,
top-up, and responsive billing-cycle workflows. This PR is stacked on
the isolated maximum-warning prerequisite #14815, which is itself
stacked on #14713 so the Cloud Team recovery-banner slice remains
independently reviewable.
## Why this is needed
These journeys span stateful API polling, exact currency payloads,
workspace-scoped balances, partner-node recovery, permission boundaries,
and responsive pricing interactions. Main and #14713 did not
deterministically exercise them, leaving regressions dependent on live
billing state and timing.
The maximum top-up test also exposed a current frontend bug: manually
entering an amount at or above $10,000 clamps the input correctly, but
the enterprise guidance was unreachable because the warning only
appeared for values strictly greater than the maximum.
## Changes
- Adds a typed stateful billing API fixture for deterministic status,
balance, plans, preview, top-up, subscription, cancellation, and
operation polling responses.
- Adds partner-node coverage for price presentation, prompt execution
request, sufficient-credit balance deduction/refresh,
insufficient-credit recovery after a failed billing refresh, and member
privacy/permissions.
- Adds top-up coverage for exact-cent personal preset/custom payloads,
active Team workspace scoping, pending completion, HTTP failure/retry,
failed operation feedback, and the current $10,000/enterprise contract.
- Adds monthly-to-yearly Creator pricing interaction through the direct
supported pricing route on Cloud desktop and mobile, guarded by nonempty
interactive-plan assertions.
- Depends on #14815, which isolates the `showCeilingWarning` production
prerequisite.
## Root cause and fix
### AS IS
`showCeilingWarning` used `value > MAX_AMOUNT`. Because the input is
clamped to `MAX_AMOUNT`, the observable value could never remain above
the cap, hiding the warning and Contact us link at $10,000.
[AS IS
screenshot](https://ampcode.com/user-content/artifacts/6f5bcdc4d255307bdaed598273b88977160cebe70cc89f89baa56c5330e79c0f-file.png)
### TO BE
The warning uses `value >= MAX_AMOUNT`, preserving the cap while
exposing enterprise billing guidance at the reachable maximum.
[TO BE
screenshot](https://ampcode.com/user-content/artifacts/4ef8548ce8b54dee264330d27bcef202cc5633667fecacd04c46d170a3a4b44b-file.png)
## Review focus
- Stateful billing operation polling and mocked balance
refresh/deduction behavior.
- Team member permission/privacy expectations.
- The one-line maximum-warning prerequisite is isolated in #14815.
- #14526 is an active draft for a future saved-payment-method UI
contract with component tests; these browser tests remain scoped to
current-main behavior and do not mock provider metering.
- Workspace Activity API wiring and browser coverage are isolated in
#14811 and #14813 rather than duplicated here.
## Validation
- `pnpm typecheck` and `pnpm typecheck:browser`
- Focused Cloud partner-node/top-up/pricing Playwright
- Pricing mobile-chrome repeated 3 times and Cloud once after the
responsive route fix
- ESLint, oxfmt, oxlint, knip, and `git diff --check`
## Stacking
- Base: `dante/topup-max-enterprise-warning` (#14815)
- #14815 is based on `dante01yoon/test-billing-e2e-matrix` (#14713)
- Workspace Activity prerequisite/tests: #14811 → #14813
---------
Co-authored-by: Amp <amp@ampcode.com>1 parent 637cbc0 commit d6020be
6 files changed
Lines changed: 1554 additions & 37 deletions
File tree
- browser_tests
- fixtures
- data
- helpers
- tests
- dialogs
0 commit comments