coverage.manifest.mjs 9.2 KB
export const REQUIRED_NODES = [
  'ENTRY.DEFAULT',
  'ENTRY.SCAN',
  'ENTRY.EDIT',
  'ENTRY.SUPPLEMENT',
  'ENTRY.MERCHANT',
  'SUBMIT.PRERECORDED',
  'SUBMIT.CREATE',
  'SUBMIT.SUPPLEMENT',
  'SUBMIT.CORRECTION',
  'SUBMIT.DEFEAT',
  'PAY.SHOP',
  'PAY.ONLINE',
  'ORDER.REFUND_GUARD',
  'ORDER.CANCEL',
  'ORDER.ERROR_MARK',
  'ORDER.CORRECT',
  'CONSTRUCTION.NONE',
  'CONSTRUCTION.PARTIAL',
  'CONSTRUCTION.ALL',
  'CONSTRUCTION.CLAIM',
  'CONSTRUCTION.OUTBOUND',
  'CONSTRUCTION.PARTIAL_COMPLETE',
  'CONSTRUCTION.COMPLETE',
  'CONSTRUCTION.REWORK'
]

export const REQUIRED_EDGES = [
  'NEW -> PRERECORDED',
  'NEW -> WAIT_PAY',
  'NEW -> DEFEATED',
  'WAIT_PAY -> PAID',
  'PAID -> REVOKED',
  'PAID -> ERROR_MARKED',
  'ERROR_MARKED -> CORRECTED',
  'PAID -> NO_CONSTRUCTION',
  'PAID -> WAIT_CLAIM',
  'WAIT_CLAIM -> WAIT_OUTBOUND',
  'WAIT_OUTBOUND -> PARTIAL_OUTBOUND',
  'WAIT_OUTBOUND -> WAIT_COMPLETE',
  'WAIT_COMPLETE -> PARTIAL_COMPLETE',
  'WAIT_COMPLETE -> COMPLETE',
  'COMPLETE -> REWORKED'
]

export const REQUIRED_INTERFACES = [
  'dj.api.smartcarlife.order.createWithPay',
  'dj.api.smartcarlife.order.preliminaryOrder',
  'dj.api.smartcarlife.order.supplementOrder',
  'dj.api.smartcarlife.order.correctionOrder',
  'dj.api.smartcarlife.payOrder.create',
  'dj.api.smartcarlife.refundApplyRecord.isExist',
  'dj.api.smartcarlife.order.revoke',
  'dj.api.smartcarlife.construction.get.showFlag',
  'dj.api.smartcarlife.construction.batch.add',
  'dj.api.smartcarlife.construction.addOrUpdate',
  'dj.api.smartcarlife.construction.outbound',
  'dj.api.smartcarlife.construction.complete',
  'dj.api.smartcarlife.construction.rework'
]

const defaults = {
  layer: 'L1',
  stateEdge: null,
  interfaces: [],
  dimensions: [],
  automated: true,
  manual: null
}

const coverageCase = value => ({ ...defaults, ...value })

export const COVERAGE_CASES = [
  ...[
    ['IT-OL-ENTRY-001', 'ENTRY.DEFAULT'],
    ['IT-OL-ENTRY-002', 'ENTRY.SCAN'],
    ['IT-OL-ENTRY-003', 'ENTRY.EDIT'],
    ['IT-OL-ENTRY-004', 'ENTRY.SUPPLEMENT'],
    ['IT-OL-ENTRY-005', 'ENTRY.MERCHANT']
  ].map(([id, requirement]) =>
    coverageCase({
      id,
      requirement,
      dimensions: ['route priority', 'query parameters'],
      testFile:
        'tabWorkOrder/pages/createOrder/tests/routeMatch.helpers.test.mjs'
    })
  ),
  coverageCase({
    id: 'IT-OL-SUBMIT-001',
    requirement: 'SUBMIT.PRERECORDED',
    stateEdge: 'NEW -> PRERECORDED',
    interfaces: ['dj.api.smartcarlife.order.preliminaryOrder'],
    dimensions: ['save mode', 'coupon removal'],
    testFile:
      'tabWorkOrder/pages/createOrder/tests/submitPayload.helpers.test.mjs'
  }),
  coverageCase({
    id: 'IT-OL-SUBMIT-002',
    requirement: 'SUBMIT.CREATE',
    stateEdge: 'NEW -> WAIT_PAY',
    interfaces: ['dj.api.smartcarlife.order.createWithPay'],
    dimensions: ['normal order', 'shop payment'],
    testFile: 'tests/order-lifecycle/e2e/orderFlow.test.mjs'
  }),
  coverageCase({
    id: 'IT-OL-SUBMIT-003',
    requirement: 'SUBMIT.SUPPLEMENT',
    interfaces: ['dj.api.smartcarlife.order.supplementOrder'],
    dimensions: ['supplement routing'],
    testFile:
      'tabWorkOrder/pages/createOrder/tests/submitPayload.helpers.test.mjs'
  }),
  coverageCase({
    id: 'IT-OL-SUBMIT-004',
    requirement: 'SUBMIT.CORRECTION',
    interfaces: ['dj.api.smartcarlife.order.correctionOrder'],
    dimensions: ['old order relation'],
    testFile: 'tests/order-lifecycle/e2e/orderFlow.test.mjs'
  }),
  coverageCase({
    id: 'IT-OL-SUBMIT-005',
    requirement: 'SUBMIT.DEFEAT',
    stateEdge: 'NEW -> DEFEATED',
    dimensions: ['customer data cleared'],
    testFile:
      'tabWorkOrder/pages/createOrder/tests/submitPayload.helpers.test.mjs'
  }),
  coverageCase({
    id: 'IT-OL-PAY-001',
    requirement: 'PAY.SHOP',
    stateEdge: 'WAIT_PAY -> PAID',
    interfaces: ['dj.api.smartcarlife.payOrder.create'],
    dimensions: ['selectPayType=2', 'payeeType=1'],
    layer: 'L3',
    testFile: 'tests/order-lifecycle/e2e/orderFlow.test.mjs'
  }),
  coverageCase({
    id: 'IT-OL-PAY-002',
    requirement: 'PAY.ONLINE',
    dimensions: ['wechat', 'alipay', 'POS'],
    layer: 'L2',
    testFile: 'manual://online-payment-polling',
    automated: false,
    manual: {
      reason: '当前合同测试不验证第三方回调、轮询超时或设备结果',
      preconditions: ['支付沙箱回调可用', '准备低金额可退款订单'],
      steps: ['发起线上支付', '验证轮询未提前成功', '回调后只变更一次为已支付'],
      targetLayer: 'L3-API/L4-UI'
    }
  }),
  coverageCase({
    id: 'IT-OL-PAY-003',
    requirement: 'PAY.ONLINE',
    dimensions: ['physical POS device callback'],
    layer: 'L4',
    testFile: 'manual://payment-device-callback',
    automated: false,
    manual: {
      reason: '实体收款设备和第三方支付回调不能在离线或共享测试环境中通用模拟',
      preconditions: ['专用测试设备已绑定测试门店', '使用可退款的小额测试订单'],
      steps: ['在设备发起支付', '确认订单仅变更一次为已支付', '核对回调和支付流水关联'],
      targetLayer: 'L4-UI/设备联调'
    }
  }),
  coverageCase({
    id: 'IT-OL-CANCEL-001',
    requirement: 'ORDER.REFUND_GUARD',
    interfaces: ['dj.api.smartcarlife.refundApplyRecord.isExist'],
    dimensions: ['before action', 'immediately before revoke'],
    layer: 'L3',
    testFile: 'tests/order-lifecycle/e2e/orderFlow.test.mjs'
  }),
  coverageCase({
    id: 'IT-OL-CANCEL-002',
    requirement: 'ORDER.CANCEL',
    stateEdge: 'PAID -> REVOKED',
    interfaces: ['dj.api.smartcarlife.order.revoke'],
    dimensions: ['shop payment', 'refund guard'],
    layer: 'L3',
    testFile: 'tests/order-lifecycle/e2e/orderFlow.test.mjs'
  }),
  coverageCase({
    id: 'IT-OL-CORRECT-001',
    requirement: 'ORDER.ERROR_MARK',
    stateEdge: 'PAID -> ERROR_MARKED',
    dimensions: ['refund risk', 'construction risk'],
    layer: 'L3',
    testFile: 'tests/order-lifecycle/e2e/orderFlow.test.mjs'
  }),
  coverageCase({
    id: 'IT-OL-CORRECT-002',
    requirement: 'ORDER.CORRECT',
    stateEdge: 'ERROR_MARKED -> CORRECTED',
    interfaces: ['dj.api.smartcarlife.order.correctionOrder'],
    dimensions: ['old/new order relation'],
    layer: 'L3',
    testFile: 'tests/order-lifecycle/e2e/orderFlow.test.mjs'
  }),
  coverageCase({
    id: 'IT-OL-BUILD-001',
    requirement: 'CONSTRUCTION.NONE',
    stateEdge: 'PAID -> NO_CONSTRUCTION',
    interfaces: ['dj.api.smartcarlife.construction.get.showFlag'],
    dimensions: ['all goods not constructed'],
    layer: 'L3',
    testFile: 'tests/order-lifecycle/e2e/constructionFlow.test.mjs'
  }),
  coverageCase({
    id: 'IT-OL-BUILD-002',
    requirement: 'CONSTRUCTION.PARTIAL',
    stateEdge: 'PAID -> WAIT_CLAIM',
    interfaces: ['dj.api.smartcarlife.construction.batch.add'],
    dimensions: ['selected sub-orders only'],
    layer: 'L3',
    testFile: 'tests/order-lifecycle/e2e/constructionFlow.test.mjs'
  }),
  coverageCase({
    id: 'IT-OL-BUILD-003',
    requirement: 'CONSTRUCTION.ALL',
    stateEdge: 'PAID -> WAIT_CLAIM',
    interfaces: ['dj.api.smartcarlife.construction.batch.add'],
    dimensions: ['all constructable sub-orders', 'multi-group'],
    layer: 'L3',
    testFile: 'tests/order-lifecycle/e2e/constructionFlow.test.mjs'
  }),
  coverageCase({
    id: 'IT-OL-CLAIM-001',
    requirement: 'CONSTRUCTION.CLAIM',
    stateEdge: 'WAIT_CLAIM -> WAIT_OUTBOUND',
    interfaces: ['dj.api.smartcarlife.construction.addOrUpdate'],
    dimensions: ['main technician', 'service item'],
    layer: 'L3',
    testFile: 'tests/order-lifecycle/e2e/constructionFlow.test.mjs'
  }),
  coverageCase({
    id: 'IT-OL-OUTBOUND-001',
    requirement: 'CONSTRUCTION.OUTBOUND',
    stateEdge: 'WAIT_OUTBOUND -> PARTIAL_OUTBOUND',
    interfaces: ['dj.api.smartcarlife.construction.outbound'],
    dimensions: ['first of two products', 'manual outbound'],
    layer: 'L3',
    testFile: 'tests/order-lifecycle/e2e/constructionFlow.test.mjs'
  }),
  coverageCase({
    id: 'IT-OL-OUTBOUND-002',
    requirement: 'CONSTRUCTION.OUTBOUND',
    stateEdge: 'WAIT_OUTBOUND -> WAIT_COMPLETE',
    interfaces: ['dj.api.smartcarlife.construction.outbound'],
    dimensions: ['last product outbound'],
    layer: 'L3',
    testFile: 'tests/order-lifecycle/e2e/constructionFlow.test.mjs'
  }),
  coverageCase({
    id: 'IT-OL-COMPLETE-001',
    requirement: 'CONSTRUCTION.PARTIAL_COMPLETE',
    stateEdge: 'WAIT_COMPLETE -> PARTIAL_COMPLETE',
    interfaces: ['dj.api.smartcarlife.construction.complete'],
    dimensions: ['first product completion'],
    layer: 'L3',
    testFile: 'tests/order-lifecycle/e2e/constructionFlow.test.mjs'
  }),
  coverageCase({
    id: 'IT-OL-COMPLETE-002',
    requirement: 'CONSTRUCTION.COMPLETE',
    stateEdge: 'WAIT_COMPLETE -> COMPLETE',
    interfaces: ['dj.api.smartcarlife.construction.complete'],
    dimensions: ['last product completion'],
    layer: 'L3',
    testFile: 'tests/order-lifecycle/e2e/constructionFlow.test.mjs'
  }),
  coverageCase({
    id: 'IT-OL-REWORK-001',
    requirement: 'CONSTRUCTION.REWORK',
    stateEdge: 'COMPLETE -> REWORKED',
    interfaces: ['dj.api.smartcarlife.construction.rework'],
    dimensions: ['quantity boundary', 'new construction relation'],
    layer: 'L3',
    testFile: 'tests/order-lifecycle/e2e/constructionFlow.test.mjs'
  })
]