40227-vm/frontend/tests/e2e/app-shell.e2e.ts
Dmitri d4a5378adf Refactor: migrate frontend to Vite/React, add product backend modules
Frontend:
- Replace Next.js with Vite + React + TypeScript
- Add new component architecture (app-shell, sidebar, dashboard modules)
- Implement product modules: FRAME, safety protocols, walkthrough checkin,
  campus/staff attendance, personality quiz, sign language, classroom timer
- Add shadcn/ui component library with Tailwind CSS
- Remove legacy generated components, stores, and pages

Backend:
- Add product migrations: frame_entries, user_progress, safety_quiz_results,
  walkthrough_checkins, communication_events, personality_quiz_results,
  campus_attendance_config/summaries, staff_attendance_records, content_catalog
- Add corresponding models, services, and routes
- Implement cookie-based auth with refresh token rotation
- Add content catalog seeder with product content
- Migrate to ESLint flat config
- Switch from yarn to npm

Infrastructure:
- Update .gitignore for new tooling
- Add project documentation (CLAUDE.md, docs/)
- Remove deprecated config files and yarn.lock

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-06-09 15:18:23 +02:00

64 lines
3.0 KiB
TypeScript

import { expect, type Page, test } from '@playwright/test';
async function switchDemoRole(page: Page, roleLabel: string): Promise<void> {
await page.getByRole('button', { name: /View as:/ }).click();
await page.getByRole('button', { name: roleLabel }).click();
}
test.describe('app shell smoke paths', () => {
test.beforeEach(async ({ page }) => {
await page.goto('/dashboard');
await expect(page.getByText("You're browsing as a Guest")).toBeVisible();
});
test('teacher guest sees staff modules and cannot access director-only modules', async ({ page }) => {
const navigation = page.getByRole('navigation');
await expect(page.getByRole('button', { name: /View as: Teacher/ })).toBeVisible();
await expect(navigation.getByRole('button', { name: 'Classroom Timer' })).toBeVisible();
await expect(navigation.getByRole('button', { name: 'Director Dashboard' })).toHaveCount(0);
await expect(navigation.getByRole('button', { name: 'Walk-Through Check-In' })).toHaveCount(0);
await navigation.getByRole('button', { name: 'Classroom Timer' }).click();
await expect(page).toHaveURL(/\/classroom-timer$/);
await expect(page.getByText('Loading classroom timer content...')).toBeVisible();
});
test('teacher guest restricted executive route redirects to dashboard', async ({ page }) => {
await page.goto('/director-dashboard');
await expect(page).toHaveURL(/\/dashboard$/);
await expect(page.getByText("You're browsing as a Guest")).toBeVisible();
});
test('director guest can reach director dashboard and walk-through module', async ({ page }) => {
const navigation = page.getByRole('navigation');
await switchDemoRole(page, 'Director');
await expect(page.getByRole('button', { name: /View as: Director/ })).toBeVisible();
await expect(navigation.getByRole('button', { name: 'Director Dashboard' })).toBeVisible();
await expect(navigation.getByRole('button', { name: 'Walk-Through Check-In' })).toBeVisible();
await navigation.getByRole('button', { name: 'Walk-Through Check-In' }).click();
await expect(page).toHaveURL(/\/walkthrough$/);
await expect(page.getByRole('heading', { name: 'Walk-Through Check-In' })).toBeVisible();
});
test('superintendent guest keeps executive module access after navigation', async ({ page }) => {
const navigation = page.getByRole('navigation');
await switchDemoRole(page, 'Superintendent');
await expect(page.getByRole('button', { name: /View as: Superintendent/ })).toBeVisible();
await navigation.getByRole('button', { name: 'Walk-Through Check-In' }).click();
await expect(page).toHaveURL(/\/walkthrough$/);
await expect(page.getByRole('heading', { name: 'Walk-Through Check-In' })).toBeVisible();
await navigation.getByRole('button', { name: 'Home Dashboard' }).click();
await expect(page).toHaveURL(/\/dashboard$/);
await expect(navigation.getByRole('button', { name: 'Director Dashboard' })).toBeVisible();
await expect(navigation.getByRole('button', { name: 'Walk-Through Check-In' })).toBeVisible();
});
});