test(firstleg): add mixed container customs acceptance

This commit is contained in:
2026-08-28 22:39:18 +08:00
parent f87647d4eb
commit f53ff76143
6 changed files with 394 additions and 18 deletions
+26 -3
View File
@@ -5,7 +5,7 @@ import { dirname, resolve } from 'node:path'
import { pathToFileURL } from 'node:url'
import process from 'node:process'
const CONFIGURED_MODULES = ['merchant-qualification-fixture', 'customers', 'overseas-storage-fees', 'system', 'notifications', 'master-data', 'suppliers', 'domestic-container', 'orders', 'fee-items', 'pricing', 'downloads', 'inbound-weight-ocr', 'inbound-measurement', 'inbound-fees', 'phase3-container-loading', 'phase3-container-overview', 'phase3-loading', 'phase3-loading-model-bridge', 'phase3-pda-convergence', 'phase3-evidence-gate', 'supplemental', 'supplemental-boundaries', 'ocean-bookings', 'truck-appointments', 'service-center-flow', 'phase3-loading-finalize', 'phase3-container-documents', 'phase3-customs', 'phase3-port-schedules', 'phase3-carrier-schedule-queries', 'phase3-outbound-dispatch', 'phase3-outbound-aggregate', 'phase3-dispatch-gate', 'phase3-waiting-for-loading', 'phase3-warehouse-rbac', 'phase3-order-splitting', 'manual-state-matrix', 'phase4-overseas-warehouse', 'phase4-carrier-pickup-ready', 'phase4-overseas-pda', 'phase4-overseas-pda-operations', 'phase4-overseas-inbound-operations', 'phase4-overseas-client-services', 'phase4-overseas-dispatch', 'phase4-cross-region-events', 'phase4-overseas-business', 'phase4-overseas-master-data', 'phase4-carrier-nodes', 'finance', 'finance-full-fixtures', 'finance-reconciliation-full', 'finance-settlement-full', 'finance-downloads', 'customer-operating-statistics']
const CONFIGURED_MODULES = ['merchant-qualification-fixture', 'customers', 'overseas-storage-fees', 'system', 'notifications', 'master-data', 'suppliers', 'domestic-container', 'orders', 'fee-items', 'pricing', 'downloads', 'inbound-weight-ocr', 'inbound-measurement', 'inbound-fees', 'phase3-container-loading', 'phase3-container-overview', 'phase3-loading', 'phase3-loading-model-bridge', 'phase3-pda-convergence', 'phase3-evidence-gate', 'supplemental', 'supplemental-boundaries', 'ocean-bookings', 'truck-appointments', 'service-center-flow', 'phase3-loading-finalize', 'phase3-container-documents', 'phase3-customs', 'phase3-container-customs', 'phase3-port-schedules', 'phase3-carrier-schedule-queries', 'phase3-outbound-dispatch', 'phase3-outbound-aggregate', 'phase3-dispatch-gate', 'phase3-waiting-for-loading', 'phase3-warehouse-rbac', 'phase3-order-splitting', 'manual-state-matrix', 'phase4-overseas-warehouse', 'phase4-carrier-pickup-ready', 'phase4-overseas-pda', 'phase4-overseas-pda-operations', 'phase4-overseas-inbound-operations', 'phase4-overseas-client-services', 'phase4-overseas-dispatch', 'phase4-cross-region-events', 'phase4-overseas-business', 'phase4-overseas-master-data', 'phase4-carrier-nodes', 'finance', 'finance-full-fixtures', 'finance-reconciliation-full', 'finance-settlement-full', 'finance-downloads', 'customer-operating-statistics']
const OPTIONAL_MODULES = ['manual-order-splitting-fixture', 'manual-order-splitting-verify',
'manual-preload-push-fixture', 'manual-preload-push-verify',
'manual-pda-ready-fixture', 'manual-pda-ready-verify',
@@ -31,6 +31,7 @@ const MODULE_DEPENDENCIES = new Map([
['phase3-loading-finalize', ['phase3-loading', 'phase3-evidence-gate']],
['phase3-container-documents', ['phase3-loading-finalize']],
['phase3-customs', ['phase3-loading-finalize']],
['phase3-container-customs', ['merchant-qualification-fixture']],
['phase3-port-schedules', ['ocean-bookings']],
['phase3-outbound-dispatch', ['phase3-container-documents', 'phase3-customs', 'phase3-port-schedules', 'service-center-flow']],
['phase3-outbound-aggregate', ['phase3-outbound-dispatch']],
@@ -1206,13 +1207,13 @@ export class AcceptanceRun {
}
}
async preparePhase3LoadingFixture(suffix = '', requireSharedOverflow = true) {
async preparePhase3LoadingFixture(suffix = '', requireSharedOverflow = true, taxModes = null) {
const originalMarker = this.marker
const fixtureMarker = `${originalMarker}-LOAD${suffix}`
const createdKeys = ['orders', 'ocrInbound', 'testInbound', 'inboundMeasurement']
const contextKeys = ['inboundWeightOcr', 'ocrInbound', 'testInbound', 'createdInbound',
'phase3LoadingRequireSharedOverflow', 'phase3LoadingIncrementalPackageCount',
'phase3LoadingIncrementalDetailCount']
'phase3LoadingIncrementalDetailCount', 'orderProfile']
const createdSnapshot = new Map(createdKeys.map((key) => [key, {
present: Object.hasOwn(this.createdResources, key), value: this.createdResources[key],
}]))
@@ -1221,6 +1222,11 @@ export class AcceptanceRun {
}]))
this.marker = fixtureMarker
if (taxModes?.primary) {
this.context.orderProfile = {
...(this.context.orderProfile || {}), taxMode: taxModes.primary,
}
}
const orders = await import(new URL('./admin-test-env-modules/orders.mjs', import.meta.url))
await this.executeModule('orders-phase3-loading-fixture', () => orders.run(this))
const fixtureInbound = this.createdResources.orders
@@ -1254,12 +1260,18 @@ export class AcceptanceRun {
customerRemark: fixtureOrder.customerRemark,
internalRemark: fixtureOrder.internalRemark,
cargoRemark: fixtureOrder.cargoRemark,
taxMode: fixtureOrder.taxMode || null,
} : { marker: originalMarker, sourceMarker: fixtureMarker, failed: true }
const incrementalMarker = `${originalMarker}-LOAD${suffix}-INC`
this.marker = incrementalMarker
this.context.phase3LoadingRequireSharedOverflow = false
this.context.phase3LoadingIncrementalPackageCount = 2
this.context.phase3LoadingIncrementalDetailCount = 4
if (taxModes?.incremental) {
this.context.orderProfile = {
...(this.context.orderProfile || {}), taxMode: taxModes.incremental,
}
}
await this.executeModule('orders-phase3-loading-incremental-fixture', () => orders.run(this))
const measurement = await import(new URL('./admin-test-env-modules/inbound-measurement.mjs', import.meta.url))
await this.executeModule('inbound-measurement-phase3-loading-incremental-fixture', () => measurement.run(this))
@@ -1272,6 +1284,7 @@ export class AcceptanceRun {
inboundId: incrementalSource.inboundId,
boxCode: incrementalSource.boxCode,
fulfillmentType: this.createdResources.orders?.fulfillmentType || 'STANDARD',
taxMode: this.createdResources.orders?.taxMode || null,
skuCodes: Array.isArray(this.createdResources.orders?.skuCodes)
? this.createdResources.orders.skuCodes : [],
skuLines: Array.isArray(this.createdResources.orders?.skuLines)
@@ -1546,6 +1559,16 @@ export class AcceptanceRun {
{ scenario: 'phase3-loading-resource-isolation' })
}
}
if (module === 'phase3-container-customs') {
try {
const fixture = await import(new URL('./admin-test-env-modules/phase3-container-customs-fixture.mjs', import.meta.url))
restoreFixture = await fixture.prepare(this)
} catch (error) {
const reason = error instanceof Error ? error.message : String(error)
this.addStep('phase3-container-customs-fixture', '创建独立BUY+TAX混合整柜', null, false,
reason, { scenario: 'phase3-container-customs-mixed-fixture', deploymentBlocker: true })
}
}
let handler = handlers[module]
if (!handler) {
try {