Skip to content

Testing & QA ​

This page outlines how the system's behaviour can be verified. It is written so you can reproduce the checks and cite them in the thesis.

Approach ​

Testing was primarily manual, scenario-based functional testing across the three roles, backed by the deterministic seed dataset (pnpm db:seed) so every run starts from a known state. Each specific objective maps to a set of concrete checks below.

Test environment ​

ItemValue
Apppnpm dev on http://localhost:3000
Datapnpm db:seed (1 admin, 1 teacher, 5 students, 3 subjects)
AccountsSee Default Accounts
Cameralocalhost or HTTPS (browser secure-context requirement)

Functional test scenarios ​

Authentication & access control ​

#ScenarioExpected
A1Log in as each roleRedirected to the correct dashboard
A2Student opens /admin/...Redirected to /
A311 wrong passwords for one emailBlocked with rate-limit message
A4Session after 8hExpired; re-login required

QR attendance ​

#ScenarioExpected
Q1Teacher scans an enrolled student for their subjectMarked PRESENT + toast
Q2Scan the same student again"already marked PRESENT" (no duplicate)
Q3Scan a student not enrolled in the subjectRejected with reason
Q4Teacher selects a subject they don't teachRejected
Q5Invalid/garbage QR"student not found"

Manual roster & time-lock ​

#ScenarioExpected
M1Teacher toggles today's statusSaved + audited
M2Teacher edits a record older than the lock windowBlocked
M3Admin edits an old recordAllowed

Appeals ​

#ScenarioExpected
P1Student submits an appealAppears as PENDING for the teacher
P2Teacher approves itStudent PRESENT today; appeal APPROVED
P3Review an already-reviewed appeal"already been reviewed"

Masterlist & CSV import ​

#ScenarioExpected
C1Import masterlist_template.csvSections/subjects/students/enrollments created
C2Re-import the same fileIdempotent; records updated/skipped, no duplicates
C3Import a file missing a required columnWhole file rejected with a clear error
C4Row missing a required valueThat row errors; valid rows still import

Data management ​

#ScenarioExpected
D1Export backupJSON downloads; no passwords included
D2Reset with wrong confirmation textCancelled
D3Reset with RESETOperational data cleared; admins + settings preserved; DATA_RESET logged

Verifying the audit trail ​

After any attendance change, confirm a matching AttendanceAudit row exists and an ActivityLog entry was written (visible on Admin → Audit). You can inspect the tables directly with pnpm exec prisma studio.

Automated testing (future) ​

The project currently has no automated test suite. Recommended additions:

  • Unit tests for parseMasterlistCSV() and the date.ts helpers (pure functions, easy to cover).
  • Integration tests for the server actions (auth gates, time-lock, scan validation) against a test database.
  • End-to-end tests (e.g. Playwright) for the login → scan → history flow.

See Limitations & Future Work.

Documentation for the Secure QR Attendance System.