test(e2e): open UI-11 prelim_design by registered doc_proj id
Card title is 系统初步设计方案, not 系统设计输入; select doc_proj*_prelim_design so the template slot cannot be mistaken for the generated document. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -316,6 +316,30 @@ async function openWorkflowDocByLabel(
|
||||
return { title: title || docId, docId };
|
||||
}
|
||||
|
||||
/** 按已注册 doc_proj{n}_{taskKey} 打开,避开同标题模板槽与宽泛文案误命中。 */
|
||||
async function openWorkflowDocByControlledTaskKey(
|
||||
page: Page,
|
||||
taskKey: string,
|
||||
): Promise<{ title: string; docId: string }> {
|
||||
if (!/^[a-z][a-z0-9_]*$/.test(taskKey)) fail(`invalid controlled taskKey: ${taskKey}`);
|
||||
const trigger = page.getByTestId('doc-selector-trigger');
|
||||
await expect(trigger).toBeVisible({ timeout: 15_000 });
|
||||
await trigger.click();
|
||||
const item = page
|
||||
.locator(`.dropdown-menu button[data-doc-id^="doc_proj"][data-doc-id$="_${taskKey}"]`)
|
||||
.first();
|
||||
if ((await item.count()) === 0) {
|
||||
fail(`workflow menu missing registered doc_proj*_${taskKey}`);
|
||||
}
|
||||
const docId = (await item.getAttribute('data-doc-id')) || '';
|
||||
const title = (await item.getAttribute('data-doc-title')) || '';
|
||||
if (!new RegExp(`^doc_proj\\d+_${taskKey}$`).test(docId)) {
|
||||
fail(`expected doc_proj{n}_${taskKey}, got ${JSON.stringify(docId)}`);
|
||||
}
|
||||
await item.click();
|
||||
return { title: title || docId, docId };
|
||||
}
|
||||
|
||||
async function openWorkflowDocById(page: Page, docId: string): Promise<void> {
|
||||
if (!docId) fail('openWorkflowDocById requires docId');
|
||||
const trigger = page.getByTestId('doc-selector-trigger');
|
||||
@@ -1053,7 +1077,11 @@ test.describe.serial('document-revision-runtime UI acceptance', () => {
|
||||
fail(`UI-11 task_key must be prelim_design, got ${JSON.stringify(taskBody.task_key)}`);
|
||||
}
|
||||
await waitForSquadCompletion(page, '系统设计输入');
|
||||
const second = await openWorkflowDocByLabel(page, /设计输入|系统设计/);
|
||||
// Prompt alias is 系统设计输入; card title is 系统初步设计方案; open by registered doc_proj id.
|
||||
const second = await openWorkflowDocByControlledTaskKey(page, 'prelim_design');
|
||||
if (second.title !== '系统初步设计方案') {
|
||||
fail(`UI-11 prelim_design card title must be 系统初步设计方案, got ${JSON.stringify(second.title)}`);
|
||||
}
|
||||
secondDocTitle = second.title;
|
||||
secondDocId = second.docId;
|
||||
await expect(page.getByTestId('active-document-pane')).toHaveAttribute('data-doc-id', secondDocId);
|
||||
|
||||
@@ -32,6 +32,14 @@ test('createProjectTemplateDeliverables: 必须精确生成 7 份全生命周期
|
||||
const actualTaskKeys = result.deliverables.map((d) => d.taskKey);
|
||||
assert.deepStrictEqual(actualTaskKeys, expectedTaskKeys);
|
||||
|
||||
const prelim = result.deliverables.find((d) => d.taskKey === 'prelim_design');
|
||||
assert.ok(prelim, 'prelim_design template must exist');
|
||||
assert.strictEqual(prelim.title, '系统初步设计方案');
|
||||
assert.strictEqual(
|
||||
STANDARD_WORKFLOW_TEMPLATES.find((t) => t.taskKey === 'prelim_design')?.title,
|
||||
'系统初步设计方案',
|
||||
);
|
||||
|
||||
// 2. 验证阶段覆盖 (V0.1, V0.5, V1.0)
|
||||
const stages = new Set(result.deliverables.map((d) => d.stage));
|
||||
assert.ok(stages.has('V0.1'));
|
||||
|
||||
Reference in New Issue
Block a user