Files
order-notification-automation/tests/assistant/action-results-ui.test.cjs
T

57 lines
2.0 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
'use strict';
const { test } = require('node:test'),
assert = require('node:assert/strict');
const { managementFixture } = require('./management-fixture.cjs');
test(
'empty sampling and missing historical result details explain what actually happened',
{ timeout: 90000 },
async (t) => {
require('../fixtures/isolated-vault-key.cjs')(t);
const { page, open, store, users } = await managementFixture(t, { browser: true }),
owner = users.users()[0].id,
c = store.create(owner),
turn = store.beginTurn(c.id, owner, '核对操作结果');
store.updateTurn(turn.id, 'success', {
reply: '操作结果已返回。',
actions: [
{
id: 'zero-samples',
kind: 'collect_field_samples',
targetId: 'source',
label: '采集字段样本',
status: 'success',
result: {
scope: 'configuration',
total: 0,
completed: 0,
captured: 0,
failed: 0,
items: [],
missing: ['仍缺样本的流程'],
link: '#rule-fields',
},
},
{
id: 'legacy-result',
kind: 'scan_bpm',
targetId: 'source',
label: '历史扫描',
status: 'success',
result: {},
},
],
});
await open();
await page.getByRole('button', { name: '查看操作(2)', exact: true }).click();
const zero = page.locator('[data-action-card="zero-samples"]');
await zero.getByText('未采集到样本', { exact: true }).waitFor();
await zero.locator('summary').filter({ hasText: '结果详情' }).click();
assert.match(await zero.innerText(), /仍缺样本的流程/);
assert.match(await zero.innerText(), /没有找到可补采/);
const legacy = page.locator('[data-action-card="legacy-result"]');
await legacy.locator('summary').filter({ hasText: '结果详情' }).click();
assert.match(await legacy.innerText(), /没有保存结果明细/);
assert.doesNotMatch(await legacy.innerText(), /\{\s*\}/);
},
);