# Phase 1 test procedures

Run these after installing. Each line is an action followed by the expected result.

## Authentication
1. Open the site while signed out. You are sent to the sign-in page showing the organisation name (and logo once uploaded).
2. Sign in with a wrong password. A generic "Incorrect login ID or password" message appears, and Login activity records a failed attempt.
3. Fail 5 times (default). The account locks for 15 minutes. Correct credentials are refused until it expires.
4. Sign in correctly as the administrator. The dashboard shows.
5. Leave the app idle past the timeout (System settings > Security) and click a link. You are signed out with a notice.
6. Forgot password: request a link for an account with an email. The email arrives, the link works once, and a second use fails.

## Organisation profile
7. Save a name, address, email and phone. The sign-in page (open in a private window) shows the new name immediately.
8. Upload a PNG logo. It appears on the sign-in page, sidebar and in Preview the official document header. Try uploading a .php or .svg file renamed to .png. It is rejected.
9. Remove the logo. The sign-in page falls back to the initial letter.

## Users and permissions
10. Create a Manager, an ES, a Clerk and an Employee. Each must change the temporary password at first sign-in.
11. Sign in as the Manager. They see only Users (their own team), can create Clerk and Employee accounts, and **cannot** pick Manager, ES or Administrator roles, cannot open /users/ID/permissions (403), and cannot see accounts created by others.
12. Manager tries to open another user's edit page by changing the ID in the address bar. 403.
13. Suspend the Clerk as administrator. The Clerk's next click signs them out, and sign-in is refused with a message.
14. Administrator tries to suspend themselves, or demote the only administrator. Refused.
15. Permissions page: give the Clerk **Allow** on "View user accounts". The Clerk sees Users in their menu after the next page load (it shows only accounts they created). Set it back to role default.
16. Sign in as ES. They see the dashboard, Users (read-only) and Audit trail. No edit buttons, no settings, no organisation page (typing the address gives 403).

## Settings, documents and logs
17. Change the receipt format to `REC-{YY}-{SEQ:4}`. The example updates after saving. An invalid format without {SEQ:n} is rejected.
18. Audit trail lists every action above. Click Verify integrity: "chain is intact".
19. (Optional tamper test) In phpMyAdmin change the `details` of one audit_log row, then Verify integrity again. It names the broken entry.

## Backups
20. Back up now, then Download. The .sql file opens in a text editor and starts with `-- NGO-BACKUP v1`.
21. Create a test user, then restore the earlier backup (password plus RESTORE). You are signed out, the test user is gone, and a `prerestore` backup exists.
22. Run the cron command from the Backups page in cPanel's Cron Jobs "Run now" or once a minute. A `-cron.sql` file appears.

## PWA
23. On HTTPS in Chrome, DevTools > Application > Manifest shows no errors, and the service worker is activated. Install prompts appear on Android Chrome.
24. Turn the network off and reload. The offline page appears. Application > Cache Storage contains only `assets/` files, the manifest and offline.html, never any page or record.

# Phase 2 test procedures

Use a test copy first. Test data is created through the screens below.

## Upgrade and setup
25. After uploading Phase 2, open the site. No error appears, and Users and access > Permissions now lists Members and Payments permissions.
26. Membership categories: rename General, set annual dues (for example 12000), and add a second category with 0 dues. Duplicate names are refused.

## Members and clerks
27. As a Clerk, register a member with a portal login. The member number follows System settings > Membership numbers. The member cannot sign in until they choose a new password.
28. Register a second member without a login, then create the login from the member page. Reset it once. The member must change the temporary password.
29. A Clerk cannot see Annual dues, Membership categories editing, Void receipt, or System settings (type the address: 403). The Clerk can see the member list, record payments and issue receipts.
30. Suspend a member. Their portal login is refused on the next click. Activate again.

## Charges, payments and receipts
31. As administrator, run Annual dues for the current year. One charge appears per active member in a paying category. Run it again: nothing new is created.
32. Add a special contribution charge to one member from their page.
33. As Clerk, Record payment: find the member, pick the charge, enter a part payment, choose bank transfer, attach a JPG slip. A receipt number appears and the balance drops by exactly that amount.
34. Try to pay more than the balance. It is refused with the balance shown.
35. Pay the rest. The charge shows Paid, and Outstanding contributions no longer lists the member.
36. Download the receipt PDF. It opens in a PDF viewer, shows the logo, name, address, email, telephone, receipt number, amount in words, the generated date, and the balance after payment. Print the on-screen receipt: only the receipt prints, no menus.
37. As administrator, void the receipt with a reason. The receipt shows VOIDED, the balance goes back up, the member gets a notification, and the PDF shows the VOIDED mark.
38. Waive a charge that has no payments. Waiving one with payments is refused.
39. Payments and receipts: filter by date and method, then Download for Excel. The file opens in Excel with correct columns and amounts. Check the totals line against the sum in the file.
40. Open the attached evidence from the payment page as staff (works), then try the same document address while signed in as the member (refused).

## Member portal
41. Sign in as the member. The dashboard goes to My membership. Charged, Paid and Outstanding match the staff view.
42. Subscriptions and dues: filter by year, month and category. Totals follow the filters.
43. My receipts: view, print and download a PDF. Change the number in the receipt address to another member's receipt ID: 404.
44. Request a change (new phone). The member sees it as waiting. As Clerk, Change requests: approve. The member record updates and the member is notified. Repeat with a reject (a note is required).

## Reports and audit
45. Dashboard (administrator): active members, payments received this financial year, outstanding, and pending requests match what you entered.
46. Audit trail shows member.registered, payment.recorded, payment.voided, receipt.downloaded, report.exported and the others. Verify integrity still reports an intact chain.
47. Backups: back up, create another payment, restore the backup. The extra payment is gone and receipt numbering continues from the restored state.

# Phase 3 test procedures

Use a test copy. Each step says what you should see.

## Setup
48. After upgrading, open the site. Chart of accounts lists the starter accounts. Users and access > Permissions shows the Finance permissions.
49. Finance settings: all six mappings show an account. Save with no changes: "No changes to save".
50. New journal: debit Main bank account 1,000,000 and credit Accumulated fund 1,000,000 as opening balances. It posts. Trial balance shows debits equal credits ("balanced"). Try one that does not balance: refused with both totals.
51. If you had Phase 2 payments, the Finance dashboard offers "Post them now". After pressing it, the offer disappears and Income grows by the confirmed payments.

## Member payments flow into the ledger
52. Record a member payment (cash) in Payments. Journals shows a new "member payment" journal: debit Cash on hand, credit the matching income account. Void the receipt: a reversal journal appears and balances return.
53. Close the current month under Accounting periods, then try to record a payment: refused with the period name. Reopen it and retry.

## Income
54. Income > Record income: a donation paid into the bank. A receipt number is issued, the PDF opens with letterhead and amount in words, and Journals shows the posting. Void it: a reversal appears.

## Budgets
55. As a Manager (with a department assigned), create a budget, add two lines, submit. The Executive Secretary receives a notification. The Manager cannot edit it now.
56. As ES: return it with remarks. The Manager sees the remarks, edits, resubmits. ES approves. The preparer cannot approve their own budget.
57. As someone with budgets.activate: activate it. A second approved budget for the same year and department refuses to activate while the first is active.

## Payment requests and vouchers
58. As Manager: New request to a supplier from a budget line, amount above the line's available balance, then Submit: refused showing what is left. Lower the amount and submit.
59. As ES: Approve it (Approve, Return and Reject all work; Return and Reject demand remarks). The requester cannot approve their own request.
60. As the finance officer: Pay from a cash or bank account. Try an amount larger than the account balance: refused. Then pay normally: a voucher number is issued, the request shows Paid, the budget line's Spent increases and Committed drops, and the ledger shows debit expense, credit bank.
61. Voucher PDF shows payee bank details, purpose, expense account, authorisation names and dates, amount in words, and signature lines. Void the voucher: ledger reversed, request back to Approved.
62. Approval history on each request and budget lists every step with names, times and remarks.
63. Attach a PDF to a request. The requester and finance staff can open it; an unrelated user cannot.

## Reports
64. Reports > Receipts and payments, quick range This month. Opening, receipts, payments and closing balances agree with the cashbook for the same range.
65. Income and expenditure statement: surplus equals total income minus total expenditure.
66. Cashbook, General ledger (choose an account), Trial balance, Budget performance, Member subscriptions: each shows data. Download PDF and Excel for each: the Excel file opens with real numbers (sum a column to check) and the PDF is readable across pages.
67. Bank reconciliation: pick the bank account, tick the statement items, enter the statement balance, save. A matching balance says "Reconciled". The Reconciliation statement report lists uncleared items and the expected statement balance.

## Access and audit
68. A Clerk with no finance permissions sees no Finance menu and gets 403 on /finance, /journals and /reports.
69. Audit trail contains journal.posted, request.submitted, request.approved, payment.processed, voucher.voided, report.exported, period.closed and reconciliation.saved. Verify integrity reports an intact chain.
70. Admin dashboard shows total income, total expenditure, cash and bank balances, pending payment requests and pending approvals, matching the Finance dashboard.

# Phase 4 test procedures

Use a test copy with a few dummy employees. Replace any figure below with your own and recompute by hand.

## Setup
71. After upgrading, HR setup, Payroll setup and Employees open. Payroll setup shows the Nigeria Tax Act table with its source note and "verified" date.
72. HR setup: add the office location with correct coordinates, a holiday, and check the leave types.
73. Register three employees with different pay (for example 80,000; 300,000 plus housing 150,000 and transport 50,000; 1,500,000). Create logins for two of them. A user without `hr.salary` sees no salary fields.

## Tax and pension (verify by hand)
74. Employee with basic 300,000, housing 150,000 and transport 50,000: pensionable pay is 500,000, employee pension is 8% = 40,000, employer pension 10% = 50,000. Annual chargeable income = 12 x (500,000 - 40,000) = 5,520,000 (no rent relief). Tax = 330,000 on the 800,001 to 3,000,000 slice, plus 18% of 2,520,000 = 453,600, total 783,600 a year, so monthly PAYE is 65,300. Prepare payroll and compare.
75. Add rent paid of 1,200,000 a year for that employee and recalculate. Rent relief is the smaller of 20% of rent (240,000) and 500,000, so chargeable income drops by 240,000 and PAYE falls accordingly.
76. Employee earning below the minimum-wage figure shows PAYE of zero while that exemption is on. Set the figure to 0 in a new tax table and the PAYE is calculated normally.
77. Add a bonus in the draft run. PAYE rises by the extra tax on the bonus only, and pension does not apply to the bonus.
78. Add a new tax table that starts in a later month. A run for an earlier month still uses the old table; the new one applies from its start date. A used table cannot be deleted.

## Payroll workflow
79. Prepare payroll for the current month. Payslips appear for all active employees. Exclude one employee with a reason: they disappear from the run.
80. Submit as the preparer. The Executive Secretary is notified. The preparer cannot approve it. Return it with remarks, correct, resubmit, approve.
81. Pay from the bank account. Ledger: debit Salaries (gross) and Employer pension; credit the bank (net), PAYE payable, Pension payable (employee + employer), and other deductions. Journals total balances. Paying more than the account holds is refused.
82. Payslips are numbered and the employees are notified. An employee sees only their own payslip; changing the number in the address to someone else's gives 404. Download the payslip PDF.
83. Reports: Payroll summary, Monthly PAYE schedule, Pension schedule and Annual PAYE report match the run. Download PDF and Excel. Record a PAYE remittance for part of the amount: the outstanding figure drops and the ledger moves PAYE payable to the bank.
84. Try to cancel a paid run: refused.

## Loans and advances
85. As an employee, apply for a loan above 3 x basic: refused with the limit. Apply within the limit: the supervisor is notified.
86. Supervisor recommends, approver approves, Finance pays out (ledger: debit Staff loans, credit bank). Prepare the next payroll: the instalment is deducted and shown on the payslip. After the last instalment the loan shows Cleared.
87. Nobody can review, approve or pay out their own application.

## Leave
88. Apply for leave that spans a weekend and a holiday: only working days are counted. Apply for more than the balance: refused. Sick leave requires a document.
89. Supervisor recommends, approver approves: the balance drops and the employee is notified. Cancel an approved future leave: the balance returns.

## Attendance
90. On a phone over HTTPS inside the work radius, Clock in works and shows the time. Outside the radius: refused with the distance. Deny location: refused with instructions.
91. Clock in after the start time plus grace: marked Late. Clocking in twice is refused. Clock out records the time.
92. Use a second phone for the same employee: flagged (or blocked, depending on the Phone check setting) and HR sees it on the employee page to approve or block.
93. A clerk with `attendance.manage` records a missed clock-in with a reason: marked manual and logged. The monthly summary shows days present, late, absent and on leave. Download month to date for Excel.

## Self-service and audit
94. Employee edits phone and address directly; a change to bank details goes to HR as a request and takes effect only on approval.
95. Audit trail records employee.registered, payroll.created, payroll.paid, loan.disbursed, leave.approved, attendance.clock_in, tax_parameters.added and report.exported. Verify integrity still reports an intact chain.
