test(e2e): scope project creation selectors to fixed modal

This commit is contained in:
weichen
2026-09-13 12:02:01 +00:00
parent d282b1e526
commit 1d2cecc522
+12 -7
View File
@@ -435,16 +435,21 @@ test.describe.serial('document-revision-runtime UI acceptance', () => {
// Isolate network evidence to project-create window (exclude login-era noise).
logs = [];
await page.getByRole('button', { name: '新建立项会话' }).click();
await expect(page.getByText('发起医疗器械新项目立项')).toBeVisible();
await page.fill('input[placeholder*="无线便携式"]', PROJECT_NAME);
const desc = page.locator('textarea').first();
const projectModalHeading = page.getByText('发起医疗器械新项目立项', { exact: true });
await expect(projectModalHeading).toBeVisible({ timeout: 30_000 });
const projectModal = projectModalHeading.locator(
'xpath=ancestor::div[contains(@style,"position: fixed")][1]',
);
await projectModal.locator('input[placeholder*="无线便携式"]').fill(PROJECT_NAME);
const desc = projectModal.locator('textarea');
if ((await desc.count()) === 0) fail('project form missing required description textarea');
await desc.fill('用于骨科微创手术的双频超声吸引与止血,需符合 GB 9706.1 与相关法规要求。');
// Select B as member
const memberRow = page.locator('div').filter({ hasText: `协作者B-${suffix}` }).first();
if ((await memberRow.count()) === 0) fail('member B not listed in create-project form');
// Select B as member inside project modal scope
const memberRow = projectModal.locator('div').filter({ hasText: `协作者B-${suffix}` }).first();
await expect(memberRow).toBeVisible({ timeout: 15_000 });
await memberRow.click();
await page.getByRole('button', { name: /确认立项/ }).click();
await projectModal.getByRole('button', { name: /确认立项/ }).click();
await expect(projectModalHeading).toBeHidden({ timeout: 15_000 });
await expect(page.getByText(PROJECT_NAME)).toBeVisible({ timeout: 30_000 });
await expect(page.locator('aside')).toBeVisible();
// Template doc selected: must show non-error hint, never 账本未就绪