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. Co-authored-by: Stephan Charles <[email protected]> Co-authored-by: Amelia Hernandez <[email protected]> Co-authored-by: Markus Franz <[email protected]> Co-authored-by: Sabrina Hota <[email protected]> Co-authored-by: Nilüfer Doğan <[email protected]>
This commit is contained in:
1 parent
b08a439949
commit
d5ec009cb5
44 files changed
+3715
-26
No files matched your search
@@ -0,0 +1,43 @@
|
||||
import type { Page } from '@playwright/test';
|
||||
|
||||
/**
|
||||
* The Agenda screen — the schedule (slots + sessions). Tapping a session opens
|
||||
* a detail sheet with: pick/clear, the speaker material upload (for the
|
||||
* session's speaker), the material download, and "Give feedback" (when the
|
||||
* session is done and the user was checked in).
|
||||
*/
|
||||
export class AgendaPage {
|
||||
constructor(
|
||||
readonly page: Page,
|
||||
) {}
|
||||
|
||||
/** Open a session's detail sheet by its title. */
|
||||
async openSession(title: string): Promise<void> {
|
||||
await this.page.getByRole('button', { name: title, exact: false }).first().click();
|
||||
}
|
||||
|
||||
/** The material upload file input (visible only for the session's speaker, when pending). */
|
||||
materialUploadInput(): ReturnType<Page['locator']> {
|
||||
return this.page.getByTestId('material-upload');
|
||||
}
|
||||
|
||||
/** Upload a material file (Playwright file-upload, spec §28). */
|
||||
async uploadMaterial(filePath: string): Promise<void> {
|
||||
await this.materialUploadInput().setInputFiles(filePath);
|
||||
}
|
||||
|
||||
/** The "Give feedback" button (done + checked-in). */
|
||||
giveFeedbackButton(): ReturnType<Page['locator']> {
|
||||
return this.page.getByTestId('give-feedback');
|
||||
}
|
||||
|
||||
/** The "You weren't checked in to this session" notice. */
|
||||
notCheckedInNotice(): ReturnType<Page['locator']> {
|
||||
return this.page.getByText(/You weren’t checked in to this session/);
|
||||
}
|
||||
|
||||
/** The "📎 you" speaker tag on a session (marks the user's own session). */
|
||||
speakerTag(): ReturnType<Page['locator']> {
|
||||
return this.page.getByText('🎤 you').first();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
import type { Page } from '@playwright/test';
|
||||
|
||||
/**
|
||||
* Base page object for the authenticated Convivo app shell.
|
||||
*
|
||||
* The app is a single-page shell with a bottom tab bar (Home / Agenda / Scan /
|
||||
* Connect / Profile) plus a full-screen Feedback takeover. This object wraps
|
||||
* tab navigation and the shared "am I admitted?" checks. Keep business
|
||||
* workflows in the tests themselves (spec §40).
|
||||
*/
|
||||
export class AppPage {
|
||||
constructor(
|
||||
readonly page: Page,
|
||||
readonly appUrl: string,
|
||||
) {}
|
||||
|
||||
/** Navigate to a tab by its testid suffix (home, agenda, scan, connections, profile). */
|
||||
async gotoTab(tab: 'home' | 'agenda' | 'scan' | 'connections' | 'profile'): Promise<void> {
|
||||
await this.page.getByTestId(`tab-${tab}`).click();
|
||||
}
|
||||
|
||||
/** True when the user is admitted (tab bar visible). */
|
||||
isAdmitted(): Promise<boolean> {
|
||||
return this.page.getByTestId('tab-home').isVisible().catch(() => false);
|
||||
}
|
||||
|
||||
/** True when the user is on the "please see a staff member" gate. */
|
||||
isGated(): Promise<boolean> {
|
||||
return this.page.getByTestId('checkin-required-gate').isVisible().catch(() => false);
|
||||
}
|
||||
|
||||
/** Wait until the user is admitted (tab bar visible). */
|
||||
async waitForAdmitted(): Promise<void> {
|
||||
await this.page.getByTestId('tab-home').waitFor({ state: 'visible' });
|
||||
}
|
||||
|
||||
/** Wait until the user is on the check-in-required gate. */
|
||||
async waitForGated(): Promise<void> {
|
||||
await this.page.getByTestId('checkin-required-gate').waitFor({ state: 'visible' });
|
||||
}
|
||||
|
||||
/** The event name shown on Home/Agenda (to verify the Demo Event is loaded). */
|
||||
eventTitle(): ReturnType<Page['locator']> {
|
||||
return this.page.getByText(/Global Power Platform Bootcamp/).first();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
import type { Page } from '@playwright/test';
|
||||
|
||||
/**
|
||||
* The Connections screen — two tabs:
|
||||
* - "My connections": established (accepted) connections.
|
||||
* - "Requests": incoming (accept/decline) + outgoing (pending) requests.
|
||||
*
|
||||
* The three states (connected / outgoing-pending / incoming) must never be
|
||||
* mixed (spec §18).
|
||||
*/
|
||||
export class ConnectionsPage {
|
||||
constructor(
|
||||
readonly page: Page,
|
||||
) {}
|
||||
|
||||
/** Navigate to the Connections screen (bottom tab). */
|
||||
async goto(): Promise<void> {
|
||||
await this.page.getByTestId('tab-connections').click();
|
||||
await this.page.getByTestId('connections-tab-mine').waitFor({ state: 'visible' });
|
||||
}
|
||||
|
||||
/** Switch to the "My connections" tab. */
|
||||
async gotoMine(): Promise<void> {
|
||||
await this.goto();
|
||||
await this.page.getByTestId('connections-tab-mine').click();
|
||||
}
|
||||
|
||||
/** Switch to the "Requests" tab. */
|
||||
async gotoRequests(): Promise<void> {
|
||||
await this.goto();
|
||||
await this.page.getByTestId('connections-tab-req').click();
|
||||
}
|
||||
|
||||
/** The "Incoming" section header (present only when there are incoming requests). */
|
||||
incomingHeader(): ReturnType<Page['locator']> {
|
||||
return this.page.getByText('Incoming', { exact: true });
|
||||
}
|
||||
|
||||
/** The "Sent" (outgoing) section header. */
|
||||
sentHeader(): ReturnType<Page['locator']> {
|
||||
return this.page.getByText('Sent', { exact: true });
|
||||
}
|
||||
|
||||
/** Accept the (single) incoming request. */
|
||||
async accept(): Promise<void> {
|
||||
await this.page.getByTestId('connection-accept').click();
|
||||
}
|
||||
|
||||
/** Decline the (single) incoming request. */
|
||||
async decline(): Promise<void> {
|
||||
await this.page.getByTestId('connection-decline').click();
|
||||
}
|
||||
|
||||
/** Does the "My connections" tab list a given person's name? */
|
||||
async mineContains(name: string): Promise<boolean> {
|
||||
await this.gotoMine();
|
||||
return (await this.page.getByText(name, { exact: true }).count()) > 0;
|
||||
}
|
||||
|
||||
/** Does the Requests tab show an incoming request from a given person? */
|
||||
async incomingContains(name: string): Promise<boolean> {
|
||||
await this.gotoRequests();
|
||||
const incoming = this.page.locator('text=Incoming');
|
||||
if ((await incoming.count()) === 0) return false;
|
||||
return (await this.page.getByText(name, { exact: true }).count()) > 0;
|
||||
}
|
||||
|
||||
/** Does the Requests tab show an outgoing (sent) request to a given person? */
|
||||
async outgoingContains(name: string): Promise<boolean> {
|
||||
await this.gotoRequests();
|
||||
const sent = this.page.locator('text=Sent');
|
||||
if ((await sent.count()) === 0) return false;
|
||||
return (await this.page.getByText(name, { exact: true }).count()) > 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
import type { Page } from '@playwright/test';
|
||||
|
||||
/**
|
||||
* The Feedback screen — a full-screen takeover to rate a session 1–5 stars and
|
||||
* optionally leave a comment. Only reachable for a session the user was
|
||||
* checked into (and that is over).
|
||||
*/
|
||||
export class FeedbackPage {
|
||||
constructor(
|
||||
readonly page: Page,
|
||||
) {}
|
||||
|
||||
/** Select a star rating (1–5). */
|
||||
async rate(n: number): Promise<void> {
|
||||
await this.page.getByTestId(`feedback-star-${n}`).click();
|
||||
}
|
||||
|
||||
/** Add a comment. */
|
||||
async setComment(text: string): Promise<void> {
|
||||
await this.page.getByTestId('feedback-comment').fill(text);
|
||||
}
|
||||
|
||||
/** Submit the feedback. */
|
||||
async submit(): Promise<void> {
|
||||
await this.page.getByTestId('feedback-submit').click();
|
||||
}
|
||||
|
||||
/** The session title shown in the feedback header. */
|
||||
sessionTitle(): ReturnType<Page['locator']> {
|
||||
return this.page.locator('.card .h2').first();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
import type { Page } from '@playwright/test';
|
||||
|
||||
/**
|
||||
* The Home screen — greeting, event name, Now/Next, the pending-material pill
|
||||
* (📎, for speakers with a session missing its attachment), the pending-feedback
|
||||
* pill (⭐), and quick actions.
|
||||
*/
|
||||
export class HomePage {
|
||||
constructor(
|
||||
readonly page: Page,
|
||||
) {}
|
||||
|
||||
/** The pending-material pill (📎 N) — the red attachment indicator. */
|
||||
materialPill(): ReturnType<Page['locator']> {
|
||||
return this.page.getByTestId('material-pill');
|
||||
}
|
||||
|
||||
/** The pending-feedback pill (⭐). */
|
||||
feedbackPill(): ReturnType<Page['locator']> {
|
||||
return this.page.getByTestId('feedback-pill');
|
||||
}
|
||||
|
||||
/** The greeting header (e.g. "Good morning, Lena 👋"). */
|
||||
greeting(): ReturnType<Page['locator']> {
|
||||
return this.page.locator('.h1').first();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
import type { Page } from '@playwright/test';
|
||||
|
||||
/**
|
||||
* The Profile screen — self-service: LinkedIn URL + the two visibility toggles
|
||||
* (Show my email / Show my LinkedIn), plus the points breakdown and logout.
|
||||
*/
|
||||
export class ProfilePage {
|
||||
constructor(
|
||||
readonly page: Page,
|
||||
) {}
|
||||
|
||||
/** The "Show my email" checkbox (data-testid is on the input; the input is
|
||||
* visually hidden, so we read state from it but click the wrapping label). */
|
||||
showEmailToggle(): ReturnType<Page['locator']> {
|
||||
return this.page.getByTestId('profile-show-email');
|
||||
}
|
||||
|
||||
/** The "Show my LinkedIn" checkbox. */
|
||||
showLinkedinToggle(): ReturnType<Page['locator']> {
|
||||
return this.page.getByTestId('profile-show-linkedin');
|
||||
}
|
||||
|
||||
/** The clickable label wrapping a toggle's hidden checkbox. */
|
||||
private toggleLabel(input: ReturnType<Page['locator']>): ReturnType<Page['locator']> {
|
||||
return input.locator('xpath=ancestor::label[1]');
|
||||
}
|
||||
|
||||
/** Set the Show-email toggle to a value. */
|
||||
async setShowEmail(value: boolean): Promise<void> {
|
||||
const t = this.showEmailToggle();
|
||||
if ((await t.isChecked()) !== value) await this.toggleLabel(t).click();
|
||||
}
|
||||
|
||||
/** Set the Show-LinkedIn toggle to a value. */
|
||||
async setShowLinkedin(value: boolean): Promise<void> {
|
||||
const t = this.showLinkedinToggle();
|
||||
if ((await t.isChecked()) !== value) await this.toggleLabel(t).click();
|
||||
}
|
||||
|
||||
/** Set the LinkedIn URL field. */
|
||||
async setLinkedinUrl(url: string): Promise<void> {
|
||||
await this.page.getByTestId('profile-linkedin-url').fill(url);
|
||||
}
|
||||
|
||||
/** Save the profile. */
|
||||
async save(): Promise<void> {
|
||||
await this.page.getByTestId('profile-save').click();
|
||||
}
|
||||
|
||||
/** Log out. */
|
||||
async logout(): Promise<void> {
|
||||
await this.page.getByTestId('profile-logout').click();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
import type { Page } from '@playwright/test';
|
||||
|
||||
/**
|
||||
* The Scan screen — dual-purpose:
|
||||
* - Attendee mode: scan a peer's lanyard → send a connection request.
|
||||
* - Staff mode: Welcome Check-In (toggle on) or Session Check-In (toggle off,
|
||||
* with a session selector).
|
||||
*
|
||||
* We drive the manual-code path (spec §2). The camera is not used.
|
||||
*/
|
||||
export class ScanPage {
|
||||
constructor(
|
||||
readonly page: Page,
|
||||
) {}
|
||||
|
||||
/** Switch to staff check-in mode (staff only). The mode toggle only renders for
|
||||
* staff; for a non-staff user the screen is already in attendee mode. */
|
||||
async setStaffMode(): Promise<void> {
|
||||
const btn = this.page.getByTestId('scan-mode-staff');
|
||||
try {
|
||||
await btn.waitFor({ state: 'visible', timeout: 3000 });
|
||||
await btn.click();
|
||||
} catch {
|
||||
// Toggle not present (non-staff) — no-op.
|
||||
}
|
||||
}
|
||||
|
||||
/** Switch to attendee (connect) mode. No-op for non-staff users (the mode
|
||||
* toggle only renders for staff, and they default to attendee mode). For
|
||||
* staff the default mode is 'staff', so we must wait for the toggle to
|
||||
* render and then click to switch to attendee mode. */
|
||||
async setAttendeeMode(): Promise<void> {
|
||||
const btn = this.page.getByTestId('scan-mode-attendee');
|
||||
try {
|
||||
await btn.waitFor({ state: 'visible', timeout: 3000 });
|
||||
await btn.click();
|
||||
} catch {
|
||||
// Toggle not present (non-staff) — already in attendee mode.
|
||||
}
|
||||
}
|
||||
|
||||
/** The welcome/session check-in toggle (the checkbox inside the labelled control). */
|
||||
private welcomeToggle(): ReturnType<Page['locator']> {
|
||||
return this.page.getByTestId('welcome-checkin-toggle').locator('input');
|
||||
}
|
||||
|
||||
/** Enable Welcome Check-In (staff). */
|
||||
async setWelcomeMode(): Promise<void> {
|
||||
const toggle = this.welcomeToggle();
|
||||
if (!(await toggle.isChecked())) await toggle.click();
|
||||
}
|
||||
|
||||
/** Disable Welcome Check-In → Session Check-In (staff). */
|
||||
async setSessionMode(): Promise<void> {
|
||||
const toggle = this.welcomeToggle();
|
||||
if (await toggle.isChecked()) await toggle.click();
|
||||
}
|
||||
|
||||
/** Select a session for Session Check-In (by option value = session id). */
|
||||
async selectSession(sessionId: string): Promise<void> {
|
||||
await this.page.getByTestId('session-selector').selectOption({ value: sessionId });
|
||||
}
|
||||
|
||||
/** Provide a scanned code via the manual field and submit it. */
|
||||
async scanCode(code: string): Promise<void> {
|
||||
await this.page.getByTestId('scanner-manual-code').fill(code);
|
||||
await this.page.getByTestId('scanner-manual-go').click();
|
||||
}
|
||||
|
||||
/** The session check-in result sheet. */
|
||||
sessionResult(): ReturnType<Page['locator']> {
|
||||
return this.page.getByTestId('session-checkin-result');
|
||||
}
|
||||
|
||||
/** The welcome check-in result sheet. */
|
||||
welcomeResult(): ReturnType<Page['locator']> {
|
||||
return this.page.getByTestId('welcome-checkin-result');
|
||||
}
|
||||
|
||||
/** Dismiss the open result sheet (the "Scan next" button) so the backdrop
|
||||
* no longer intercepts clicks on the mode/toggle controls. */
|
||||
async dismissResult(): Promise<void> {
|
||||
const btn = this.page.getByRole('button', { name: 'Scan next' });
|
||||
if (await btn.isVisible().catch(() => false)) await btn.click();
|
||||
}
|
||||
|
||||
/** The connect sheet's "Connect" button. */
|
||||
connectButton(): ReturnType<Page['locator']> {
|
||||
return this.page.getByTestId('connection-send');
|
||||
}
|
||||
|
||||
/** Send a connection request (attendee mode, after scanning a peer). */
|
||||
async sendConnection(): Promise<void> {
|
||||
await this.connectButton().click();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user