- 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.
33 lines
1.2 KiB
TypeScript
33 lines
1.2 KiB
TypeScript
import { expect, test } from '@playwright/test';
|
|
import { baseTemplates, baseUsers, seedLocalStorage } from './helpers';
|
|
|
|
test('doctor can save current report as a personal template visible only to self', async ({ page }) => {
|
|
await seedLocalStorage(page, {
|
|
users: baseUsers,
|
|
templates: baseTemplates,
|
|
currentUser: baseUsers[2],
|
|
reports: [],
|
|
});
|
|
|
|
page.on('dialog', async (dialog) => {
|
|
if (dialog.type() === 'prompt') {
|
|
await dialog.accept('我的测试模板');
|
|
return;
|
|
}
|
|
await dialog.accept();
|
|
});
|
|
|
|
await page.goto('/report-editor');
|
|
await expect(page.getByRole('button', { name: '保存为我的模板' })).toBeVisible();
|
|
await page.getByRole('button', { name: '保存为我的模板' }).click();
|
|
|
|
await expect.poll(async () => {
|
|
return page.evaluate(() => {
|
|
const templates = JSON.parse(window.localStorage.getItem('templates') || '[]');
|
|
return templates.some((template: any) => template.name === '我的测试模板' && template.scope === 'personal' && template.ownerUser === '0001');
|
|
});
|
|
}).toBe(true);
|
|
|
|
await expect(page.locator('option:not([disabled])', { hasText: '我的测试模板' })).toHaveCount(1);
|
|
});
|