优化
This commit is contained in:
@@ -5,8 +5,8 @@ import { readFile } from 'node:fs/promises'
|
||||
const read = (path) => readFile(new URL(path, import.meta.url), 'utf8')
|
||||
|
||||
test('overseas PDA is an independent Vue 3 app with separate packaging identity', async () => {
|
||||
const [manifest, pages, pkg, vite] = await Promise.all([
|
||||
read('../src/manifest.json'), read('../src/pages.json'), read('../package.json'), read('../vite.config.js')
|
||||
const [manifest, pages, pkg, vite, styles] = await Promise.all([
|
||||
read('../src/manifest.json'), read('../src/pages.json'), read('../package.json'), read('../vite.config.js'), read('../src/styles/pda.scss')
|
||||
])
|
||||
assert.match(manifest, /"name"\s*:\s*"柏悦物流\s*PDA\s*海外版"/)
|
||||
assert.match(manifest, /"packagename"\s*:\s*"com\.baiyuelogistics\.pda\.overseas"/)
|
||||
@@ -17,6 +17,10 @@ test('overseas PDA is an independent Vue 3 app with separate packaging identity'
|
||||
assert.match(vite, /OVERSEAS_API_PROXY_TARGET/)
|
||||
assert.match(vite, /\/overseas-api/)
|
||||
assert.match(vite, /replace\(\/\^\\\/overseas-api\//)
|
||||
assert.match(vite, /removeHeader\('origin'\)/)
|
||||
assert.match(vite, /removeHeader\('referer'\)/)
|
||||
assert.match(styles, /home-operation-grid[^}]*grid-template-columns:\s*repeat\(3/)
|
||||
assert.match(styles, /home-operation[^}]*width:\s*100%/)
|
||||
})
|
||||
|
||||
test('overseas workbench contains only confirmed inbound and in-warehouse domains', async () => {
|
||||
@@ -34,7 +38,7 @@ test('login has no committed demo credentials and inbound operation implements t
|
||||
read('../src/pages/login/login.vue'), read('../src/config/runtime.js'),
|
||||
read('../src/pages/operation/operation.vue'), read('../src/api/inbound.js'), read('../src/api/receiving-adapter.js'), read('../src/api/overseas.js')
|
||||
])
|
||||
assert.match(login, /柏悦物流海外版/)
|
||||
assert.match(login, /\$t\('app\.title'\)/)
|
||||
assert.doesNotMatch(login, /ChangeMe|platform_admin/)
|
||||
assert.match(login, /DEV_LOGIN\.username|DEV_LOGIN\.password/)
|
||||
assert.match(runtime, /runtimeEnvironment\.DEV|VITE_PDA_DEV_USERNAME|VITE_PDA_DEV_PASSWORD/)
|
||||
@@ -42,8 +46,14 @@ test('login has no committed demo credentials and inbound operation implements t
|
||||
assert.match(runtime, /#ifdef H5[\s\S]*?VITE_H5_AUTH_API_BASE_URL/)
|
||||
assert.match(runtime, /#ifdef H5[\s\S]*?VITE_H5_OVERSEAS_API_BASE_URL/)
|
||||
assert.match(operation, /startScanBroadcast/)
|
||||
for (const action of ['prepareReceivingContainer', 'getCurrentReceiving', 'resolveCurrentSku', 'resolveCurrentCarton', 'resolveCurrentPallet', 'receiveCurrentBulk', 'receiveCurrentCarton', 'completeCurrentReceiving']) assert.match(operation, new RegExp(action))
|
||||
for (const path of ['/candidates', '/prepare', '/unload-photos/files', '/sign', '/skus/resolve', '/cartons/resolve', '/pallets/resolve', '/receipts/bulk', '/receipts/carton', '/complete']) assert.match(inbound, new RegExp(path.replaceAll('/', '\\/')))
|
||||
for (const action of ['prepareReceivingContainer', 'getCurrentReceiving', 'resolveCurrentCarton', 'resolveCurrentPallet', 'receiveCurrentBulk', 'receiveCurrentCarton', 'completeCurrentReceiving']) assert.match(operation, new RegExp(action))
|
||||
for (const path of ['/candidates', '/prepare', '/unload-photos/files', '/sign', '/cartons/resolve', '/pallets/resolve', '/receipts/bulk', '/receipts/carton', '/complete']) assert.match(inbound, new RegExp(path.replaceAll('/', '\\/')))
|
||||
assert.doesNotMatch(operation, /resolveCurrentSku|resolvedSku|skuInput|selectedInboundCode|chooseInbound|class="inbound-tabs"/)
|
||||
assert.doesNotMatch(operation, /InboundList|柜内入仓码/)
|
||||
assert.doesNotMatch(inbound, /skus\/resolve/)
|
||||
assert.match(operation, /const payload = isFba \? \{ inboundCode: this\.activeInbound\.inboundCode, palletCode: this\.resolvedPallet\.palletCode, packageCount: Number\(this\.packageCount\) \}/)
|
||||
assert.doesNotMatch(operation, /skuCode/)
|
||||
assert.match(operation, /clearReceiptContext\(\)[\s\S]*activeScanTarget = 'carton'/)
|
||||
for (const role of ['LICENSE_PLATE', 'CONTAINER_SEAL', 'DOOR_OPEN']) assert.match(adapter, new RegExp(role))
|
||||
for (const forbidden of ['customerId', 'planNo', 'allocationId', 'warehouseId', 'locationId']) assert.doesNotMatch(inbound, new RegExp(forbidden))
|
||||
assert.match(operation, /isReceivingConflict|recoverCurrentAfterConflict/)
|
||||
@@ -56,7 +66,32 @@ test('unimplemented warehouse operations cannot submit prototype scans', async (
|
||||
read('../src/pages/operation/operation.vue'), read('../src/pages/home/home.vue'), read('../src/pages/module/module.vue')
|
||||
])
|
||||
assert.doesNotMatch(operation, /prototypeScan|prototypeInput/)
|
||||
assert.match(operation, /功能暂未开放|扫码不会提交/)
|
||||
assert.match(home, /暂未开放/)
|
||||
assert.match(module, /当前仅开放拆柜收货,其他作业暂未开放/)
|
||||
assert.match(operation, /operation\.unavailableTitle|operation\.unavailableDescription/)
|
||||
assert.match(home, /common\.unavailable/)
|
||||
assert.match(module, /module\.onlyReceiving/)
|
||||
})
|
||||
|
||||
test('receiving phases use a compiled container summary with cabinet and aggregate facts', async () => {
|
||||
const [operation, summary] = await Promise.all([
|
||||
read('../src/pages/operation/operation.vue'), read('../src/components/ReceivingSessionSummary.vue')
|
||||
])
|
||||
assert.match(operation, /import ReceivingSessionSummary/)
|
||||
assert.equal((operation.match(/<ReceivingSessionSummary/g) || []).length, 3)
|
||||
assert.doesNotMatch(operation, /const SessionSummary|template:\s*`<view class="container-card summary-card/)
|
||||
for (const fact of ['containerNo', 'inboundCodeCount', 'plannedPalletCount', 'destinationSummary', 'totalPackages', 'receivedPackages', 'pendingPackages']) assert.match(summary, new RegExp(fact))
|
||||
assert.match(summary, /receiving-summary-metrics/)
|
||||
assert.match(summary, /grid-template-columns:repeat\(4/)
|
||||
assert.match(summary, /padding:10px 12px/)
|
||||
})
|
||||
|
||||
test('Chinese English and Spanish locale resources are installed and selectable', async () => {
|
||||
const [main, i18n, zh, en, es, profile, inbound] = await Promise.all([
|
||||
read('../src/main.js'), read('../src/i18n/index.js'), read('../src/i18n/locales/zh-CN.js'),
|
||||
read('../src/i18n/locales/en.js'), read('../src/i18n/locales/es.js'), read('../src/pages/profile/profile.vue'), read('../src/api/inbound.js')
|
||||
])
|
||||
assert.match(main, /app\.use\(i18n\)/)
|
||||
for (const locale of [zh, en, es]) for (const key of ['operationPhase', 'receivingSummary', 'warehouseOperator']) assert.match(locale, new RegExp(key))
|
||||
assert.match(i18n, /SUPPORTED_LOCALES = \['zh-CN', 'en', 'es'\]/)
|
||||
assert.match(profile, /setLocale|LOCALE_OPTIONS/)
|
||||
assert.match(inbound, /warehouse-profile/)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user