Test Cases: Invoice Export & Reporting
Module: Billing & Invoicing - Export & Reporting
Backend Endpoint: GET /api/billing/admin/invoices/export
Frontend Page: frontend/pwa-app/src/pages/AdminInvoicesPage.tsx
Prerequisites
- User logged in with ADMIN or FINANCE_MANAGER role.
- Multiple invoices exist with various statuses and dates.
- Test data from
00_MASTER_TEST_DATA.mdis seeded.
Test Data
Ensure invoices span:
- Multiple months for date range testing
- All status types: PENDING, PAID, OVERDUE, VOIDED, PARTIALLY_PAID
- Multiple members for filtering
Test Cases
TC-BIL-046: Export All Invoices to CSV
| Step | Action | Expected Result |
|---|---|---|
| 1 | Login as Ana Reyes (FINANCE_MANAGER). | Dashboard displayed. |
| 2 | Navigate to Admin > Invoices. | Invoice list displayed. |
| 3 | Click "Export" button. | Export options appear. |
| 4 | Select "Export All" or "Download CSV". | API GET /api/billing/admin/invoices/export called. |
| 5 | Verify download initiated. | CSV file downloads. |
| 6 | Open CSV file. | File opens in spreadsheet application. |
| 7 | Verify headers. | Invoice #, Member, Email, Amount, Status, Due Date, Paid Date, Created Date. |
| 8 | Verify data rows. | All invoices included with correct data. |
TC-BIL-047: Export Filtered Invoices
| Step | Action | Expected Result |
|---|---|---|
| 1 | Apply status filter: "PAID". | List filtered to paid invoices. |
| 2 | Click "Export". | CSV downloaded. |
| 3 | Verify CSV content. | Only PAID invoices in export. |
| 4 | Verify row count. | Matches count shown in filtered list. |
TC-BIL-048: Export by Date Range
| Step | Action | Expected Result |
|---|---|---|
| 1 | Set date filter: January 2024. | List filtered. |
| 2 | Click "Export". | CSV downloaded. |
| 3 | Verify CSV content. | Only invoices from January 2024 included. |
| 4 | Verify all January invoices present. | No missing records. |
TC-BIL-049: Export by Member
| Step | Action | Expected Result |
|---|---|---|
| 1 | Filter invoices by member: Maria Cruz. | Juan's invoices displayed. |
| 2 | Click "Export". | CSV downloaded. |
| 3 | Verify CSV content. | Only Maria Cruz's invoices in file. |
TC-BIL-050: Export Combined Filters
| Step | Action | Expected Result |
|---|---|---|
| 1 | Set status filter: OVERDUE. | - |
| 2 | Set date range: Last 90 days. | - |
| 3 | Click "Export". | CSV downloaded. |
| 4 | Verify CSV content. | Only overdue invoices from last 90 days. |
TC-BIL-051: CSV Format Validation
| Step | Action | Expected Result |
|---|---|---|
| 1 | Export invoices to CSV. | File downloaded. |
| 2 | Verify file extension. | .csv extension. |
| 3 | Verify encoding. | UTF-8 encoding (special characters handled). |
| 4 | Verify delimiter. | Comma-separated values. |
| 5 | Verify numeric fields. | Amounts formatted correctly (no currency symbols in raw data). |
| 6 | Verify date fields. | Consistent date format (ISO or locale-specific). |
| 7 | Verify text with commas. | Properly escaped/quoted. |
TC-BIL-052: Export Large Dataset Performance
| Step | Action | Expected Result |
|---|---|---|
| 1 | Ensure 1000+ invoices exist. | - |
| 2 | Request full export without filters. | Export initiated. |
| 3 | Measure response time. | Export completes within acceptable time (< 30 seconds). |
| 4 | Verify file completeness. | All 1000+ records present. |
| 5 | Verify no timeout errors. | Request completes successfully. |
TC-BIL-053: Export Empty Result Set
| Step | Action | Expected Result |
|---|---|---|
| 1 | Apply filter that returns no results (e.g., future date). | "No invoices found" displayed. |
| 2 | Attempt export. | Appropriate message or empty CSV with headers only. |
| 3 | Verify handling. | No error, graceful handling. |
TC-BIL-054: Export with Special Characters
| Step | Action | Expected Result |
|---|---|---|
| 1 | Create invoice with special characters in description (e.g., "José's Fee, 50%"). | Invoice created. |
| 2 | Export invoices. | CSV downloaded. |
| 3 | Open CSV and find the invoice. | Special characters preserved correctly. |
| 4 | Verify no CSV parsing errors. | File opens without corruption. |
TC-BIL-055: Export Permission - Denied for Regular Member
| Step | Action | Expected Result |
|---|---|---|
| 1 | Login as Maria Cruz (MEMBER). | Member dashboard. |
| 2 | Attempt to access export endpoint directly. | GET /api/billing/admin/invoices/export |
| 3 | Verify response. | Status 403 Forbidden. |
TC-BIL-056: Finance Dashboard Summary
| Step | Action | Expected Result |
|---|---|---|
| 1 | Login as FINANCE_MANAGER. | - |
| 2 | Navigate to Admin > Finance Dashboard. | Dashboard displayed. |
| 3 | Verify summary cards. | Total Outstanding, Total Collected (This Month), Overdue Count. |
| 4 | Verify amounts correct. | Match sum of invoice amounts by status. |
| 5 | Verify chart/graph if present. | Revenue trend, status distribution. |
TC-BIL-057: Invoices by Status Report
| Step | Action | Expected Result |
|---|---|---|
| 1 | Access Finance Dashboard or Reports. | - |
| 2 | View "Invoices by Status" breakdown. | Pie chart or table displayed. |
| 3 | Verify counts. | PENDING: X, PAID: Y, OVERDUE: Z, VOIDED: W. |
| 4 | Click on a status segment. | Filtered list of those invoices shown. |
TC-BIL-058: Monthly Revenue Report
| Step | Action | Expected Result |
|---|---|---|
| 1 | Access monthly revenue report. | Report displayed. |
| 2 | Select month: January 2024. | - |
| 3 | Verify totals. | Total billed, Total collected, Outstanding. |
| 4 | Verify breakdown by invoice type. | Dues, Events, Manual, etc. |
TC-BIL-059: Aging Report (Overdue Invoices)
| Step | Action | Expected Result |
|---|---|---|
| 1 | Access Aging Report. | Report displayed. |
| 2 | Verify aging buckets. | 1-30 days, 31-60 days, 61-90 days, 90+ days. |
| 3 | Verify invoices categorized correctly. | Based on days past due date. |
| 4 | Verify amounts per bucket. | Sum of overdue amounts in each category. |
TC-BIL-060: Export Audit Trail
| Step | Action | Expected Result |
|---|---|---|
| 1 | Perform export action. | Export downloaded. |
| 2 | Check audit log. | Export action logged with timestamp and user. |
| 3 | Verify log entry. | "User treasurer@demo.membervu.com exported invoices with filters: {...}". |
API Test Cases
TC-BIL-API-014: GET /api/billing/admin/invoices/export
Request: GET /api/billing/admin/invoices/export
Expected Response: 200 OK
Content-Type: text/csv or application/csv
Content-Disposition: attachment; filename="invoices_export_2024-01-27.csv"
TC-BIL-API-015: GET /api/billing/admin/invoices/export?status=OVERDUE
Request: GET /api/billing/admin/invoices/export?status=OVERDUE
Expected Response: 200 OK with only overdue invoices in CSV
TC-BIL-API-016: GET /api/billing/admin/invoices/export?startDate=2024-01-01&endDate=2024-01-31
Request with date range
Expected Response: 200 OK with invoices from January 2024
TC-BIL-API-017: GET /api/billing/admin/finance/summary
Expected Response: 200 OK
{
"totalOutstanding": 25000,
"totalCollectedThisMonth": 150000,
"overdueCount": 12,
"overdueAmount": 35000,
"pendingCount": 25,
"pendingAmount": 125000,
"byStatus": {
"PENDING": { "count": 25, "amount": 125000 },
"PAID": { "count": 150, "amount": 750000 },
"OVERDUE": { "count": 12, "amount": 35000 },
"VOIDED": { "count": 5, "amount": 15000 }
}
}