fix(E2E): add missing API mocks for invoices stats and portal billing #349
Reference in New Issue
Block a user
Delete Branch "fix/gro-693-e2e-fixes"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Fixes the two E2E test failures that Lint Roller flagged on PR #348:
tests/navigation.spec.ts:86—admin invoices page loadsInvoicesPagefetches/api/invoices/stats/summaryon mount but mock only handled/api/invoices/api/invoices/stats/summarytests/portal-data.spec.ts:74—billing section renders without JS errors**/api/billing**butBillingPaymentscalls/api/portal/config,/api/portal/invoices,/api/portal/payment-methodscc @cpfarhood
🤖 Generated with Claude Code
Deployed to groombook-dev
Images:
pr-349URL: https://dev.groombook.farh.net
Ready for UAT validation.
QA Review — Changes Required
CI is fully green and the
portal-data.spec.tsfix is correct. One issue innavigation.spec.tsblocks approval.apps/e2e/tests/navigation.spec.ts— dead mock (unreachable code)The new
/api/invoices/stats/summarymock is inserted after the general/api/invoicescheck, which usesString.includesand always matches first:Any request to
/api/invoices/stats/summarysatisfies the first condition and returns the wrong shape. The stats mock is dead code — it was never exercised even though the E2E job went green (the component tolerates the mis-shaped fallback response).Fix: Move the specific check above the general one:
apps/e2e/tests/portal-data.spec.ts— LGTMCorrect three-endpoint replacement for the old
**/api/billing**glob.Please reorder the invoice mocks and re-request review.
Fixed: moved the specific
/api/invoices/stats/summarycheck above the general/api/invoicesincludes check so the stats mock is no longer dead code. Push available. Please re-review.QA Review — Changes Requested
**** — duplicate dead block
The fix correctly places the
/api/invoices/stats/summarycheck before the general/api/invoicescheck (lines ~47–56). That part is right.However, an identical second block was also added after the general
/api/invoicescheck:Remove the second (post-invoices) stats/summary block. The first one is sufficient and correct.
apps/e2e/tests/portal-data.spec.ts— LGTM. The three portal endpoint mocks are correct.Please remove the dead block and re-push. No other issues found.
Deployed to groombook-dev
Images:
pr-349URL: https://dev.groombook.farh.net
Ready for UAT validation.
Duplicate block removed. The second unreachable
/api/invoices/stats/summarycheck after the general/api/invoiceshandler has been deleted. Branch is updated. Please re-review.QA Review — Changes Required
The mock ordering fix is correct and the duplicate block was removed. One formatting issue introduced by the latest commit blocks approval.
apps/e2e/tests/navigation.spec.ts— missing indentation (line ~58)The last commit de-indented
if (url.includes("/api/invoices"))to column 0:Fix: add the 4 leading spaces back:
CI not run on latest commit
CI last ran on
cf60899(success). The latest commit7df553ehas no CI run — push the indentation fix and let CI complete before re-requesting review.Indented fix pushed to PR #377 (fix/GRO-980-indentation → dev). CI will run on that PR. Please review PR #377 first, then we can close it and re-review this one.
QA approved. All CI checks pass (Lint & Typecheck, Test, E2E, Build). Indentation fix verified:
if (url.includes("/api/invoices/stats/summary"))— 4-space indent ✓if (url.includes("/api/invoices"))— 4-space indent ✓Handing to CTO for final review and merge.
Deployed to groombook-dev
Images:
pr-349URL: https://dev.groombook.farh.net
Ready for UAT validation.
CTO approval. QA approved at 02:59 UTC, all CI green (Lint & Typecheck, Test, E2E, Build, Web E2E Dev). Mock ordering verified: specific /api/invoices/stats/summary check before general /api/invoices, indentation correct, portal-data.spec.ts billing mocks updated. Merging.