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.
This commit is contained in:
77
e2e/helpers.ts
Normal file
77
e2e/helpers.ts
Normal file
@@ -0,0 +1,77 @@
|
||||
import { Page } from '@playwright/test';
|
||||
|
||||
export const baseUsers = [
|
||||
{
|
||||
username: 'admin',
|
||||
password: '123456',
|
||||
role: 'super',
|
||||
name: '超级管理员',
|
||||
department: 'admin',
|
||||
status: 'active',
|
||||
visibleTemplates: ['dept_surgery'],
|
||||
manageableTemplates: ['dept_surgery'],
|
||||
},
|
||||
{
|
||||
username: 'manager',
|
||||
password: '123456',
|
||||
role: 'admin',
|
||||
name: '管理员',
|
||||
department: '外科',
|
||||
status: 'active',
|
||||
visibleTemplates: ['dept_surgery'],
|
||||
manageableTemplates: ['dept_surgery'],
|
||||
},
|
||||
{
|
||||
username: '0001',
|
||||
password: '123456',
|
||||
role: 'user',
|
||||
name: '张医生',
|
||||
department: '外科',
|
||||
status: 'active',
|
||||
visibleTemplates: ['dept_surgery'],
|
||||
manageableTemplates: [],
|
||||
},
|
||||
{
|
||||
username: '0002',
|
||||
password: '123456',
|
||||
role: 'user',
|
||||
name: '李医生',
|
||||
department: '内科',
|
||||
status: 'active',
|
||||
visibleTemplates: ['dept_internal'],
|
||||
manageableTemplates: [],
|
||||
},
|
||||
];
|
||||
|
||||
export const baseTemplates = [
|
||||
{
|
||||
id: 'dept_surgery',
|
||||
name: '外科部门模板',
|
||||
desc: 'E2E 外科模板',
|
||||
content: '<p><span class="field-value" data-bind="patientName" contenteditable="true"></span></p><div class="ai-region" data-ai-id="手术步骤"><div class="ai-content"><p>默认内容</p></div></div>',
|
||||
createdAt: '2026-05-01T00:00:00.000Z',
|
||||
author: 'admin',
|
||||
scope: 'department',
|
||||
department: '外科',
|
||||
},
|
||||
{
|
||||
id: 'dept_internal',
|
||||
name: '内科部门模板',
|
||||
desc: 'E2E 内科模板',
|
||||
content: '<p>内科模板</p>',
|
||||
createdAt: '2026-05-01T00:00:00.000Z',
|
||||
author: 'admin',
|
||||
scope: 'department',
|
||||
department: '内科',
|
||||
},
|
||||
];
|
||||
|
||||
export const seedLocalStorage = async (page: Page, data: Record<string, unknown>) => {
|
||||
await page.addInitScript((seed) => {
|
||||
window.localStorage.clear();
|
||||
window.sessionStorage.clear();
|
||||
for (const [key, value] of Object.entries(seed)) {
|
||||
window.localStorage.setItem(key, JSON.stringify(value));
|
||||
}
|
||||
}, data);
|
||||
};
|
||||
Reference in New Issue
Block a user