This commit is contained in:
2026-09-11 11:51:35 +08:00
parent f8ebbd9610
commit 138ab6405a
18 changed files with 209 additions and 97 deletions
+26 -12
View File
@@ -8,9 +8,9 @@ test('domestic workbench exposes a real one-click dropship palletization entry',
const [data, home, modulePage, pages] = await Promise.all([
read('../data/demo-data.js'), read('../pages/home/home.vue'), read('../pages/module/module.vue'), read('../pages.json')
])
assert.match(data, /key: 'inbound'[\s\S]*?name: '一件代发合托'[\s\S]*?available: true, visible: true/)
assert.match(home, /'一件代发合托': '\/pages\/dropship-tasks\/dropship-tasks'/)
assert.match(modulePage, /'一件代发合托': '\/pages\/dropship-tasks\/dropship-tasks'/)
assert.match(data, /key: 'inbound'[\s\S]*?name: '一件代发'[\s\S]*?available: true, visible: true/)
assert.match(home, /'一件代发': '\/pages\/dropship-tasks\/dropship-tasks'/)
assert.match(modulePage, /'一件代发': '\/pages\/dropship-tasks\/dropship-tasks'/)
assert.match(pages, /pages\/dropship-tasks\/dropship-tasks/)
assert.match(pages, /pages\/dropship-palletization\/dropship-palletization/)
})
@@ -18,27 +18,41 @@ test('domestic workbench exposes a real one-click dropship palletization entry',
test('dropship palletization adapter uses only the dedicated production PDA contract', async () => {
const api = await read('../api/pda-dropship.js')
for (const route of [
'/tasks/pending', '/cartons/resolve', '/cartons/count', '/pallets/bind-pending',
'/pallets/create-and-bind', '/seal'
'/tasks/pending', '/cartons/resolve', '/cartons/count',
'/pallets/create-and-bind', '/print'
]) assert.match(api, new RegExp(route.replaceAll('/', '\\/')))
assert.match(api, /expectedVersion: pallet\.version/)
assert.match(api, /apiDownload/)
assert.match(api, /application\\\/pdf/)
assert.match(api, /tasks\/pending\?\$\{params\.join\('&'\)\}/)
assert.match(api, /warehouseId=\$\{encodeURIComponent\(warehouseId\)\}/)
assert.match(api, /operationId\('count'/)
assert.match(api, /operationId\('bind'/)
assert.match(api, /operationId\('create-bind'/)
assert.match(api, /operationId\('seal'/)
assert.match(api, /function stableId\(value\)[\s\S]*?String\(value \?\? ''\)\.trim\(\)/)
assert.match(api, /warehouseId: stableId\(warehouseId\)/)
assert.match(api, /warehouseId: stableId\(payload\.warehouseId\)/)
assert.doesNotMatch(api, /customerId|tenantId|inboundId/)
})
test('palletization UI supports scan, count, existing or generated pallet, and seal', async () => {
test('palletization UI generates and prints the final pallet number only after inbound work is complete', async () => {
const [tasks, work] = await Promise.all([
read('../pages/dropship-tasks/dropship-tasks.vue'),
read('../pages/dropship-palletization/dropship-palletization.vue')
])
for (const text of ['待合托任务', '入仓码', '进入作业']) assert.match(tasks, new RegExp(text))
for (const text of ['领取并开始合托', '扫箱清点', '差异说明', '绑定到扫描托盘', '生成 DP 托盘并绑定', '确认封托']) assert.match(work, new RegExp(text))
for (const text of ['待入库任务', '入仓码', '进入作业']) assert.match(tasks, new RegExp(text))
assert.match(tasks, /\.search-card\s*\{[^}]*display:\s*flex;[^}]*box-shadow:\s*none;/)
assert.match(tasks, /\.task-list\s*\{[^}]*overflow:\s*hidden;[^}]*border-radius:\s*7px;/)
assert.match(tasks, /\.task-card\s*\{[^}]*margin:\s*0;[^}]*border-radius:\s*0;[^}]*box-shadow:\s*none;/)
for (const text of ['一件代发入库', '领取并开始入库', '扫箱清点', '差异说明', '完成入库并生成托盘码', '托盘码与打印', '打印托盘码']) assert.match(work, new RegExp(text))
for (const text of ['绑定到扫描托盘', '生成 DP 托盘并绑定', '确认封托']) assert.doesNotMatch(work, new RegExp(text))
assert.match(work, /class="task-summary-card"/)
assert.match(work, /\.task-summary-card\s*\{\s*display:\s*block;/)
assert.doesNotMatch(work, /class="summary-card"/)
assert.match(work, /startScanBroadcast/)
assert.match(work, /quantityDiffers[\s\S]*?ACCEPT_VARIANCE/)
assert.match(work, /canSeal\(\)[\s\S]*?countedCartons[\s\S]*?totalCartons[\s\S]*?unboundCartons/)
assert.match(work, /allCartonsCounted\(\)[\s\S]*?countedCartons[\s\S]*?totalCartons/)
assert.match(work, /pallet\.status !== 'SEALED'/)
assert.match(work, /downloadDropshipPalletLabel/)
assert.match(work, /formatApiError/)
assert.doesNotMatch(work, /Number\(this\.warehouseId\)/)
assert.doesNotMatch(work, /taskId\s*\}\}|warehouseId\s*\}\}|inboundId\s*\}\}/)
})
+9 -7
View File
@@ -88,16 +88,16 @@ test('workbench, module, history and profile are independent sources', async ()
for (const text of ['首页', '库内作业', 'home-operation-grid', 'home-operation-primary', '开始作业', 'uni-icons']) assert.match(home, new RegExp(text))
assert.doesNotMatch(home, /getPickingOverview|pendingBoxCount|箱待拣/)
assert.doesNotMatch(home, /BottomNav|status-strip|task-card/)
for (const text of ['业务模块', '业务功能', '一件代发合托', '出库拣货', '库位查询']) assert.match(module, new RegExp(text))
for (const text of ['业务模块', '业务功能', '一件代发', '出库拣货', '库位查询']) assert.match(module, new RegExp(text))
assert.match(home, /:disabled="!operation\.available"/)
assert.match(home, /home-operation-disabled/)
assert.match(home, /home-operation-meta home-operation-pending/)
assert.match(home, /home-operation-meta home-operation-unavailable/)
assert.match(home, /openOperation\(operation\)[\s\S]*?if \(!operation\.available\) return[\s\S]*?'一件代发合托': '\/pages\/dropship-tasks\/dropship-tasks'[\s\S]*?'出库拣货': '\/pages\/tasks\/tasks'[\s\S]*?'库位查询'/)
assert.match(home, /openOperation\(operation\)[\s\S]*?if \(!operation\.available\) return[\s\S]*?'一件代发': '\/pages\/dropship-tasks\/dropship-tasks'[\s\S]*?'出库拣货': '\/pages\/tasks\/tasks'[\s\S]*?'库位查询'/)
assert.match(home, /pages\/operation\/operation\?module=query&name=/)
assert.match(module, /:disabled="!operation\.available"/)
assert.match(module, /operation-item-disabled/)
assert.match(module, /openOperation\(operation\)[\s\S]*?if \(!operation\.available\) return[\s\S]*?'一件代发合托': '\/pages\/dropship-tasks\/dropship-tasks'[\s\S]*?'出库拣货': '\/pages\/tasks\/tasks'/)
assert.match(module, /openOperation\(operation\)[\s\S]*?if \(!operation\.available\) return[\s\S]*?'一件代发': '\/pages\/dropship-tasks\/dropship-tasks'[\s\S]*?'出库拣货': '\/pages\/tasks\/tasks'/)
assert.match(module, /pages\/operation\/operation\?module=\$\{encodeURIComponent\(this\.moduleKey\)\}&name=/)
assert.match(history, /作业记录/)
assert.match(profile, /个人中心/)
@@ -110,14 +110,14 @@ test('home exposes only the three confirmed operations and keeps hidden definiti
const data = await read('../data/demo-data.js')
const { MODULES } = await import('../data/demo-data.js')
for (const text of ['入库', '出库', '库存', '查询', '出库拣货']) assert.match(data, new RegExp(text))
assert.match(data, /key: 'inbound'[\s\S]*?name: '一件代发合托'[\s\S]*?available: true, visible: true/)
assert.match(data, /key: 'inbound'[\s\S]*?name: '一件代发'[\s\S]*?available: true, visible: true/)
assert.match(data, /key: 'outbound'[\s\S]*?name: '出库拣货'[\s\S]*?available: true, visible: true/)
assert.match(data, /key: 'query'[\s\S]*?name: '库位查询'[\s\S]*?available: true, visible: true/)
assert.match(await read('../pages/home/home.vue'), /operations: module\.operations\.filter\(\(operation\) => operation\.visible\)/)
assert.deepEqual(MODULES.flatMap((module) => module.operations
.filter((operation) => operation.visible)
.map((operation) => `${module.key}:${operation.name}`)), [
'inbound:一件代发合托',
'inbound:一件代发',
'outbound:出库拣货',
'query:库位查询'
])
@@ -178,7 +178,7 @@ test('picking cabinet selector synchronizes all ready server tasks by stable tas
const page = await read('../pages/picking/picking.vue')
assert.match(page, /listLoadingOrders/)
assert.match(page, /async onShow\(\)[\s\S]*?await this\.refreshAvailableBoxes\(\)[\s\S]*?await this\.syncRemoteTask\(\)/)
assert.match(page, /async refreshAvailableBoxes\(\)[\s\S]*?listLoadingOrders\(\{ page: 1, size: 50 \}\)/)
assert.match(page, /async refreshAvailableBoxes\(\)[\s\S]*?listLoadingOrders\(\{ page: 1, size: 50, warehouseId: session\.currentUser\?\.warehouseId \}\)/)
assert.match(page, /isSelectableTask\(task\)[\s\S]*?recordStatus === 'ACTIVE'[\s\S]*?\['UNASSIGNED', 'IN_PROGRESS', 'AWAITING_REVIEW'\]/)
assert.match(page, /existingByTaskId[\s\S]*?recordByTaskId[\s\S]*?orderedTaskIds[\s\S]*?this\.boxes = nextBoxes/)
assert.match(page, /selectedTaskId[\s\S]*?findIndex\(\(box\) => String\(box\.taskId \|\| ''\) === selectedTaskId\)/)
@@ -226,7 +226,9 @@ test('business dialogs use uni-ui popup components consistently', async () => {
assert.match(popupHeader, /aria-label="`关闭\$\{title\}`"/)
assert.match(popupHeader, /@tap="\$emit\('close'\)"/)
assert.match(header, /<uni-popup ref="menuPopup"[\s\S]*?:is-mask-click="true"/)
assert.match(header, /<PopupHeader title="功能菜单" @close="closeMenu"/)
assert.match(header, /<PopupHeader title="选择作业仓库" @close="closeMenu"/)
assert.match(header, /v-for="warehouse in warehouses"[\s\S]*?@tap="chooseWarehouse\(warehouse\)"/)
assert.doesNotMatch(header, />作业记录<|>个人中心</)
assert.doesNotMatch(header, /uni\.showActionSheet/)
assert.match(profile, /<uni-popup ref="logoutPopup" type="center"[\s\S]*?:is-mask-click="true"[\s\S]*?@change="handleLogoutChange"/)
assert.match(profile, /<PopupHeader title="确认退出登录?"[\s\S]*?@close="closeLogout"/)
+2
View File
@@ -10,6 +10,8 @@ test('PDA loading adapter uses only task-scoped cabinet evidence paths', () => {
for (const path of [
'/first-leg/pda-loading/tasks/pending'
]) assert.match(source, new RegExp(path.replace(/[?]/g, '\\?')))
assert.match(source, /\/first-leg\/pda-loading\/warehouses/)
assert.match(source, /query\.push\(`warehouseId=\$\{encodeURIComponent\(warehouseId\)\}`\)/)
assert.match(source, /first-leg\/pda-loading\/tasks\/\$\{encodeURIComponent\(taskId\)\}\/evidence/)
assert.match(source, /'Idempotency-Key'/)
assert.match(source, /PHOTO_STEP_1[\s\S]*PHOTO_STEP_4[\s\S]*SEAL/)