test: require incremental pallet growth

This commit is contained in:
2026-09-04 15:30:59 +08:00
parent 7babcb9e0d
commit 9c96bdfaa8
3 changed files with 41 additions and 4 deletions
@@ -37,13 +37,17 @@ export const PALLET_LOCATION_SCENARIOS = Object.freeze([
},
{
name: 'three-image-incremental-growth',
description: '61 箱、3 张称重图,验证连续两次增托与既有槽身份稳定',
description: '小体积订单上传 3 张称重图,强制验证库位块 1→2→3 连续扩容',
expectedPalletCount: 3,
args: ['--wait-split-package-count', '61', '--wait-split-random-value', '1'],
args: ['--route-mode', 'random', '--wait-split-random-value', '2'],
requiredSteps: [
'第2张确认后扩容只追加且既有槽身份不漂移',
'第3张确认后扩容只追加且既有槽身份不漂移',
],
requiredStepEvidence: [
{ name: '第2张确认后扩容只追加且既有槽身份不漂移', pattern: /beforeSlots=1, afterSlots=2/ },
{ name: '第3张确认后扩容只追加且既有槽身份不漂移', pattern: /beforeSlots=2, afterSlots=3/ },
],
},
])
@@ -91,6 +95,9 @@ export function inspectScenarioReport(scenario, report, exitCode = 0) {
const stepByName = new Map(steps.map((step) => [step.name, step]))
const requiredSteps = [...COMMON_REQUIRED_STEPS, ...(scenario.requiredSteps || [])]
const missingOrFailedSteps = requiredSteps.filter((name) => stepByName.get(name)?.passed !== true)
const mismatchedStepEvidence = (scenario.requiredStepEvidence || [])
.filter(({ name, pattern }) => !pattern.test(String(stepByName.get(name)?.evidence || '')))
.map(({ name }) => name)
const measurement = report?.createdResources?.inboundMeasurement || {}
const guide = report?.createdResources?.inboundMeasurementLocationGuide || {}
const guideEvidence = steps
@@ -102,6 +109,7 @@ export function inspectScenarioReport(scenario, report, exitCode = 0) {
childExitCode: exitCode === 0,
childReportSuccess: report?.success === true,
requiredSteps: missingOrFailedSteps.length === 0,
requiredStepEvidence: mismatchedStepEvidence.length === 0,
expectedPalletCount: Number(measurement.palletCount) === scenario.expectedPalletCount,
waitSplitReached: measurement.processStatus === 'WAIT_SPLIT',
locationIdentityRecorded: Boolean(guide.blockId && guide.reservationId && guide.locationId),
@@ -117,6 +125,7 @@ export function inspectScenarioReport(scenario, report, exitCode = 0) {
passed,
assertions,
missingOrFailedSteps,
mismatchedStepEvidence,
summary: report?.summary || null,
resources: {
marker: report?.marker || null,