Quellcode durchsuchen

test: 增加库位绑定管理测试

xyh vor 2 Jahren
Ursprung
Commit
c60c464a9e

+ 107 - 0
cypress/e2e/matter.cy.ts

@@ -0,0 +1,107 @@
+import {
+  beforeSetup,
+  exportIntercept,
+  generateNetworkResult,
+  intercept,
+  intoMenu,
+  successIntercept,
+  validateDelete,
+  validateExport,
+  validatePut,
+  validateTableList,
+  validateTableSearch,
+} from './utils';
+
+const basicData = {
+  id: '5010',
+  storageLocationCode: 'B3-10-4',
+  wllbCode: '3599020010010141',
+  wllbClass: null,
+  wllbName: '科密EP-9000 一二维码有线USB扫描枪;科密EP-9000 收银农资',
+  storageLocationName: 'B3-10-4',
+  size: null,
+  tldId: null,
+  materialType: null,
+  isNotDisable: null,
+  isRecommend: null,
+  partType: null,
+  warehouseWhere: 'e7f6bff1-e6ab-49e7-9',
+  minNum: null,
+  maxNum: null,
+  page: 0,
+  limit: 0,
+  modifyUser: 'admin',
+  modifyTime: '2023-03-30 09:27:44',
+  code: null,
+};
+
+const TABLE_NAME = 'matter_table';
+
+describe('库位绑定管理', function () {
+  beforeEach(function () {
+    beforeSetup(true);
+    intoMenu('基础资料', '库位绑定管理');
+  });
+
+  beforeEach(function () {
+    intercept('/materialClass/getMaterialClass', function ({reply, search}) {
+      generateNetworkResult({search, reply, basicData, title: 'wllbCode'});
+    });
+
+    exportIntercept('/materialClass/Export');
+    successIntercept([
+      '/materialClass/addMaterialClass',
+      '/materialClass/updateMaterialClass',
+      '/materialClass/delMaterialClass',
+    ]);
+  });
+
+  it('table', function () {
+    validateTableList(TABLE_NAME);
+
+    validateTableSearch(
+      TABLE_NAME,
+      [
+        'wllbCode',
+        'wllbName',
+        'storageLocationCode',
+        'storageLocationName',
+        'modifyUser',
+      ],
+      {
+        toolId: 'matter_filter',
+        url: '/materialClass/getMaterialClass',
+      },
+    );
+
+    validateExport(TABLE_NAME);
+  });
+
+  it('operation', function () {
+    const {validateAdd, validateEdit} = validatePut(
+      'matter_modal',
+      TABLE_NAME,
+      {
+        label: '库位绑定',
+      },
+    );
+
+    validateAdd([
+      {id: 'wllbCode', type: 'keySelect'},
+      {id: 'warehouseId', type: 'select'},
+      {id: 'storageLocationCode', type: 'select'},
+    ]);
+
+    validateEdit([
+      {id: 'wllbCode', type: 'select', value: basicData.wllbName},
+      {id: 'warehouseId', type: 'select', value: '充电设备事业部原材料库'},
+      {
+        id: 'storageLocationCode',
+        type: 'select',
+        value: basicData.storageLocationName,
+      },
+    ]);
+
+    validateDelete(TABLE_NAME, '库位绑定', {title: basicData.wllbName});
+  });
+});

+ 3 - 1
cypress/e2e/utils/setup.ts

@@ -55,6 +55,8 @@ export function dictionaryIntercept() {
         return reply({fixture: 'dictonary/materialType'});
       case '仓库':
         return reply({fixture: 'dictonary/warehouse'});
+      case '物料字典':
+        return reply({fixture: 'dictonary/material'});
     }
   });
 }
@@ -78,7 +80,7 @@ export function menuIntercept() {
 
 export function optionsIntercept() {
   normalIntercept('/role/roleBefore', 'options/role');
-  // normalIntercept('/storage/getStorageAll', 'storage/options');
+  normalIntercept('/storage/getStorageAll', 'options/storage');
 }
 
 export function exportIntercept(url: string) {

+ 5 - 0
cypress/e2e/utils/utils.ts

@@ -219,6 +219,7 @@ export function validatePut(
     keys: (
       | string
       | {id: string; type: 'select'}
+      | {id: string; type: 'keySelect'}
       | {id: string; type: 'field'; value: string}
     )[],
   ) {
@@ -243,6 +244,10 @@ export function validatePut(
           case 'field':
             cy.getTestId(`field_${id}`).clear().type(key.value);
             break;
+          case 'keySelect':
+            cy.get(`#field_${id}`).clear().type(id);
+            selectClick(`field_${id}`, 0);
+            break;
         }
       }
     });

+ 498 - 0
cypress/fixtures/dictonary/material.json

@@ -0,0 +1,498 @@
+{
+  "msg": "200",
+  "data": [
+    {
+      "id": "10071",
+      "code": "3599020010010141",
+      "name": "科密EP-9000 一二维码有线USB扫描枪;科密EP-9000 收银农资",
+      "tldId": "00000000000000017110",
+      "specificationAndModel": "",
+      "unitOfMeasurement": null,
+      "materialId": null,
+      "num": null,
+      "type": null,
+      "tableName": null,
+      "size": null,
+      "materialType": null,
+      "wllbClass": null,
+      "isNotDisable": "0",
+      "isRecommend": null,
+      "partType": null,
+      "page": 0,
+      "limit": 0,
+      "amount": null,
+      "minNum": null,
+      "maxNum": null,
+      "modifyUser": null,
+      "modifyTime": null,
+      "typeVal": null,
+      "companyNumber": "8400",
+      "warehouseType": null,
+      "nameOrCode": null
+    },
+    {
+      "id": "12253",
+      "code": "3723030010010159",
+      "name": "二维码贴;PC磨砂膜;38×38",
+      "tldId": "00000000000000018201",
+      "specificationAndModel": "",
+      "unitOfMeasurement": null,
+      "materialId": null,
+      "num": null,
+      "type": null,
+      "tableName": null,
+      "size": null,
+      "materialType": null,
+      "wllbClass": null,
+      "isNotDisable": "0",
+      "isRecommend": null,
+      "partType": null,
+      "page": 0,
+      "limit": 0,
+      "amount": null,
+      "minNum": null,
+      "maxNum": null,
+      "modifyUser": null,
+      "modifyTime": null,
+      "typeVal": null,
+      "companyNumber": "8130",
+      "warehouseType": null,
+      "nameOrCode": null
+    },
+    {
+      "id": "12255",
+      "code": "3723030010010156",
+      "name": "二维码贴;交流单桩充电联盟认证二维码;8丝PC磨砂;背3M防水胶;70×44.5",
+      "tldId": "00000000000000018202",
+      "specificationAndModel": "",
+      "unitOfMeasurement": null,
+      "materialId": null,
+      "num": null,
+      "type": null,
+      "tableName": null,
+      "size": null,
+      "materialType": null,
+      "wllbClass": null,
+      "isNotDisable": "0",
+      "isRecommend": null,
+      "partType": null,
+      "page": 0,
+      "limit": 0,
+      "amount": null,
+      "minNum": null,
+      "maxNum": null,
+      "modifyUser": null,
+      "modifyTime": null,
+      "typeVal": null,
+      "companyNumber": "8400",
+      "warehouseType": null,
+      "nameOrCode": null
+    },
+    {
+      "id": "13795",
+      "code": "3723030010130011",
+      "name": "二维码色带\\\\TZE-641;YELLOW 18MM 0.7\\\\",
+      "tldId": "00000000000000018972",
+      "specificationAndModel": "",
+      "unitOfMeasurement": null,
+      "materialId": null,
+      "num": null,
+      "type": null,
+      "tableName": null,
+      "size": null,
+      "materialType": null,
+      "wllbClass": null,
+      "isNotDisable": "0",
+      "isRecommend": null,
+      "partType": null,
+      "page": 0,
+      "limit": 0,
+      "amount": null,
+      "minNum": null,
+      "maxNum": null,
+      "modifyUser": null,
+      "modifyTime": null,
+      "typeVal": null,
+      "companyNumber": "8400",
+      "warehouseType": null,
+      "nameOrCode": null
+    },
+    {
+      "id": "43177",
+      "code": "3907060140050270",
+      "name": "汽车充电充电单桩/交流充电桩/M22010A/交流充电桩/7kW/扫二维码启动/带5m线新国标充电枪/壁挂安装/自研/",
+      "tldId": "00000000000000033663",
+      "specificationAndModel": "",
+      "unitOfMeasurement": null,
+      "materialId": null,
+      "num": null,
+      "type": null,
+      "tableName": null,
+      "size": null,
+      "materialType": null,
+      "wllbClass": null,
+      "isNotDisable": "0",
+      "isRecommend": null,
+      "partType": null,
+      "page": 0,
+      "limit": 0,
+      "amount": null,
+      "minNum": null,
+      "maxNum": null,
+      "modifyUser": null,
+      "modifyTime": null,
+      "typeVal": null,
+      "companyNumber": "8130",
+      "warehouseType": null,
+      "nameOrCode": null
+    },
+    {
+      "id": "43181",
+      "code": "3907060140050268",
+      "name": "汽车充电充电单桩\\\\交流充电桩;M22008A/ 交流充电桩/7kW/扫二维码启动/带通讯/带15新国标充电插座/壁挂安装/自研 \\\\",
+      "tldId": "00000000000000033665",
+      "specificationAndModel": "",
+      "unitOfMeasurement": null,
+      "materialId": null,
+      "num": null,
+      "type": null,
+      "tableName": null,
+      "size": null,
+      "materialType": null,
+      "wllbClass": null,
+      "isNotDisable": "0",
+      "isRecommend": null,
+      "partType": null,
+      "page": 0,
+      "limit": 0,
+      "amount": null,
+      "minNum": null,
+      "maxNum": null,
+      "modifyUser": null,
+      "modifyTime": null,
+      "typeVal": null,
+      "companyNumber": "8130",
+      "warehouseType": null,
+      "nameOrCode": null
+    },
+    {
+      "id": "43373",
+      "code": "3907060140050134",
+      "name": "4×30KW户外充电桩M10004A\\IP54\\无刷卡\\二维码扫码功能\\无充电枪\\有源\\交流计量\\4单元\\含模块不含充电枪\\能与特来电后台通讯\\\\不含模块",
+      "tldId": "00000000000000033761",
+      "specificationAndModel": "",
+      "unitOfMeasurement": null,
+      "materialId": null,
+      "num": null,
+      "type": null,
+      "tableName": null,
+      "size": null,
+      "materialType": null,
+      "wllbClass": null,
+      "isNotDisable": "0",
+      "isRecommend": null,
+      "partType": null,
+      "page": 0,
+      "limit": 0,
+      "amount": null,
+      "minNum": null,
+      "maxNum": null,
+      "modifyUser": null,
+      "modifyTime": null,
+      "typeVal": null,
+      "companyNumber": "8130",
+      "warehouseType": null,
+      "nameOrCode": null
+    },
+    {
+      "id": "43375",
+      "code": "3907060140050133",
+      "name": "直流充电桩\\4×30KW户外充电桩M10004A\\IP54\\无刷卡\\二维码扫码功能\\无充电枪\\有源\\交流计量\\4单元\\含模块不含充电枪\\能与特来电后台通讯\\\\",
+      "tldId": "00000000000000033762",
+      "specificationAndModel": "",
+      "unitOfMeasurement": null,
+      "materialId": null,
+      "num": null,
+      "type": null,
+      "tableName": null,
+      "size": null,
+      "materialType": null,
+      "wllbClass": null,
+      "isNotDisable": "0",
+      "isRecommend": null,
+      "partType": null,
+      "page": 0,
+      "limit": 0,
+      "amount": null,
+      "minNum": null,
+      "maxNum": null,
+      "modifyUser": null,
+      "modifyTime": null,
+      "typeVal": null,
+      "companyNumber": "8400",
+      "warehouseType": null,
+      "nameOrCode": null
+    },
+    {
+      "id": "44275",
+      "code": "3907060140070001",
+      "name": "直流充电柜\\120kW\\4路输出均充(扫二维码);是\\\\",
+      "tldId": "00000000000000034212",
+      "specificationAndModel": "",
+      "unitOfMeasurement": null,
+      "materialId": null,
+      "num": null,
+      "type": null,
+      "tableName": null,
+      "size": null,
+      "materialType": null,
+      "wllbClass": null,
+      "isNotDisable": "0",
+      "isRecommend": null,
+      "partType": null,
+      "page": 0,
+      "limit": 0,
+      "amount": null,
+      "minNum": null,
+      "maxNum": null,
+      "modifyUser": null,
+      "modifyTime": null,
+      "typeVal": null,
+      "companyNumber": "8400",
+      "warehouseType": null,
+      "nameOrCode": null
+    },
+    {
+      "id": "67115",
+      "code": "8TK540010978",
+      "name": "二维码罩;8T.K54.001.0978",
+      "tldId": "00000000000000045632",
+      "specificationAndModel": "",
+      "unitOfMeasurement": null,
+      "materialId": null,
+      "num": null,
+      "type": null,
+      "tableName": null,
+      "size": null,
+      "materialType": null,
+      "wllbClass": null,
+      "isNotDisable": "0",
+      "isRecommend": null,
+      "partType": null,
+      "page": 0,
+      "limit": 0,
+      "amount": null,
+      "minNum": null,
+      "maxNum": null,
+      "modifyUser": null,
+      "modifyTime": null,
+      "typeVal": null,
+      "companyNumber": "8400",
+      "warehouseType": null,
+      "nameOrCode": null
+    },
+    {
+      "id": "67307",
+      "code": "8TK540010670",
+      "name": "二维码防护板;8T.K54.001.0670",
+      "tldId": "00000000000000045728",
+      "specificationAndModel": "",
+      "unitOfMeasurement": null,
+      "materialId": null,
+      "num": null,
+      "type": null,
+      "tableName": null,
+      "size": null,
+      "materialType": null,
+      "wllbClass": null,
+      "isNotDisable": "0",
+      "isRecommend": null,
+      "partType": null,
+      "page": 0,
+      "limit": 0,
+      "amount": null,
+      "minNum": null,
+      "maxNum": null,
+      "modifyUser": null,
+      "modifyTime": null,
+      "typeVal": null,
+      "companyNumber": "8400",
+      "warehouseType": null,
+      "nameOrCode": null
+    },
+    {
+      "id": "67699",
+      "code": "8TK540010378",
+      "name": "二维码补片;8T.K54.001.0378",
+      "tldId": "00000000000000045924",
+      "specificationAndModel": "",
+      "unitOfMeasurement": null,
+      "materialId": null,
+      "num": null,
+      "type": null,
+      "tableName": null,
+      "size": null,
+      "materialType": null,
+      "wllbClass": null,
+      "isNotDisable": "0",
+      "isRecommend": null,
+      "partType": null,
+      "page": 0,
+      "limit": 0,
+      "amount": null,
+      "minNum": null,
+      "maxNum": null,
+      "modifyUser": null,
+      "modifyTime": null,
+      "typeVal": null,
+      "companyNumber": "8400",
+      "warehouseType": null,
+      "nameOrCode": null
+    },
+    {
+      "id": "67701",
+      "code": "8TK540010377",
+      "name": "二维码防护板;8T.K54.001.0377",
+      "tldId": "00000000000000045925",
+      "specificationAndModel": "",
+      "unitOfMeasurement": null,
+      "materialId": null,
+      "num": null,
+      "type": null,
+      "tableName": null,
+      "size": null,
+      "materialType": null,
+      "wllbClass": null,
+      "isNotDisable": "0",
+      "isRecommend": null,
+      "partType": null,
+      "page": 0,
+      "limit": 0,
+      "amount": null,
+      "minNum": null,
+      "maxNum": null,
+      "modifyUser": null,
+      "modifyTime": null,
+      "typeVal": null,
+      "companyNumber": "8130",
+      "warehouseType": null,
+      "nameOrCode": null
+    },
+    {
+      "id": "81397",
+      "code": "8TK540011541W01",
+      "name": "二维码防护罩图纸临时物料号;8T.K54.001.1541W01",
+      "tldId": "00000000000000057690",
+      "specificationAndModel": "",
+      "unitOfMeasurement": null,
+      "materialId": null,
+      "num": null,
+      "type": null,
+      "tableName": null,
+      "size": null,
+      "materialType": null,
+      "wllbClass": null,
+      "isNotDisable": "0",
+      "isRecommend": null,
+      "partType": null,
+      "page": 0,
+      "limit": 0,
+      "amount": null,
+      "minNum": null,
+      "maxNum": null,
+      "modifyUser": null,
+      "modifyTime": null,
+      "typeVal": null,
+      "companyNumber": "8130",
+      "warehouseType": null,
+      "nameOrCode": null
+    },
+    {
+      "id": "84542",
+      "code": "8TK541080097",
+      "name": "标贴-出厂二维码;用于设备出厂时粘贴的二维码320kW专用二维码标签;整体尺寸250*74;3张59*59终端编号;1张集控编号;8T.K54.108.0097",
+      "tldId": "00000000000000072324",
+      "specificationAndModel": "",
+      "unitOfMeasurement": null,
+      "materialId": null,
+      "num": null,
+      "type": null,
+      "tableName": null,
+      "size": null,
+      "materialType": null,
+      "wllbClass": null,
+      "isNotDisable": "0",
+      "isRecommend": null,
+      "partType": null,
+      "page": 0,
+      "limit": 0,
+      "amount": null,
+      "minNum": null,
+      "maxNum": null,
+      "modifyUser": null,
+      "modifyTime": null,
+      "typeVal": null,
+      "companyNumber": "8400",
+      "warehouseType": null,
+      "nameOrCode": null
+    },
+    {
+      "id": "84603",
+      "code": "8TK541080100",
+      "name": "标贴;出厂预制二维码;用于设备出厂时粘贴的二维码 160kW专用二维码标签;3张59*59终端编号 1张集控编号;8T.K54.108.0100",
+      "tldId": "00000000000000072468",
+      "specificationAndModel": "",
+      "unitOfMeasurement": null,
+      "materialId": null,
+      "num": null,
+      "type": null,
+      "tableName": null,
+      "size": null,
+      "materialType": null,
+      "wllbClass": null,
+      "isNotDisable": "0",
+      "isRecommend": null,
+      "partType": null,
+      "page": 0,
+      "limit": 0,
+      "amount": null,
+      "minNum": null,
+      "maxNum": null,
+      "modifyUser": null,
+      "modifyTime": null,
+      "typeVal": null,
+      "companyNumber": "8400",
+      "warehouseType": null,
+      "nameOrCode": null
+    },
+    {
+      "id": "84868",
+      "code": "8TK541080160",
+      "name": "标贴-出厂二维码-G2.5-80kW单桩",
+      "tldId": "00000000000000072947",
+      "specificationAndModel": "",
+      "unitOfMeasurement": null,
+      "materialId": null,
+      "num": null,
+      "type": null,
+      "tableName": null,
+      "size": "1",
+      "materialType": null,
+      "wllbClass": "单桩",
+      "isNotDisable": "0",
+      "isRecommend": "1",
+      "partType": "产成品",
+      "page": 0,
+      "limit": 0,
+      "amount": null,
+      "minNum": "0",
+      "maxNum": "0",
+      "modifyUser": "3",
+      "modifyTime": "2023-04-04 18:15:01",
+      "typeVal": null,
+      "companyNumber": "8400",
+      "warehouseType": null,
+      "nameOrCode": null
+    }
+  ]
+}

Datei-Diff unterdrückt, da er zu groß ist
+ 14145 - 0
cypress/fixtures/options/storage.json


+ 1 - 1
packages/app/src/pages/matter/filter/index.tsx

@@ -22,7 +22,7 @@ const Filter: FC = function () {
 
   return (
     <Card>
-      <FilterFieldWrapper onSearch={onSearch}>
+      <FilterFieldWrapper onSearch={onSearch} testId='matter_filter'>
         <FilterField
           value={fields.wllbCode}
           label='物料编号'