17 lines
1.4 KiB
Python
17 lines
1.4 KiB
Python
from pathlib import Path
|
|
p=Path('C:/kefu/deploy/review-visibility-20260916/frontend-test.mjs')
|
|
s=p.read_text(encoding='utf-8');needle=" await check('未知审批权限或纯空白回复不开放发送',async()=>{"
|
|
assert s.count(needle)==1
|
|
addition=''' await check('发送结果不确定只允许核对后人工处理',async()=>{
|
|
const p=await page('queue',{task:{...task,awaitingReview:false,needsHuman:true,canRetry:true,deliveryUncertain:true,reviewReason:'发送结果待人工核对'}});
|
|
assert.equal(await p.locator('[data-action="approve-task"]').count(),0);assert.equal(await p.locator('[data-action="retry-task"]').count(),0);
|
|
assert.match(await p.locator('[data-action="handoff-task"]').innerText(),/核对后转人工/);assert.match(await p.locator('.task-review-hint').innerText(),/先在企业微信核对是否已发出/);await p.close();
|
|
});
|
|
await check('可重试生成失败任务提供重试并传递正确key',async()=>{
|
|
const p=await page('queue',{task:{...task,awaitingReview:false,needsHuman:true,canRetry:true,answer:'',reviewReason:'模型请求失败'}});
|
|
assert.equal(await p.locator('[data-action="approve-task"]').count(),0);await p.locator('[data-action="retry-task"]').click();
|
|
assert.deepEqual(await p.evaluate(()=>calls.filter(c=>c.method==='retryTask')),[{method:'retryTask',args:[task.key]}]);await p.close();
|
|
});
|
|
'''
|
|
p.write_text(s.replace(needle,addition+needle),encoding='utf-8')
|