import { expect, test } from '@playwright/test'; import { createReportByApi, loginByApi, uniqueId } from './helpers'; test('route guards block doctors from admin pages and super users can view audit logs', async ({ page }) => { await loginByApi(page, '0001'); await page.goto('/user-manage'); await page.waitForURL('**/dashboard'); await expect(page.getByRole('heading', { name: '工作台概览' })).toBeVisible(); const title = `审计验证报告 ${uniqueId('audit')}`; await createReportByApi(page.request, { title, content: `

${title}

`, status: 'completed', }); await loginByApi(page, 'admin'); await page.goto('/audit-logs'); await expect(page.getByRole('heading', { name: '审计日志' })).toBeVisible(); await expect(page.locator('tbody').getByText('完成报告').first()).toBeVisible(); });