Add Playwright E2E suite (46 tests) + app testids + test_cases.md
- e2e/: full Playwright suite covering every spec case (staff auth/UI, welcome + session check-in, attendee access/gating, connections, profile visibility, speaker material, sponsor, feedback, E2E journeys, role security matrix). 46/46 passing. - apps/convivo: add data-testid attributes (gate, tabs, scanner, toggles) to support the E2E suite. - test_cases.md: spec-case-to-test coverage map (all cases fully covered). - .gitignore: ignore e2e node_modules/reports/test-results.
This commit is contained in:
1 parent
e4c8815e52
commit
692df23149
44 files changed
+3715
-26
No files matched your search
@@ -0,0 +1,92 @@
|
||||
import { test, expect } from './base';
|
||||
import { APP_URL, ID, SESSION_A, SESSION_B } from '../src/helpers/config';
|
||||
import { login } from '../src/helpers/auth';
|
||||
import { createUser } from '../src/helpers/multi';
|
||||
import { db } from '../src/helpers/db';
|
||||
import { AppPage } from '../src/pages/AppPage';
|
||||
import { ScanPage } from '../src/pages/ScanPage';
|
||||
|
||||
/**
|
||||
* §21–§23 Session Check-In + Welcome/Session independence.
|
||||
*/
|
||||
|
||||
test.describe('Session Check-In', () => {
|
||||
test('CONV-SESSION-001 staff checks an attendee into a session (QR)', async ({ page }) => {
|
||||
const app = new AppPage(page, APP_URL);
|
||||
const scan = new ScanPage(page);
|
||||
|
||||
await login(page, APP_URL, ID.staff);
|
||||
await app.waitForAdmitted();
|
||||
await app.gotoTab('scan');
|
||||
await scan.setStaffMode();
|
||||
await scan.setSessionMode();
|
||||
|
||||
// SESSION_A is explicitly selected.
|
||||
await scan.selectSession(SESSION_A);
|
||||
|
||||
// Scan ATTENDEE_A and complete the check-in.
|
||||
await scan.scanCode(ID.attendeeA.qrToken);
|
||||
await expect(scan.sessionResult()).toBeVisible();
|
||||
|
||||
// Attendance is registered for (ATTENDEE_A, SESSION_A) and persisted.
|
||||
expect(await db.waitForSessionCheckin(ID.attendeeA.email, SESSION_A)).toBe(true);
|
||||
|
||||
// Attendance is NOT automatically created for other sessions.
|
||||
const checkins = db.sessionCheckins(ID.attendeeA.email);
|
||||
expect(checkins).toContain(SESSION_A);
|
||||
expect(checkins).not.toContain(SESSION_B);
|
||||
});
|
||||
|
||||
test('CONV-SESSION-002 session check-in via manual code is equivalent to QR', async ({ page }) => {
|
||||
const app = new AppPage(page, APP_URL);
|
||||
const scan = new ScanPage(page);
|
||||
|
||||
await login(page, APP_URL, ID.staff);
|
||||
await app.waitForAdmitted();
|
||||
await app.gotoTab('scan');
|
||||
await scan.setStaffMode();
|
||||
await scan.setSessionMode();
|
||||
await scan.selectSession(SESSION_A);
|
||||
|
||||
// Manual code input (the same token the QR would carry).
|
||||
await scan.scanCode(ID.attendeeA.qrToken);
|
||||
await expect(scan.sessionResult()).toBeVisible();
|
||||
|
||||
// Equivalent backend state: (ATTENDEE_A, SESSION_A) checked in.
|
||||
expect(await db.waitForSessionCheckin(ID.attendeeA.email, SESSION_A)).toBe(true);
|
||||
});
|
||||
|
||||
test('CONV-SESSION-003 welcome check-in and session check-in are independent states', async ({ page }) => {
|
||||
const app = new AppPage(page, APP_URL);
|
||||
const scan = new ScanPage(page);
|
||||
|
||||
await login(page, APP_URL, ID.staff);
|
||||
await app.waitForAdmitted();
|
||||
await app.gotoTab('scan');
|
||||
|
||||
// 1. Welcome check-in only (no session).
|
||||
await scan.setWelcomeMode();
|
||||
await scan.scanCode(ID.attendeeA.qrToken);
|
||||
await expect(scan.welcomeResult()).toBeVisible();
|
||||
expect(await db.waitForWelcomeCheckedIn(ID.attendeeA.email)).toBe(true);
|
||||
|
||||
// Welcome check-in must NOT create any session attendance.
|
||||
await new Promise((r) => setTimeout(r, 300));
|
||||
expect(db.sessionCheckins(ID.attendeeA.email)).toEqual([]);
|
||||
|
||||
// Dismiss the result sheet so its backdrop doesn't block the mode toggle.
|
||||
await scan.dismissResult();
|
||||
|
||||
// 2. Now a session check-in (SESSION_A) — a distinct, session-specific state.
|
||||
await scan.setSessionMode();
|
||||
await scan.selectSession(SESSION_A);
|
||||
await scan.scanCode(ID.attendeeA.qrToken);
|
||||
await expect(scan.sessionResult()).toBeVisible();
|
||||
expect(await db.waitForSessionCheckin(ID.attendeeA.email, SESSION_A)).toBe(true);
|
||||
|
||||
// The session check-in references a specific session (SESSION_A, not SESSION_B).
|
||||
const checkins = db.sessionCheckins(ID.attendeeA.email);
|
||||
expect(checkins).toContain(SESSION_A);
|
||||
expect(checkins).not.toContain(SESSION_B);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user