- npm run test:e2e builds the app, runs it on port 3101 with an empty throwaway database and drives Chrome (the installed one; no browser download) through notes and the paste check, the daily five minutes and weekly recall, translation compare (Bible text faked), and two-screen presenting. - Vitest skips e2e/; ESLint knows the e2e folder and playwright.config.js. - .gitignore: the local demo video, Playwright output and sign-in file. - README and TODO describe the browser tests and what CI still needs. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
37 lines
2.0 KiB
JavaScript
37 lines
2.0 KiB
JavaScript
import { test, expect } from '@playwright/test';
|
|
import { SPEAKER_NOTE, resumeButton, seedStudy } from './helpers.js';
|
|
|
|
test('presenting on two screens: the audience window never shows the speaker notes', async ({ page, context }) => {
|
|
const { title } = await seedStudy(page, { withOutline: true });
|
|
await resumeButton(page, title).click();
|
|
await page.getByRole('navigation', { name: 'Study stages' }).getByRole('button', { name: 'Outline' }).click();
|
|
await page.getByRole('button', { name: 'Present' }).click();
|
|
const presenter = page.getByRole('dialog', { name: /presenting/i });
|
|
|
|
// one screen: notes stay hidden until turned on
|
|
await expect(presenter.getByRole('heading', { name: /God so loved/ })).toBeVisible();
|
|
await expect(presenter.getByText(SPEAKER_NOTE)).toHaveCount(0);
|
|
|
|
// a second window (the projector) connects and follows along
|
|
const audience = await context.newPage();
|
|
await audience.goto('/?audience=1');
|
|
await expect(audience.getByRole('heading', { name: /God so loved/ })).toBeVisible();
|
|
await expect(presenter.getByText('Only you see this')).toBeVisible();
|
|
await expect(presenter.getByText(SPEAKER_NOTE)).toBeVisible(); // on the presenter's screen only
|
|
await expect(audience.getByText(SPEAKER_NOTE)).toHaveCount(0);
|
|
expect(await audience.locator('body').innerText()).not.toMatch(/PRIVATE|On pace|Start/);
|
|
|
|
await page.keyboard.press('ArrowRight');
|
|
await expect(audience.getByRole('heading', { name: /Light and darkness/ })).toBeVisible();
|
|
|
|
// B blacks the audience screen out, and again brings it back
|
|
await page.keyboard.press('b');
|
|
await expect(audience.getByRole('heading', { name: /Light and darkness/ })).toHaveCount(0);
|
|
await page.keyboard.press('b');
|
|
await expect(audience.getByRole('heading', { name: /Light and darkness/ })).toBeVisible();
|
|
|
|
// closing the presentation tells the audience window
|
|
await presenter.getByRole('button', { name: 'Close' }).click();
|
|
await expect(audience.getByText(/presentation has ended/i)).toBeVisible();
|
|
});
|