Skip to content

test(e2e): cover organization budget enforcement - #1070

Draft
saurya wants to merge 1 commit into
mainfrom
e2e/org-budget-enforcement
Draft

test(e2e): cover organization budget enforcement#1070
saurya wants to merge 1 commit into
mainfrom
e2e/org-budget-enforcement

Conversation

@saurya

@saurya saurya commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Migration

Ports https://github.com/OpenHands/saas-deploy/pull/578 from OpenHands/saas-deploy so the test ships with the OpenHands-Cloud chart release it validates.

This pull request is based directly on main, which includes the foundational Playwright harness from OpenHands-Cloud #1048.

Original scenario contract

Scenario

Adds one Playwright spec with one test that sets an already-exceeded near-zero organization limit through /settings/budgets, submits a minimal conversation-start request, and requires a budget rejection before a conversation ID is created.

No-spend proof

  • Requires existing month-to-date spend to already exceed the near-zero limit; it never generates spend to reach the cap.
  • Requires the start task to finish as ERROR with no app_conversation_id.
  • Reads budget state before and after the probe and asserts current_spend is exactly unchanged.

Validation

  • npm ci completed once in the isolated clone
  • npm run typecheck
  • focused ESLint and Prettier checks ✅
  • npx playwright test tests/org-budget-enforcement.spec.ts --list
  • repository-wide npm run lint ⚠️ blocked by 15 pre-existing errors in ConversationPage.ts, HomePage.ts, and smoke.spec.ts; this new spec has no lint errors
  • Live execution not attempted because the admin storage-state fixture is unavailable locally.

Environment contract

  • e2e_tests/fixtures/auth.json: authenticated organization admin or owner
  • Selected non-personal organization has Budgets enabled, working LiteLLM budget sync, and current_spend > 0.000001
  • Dedicated test organization; no concurrent budget-mutating tests

Missing or unsuitable fixtures raise explicit errors; the test never silently skips.

Cleanup

A finally block restores the complete original budget snapshot. Any unexpectedly created conversation is deleted defensively.

Risk

Medium: temporarily blocks conversation starts for the organization. Run only against a dedicated test organization. The test is intentionally designed not to incur LLM spend.

This pull request was created by an AI agent (OpenHands) on behalf of the user.

Port validation

  • Exactly one changed file: e2e_tests/tests/org-budget-enforcement.spec.ts.
  • Exactly one Playwright test in the spec.
  • Focused ESLint and Prettier checks passed.
  • tsc --noEmit passed against the Cloud harness.
  • Chromium Playwright --list discovery passed.
  • Live execution still requires the explicit authentication and TEST_* contracts documented above.

AI disclosure: This pull request was migrated by an AI agent (OpenHands) on behalf of the user.

@github-actions github-actions Bot added the type: test Adding or fixing tests label Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: test Adding or fixing tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant