Skip to content

test(e2e): add Playwright tests for budget source bar chart rework (#1319)#1322

Merged
steilerDev merged 7 commits into
betafrom
fix/1319-budget-sources-bar-rework
Apr 20, 2026
Merged

test(e2e): add Playwright tests for budget source bar chart rework (#1319)#1322
steilerDev merged 7 commits into
betafrom
fix/1319-budget-sources-bar-rework

Conversation

@steilerDev
Copy link
Copy Markdown
Owner

@steilerDev steilerDev commented Apr 20, 2026

Summary

Reworks the budget source bar chart on /budget/sources to be clearer and less confusing:

  • Backend: adds projectedMinAmount and projectedMaxAmount to BudgetSource (min/max confidence-margined projection range). Existing projectedAmount preserved for back-compat.
  • Frontend: removes the "Allocated" segment entirely; moves Total to a header badge; removes the footer summary row (Total | Available | Planned | Rate); replaces the legend with a 3-row summary table (Projected, Paid, Claimed) with primary + de-emphasized secondary values; renders negative secondaries in var(--color-danger); relocates interest rate to a subtitle under the source name; adds a new --color-budget-projected-uncertainty token for the range band.
  • i18n: updated sources.barChart.* keys in en and de (removed allocated, total, available, planned; added projectedRange, projectedUncertainty, headroom, totalBadge, totalBadgeAriaLabel, summaryProjectedLabel, summaryPaidLabel, summaryClaimedLabel, srOnly).
  • Tests: backend unit tests for computeProjectedRange; frontend unit tests for the new summary table, total badge, negative-class on Paid/Claimed rows, and interest rate subtitle; E2E tests in budget-sources.spec.ts asserting the new layout; stale tests for the old bar legend removed.

Fixes #1319

Test plan

  • Quality Gates pass (unit + integration + typecheck + build + E2E smoke)
  • No regressions in existing budget-sources E2E tests
  • Dark mode verified for total badge, summary table, and projected-uncertainty segment

🤖 Generated with Claude Code

Frank Steiler and others added 3 commits April 20, 2026 09:23
Add projectedMinAmount and projectedMaxAmount fields to BudgetSource API
response to expose the full cost range. For non-invoiced lines, min uses
(1 - margin) and max uses (1 + margin). For invoiced lines, both min and
max use actual cost. Existing projectedAmount field unchanged for backward
compatibility.

- Add computeProjectedRange() function calculating min/max bounds
- Extend getSourceAmounts() to return both new fields
- Update toBudgetSource() signature to accept and return new fields
- Update all call sites (listBudgetSources, getBudgetSourceById)
- Fix client test fixtures to include new required fields

Co-Authored-By: Claude backend-developer (Haiku 4.5) <noreply@anthropic.com>
…nty (#1319)

Replace 'Allocated' segment with 'Projected uncertainty' range visualization. Move Total to header badge, add interest rate subtitle. Replace legend with 3-row summary table (Projected, Paid, Claimed) showing both allocated and remaining amounts. Add srOnly text for screen readers.

Changes:
- Add --color-budget-projected-uncertainty token for light and dark themes
- Update barChart i18n keys (remove allocated/total/available/planned, add srOnly and summary labels)
- Rewrite SourceBarChart: 4 segments (claimed, paid, projected, projectedUncertainty), summary table
- Add total badge in source header with aria-label
- Add interest rate subtitle between sourceMain and SourceBarChart
- Remove barLegend, sourceSummaryRow, amountNegative CSS classes
- Add summaryTable, summaryRow, summaryLabel, summaryValues, summarySecondary, sourceInterestRate, totalBadge, srOnly CSS classes
- Use projectedMinAmount and projectedMaxAmount for calculations

Co-Authored-By: Claude frontend-developer (Haiku 4.5) <noreply@anthropic.com>
Add new `test.describe('Bar chart rework #1319')` block in budget-sources.spec.ts
covering: no Allocated text, total badge visibility, 3-row summary table
(Projected/Paid/Claimed), interest rate subtitle present/absent, and dark mode.

Update BudgetSourcesPage POM:
- Add getTotalBadge(), getSummaryLabels(), getInterestRateSubtitle() helpers
- Route deprecated getAmountLabelsInRow() to getSummaryLabels() (barLegendLabel
  CSS class removed in #1319 rework)

Update existing 'Bar chart and summary row' test to match new structure:
- Assert exactly 3 summaryLabel rows instead of old summaryItem footer
- Assert 'Allocated' text is absent from source row

Fixes #1319

Co-Authored-By: Claude e2e-test-engineer (Sonnet 4.6) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

Thank you for your submission! We require all contributors to sign our Contributor License Agreement before we can accept your contribution.

To sign, please comment on this PR with:
I have read the CLA Document and I hereby sign the CLA


I have read the CLA Document and I hereby sign the CLA


Frank Steiler seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

Frank Steiler and others added 4 commits April 20, 2026 09:36
…ts (#1319)

- Add 10 backend unit tests for computeProjectedRange / projectedMinAmount /
  projectedMaxAmount covering: empty source, single invoiced, non-invoiced
  own_estimate/quote/professional_estimate, mixed invoiced+non-invoiced, HI
  lines, all-invoiced, listBudgetSources/getBudgetSourceById field presence,
  and projectedAmount == projectedMaxAmount back-compat
- Add 11 frontend tests for SourceBarChart rework: total badge, aria-label,
  3-row summary table order, no "Allocated" label, no footer rows, projected
  range primary text, negative danger class on Projected row, interest rate
  subtitle presence/absence, no "allocated" segment in BudgetBar output

Fixes #1319

Co-Authored-By: Claude qa-integration-tester (Sonnet 4.6) <noreply@anthropic.com>
…e tests (#1319)

- Apply `summarySecondaryNegative` to Paid and Claimed row secondary values
  (fixes original requirement on #1319 that any negative `total - X` value
  renders in red/danger color)
- Remove 6+ stale BudgetSourcesPage unit tests that asserted on the
  pre-rework legend/footer UI (Allocated, Overflow, old summary row labels)
- Add 2 tests covering new Paid/Claimed negative-class behavior
- Add LocaleContext mock to BudgetSourcesPage.test.tsx to unblock ESM test
  execution (useLocale() was throwing outside LocaleProvider)

Fixes #1319

Co-Authored-By: Claude frontend-developer (Haiku 4.5) <noreply@anthropic.com>
Co-Authored-By: Claude qa-integration-tester (Haiku 4.5) <noreply@anthropic.com>
Add :not([class*="summaryLabelDot"]) to the getSummaryLabels POM method so
the substring selector doesn't inadvertently match the inner color dot span
(CSS Modules hashes produce summaryLabel_xxx and summaryLabelDot_xxx, and
[class*="summaryLabel"] matched both).

Fixes #1319

Co-Authored-By: Claude dev-team-lead (Sonnet 4.6) <noreply@anthropic.com>
Co-Authored-By: Claude e2e-test-engineer (Sonnet) <noreply@anthropic.com>
@steilerDev steilerDev merged commit 5fa2bc2 into beta Apr 20, 2026
30 of 34 checks passed
@steilerDev steilerDev deleted the fix/1319-budget-sources-bar-rework branch April 20, 2026 10:07
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant