test(overseas): cover list search interactions
This commit is contained in:
@@ -37,6 +37,12 @@ import InboundOrdersView from '@/modules/overseas-warehouse/pages/InboundOrdersV
|
||||
import InventoryView from '@/modules/overseas-warehouse/pages/InventoryView.vue'
|
||||
import DispatchesView from '@/modules/overseas-warehouse/pages/DispatchesView.vue'
|
||||
import RelabelOrdersView from '@/modules/overseas-warehouse/pages/RelabelOrdersView.vue'
|
||||
import OutboundsView from '@/modules/overseas-warehouse/pages/OutboundsView.vue'
|
||||
import DeliveryOrdersView from '@/modules/overseas-warehouse/pages/DeliveryOrdersView.vue'
|
||||
import ExceptionOrdersView from '@/modules/overseas-warehouse/pages/ExceptionOrdersView.vue'
|
||||
import CustomerVisitsView from '@/modules/overseas-warehouse/pages/CustomerVisitsView.vue'
|
||||
import InventoryTransactionsView from '@/modules/overseas-warehouse/pages/InventoryTransactionsView.vue'
|
||||
import PalletsView from '@/modules/overseas-warehouse/pages/PalletsView.vue'
|
||||
import QueryToolbar from '@/shared/components/QueryToolbar.vue'
|
||||
|
||||
type Region = 'domestic' | 'overseas'
|
||||
@@ -241,18 +247,60 @@ async function mountPage(component: Parameters<typeof mount>[0], method: string,
|
||||
expect(wrapper.text()).not.toContain('服务暂时不可用')
|
||||
return wrapper
|
||||
}
|
||||
async function pageRequestCoverage() {
|
||||
await mountPage(OverseasQuotesView, 'GET', '/platform/v1/last-leg/master-data/overseas-quotes')
|
||||
await mountPage(PurchaseOrdersView, 'GET', '/platform/v1/last-leg/overseas-procurements')
|
||||
await mountPage(TransportOrdersView, 'GET', '/platform/v1/last-leg/us-truck-orders', { domain: 'truck' })
|
||||
await mountPage(TransportOrdersView, 'GET', '/platform/v1/last-leg/local-looseboard-orders', { domain: 'looseboard' })
|
||||
const lastMile = await mountPage(LastMileOrdersView, 'GET', '/platform/v1/last-leg/orders')
|
||||
const lastMileToolbar = lastMile.findComponent(QueryToolbar)
|
||||
async function exerciseListSearch(
|
||||
wrapper: VueWrapper,
|
||||
path: string,
|
||||
model: Record<string, unknown>,
|
||||
expectedParams: Record<string, unknown>,
|
||||
) {
|
||||
const toolbar = wrapper.findComponent(QueryToolbar)
|
||||
expect(toolbar.exists()).toBe(true)
|
||||
toolbar.vm.$emit('update:modelValue', { ...model })
|
||||
await nextTick()
|
||||
let start = traces.length
|
||||
lastMileToolbar.vm.$emit('search', { orderNo: '', inboundCode: '', lxCode: `${marker}-NO-MATCH`, orderType: '', warehouse: '', sourceOrderNo: '', containerNo: '', transferWarehouseCode: '', status: '', abnormal: '', detained: '', createdAt: [] })
|
||||
await waitForTrace('GET', '/platform/v1/last-leg/orders', start)
|
||||
expect(traces.slice(start).some(item => item.path.startsWith('/platform/v1/last-leg/orders') && (item.params as Record<string, unknown> | undefined)?.lxCode === `${marker}-NO-MATCH`)).toBe(true)
|
||||
toolbar.vm.$emit('search', { ...model })
|
||||
await waitForTrace('GET', path, start)
|
||||
const searchRequests = traces.slice(start).filter(item => item.method === 'GET' && item.path === path)
|
||||
expect(searchRequests).toHaveLength(1)
|
||||
expect(searchRequests[0]?.httpStatus).toBe(200)
|
||||
expect(searchRequests[0]?.params).toMatchObject(expectedParams)
|
||||
expect(wrapper.text()).not.toContain('加载失败')
|
||||
|
||||
start = traces.length
|
||||
;(toolbar.vm as unknown as { reset(): void }).reset()
|
||||
await waitForTrace('GET', path, start)
|
||||
const resetRequests = traces.slice(start).filter(item => item.method === 'GET' && item.path === path)
|
||||
expect(resetRequests).toHaveLength(1)
|
||||
expect(resetRequests[0]?.httpStatus).toBe(200)
|
||||
const resetParams = resetRequests[0]?.params as Record<string, unknown> | undefined
|
||||
for (const key of Object.keys(expectedParams)) expect(resetParams?.[key] == null || resetParams[key] === '').toBe(true)
|
||||
}
|
||||
async function pageRequestCoverage() {
|
||||
const quotes = await mountPage(OverseasQuotesView, 'GET', '/platform/v1/last-leg/master-data/overseas-quotes')
|
||||
await exerciseListSearch(quotes, '/platform/v1/last-leg/master-data/overseas-quotes',
|
||||
{ keyword: `${marker}-NO-MATCH`, warehouseId: '', providerName: `${marker}-PROVIDER`, currency: 'USD', status: 'INACTIVE' },
|
||||
{ keyword: `${marker}-NO-MATCH`, providerName: `${marker}-PROVIDER`, currency: 'USD', status: 'INACTIVE' })
|
||||
|
||||
const purchases = await mountPage(PurchaseOrdersView, 'GET', '/platform/v1/last-leg/overseas-procurements')
|
||||
await exerciseListSearch(purchases, '/platform/v1/last-leg/overseas-procurements',
|
||||
{ orderNo: `${marker}-NO-MATCH`, customerId: '', purchaseCategory: `${marker}-CATEGORY`, productName: `${marker}-PRODUCT` },
|
||||
{ orderNo: `${marker}-NO-MATCH`, purchaseCategory: `${marker}-CATEGORY`, productName: `${marker}-PRODUCT` })
|
||||
|
||||
const trucks = await mountPage(TransportOrdersView, 'GET', '/platform/v1/last-leg/us-truck-orders', { domain: 'truck' })
|
||||
await exerciseListSearch(trucks, '/platform/v1/last-leg/us-truck-orders',
|
||||
{ status: 'CANCELLED', routeKeyword: `${marker}-NO-MATCH` },
|
||||
{ status: 'CANCELLED', routeKeyword: `${marker}-NO-MATCH` })
|
||||
|
||||
const looseboards = await mountPage(TransportOrdersView, 'GET', '/platform/v1/last-leg/local-looseboard-orders', { domain: 'looseboard' })
|
||||
await exerciseListSearch(looseboards, '/platform/v1/last-leg/local-looseboard-orders',
|
||||
{ status: 'CANCELLED', routeKeyword: `${marker}-NO-MATCH` },
|
||||
{ status: 'CANCELLED', routeKeyword: `${marker}-NO-MATCH` })
|
||||
|
||||
const lastMile = await mountPage(LastMileOrdersView, 'GET', '/platform/v1/last-leg/orders')
|
||||
await exerciseListSearch(lastMile, '/platform/v1/last-leg/orders',
|
||||
{ orderNo: `${marker}-ORDER`, inboundCode: `${marker}-INBOUND`, lxCode: `${marker}-LX`, orderType: 'FIRST_LEG', warehouse: `${marker}-WAREHOUSE`, sourceOrderNo: `${marker}-SOURCE`, containerNo: `${marker}-CONTAINER`, transferWarehouseCode: `${marker}-TRANSFER`, status: 'DELIVERED', abnormal: 'true', detained: 'false', createdAt: ['2098-01-01', '2098-01-02'] },
|
||||
{ orderNo: `${marker}-ORDER`, inboundCode: `${marker}-INBOUND`, lxCode: `${marker}-LX`, orderType: 'FIRST_LEG', warehouse: `${marker}-WAREHOUSE`, sourceOrderNo: `${marker}-SOURCE`, containerNo: `${marker}-CONTAINER`, transferWarehouseCode: `${marker}-TRANSFER`, currentStatus: 'DELIVERED', abnormal: true, detained: false, createdFrom: '2098-01-01T00:00:00', createdTo: '2098-01-02T23:59:59' })
|
||||
let start = traces.length
|
||||
await lastMile.findAll('.el-radio-button').find(item => item.text() === '待分配')!.trigger('click')
|
||||
await waitForTrace('GET', '/platform/v1/last-leg/orders', start)
|
||||
start = traces.length
|
||||
@@ -261,14 +309,56 @@ async function pageRequestCoverage() {
|
||||
start = traces.length
|
||||
await lastMile.findAll('.el-radio-button').find(item => item.text() === '全部')!.trigger('click')
|
||||
await waitForTrace('GET', '/platform/v1/last-leg/orders', start)
|
||||
start = traces.length
|
||||
lastMileToolbar.vm.$emit('reset', { orderNo: '', inboundCode: '', lxCode: '', orderType: '', warehouse: '', sourceOrderNo: '', containerNo: '', transferWarehouseCode: '', status: '', abnormal: '', detained: '', createdAt: [] })
|
||||
await waitForTrace('GET', '/platform/v1/last-leg/orders', start)
|
||||
expect(traces.slice(start).some(item => item.path.startsWith('/platform/v1/last-leg/orders') && !(item.params as Record<string, unknown> | undefined)?.lxCode)).toBe(true)
|
||||
await mountPage(InboundOrdersView, 'GET', '/platform/v1/last-leg/inbound-plans')
|
||||
await mountPage(InventoryView, 'GET', '/platform/v1/last-leg/inventory/balances')
|
||||
await mountPage(DispatchesView, 'GET', '/platform/v1/last-leg/dispatches')
|
||||
await mountPage(RelabelOrdersView, 'GET', '/platform/v1/last-leg/relabel-applications')
|
||||
|
||||
const inbounds = await mountPage(InboundOrdersView, 'GET', '/platform/v1/last-leg/inbound-plans')
|
||||
await exerciseListSearch(inbounds, '/platform/v1/last-leg/inbound-plans',
|
||||
{ orderNo: `${marker}-PLAN`, inboundCode: `${marker}-INBOUND`, lxCode: `${marker}-LX`, status: 'COMPLETED', warehouse: `${marker}-WAREHOUSE`, fbaWarehouse: `${marker}-FBA`, appointmentStatus: 'CANCELLED', dispatchStatus: 'SCHEDULED', inboundDate: ['2098-01-01', '2098-01-02'] },
|
||||
{ planNo: `${marker}-PLAN`, inboundCode: `${marker}-INBOUND`, lxCode: `${marker}-LX`, status: 'COMPLETED', warehouse: `${marker}-WAREHOUSE`, fbaWarehouseCode: `${marker}-FBA`, appointmentStatus: 'CANCELLED', dispatchStatus: 'SCHEDULED', createdFrom: '2098-01-01T00:00:00', createdTo: '2098-01-02T23:59:59' })
|
||||
|
||||
const inventory = await mountPage(InventoryView, 'GET', '/platform/v1/last-leg/inventory/balances')
|
||||
await exerciseListSearch(inventory, '/platform/v1/last-leg/inventory/balances',
|
||||
{ warehouseId: '', owner: `${marker}-OWNER`, sku: `${marker}-SKU`, productName: `${marker}-PRODUCT`, batchNo: `${marker}-BATCH`, location: `${marker}-LOCATION`, status: 'AVAILABLE' },
|
||||
{ customerName: `${marker}-OWNER`, skuCode: `${marker}-SKU`, productName: `${marker}-PRODUCT`, batchNo: `${marker}-BATCH`, warehouseLocationCode: `${marker}-LOCATION`, inventoryStatus: 'AVAILABLE' })
|
||||
|
||||
const dispatches = await mountPage(DispatchesView, 'GET', '/platform/v1/last-leg/dispatches')
|
||||
await exerciseListSearch(dispatches, '/platform/v1/last-leg/dispatches',
|
||||
{ dispatchNo: `${marker}-DISPATCH`, vehiclePlate: `${marker}-PLATE`, status: 'CANCELLED', fbaAppointmentNo: `${marker}-APPOINTMENT` },
|
||||
{ dispatchNo: `${marker}-DISPATCH`, vehiclePlate: `${marker}-PLATE`, status: 'CANCELLED', fbaAppointmentNo: `${marker}-APPOINTMENT` })
|
||||
|
||||
const relabels = await mountPage(RelabelOrdersView, 'GET', '/platform/v1/last-leg/relabel-applications')
|
||||
await exerciseListSearch(relabels, '/platform/v1/last-leg/relabel-applications',
|
||||
{ relabelNo: `${marker}-RELABEL`, sku: `${marker}-SKU`, status: 'CANCELLED' },
|
||||
{ relabelNo: `${marker}-RELABEL`, skuCode: `${marker}-SKU`, status: 'CANCELLED' })
|
||||
|
||||
const outbounds = await mountPage(OutboundsView, 'GET', '/platform/v1/last-leg/outbound-orders')
|
||||
await exerciseListSearch(outbounds, '/platform/v1/last-leg/outbound-orders',
|
||||
{ documentNo: `${marker}-OUTBOUND`, lxCode: `${marker}-LX`, warehouseId: `${marker}-WAREHOUSE`, status: 'OUTBOUNDED' },
|
||||
{ documentNo: `${marker}-OUTBOUND`, lxCode: `${marker}-LX`, warehouseId: `${marker}-WAREHOUSE`, status: 'OUTBOUNDED' })
|
||||
|
||||
const deliveries = await mountPage(DeliveryOrdersView, 'GET', '/platform/v1/last-leg/delivery-orders')
|
||||
await exerciseListSearch(deliveries, '/platform/v1/last-leg/delivery-orders',
|
||||
{ documentNo: `${marker}-DELIVERY`, dispatchNo: `${marker}-DISPATCH`, waybillNo: `${marker}-WAYBILL`, warehouseId: '', status: 'CANCELLED', vehiclePlate: `${marker}-PLATE`, driverName: `${marker}-DRIVER`, deliveryMethod: 'EXPRESS', plannedAt: ['2098-01-01', '2098-01-02'] },
|
||||
{ documentNo: `${marker}-DELIVERY`, dispatchNo: `${marker}-DISPATCH`, waybillNo: `${marker}-WAYBILL`, status: 'CANCELLED', vehiclePlate: `${marker}-PLATE`, driverName: `${marker}-DRIVER`, deliveryMethod: 'EXPRESS', plannedFrom: '2098-01-01T00:00:00', plannedTo: '2098-01-02T23:59:59' })
|
||||
|
||||
const exceptions = await mountPage(ExceptionOrdersView, 'GET', '/platform/v1/last-leg/exception-orders')
|
||||
await exerciseListSearch(exceptions, '/platform/v1/last-leg/exception-orders',
|
||||
{ keyword: `${marker}-EXCEPTION`, exceptionType: 'OTHER', status: 'COMPLETED' },
|
||||
{ keyword: `${marker}-EXCEPTION`, exceptionType: 'OTHER', status: 'COMPLETED' })
|
||||
|
||||
const visits = await mountPage(CustomerVisitsView, 'GET', '/platform/v1/last-leg/customer-visits')
|
||||
await exerciseListSearch(visits, '/platform/v1/last-leg/customer-visits',
|
||||
{ keyword: `${marker}-VISIT`, status: 'COMPLETED', completedAt: ['2098-01-01', '2098-01-02'] },
|
||||
{ keyword: `${marker}-VISIT`, status: 'COMPLETED', completedFrom: '2098-01-01T00:00:00', completedTo: '2098-01-02T23:59:59' })
|
||||
|
||||
const ledger = await mountPage(InventoryTransactionsView, 'GET', '/platform/v1/last-leg/inventory/ledger')
|
||||
await exerciseListSearch(ledger, '/platform/v1/last-leg/inventory/ledger',
|
||||
{ occurredDate: ['2098-01-01', '2098-01-02'], customerName: `${marker}-CUSTOMER`, warehouse: `${marker}-WAREHOUSE`, sku: `${marker}-SKU`, businessType: 'ADJUST', businessOrderNo: `${marker}-BUSINESS`, inboundCode: `${marker}-INBOUND`, inboundOrderNo: `${marker}-INBOUND-ORDER`, outboundOrderNo: `${marker}-OUTBOUND` },
|
||||
{ customerName: `${marker}-CUSTOMER`, destinationWarehouseCode: `${marker}-WAREHOUSE`, skuCode: `${marker}-SKU`, businessType: 'ADJUST', businessOrderNo: `${marker}-BUSINESS`, inboundCode: `${marker}-INBOUND`, inboundOrderNo: `${marker}-INBOUND-ORDER`, outboundOrderNo: `${marker}-OUTBOUND`, occurredFrom: '2098-01-01T00:00:00', occurredTo: '2098-01-02T23:59:59' })
|
||||
|
||||
const pallets = await mountPage(PalletsView, 'GET', '/platform/v1/warehouse-admin/pallets')
|
||||
await exerciseListSearch(pallets, '/platform/v1/warehouse-admin/pallets',
|
||||
{ warehouseId: '', code: `${marker}-PALLET`, type: 'WOOD', status: 'IDLE' },
|
||||
{ keyword: `${marker}-PALLET`, palletType: 'WOOD', status: 'IDLE' })
|
||||
}
|
||||
|
||||
describe.skipIf(!enabled).sequential('phase4 development frontend acceptance', () => {
|
||||
|
||||
Reference in New Issue
Block a user