fix(e2e): accept bd_intake task_key for UI-05b intake runs

Server posts doc_proj suffix (bd_intake) as task_key; bare intake
assertion was a false FAIL after UI-05a.
This commit is contained in:
WeiCHEN
2026-09-22 23:11:00 +08:00
parent 1c78d614cb
commit 5e7fb240c3
+10 -2
View File
@@ -558,8 +558,16 @@ function assertIntakeTaskRun(res: Response, expectedDocId: string, caseId: strin
fail(`${caseId} tasks/runs must be 2xx, got HTTP ${status}`);
}
const body = res.request().postDataJSON() as { task_key?: string; doc_id?: string };
if (body.task_key !== 'intake') {
fail(`${caseId} task_key must be intake, got ${JSON.stringify(body.task_key)}`);
// Server task_key is the doc_proj* suffix (e.g. bd_intake), not the bare template token.
const expectedKey = expectedDocId.replace(/^doc_proj\d+_/, '') || 'intake';
const keyOk =
body.task_key === expectedKey ||
body.task_key === 'intake' ||
(typeof body.task_key === 'string' && /(?:^|_)intake$/.test(body.task_key));
if (!keyOk) {
fail(
`${caseId} task_key must be intake-family (expected ${JSON.stringify(expectedKey)}), got ${JSON.stringify(body.task_key)}`,
);
}
if (!expectedDocId || body.doc_id !== expectedDocId) {
fail(`${caseId} doc_id must be ${expectedDocId}, got ${JSON.stringify(body.doc_id)}`);