fix: synchronize inline rule versions without losing clean state

This commit is contained in:
abaishu0730 committed 2026-10-20 11:49:20 +08:00
1 parent 4f89c4765f
commit 26fc431d2e
2 files changed
+11 -8

No files matched your search

@@ -22,3 +22,5 @@ test('ambiguous fields can be selected directly in the rule and remain an unsave
});
test('cancelling an order clears the formal check selection and keeps the rule clean',{timeout:90000},async t=>{const {page}=await orderDrivenUI(t,'#order-rules');await page.locator('[data-rule-id="bs-change"]').click();await page.getByRole('button',{name:'选择订单 S-1',exact:true}).click();await page.locator('#rule-order-recognition').getByText('148396',{exact:true}).waitFor();await page.getByRole('button',{name:'取消选择',exact:true}).click();assert.equal(await page.locator('#order-rule-sample-source').inputValue(),'');assert.equal(await page.locator('#order-rule-preview-result').innerText(),'');assert.equal(await page.evaluate(()=>PageLifecycle.dirty()),false);});
test('inline activation synchronizes the visible rule version atomically and a clean rule remains clean',{timeout:90000},async t=>{const {page,runtime}=await orderDrivenUI(t,'#order-rules');await page.locator('[data-rule-id="bs-change"]').click();await page.getByRole('button',{name:'选择订单 S-1',exact:true}).click();await page.locator('#rule-order-recognition').getByText('148396',{exact:true}).waitFor();await page.getByRole('button',{name:'在此配置字段识别',exact:true}).click();await page.locator('#fm-save').click();await page.getByText('字段对应草稿已保存。',{exact:true}).waitFor();await page.locator('#fm-check').click();await page.getByText('识别检查完成,请核对订单与文件名。',{exact:true}).waitFor();await page.locator('#fm-confirm').check();let release,arrive;const gate=new Promise(r=>release=r),arrived=new Promise(r=>arrive=r);await page.route('**/api/order-rules',async route=>{arrive();await gate;await route.continue();});await page.locator('#fm-activate').click();await arrived;const locked=await page.getByLabel('收件人',{exact:true}).isDisabled();release();await page.getByText(/字段配置已生效,已同步规则版本/).waitFor();assert.equal(locked,true);assert.equal(await page.evaluate(()=>PageLifecycle.dirty()),false);assert.match(await page.locator('#rule-version-state').innerText(),new RegExp('草稿 v'+runtime.orderRules.get('rules','bs-change').draft.version));});