Files
chore/frontend/e2e/mode_parent/profile-button/profile-button.spec.ts
T
ryan 8e4f89f4ec
Chore App Build, Test, and Push Docker Images / build-and-push (push) Successful in 3m12s
feat(tutorial): update tutorial labels and modal titles to improve clarity
- Changed "Skip tour" button to "Cancel" in various tutorial overlays.
- Updated modal titles from "Confirm Task" to "Confirm Penalty" where applicable.
- Modified tutorial step call-to-action labels from "Got it" and "Next" to "Continue" for consistency.
- Added tests for new tutorial overlay behavior and button interactions.
- Refactored tutorial controller to allow ignoring tutorial enabled state in step visibility checks.
- Enhanced user profile tutorial restart functionality with appropriate modal messages.
- Updated user profile and task confirmation dialog components to reflect new titles and messages.
- Adjusted configuration files for local development environments.
2026-07-25 12:56:18 -04:00

92 lines
3.8 KiB
TypeScript
Raw 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, expect } from '@playwright/test'
import { E2E_EMAIL, E2E_FIRST_NAME, E2E_PIN } from '../../e2e-constants'
test.describe('Parent profile button permanent parent mode', () => {
test.beforeEach(async ({ page }) => {
await page.goto('/parent')
// Dismiss tutorial overlay if present — it intercepts pointer events
const skip = page.getByRole('button', { name: 'Cancel' })
if (await skip.isVisible({ timeout: 1000 }).catch(() => false)) {
await skip.click()
}
})
test('Badge shows 🔒 in permanent parent mode', async ({ page }) => {
await expect(page.getByLabel('Persistent parent mode active')).toBeVisible()
await expect(page.getByLabel('Persistent parent mode active')).toHaveText('🔒')
})
test('Menu shows user name and email', async ({ page }) => {
await page.getByRole('button', { name: 'Parent menu' }).click()
await expect(page.getByText(E2E_FIRST_NAME, { exact: true })).toBeVisible()
await expect(page.getByText(E2E_EMAIL, { exact: true })).toBeVisible()
})
test('Menu Profile option navigates to the User Profile page', async ({ page }) => {
await page.getByRole('button', { name: 'Parent menu' }).click()
await page.getByRole('menuitem', { name: 'Profile' }).click()
await expect(page).toHaveURL(/\/parent\/profile/)
await expect(page.getByRole('heading', { name: 'Profile' })).toBeVisible()
})
test('Menu Child Mode exits parent mode', async ({ page }) => {
await page.getByRole('button', { name: 'Parent menu' }).click()
await page.getByRole('menuitem', { name: 'Child Mode' }).click()
// View-selector navigation buttons disappear after exiting parent mode
await expect(page.getByRole('button', { name: 'Children' })).not.toBeVisible()
// Profile button changes label to "Parent login" when not in parent mode
await expect(page.getByRole('button', { name: 'Parent login' })).toBeVisible()
})
test('Menu Child Mode re-entry without checkbox enters temporary mode', async ({ page }) => {
await page.getByRole('button', { name: 'Parent menu' }).click()
await page.getByRole('menuitem', { name: 'Child Mode' }).click()
// Click profile button to open PIN modal
await page.getByRole('button', { name: 'Parent login' }).click()
const pinInput = page.getByPlaceholder('46 digits')
await pinInput.waitFor({ timeout: 5000 })
await pinInput.fill(E2E_PIN)
// Do NOT check "Stay in parent mode"
await page.getByRole('button', { name: 'OK' }).click()
await page.waitForURL(/\/parent(\/|$)/)
// No persistent badge — temporary mode
await expect(page.getByLabel('Persistent parent mode active')).not.toBeVisible()
})
test('Menu Child Mode re-entry with checkbox enters permanent mode', async ({ page }) => {
await page.getByRole('button', { name: 'Parent menu' }).click()
await page.getByRole('menuitem', { name: 'Child Mode' }).click()
// Click profile button to open PIN modal
await page.getByRole('button', { name: 'Parent login' }).click()
const pinInput = page.getByPlaceholder('46 digits')
await pinInput.waitFor({ timeout: 5000 })
await pinInput.fill(E2E_PIN)
await page.getByLabel('Stay in parent mode on this device').check()
await page.getByRole('button', { name: 'OK' }).click()
await page.waitForURL(/\/parent(\/|$)/)
// Persistent badge visible — permanent mode
await expect(page.getByLabel('Persistent parent mode active')).toBeVisible()
})
test('Menu Sign Out navigates to landing page', async ({ page }) => {
await page.getByRole('button', { name: 'Parent menu' }).click()
await page.getByRole('menuitem', { name: 'Sign out' }).click()
await expect(page).toHaveURL('/')
await expect(
page.getByRole('navigation').getByRole('button', { name: 'Sign In' }),
).toBeVisible()
})
})