Files
Mdeical_Sur_Report/e2e/login.spec.ts
admin 014aca8619 Initialize backendized SurClaw report system
- Add React/Vite frontend for login, dashboard, reports, templates, users, settings, AI, speech, and media workflows.

- Add NestJS/Prisma/PostgreSQL backend with auth, dashboard stats, reports, templates, users, departments, settings, files, AI, speech, audit logs, and HTML sanitization.

- Add Prisma schema, migrations, seed data, persistent app sessions, Docker/Nginx deployment files, and upload volume configuration.

- Add Vitest, Playwright, backend integration tests, and project documentation for requirements, design, permissions, API contracts, testing, deployment, security, and progress.

- Configure production local fallback switch and remove unused Gemini direct dependency/env wiring.
2026-05-02 01:41:57 +08:00

41 lines
1.2 KiB
TypeScript

import { expect, test } from '@playwright/test';
test('default quick login enters dashboard', async ({ page }) => {
await page.route('**/api/auth/me', async (route) => {
await route.fulfill({
status: 401,
contentType: 'application/json',
body: JSON.stringify({ error: { code: 'UNAUTHORIZED', message: '未登录' } }),
});
});
await page.route('**/api/auth/login', async (route) => {
await route.fulfill({
status: 200,
contentType: 'application/json',
body: JSON.stringify({
data: {
user: {
id: 'u-admin',
username: 'admin',
role: 'super',
name: '超级管理员',
tenantId: 'tenant-demo',
departmentId: 'dept-admin',
departmentName: 'admin',
status: 'active',
createdAt: '2026-05-01T00:00:00.000Z',
updatedAt: '2026-05-01T00:00:00.000Z',
},
},
}),
});
});
await page.goto('/');
await page.getByText('admin / 123456').click();
await expect(page.getByRole('heading', { name: '工作台概览' })).toBeVisible();
await expect(page.getByText('超级管理员')).toBeVisible();
});