Преглед изворни кода

test: 增加移库单明细测试

xyh пре 2 година
родитељ
комит
9c0249b969

+ 127 - 0
cypress/e2e/relocation.cy.ts

@@ -0,0 +1,127 @@
+import {
+  beforeSetup,
+  exportIntercept,
+  generateNetworkResult,
+  intercept,
+  intoMenu,
+  selectAllFilters,
+  successIntercept,
+  validateDelete,
+  validateExport,
+  validatePut,
+  validateTableList,
+  validateTableSearch,
+} from './utils';
+
+const basicData = {
+  id: '65',
+  warehouseTransferId: 'YK004',
+  warehouseTransferCode: 'YK004',
+  askGoodsWarehouseId: 'd7f30912-8d52-47e3-b',
+  askGoodsWarehouseName: '充电设备事业部电气半成品库',
+  documentTime: '2023-02-10',
+  warehouseTransferType: '移库',
+  entryNumber: '1',
+  supplyWarehouseId: '6062e900-b3f0-4a5a-b',
+  supplyWarehouseName: '充电设备事业部借件库',
+  materialId: '00000000000000012034',
+  materialName: '酒精纸\\',
+  materialCode: '2205010010020003',
+  companyName: '青岛特来电智能设备有限公司',
+  companyCode: null,
+  wbs: '1',
+  measurementId: null,
+  num: '100',
+  outNum: '100',
+  type: '0',
+  warehouseWhere: null,
+  startTime: null,
+  endTime: null,
+  page: 0,
+  limit: 0,
+  uniqueCode: null,
+  accountSleeve: '8130',
+  partType: null,
+  askType: null,
+  suppType: null,
+  isRecommend: null,
+};
+
+describe('移库单明细', function () {
+  beforeEach(function () {
+    beforeSetup();
+    intoMenu('库内管理', '移库单明细');
+  });
+
+  beforeEach(function () {
+    intercept('/queryList/getWarehouseTransfer', function ({reply, search}) {
+      generateNetworkResult({
+        search,
+        reply,
+        basicData,
+        title: 'warehouseTransferCode',
+      });
+    });
+
+    exportIntercept('/queryList/getWarehouseTransferExcel');
+    successIntercept('/warehouseTransfer/delWarehouseTransfer');
+  });
+
+  it('table', function () {
+    selectAllFilters('relocation_filter', 10);
+    validateTableList('relocation_table');
+    validateTableSearch(
+      'relocation_table',
+      [
+        'warehouseTransferCode',
+        'materialCode',
+        'materialName',
+        {
+          id: 'askGoodsWarehouseId',
+          type: 'select',
+          value: '2bdf33b8-4326-47e8-b',
+        },
+        {
+          id: 'supplyWarehouseId',
+          type: 'select',
+          value: '2bdf33b8-4326-47e8-b',
+        },
+        {
+          id: 'companyCode',
+          type: 'select',
+          value: '8130',
+        },
+        'warehouseTransferType',
+        'wbs',
+        'entryNumber',
+        {id: 'startTime', type: 'date'},
+      ],
+      {
+        toolId: 'relocation_filter',
+        url: '/queryList/getWarehouseTransfer',
+      },
+    );
+  });
+
+  it('operation', function () {
+    const {validateAdd} = validatePut('relocation_modal', 'relocation_table', {
+      label: '移库单',
+    });
+
+    validateAdd([
+      'transferNoticeOrderId',
+      'transferNoticeOrderNo',
+      {type: 'keySelect', id: 'materialId'},
+      {type: 'field', id: 'orderCount', value: '10'},
+      {type: 'keySelect', id: 'measUnitId'},
+      {type: 'keySelect', id: 'requestWarehouseId'},
+      {type: 'keySelect', id: 'supplyWarehouseId'},
+      {type: 'keySelect', id: 'accountSleeve'},
+      'entryNo',
+      'WBS',
+    ]);
+
+    validateExport('relocation_table');
+    validateDelete('relocation_table', '移库单', {eq: 0, title: 'page-1'});
+  });
+});

+ 1 - 0
packages/app/src/pages/relocation-order/filter/index.tsx

@@ -57,6 +57,7 @@ const Filter: FC = function () {
         fixedMap={fixedMap}
         onFilter={onShowModal}
         filterData={filterList}
+        testId='relocation_filter'
       />
 
       <FilterSelectorModal

+ 1 - 0
packages/app/src/pages/relocation-order/table/index.tsx

@@ -47,6 +47,7 @@ const TableList: FC = function () {
           count={count}
           pageContext={pageContext}
           searchContext={searchContext}
+          data-testid='relocation_table'
         />
       </Card>
 

+ 1 - 0
packages/app/src/pages/relocation-order/table/modal/index.tsx

@@ -29,6 +29,7 @@ const AddModal: FC<Props> = function (props) {
       {...props}
       isLoading={isLoading}
       onSubmit={onSubmit}
+      testId='relocation_modal'
     >
       <ModalField
         label='移库通知单ID'