feat(bpm): add recoverable connections and passive arrival monitoring

This commit is contained in:
abaishu0730 committed 2026-10-20 16:19:32 +08:00
1 parent 2d6349134f
commit 8ca493d439
37 files changed
+676 -69

No files matched your search

+7 -1
View File
@@ -26,9 +26,15 @@ test('browser displays separate arrival days, searches, scans and preserves PDF
await page.locator('[data-arrival-day="2026-10-15"]').waitFor();assert.equal(await page.locator('[data-arrival-day]').count(),2);
const background=normalizeArrival({taskId:'background',serialNum:'BG-1',processName:'新增流程',startTime:'2026-10-16T12:00:00',processInstanceSubject:'后台扫描新增'},'portal-v8');scanStore.complete(scanStore.begin('fixture','系统扫描'),'fixture',[background]);
await page.getByText('后台扫描新增',{exact:true}).waitFor({timeout:20000});
await page.getByLabel('搜索流程记录',{exact:true}).fill('昨天');await page.getByRole('button',{name:'查询',exact:true}).click();await page.getByText('昨天的流程',{exact:true}).waitFor();assert.equal(await page.locator('[data-arrival-day]').count(),1);
await page.getByLabel('搜索流程记录',{exact:true}).fill('昨天');await page.getByRole('button',{name:'查询',exact:true}).click();await page.waitForFunction(()=>document.querySelectorAll('[data-arrival-day]').length===1);await page.getByText('昨天的流程',{exact:true}).waitFor();assert.equal(await page.locator('[data-arrival-day]').count(),1);
await page.getByRole('button',{name:'立即扫描',exact:true}).click();await page.getByText(/扫描完成/).waitFor();
await page.getByRole('button',{name:'PDF 导出记录',exact:true}).click();await page.locator('#record-search').waitFor();assert.equal(await page.locator('#record-search').isVisible(),true);
await page.route('**/api/bpm-scan',route=>route.fulfill({status:503,contentType:'application/json',body:JSON.stringify({error:'扫描暂不可用'})}));
await page.getByRole('link',{name:'工作总览',exact:true}).click();await page.getByRole('link',{name:'订单与导出记录',exact:true}).click();await page.locator('#pdf-fallback').waitFor();await page.locator('#pdf-fallback').click();await page.locator('#record-search').waitFor();
});
test('todo arrival queries stay separate from inform history and cannot invoke an unavailable todo listener',async t=>{
const {call,login,scanner,scanStore}=await setup(t),cookie=await login('admin');await scanner.scan('fixture',{user:{username:'admin',role:'admin'},sessionId:'fixture'});
const row=require('../../src/modules/bpm/arrival-monitor.cjs').todoArrival({source:'todo',portalSource:'portal-v4',taskId:'TODO-1',instanceId:'INSTANCE',revision:1,processName:'订单流程',nodeName:'通知节点',title:'待办样例',receivedAt:'2026-10-20T01:00:00Z'});scanStore.complete(scanStore.begin('fixture','系统监听','todo'),'fixture',[row]);
const todo=await (await call('/api/arrivals?kind=todo',undefined,cookie)).json();assert.equal(todo.total,1);assert.equal(todo.groups[0].items[0].kind,'todo');assert.equal((await (await call('/api/arrivals',undefined,cookie)).json()).total,2);assert.equal((await call('/api/arrivals?kind=unknown',undefined,cookie)).status,400);assert.equal((await call('/api/bpm-scan/run',{connectionId:'fixture',kind:'todo'},cookie)).status,503);
});
test('a successful todo observation does not claim that the independent inform-history source was verified',async t=>{const {call,login,scanStore}=await setup(t),cookie=await login('admin'),row=require('../../src/modules/bpm/arrival-monitor.cjs').todoArrival({source:'todo',portalSource:'portal-v4',taskId:'TODO',instanceId:'I',revision:1,processName:'订单流程',nodeName:'通知节点',title:'待办样例',receivedAt:'2026-10-20T01:00:00Z'});scanStore.complete(scanStore.begin('fixture','系统监听','todo'),'fixture',[row]);const overview=await (await call('/api/overview',undefined,cookie)).json();assert.equal(overview.connections.find(c=>c.name==='到达历史扫描').ready,false);});