- 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.
42 lines
1.2 KiB
TypeScript
42 lines
1.2 KiB
TypeScript
import { expect, test } from '@playwright/test';
|
|
import { baseTemplates, baseUsers, seedLocalStorage } from './helpers';
|
|
|
|
test('editing a completed report increments revision and preserves history', async ({ page }) => {
|
|
await seedLocalStorage(page, {
|
|
users: baseUsers,
|
|
templates: baseTemplates,
|
|
currentUser: baseUsers[2],
|
|
reports: [
|
|
{
|
|
id: 'RPT_DONE',
|
|
title: '已完成报告',
|
|
patientName: '患者甲',
|
|
hospitalId: 'H001',
|
|
department: '外科',
|
|
content: '<p>旧报告内容</p>',
|
|
author: '0001',
|
|
authorName: '张医生',
|
|
createdAt: '2026-05-01',
|
|
updatedAt: '2026-05-01T08:00:00.000Z',
|
|
status: 'completed',
|
|
revision: 1,
|
|
history: [],
|
|
},
|
|
],
|
|
});
|
|
|
|
await page.goto('/report-editor?id=RPT_DONE');
|
|
await expect(page.getByText('编辑报告: RPT_DONE')).toBeVisible();
|
|
|
|
await page.getByRole('button', { name: '完成报告' }).click();
|
|
await page.waitForURL('**/report-manage');
|
|
|
|
const report = await page.evaluate(() => {
|
|
return JSON.parse(window.localStorage.getItem('reports') || '[]')[0];
|
|
});
|
|
|
|
expect(report.revision).toBe(2);
|
|
expect(report.history).toHaveLength(1);
|
|
expect(report.history[0].revision).toBe(1);
|
|
});
|