Refresh AI region list after editor content loads
- Extract AI region scanning into a reusable utility with unit coverage. - Refresh AI region dropdown state after drafts, reports, default templates, and selected templates write HTML into the editor. - Keep the existing MutationObserver path for later DOM edits and inserted AI regions. - Add E2E coverage for existing template AI regions appearing on initial report editor load. - Update README, AGENTS, report editor, progress, and testing docs for AI region synchronization behavior.
This commit is contained in:
@@ -1,6 +1,19 @@
|
||||
import { expect, test } from '@playwright/test';
|
||||
import { loginByApi, uniqueId } from './helpers';
|
||||
|
||||
test('existing template AI region appears in the AI writing target dropdown on page load', async ({ page }) => {
|
||||
await loginByApi(page, '0001');
|
||||
|
||||
await page.goto('/report-editor');
|
||||
await page.getByRole('button', { name: 'AI撰写' }).click();
|
||||
|
||||
const aiRegionSelect = page.locator('select').filter({
|
||||
has: page.locator('option', { hasText: '手术步骤、术中出现的情况及处理' }),
|
||||
});
|
||||
await expect(aiRegionSelect).toHaveValue('手术步骤');
|
||||
await expect(page.locator('select option', { hasText: '无可用 AI 区域' })).toHaveCount(0);
|
||||
});
|
||||
|
||||
test('newly inserted AI region appears in the AI writing target dropdown immediately', async ({ page }) => {
|
||||
await loginByApi(page, '0001');
|
||||
const regionName = `AI区域${uniqueId('region')}`;
|
||||
|
||||
Reference in New Issue
Block a user