Files
chore/frontend/e2e/auth-tutorial.setup.ts
ryan d910a6bc65
Chore App Build, Test, and Push Docker Images / build-and-push (push) Failing after 2m29s
feat(playwright-cli): add comprehensive test generation, tracing, and video recording documentation
- Introduced detailed documentation for test generation workflow in Playwright CLI, covering planning, generating, and healing tests.
- Added tracing capabilities documentation, including usage, output files, and best practices for debugging and performance analysis.
- Included video recording instructions, emphasizing best practices for capturing browser automation sessions with chapter markers and overlays.
- Implemented user tutorial authentication setup and tutorial tests for parent mode in the E2E testing framework.
- Created JSON files for user tutorial state management, ensuring isolated test environments.
2026-07-17 19:38:02 -04:00

48 lines
1.6 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { test as setup } from '@playwright/test'
import {
STORAGE_STATE_TUTORIAL,
E2E_TUTORIAL_EMAIL,
E2E_TUTORIAL_PASSWORD,
E2E_TUTORIAL_PIN,
} from './e2e-constants'
const BACKEND = 'http://localhost:5000'
setup('authenticate tutorial user', async ({ page }) => {
// Create the isolated tutorial-test user (separate from the main E2E user)
const createRes = await page.request.post(`${BACKEND}/auth/e2e-create-tutorial-user`)
if (!createRes.ok()) {
throw new Error(
`e2e-create-tutorial-user failed: ${createRes.status()} ${await createRes.text()}`,
)
}
await page.goto('/auth/login')
await page.getByLabel('Email address').fill(E2E_TUTORIAL_EMAIL)
await page.getByLabel('Password').fill(E2E_TUTORIAL_PASSWORD)
await page.getByRole('button', { name: 'Sign in' }).click()
await page.waitForURL(/\/(parent|child)/)
await page.getByRole('button', { name: 'Parent login' }).click()
const pinInput = page.getByPlaceholder('46 digits')
await pinInput.waitFor({ timeout: 5000 })
await pinInput.fill(E2E_TUTORIAL_PIN)
await page.getByLabel('Stay in parent mode on this device').check()
await page.getByRole('button', { name: 'OK' }).click()
await page.waitForURL(/\/parent(\/|$)/)
try {
await page.getByRole('button', { name: 'Add Child' }).waitFor({ timeout: 5000 })
} catch {
await page.screenshot({ path: 'auth-setup-tutorial-parent-fail.png' })
throw new Error(
'Tutorial user parent mode not reached after PIN entry. See auth-setup-tutorial-parent-fail.png for details.',
)
}
await page.context().storageState({ path: STORAGE_STATE_TUTORIAL })
})