Skip to content

fix(e2e): correct Scenario 25 invoice amount to account for VAT gross-up (#1591)#1699

Merged
steilerDev merged 1 commit into
betafrom
fix/1591-e2e-variance-vat-gross-up
Jun 15, 2026
Merged

fix(e2e): correct Scenario 25 invoice amount to account for VAT gross-up (#1591)#1699
steilerDev merged 1 commit into
betafrom
fix/1591-e2e-variance-vat-gross-up

Conversation

@steilerDev

Copy link
Copy Markdown
Owner

Summary

  • Fixes deterministic failure in Scenario 25 of invoice-auto-itemize-page.spec.ts: the variance indicator initial state assertion toHaveClass(/varianceMatch/) was failing because the invoice amount of 1700 was the raw net sum, but the production AutoItemizePage computes variance using effectiveLineAmount() which grosses up includesVat:false lines by ×1.19
  • THREE_LINES fixture: 900 + 680 + 120 (all net) → 1071 + 809.20 + 142.80 = 2023.00 gross
  • Set amount: 2023 in the createInvoiceViaApi call so the initial state is a genuine 0% variance → varianceMatch
  • Post-edit math (line 0 → 500 net = 595 gross): new total 1547 vs 2023 = 23.5% > 5% → varianceDanger (unchanged)
  • Updated all inline comments to reflect gross-up math; assertions are unchanged

Root Cause

The effectiveLineAmount() gross-up was introduced in Stories #1677/#1678 after Scenario 25 was written. The test was written when AutoItemizePage summed raw totalAmount, so amount: 1700 was correct then. After the gross-up change, the production code computes 2023 as the effective total but the test still used 1700, causing an immediate 19% deviation on load.

Test plan

  • CI E2E run: Scenario 25 in invoice-auto-itemize-page.spec.ts passes on all viewports (desktop/tablet/mobile)
  • Other scenarios that use THREE_LINES are unaffected (they don't assert varianceMatch)
  • amount: 1700 in all other scenarios is correct (they don't depend on gross-total matching invoice amount)

🤖 Generated with Claude Code

…-up (#1591)

The variance computation in AutoItemizePage sums effectiveLineAmount() which
grosses up net (includesVat:false) amounts by 1.19. THREE_LINES has all three
lines as net: 900+680+120 net = 1071+809.20+142.80 = 2023 gross. The test was
using invoice amount=1700 (raw net sum), causing an immediate ~19% variance on
page load and deterministic varianceMatch assertion failure.

Fix: set invoice amount=2023 (gross total) so the initial state is a genuine
0% match, then editing line 0 to 500 net (=595 gross) produces a new gross
total of 1547 vs 2023 = ~23.5% > 5% = varianceDanger as expected.

Co-Authored-By: Claude e2e-test-engineer (Sonnet 4.5) <[email protected]>
@steilerDev steilerDev merged commit b51708d into beta Jun 15, 2026
27 checks passed
@steilerDev steilerDev deleted the fix/1591-e2e-variance-vat-gross-up branch June 15, 2026 19:48
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 2.8.0-beta.18 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant