test(shipping): 更新订单复核库存与通知流程测试
This commit is contained in:
1 parent
8ec028e6a3
commit
265a6e179a
168 files changed
+9420
-4613
No files matched your search
+222
-20
@@ -293,6 +293,51 @@ describe('ShippingConversationProcessingCard', () => {
|
||||
expect(wrapper.text()).not.toContain('snapshot-attachment.pdf');
|
||||
});
|
||||
|
||||
it('keeps selected but unrecognized EML attachments visible without file actions', async () => {
|
||||
const projection = buildProjection();
|
||||
setStatusGroup(projection, 'processing', [{
|
||||
user_task_no: 'INTAKE:EML-PENDING', group: 'processing', status_label: 'extracting',
|
||||
title: 'pending-mail.eml', file_count: 2, run_no: 'RUN-EML-PENDING', can_append: false,
|
||||
}]);
|
||||
const recognizedLeaf = buildWorkItem('DOCUMENT:91', {
|
||||
sourceType: 'eml', rootOrderTaskNo: 'OT-EML-PENDING',
|
||||
sourceSummary: {
|
||||
emailSubject: null, filename: 'recognized.pdf', documentId: 91,
|
||||
documentCount: 1, parsedDocumentCount: 1, candidateCount: 1,
|
||||
customerName: null, poNumber: null,
|
||||
},
|
||||
});
|
||||
const pendingLeaf = buildWorkItem('PLAN:EML-PENDING:missing.pdf', {
|
||||
workItemType: 'order_intake', sourceType: 'eml', rootOrderTaskNo: null,
|
||||
sourceSummary: {
|
||||
emailSubject: null, filename: 'missing.pdf', documentId: null,
|
||||
documentCount: 0, parsedDocumentCount: 0, candidateCount: 0,
|
||||
customerName: null, poNumber: null,
|
||||
},
|
||||
facts: { recognized: false, planState: 'selected_pending' },
|
||||
uiState: undefined,
|
||||
});
|
||||
const root = buildWorkItem('INTAKE:EML-PENDING', {
|
||||
sourceType: 'eml', rootOrderTaskNo: 'OT-EML-PENDING',
|
||||
sourceSummary: {
|
||||
emailSubject: 'Pending mail', filename: 'pending-mail.eml', documentId: null,
|
||||
documentCount: 2, parsedDocumentCount: 1, candidateCount: 1,
|
||||
customerName: null, poNumber: null,
|
||||
},
|
||||
aggregateChildren: [recognizedLeaf, pendingLeaf],
|
||||
});
|
||||
const wrapper = mount(ShippingConversationProcessingCard, {
|
||||
props: { projection, workItems: [root], workbenchMode: true },
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
await flushPromises();
|
||||
|
||||
const pendingRow = wrapper.get('[data-testid="shipping-processing-file-INTAKE:EML-PENDING-live-PLAN:EML-PENDING:missing.pdf"]');
|
||||
expect(pendingRow.text()).toContain('missing.pdf');
|
||||
expect(pendingRow.text()).toContain('待识别');
|
||||
expect(pendingRow.find('button').exists()).toBe(false);
|
||||
});
|
||||
|
||||
it('counts only stage-filtered EML leaves in the batch status heading', async () => {
|
||||
const projection = buildProjection();
|
||||
setStatusGroup(projection, 'processing', [{
|
||||
@@ -330,6 +375,91 @@ describe('ShippingConversationProcessingCard', () => {
|
||||
expect(wrapper.get('[data-testid="shipping-processing-group-processing"]').text()).not.toContain('2 个文件');
|
||||
});
|
||||
|
||||
it('keeps backend processing rows visible while matching work items are still unavailable', async () => {
|
||||
const processingLeaf = buildWorkItem('DOCUMENT:610', {
|
||||
sourceType: 'eml', rootOrderTaskNo: 'OT-PROCESSING-SNAPSHOT',
|
||||
sourceSummary: { ...buildWorkItem('DOCUMENT:610').sourceSummary, documentId: 610, filename: 'processing.pdf' },
|
||||
uiState: {
|
||||
status: 'running', stage: 'document_parsing', lifecycleStage: 'intake_parse',
|
||||
lifecycleEntries: [], blocking_reason: null, primary_action: null, secondary_actions: [],
|
||||
},
|
||||
});
|
||||
const projection = projectionWithGroups(
|
||||
{ total_tasks: 1, processing: 1, needs_action: 0, completed: 0, history: 0 },
|
||||
{
|
||||
failed: [], waiting_human: [],
|
||||
processing: [{
|
||||
user_task_no: 'OT-PROCESSING-SNAPSHOT', group: 'processing', status_label: 'processing',
|
||||
title: 'processing.eml', file_count: 1, run_no: 'RUN-PROCESSING-SNAPSHOT', can_append: false,
|
||||
aggregateChildren: [processingLeaf],
|
||||
}],
|
||||
completed: [], cancelled: [], archived: [],
|
||||
},
|
||||
);
|
||||
const wrapper = mount(ShippingConversationProcessingCard, {
|
||||
props: { projection, workItems: [], workbenchMode: true },
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
await flushPromises();
|
||||
|
||||
// 状态分组先到达时,须以同次响应的叶子快照保留处理中附件。
|
||||
const group = wrapper.get('[data-testid="shipping-processing-group-processing"]');
|
||||
expect(group.text()).toContain('处理中 · 1 个文件');
|
||||
expect(group.text()).toContain('processing.pdf');
|
||||
});
|
||||
|
||||
it('shows a mixed-status EML once per PDF status without mixing completed files', async () => {
|
||||
const completedLeaf = buildWorkItem('DOCUMENT:501', {
|
||||
sourceType: 'eml', rootOrderTaskNo: 'OT-MIXED-STATUS',
|
||||
sourceSummary: { ...buildWorkItem('DOCUMENT:501').sourceSummary, documentId: 501, filename: 'done.pdf' },
|
||||
uiState: {
|
||||
status: 'completed', stage: 'completed', lifecycleStage: 'upload_complete',
|
||||
lifecycleEntries: [], blocking_reason: null, primary_action: null, secondary_actions: [],
|
||||
},
|
||||
});
|
||||
const processingLeaf = buildWorkItem('DOCUMENT:502', {
|
||||
sourceType: 'eml', rootOrderTaskNo: 'OT-MIXED-STATUS',
|
||||
sourceSummary: { ...buildWorkItem('DOCUMENT:502').sourceSummary, documentId: 502, filename: 'running.pdf' },
|
||||
uiState: {
|
||||
status: 'running', stage: 'freight_upload', lifecycleStage: 'freight_upload',
|
||||
lifecycleEntries: [], blocking_reason: null, primary_action: null, secondary_actions: [],
|
||||
},
|
||||
});
|
||||
const root = buildWorkItem('INTAKE:MIXED-STATUS', {
|
||||
sourceType: 'eml', rootOrderTaskNo: 'OT-MIXED-STATUS',
|
||||
sourceSummary: { ...buildWorkItem('INTAKE:MIXED-STATUS').sourceSummary, filename: 'mixed.eml', documentId: null },
|
||||
aggregateChildren: [completedLeaf, processingLeaf],
|
||||
});
|
||||
const task = {
|
||||
user_task_no: 'OT-MIXED-STATUS', title: 'mixed.eml', file_count: 1, run_no: 'RUN-MIXED-STATUS', can_append: false,
|
||||
aggregateSummary: { intakeNo: 'SNI-MIXED-STATUS', total: 2, in_group: 1 },
|
||||
};
|
||||
const wrapper = mount(ShippingConversationProcessingCard, {
|
||||
props: {
|
||||
projection: projectionWithGroups(
|
||||
{ total_tasks: 2, processing: 1, needs_action: 0, completed: 1, history: 0 },
|
||||
{
|
||||
failed: [], waiting_human: [],
|
||||
processing: [{ ...task, group: 'processing', status_label: 'processing', aggregateChildren: [processingLeaf] }],
|
||||
completed: [{ ...task, group: 'completed', status_label: 'completed', aggregateChildren: [completedLeaf] }],
|
||||
cancelled: [], archived: [],
|
||||
},
|
||||
),
|
||||
workItems: [root], workbenchMode: true,
|
||||
},
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
await flushPromises();
|
||||
|
||||
expect(wrapper.get('[data-testid="shipping-processing-group-processing"]').text()).toContain('running.pdf');
|
||||
expect(wrapper.get('[data-testid="shipping-processing-group-processing"]').text()).not.toContain('done.pdf');
|
||||
expect(wrapper.get('[data-testid="shipping-processing-group-processing"]').text()).toContain('本组 1/共 2 个文件');
|
||||
await wrapper.get('[data-testid="shipping-processing-history-toggle"]').trigger('click');
|
||||
expect(wrapper.get('[data-testid="shipping-processing-history-completed"]').text()).toContain('done.pdf');
|
||||
expect(wrapper.get('[data-testid="shipping-processing-history-completed"]').text()).not.toContain('running.pdf');
|
||||
expect(wrapper.get('[data-testid="shipping-processing-history-completed"]').text()).toContain('本组 1/共 2 个文件');
|
||||
});
|
||||
|
||||
it('keeps an EML attachment when it has a linked child order task', async () => {
|
||||
const projection = buildProjection();
|
||||
setStatusGroup(projection, 'processing', [{
|
||||
@@ -386,15 +516,15 @@ describe('ShippingConversationProcessingCard', () => {
|
||||
expect(wrapper.find('[data-testid="shipping-conversation-processing-card"]').exists()).toBe(true);
|
||||
expect(wrapper.find('[data-testid="shipping-processing-group-failed"]').exists()).toBe(true);
|
||||
expect(wrapper.find('[data-testid="shipping-processing-group-processing"]').exists()).toBe(true);
|
||||
// 批次中心统一按文件计数;旧任务数文案不再是页面统计口径。
|
||||
expect(wrapper.text()).toContain('异常 · 0 个文件');
|
||||
expect(wrapper.text()).toContain('处理中 · 0 个文件');
|
||||
// 状态组与对话流一致,未展开附件时仍按后端 file_count 统计。
|
||||
expect(wrapper.text()).toContain('异常 · 2 个文件');
|
||||
expect(wrapper.text()).toContain('处理中 · 1 个文件');
|
||||
expect(wrapper.text()).toContain('刚刚创建');
|
||||
|
||||
// 处理记录默认折叠;标题 count = completed + history 返回条数。
|
||||
// 处理记录默认折叠;标题按文件数而非 EML / 任务行数统计。
|
||||
const historyGroup = wrapper.find('[data-testid="shipping-processing-group-history"]');
|
||||
expect(historyGroup.exists()).toBe(true);
|
||||
expect(historyGroup.text()).toContain('处理记录 · 3');
|
||||
expect(historyGroup.text()).toContain('处理记录 · 3 个文件');
|
||||
expect(wrapper.find('[data-testid="shipping-processing-history-body"]').exists()).toBe(false);
|
||||
expect(wrapper.find('[data-testid="shipping-processing-task-OT-DONE"]').exists()).toBe(false);
|
||||
expect(wrapper.find('[data-testid="shipping-processing-task-OT-HIST"]').exists()).toBe(false);
|
||||
@@ -464,7 +594,7 @@ describe('ShippingConversationProcessingCard', () => {
|
||||
const doneCard = wrapper.find('[data-testid="shipping-processing-task-OT-DONE"]');
|
||||
expect(doneCard.find('[data-testid="sidebar-progress-inline"]').exists()).toBe(false);
|
||||
expect(doneCard.find('[data-testid="shipping-processing-task-actions"]').exists()).toBe(false);
|
||||
expect(doneCard.find('[data-testid="shipping-processing-action-view_result"]').exists()).toBe(true);
|
||||
expect(doneCard.find('[data-testid="shipping-processing-action-view_result"]').exists()).toBe(false);
|
||||
expect(doneCard.find('[data-testid="shipping-processing-action-cancel_task"]').exists()).toBe(false);
|
||||
});
|
||||
|
||||
@@ -490,11 +620,11 @@ describe('ShippingConversationProcessingCard', () => {
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
await flushPromises();
|
||||
expect(wrapper.text()).toContain('订单识别任务');
|
||||
expect(wrapper.text()).toContain('本次订单文件处理');
|
||||
expect(wrapper.text()).toContain('2 个 PDF');
|
||||
expect(wrapper.text()).toContain('主文件:4518838152.pdf');
|
||||
const titleEl = wrapper.find('[data-testid="shipping-processing-task-OT-MULTI"] .text-sm.font-semibold');
|
||||
expect(titleEl.text()).toContain('订单识别任务');
|
||||
expect(titleEl.text()).toContain('本次订单文件处理');
|
||||
expect(titleEl.text()).not.toContain('4518838152.pdf');
|
||||
|
||||
// UI-02:有文件对象时不双开「查看详情」与「展开文件详情」。
|
||||
@@ -554,14 +684,14 @@ describe('ShippingConversationProcessingCard', () => {
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
await flushPromises();
|
||||
expect(wrapper.text()).toContain('订单识别任务');
|
||||
expect(wrapper.text()).toContain('本次订单文件处理');
|
||||
expect(wrapper.text()).toContain('2 个 PDF');
|
||||
const titleEl = wrapper.find('[data-testid="shipping-processing-task-OT-MULTI"] .text-sm.font-semibold');
|
||||
expect(titleEl.text()).toContain('订单识别任务');
|
||||
expect(titleEl.text()).toContain('本次订单文件处理');
|
||||
expect(titleEl.text()).not.toContain('4518838152.pdf');
|
||||
});
|
||||
|
||||
it('uses unified order recognition title instead of internal OT number', async () => {
|
||||
it('uses unified order file processing title instead of internal OT number', async () => {
|
||||
const wrapper = mount(ShippingConversationProcessingCard, {
|
||||
props: {
|
||||
projection: projectionWithGroups(
|
||||
@@ -580,7 +710,7 @@ describe('ShippingConversationProcessingCard', () => {
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
await flushPromises();
|
||||
expect(wrapper.text()).toContain('订单识别任务');
|
||||
expect(wrapper.text()).toContain('本次订单文件处理');
|
||||
expect(wrapper.text()).not.toContain('20260803-A13F95D2');
|
||||
});
|
||||
|
||||
@@ -597,7 +727,7 @@ describe('ShippingConversationProcessingCard', () => {
|
||||
expect(wrapper.emitted('expandFiles')).toBeUndefined();
|
||||
});
|
||||
|
||||
it('opens local task details without emitting a viewed write event', async () => {
|
||||
it('does not show a view-result action for completed records', async () => {
|
||||
const wrapper = mount(ShippingConversationProcessingCard, {
|
||||
props: {
|
||||
projection: {
|
||||
@@ -620,15 +750,87 @@ describe('ShippingConversationProcessingCard', () => {
|
||||
|
||||
await wrapper.find('[data-testid="shipping-processing-history-toggle"]').trigger('click');
|
||||
|
||||
await wrapper.find('[data-testid="shipping-processing-action-view_result"]').trigger('click');
|
||||
|
||||
expect(wrapper.emitted('taskAction')?.[0]?.[0]).toMatchObject({
|
||||
task: { user_task_no: 'OT-DETAIL' },
|
||||
action: 'view_result',
|
||||
});
|
||||
expect(wrapper.find('[data-testid="shipping-processing-action-view_result"]').exists()).toBe(false);
|
||||
expect(wrapper.emitted('taskAction')).toBeUndefined();
|
||||
expect(wrapper.emitted('viewed')).toBeUndefined();
|
||||
});
|
||||
|
||||
it('marks an unrecognized Excel attachment as ignored but keeps a pending PDF recognizable', async () => {
|
||||
const projection = buildProjection();
|
||||
setStatusGroup(projection, 'processing', [{
|
||||
user_task_no: 'INTAKE:EML-EXCEL', group: 'processing', status_label: 'extracting',
|
||||
title: 'mail.eml', file_count: 2, run_no: 'RUN-EML-EXCEL', can_append: false,
|
||||
aggregateChildren: [],
|
||||
}]);
|
||||
const pendingPdf = buildWorkItem('PLAN:EML-EXCEL:pending', {
|
||||
workItemType: 'order_intake', sourceType: 'eml', rootOrderTaskNo: null,
|
||||
sourceSummary: { emailSubject: null, filename: 'pending.pdf', documentId: null, documentCount: 0, parsedDocumentCount: 0, candidateCount: 0, customerName: null, poNumber: null },
|
||||
facts: { recognized: false, planState: 'selected_pending' }, uiState: undefined,
|
||||
});
|
||||
const ignoredExcel = buildWorkItem('PLAN:EML-EXCEL:report', {
|
||||
workItemType: 'order_intake', sourceType: 'eml', rootOrderTaskNo: null,
|
||||
sourceSummary: { emailSubject: null, filename: 'report.xlsx', documentId: null, documentCount: 0, parsedDocumentCount: 0, candidateCount: 0, customerName: null, poNumber: null },
|
||||
facts: { recognized: false, planState: 'selected_pending' }, uiState: undefined,
|
||||
});
|
||||
const root = buildWorkItem('INTAKE:EML-EXCEL', {
|
||||
sourceType: 'eml', rootOrderTaskNo: 'OT-EML-EXCEL',
|
||||
aggregateChildren: [pendingPdf, ignoredExcel],
|
||||
});
|
||||
projection.status_groups!.processing![0]!.aggregateChildren = [pendingPdf, ignoredExcel];
|
||||
const wrapper = mount(ShippingConversationProcessingCard, {
|
||||
props: { projection, workItems: [root], workbenchMode: true },
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
await flushPromises();
|
||||
|
||||
const processingGroup = wrapper.get('[data-testid="shipping-processing-group-processing"]');
|
||||
expect(processingGroup.text()).toContain('pending.pdf');
|
||||
expect(processingGroup.text()).not.toContain('report.xlsx');
|
||||
expect(wrapper.get('[data-testid="shipping-processing-file-INTAKE:EML-EXCEL-live-PLAN:EML-EXCEL:pending"]').text()).toContain('待识别');
|
||||
const ignoredGroup = wrapper.get('[data-testid="shipping-processing-group-ignored"]');
|
||||
expect(ignoredGroup.text()).toContain('已忽略 · 1 个文件');
|
||||
expect(wrapper.find('[data-testid="shipping-processing-ignored-body"]').exists()).toBe(false);
|
||||
await ignoredGroup.get('[data-testid="shipping-processing-ignored-toggle"]').trigger('click');
|
||||
const excelRow = ignoredGroup.get('[data-testid="shipping-processing-file-INTAKE:EML-EXCEL-live-PLAN:EML-EXCEL:report"]');
|
||||
expect(excelRow.text()).toContain('已忽略');
|
||||
expect(excelRow.text()).not.toContain('待识别');
|
||||
});
|
||||
|
||||
it('keeps an ignored Excel row when its EML parent originates from completed', async () => {
|
||||
const ignoredExcel = buildWorkItem('PLAN:EML-COMPLETED:report', {
|
||||
workItemType: 'order_intake', sourceType: 'eml', rootOrderTaskNo: null,
|
||||
sourceSummary: { emailSubject: null, filename: 'report.xlsx', documentId: null, documentCount: 0, parsedDocumentCount: 0, candidateCount: 0, customerName: null, poNumber: null },
|
||||
facts: { recognized: false, planState: 'selected_pending' }, uiState: undefined,
|
||||
});
|
||||
const root = buildWorkItem('INTAKE:EML-COMPLETED', {
|
||||
sourceType: 'eml', rootOrderTaskNo: 'OT-EML-COMPLETED',
|
||||
aggregateChildren: [ignoredExcel],
|
||||
});
|
||||
const projection = projectionWithGroups(
|
||||
{ total_tasks: 1, processing: 0, needs_action: 0, completed: 1, history: 0 },
|
||||
{
|
||||
failed: [], waiting_human: [], processing: [],
|
||||
completed: [{
|
||||
user_task_no: 'INTAKE:EML-COMPLETED', group: 'completed', status_label: 'completed',
|
||||
title: 'mail.eml', file_count: 1, run_no: 'RUN-EML-COMPLETED', can_append: false,
|
||||
aggregateChildren: [ignoredExcel],
|
||||
}],
|
||||
cancelled: [], archived: [],
|
||||
},
|
||||
);
|
||||
const wrapper = mount(ShippingConversationProcessingCard, {
|
||||
props: { projection, workItems: [root], workbenchMode: true },
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
await flushPromises();
|
||||
|
||||
const ignoredGroup = wrapper.get('[data-testid="shipping-processing-group-ignored"]');
|
||||
expect(ignoredGroup.text()).toContain('已忽略 · 1 个文件');
|
||||
expect(wrapper.find('[data-testid="shipping-processing-ignored-body"]').exists()).toBe(false);
|
||||
await ignoredGroup.get('[data-testid="shipping-processing-ignored-toggle"]').trigger('click');
|
||||
expect(ignoredGroup.get('[data-testid="shipping-processing-file-INTAKE:EML-COMPLETED-live-PLAN:EML-COMPLETED:report"]').text()).toContain('report.xlsx');
|
||||
});
|
||||
|
||||
it('applies visible focus ring on needs_action card when focused', async () => {
|
||||
const wrapper = mount(ShippingConversationProcessingCard, {
|
||||
props: {
|
||||
@@ -800,7 +1002,7 @@ describe('ShippingConversationProcessingCard', () => {
|
||||
|
||||
expect(wrapper.findAll('[data-testid="sidebar-progress-inline"]')).toHaveLength(2);
|
||||
expect(wrapper.find('[data-testid="shipping-processing-task-OT-NEED"]').text()).toContain('待人工处理');
|
||||
expect(wrapper.find('[data-testid="shipping-processing-task-OT-PROC"]').text()).toContain('库存匹配');
|
||||
expect(wrapper.find('[data-testid="shipping-processing-task-OT-PROC"]').text()).toContain('通知准备');
|
||||
expect(wrapper.findAll('[data-testid="shipping-processing-task-actions"]')).toHaveLength(0);
|
||||
const task = wrapper.find('[data-testid="shipping-processing-task-OT-NEED"]');
|
||||
expect(task.find('[data-testid="unified-action-primary"]').exists()).toBe(true);
|
||||
|
||||
Reference in new issue
Block a user