فهرست منبع

test: 增加无聊绑定管理测试

xyh 2 سال پیش
والد
کامیت
8f668698c8

+ 80 - 0
cypress/e2e/materialBind.cy.ts

@@ -0,0 +1,80 @@
+import {
+  beforeSetup,
+  exportIntercept,
+  generateNetworkResult,
+  intercept,
+  intoMenu,
+  successIntercept,
+  validateDelete,
+  validatePut,
+  validateTableList,
+  validateTableSearch,
+} from './utils';
+
+const basicData = {
+  id: '5020',
+  userId: '83',
+  materialId: '3599020010010141',
+  scrq: '2023-04-11 14:59:10',
+  userName: 'admin2',
+  materialName: '科密EP-9000 一二维码有线USB扫描枪;科密EP-9000 收银农资',
+  wllbCode: '3599020010010141',
+  realName: '测试2',
+  page: 0,
+  limit: 0,
+  modifyUser: 'admin',
+  modifyTime: '2023-04-11 14:59:10',
+};
+
+describe('物料绑定管理', function () {
+  beforeEach(function () {
+    beforeSetup(true);
+    intoMenu('基础资料', '物料绑定管理');
+  });
+
+  beforeEach(function () {
+    intercept('/userMaterial/getUserMaterial', function ({search, reply}) {
+      generateNetworkResult({search, reply, basicData, title: 'wllbCode'});
+    });
+
+    successIntercept([
+      '/userMaterial/addUserMaterial',
+      '/userMaterial/updateUserMaterial',
+      '/userMaterial/delUserMaterial',
+    ]);
+
+    exportIntercept('/userMaterial/Export');
+  });
+
+  it('table', function () {
+    validateTableList('material_bind_table');
+
+    validateTableSearch(
+      'material_bind_table',
+      ['wllbCode', 'materialName', 'userName', 'realName', 'modifyUser'],
+      {toolId: 'material_bind_filter', url: '/userMaterial/getUserMaterial'},
+    );
+  });
+
+  it('operation', function () {
+    const {validateAdd, validateEdit} = validatePut(
+      'material_bind_modal',
+      'material_bind_table',
+      {
+        label: '物料绑定',
+      },
+    );
+
+    validateAdd([
+      {id: 'userId', type: 'select'},
+      {id: 'materialId', type: 'keySelect'},
+    ]);
+
+    validateEdit([
+      {id: 'userId', type: 'select', value: basicData.realName},
+      {id: 'materialId', type: 'select', value: basicData.materialName},
+    ]);
+
+    validateDelete('material_bind_table', '物料绑定', {title: 'page-1'});
+  });
+});

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

@@ -81,6 +81,7 @@ export function menuIntercept() {
 export function optionsIntercept() {
   normalIntercept('/role/roleBefore', 'options/role');
   normalIntercept('/storage/getStorageAll', 'options/storage');
+  normalIntercept('/userMaterial/getUser', 'options/user');
 }
 
 export function exportIntercept(url: string) {

+ 467 - 0
cypress/fixtures/options/user.json

@@ -0,0 +1,467 @@
+{
+  "msg": "200",
+  "data": [
+    {
+      "id": 3,
+      "code": "TLD0003",
+      "userName": "admin",
+      "password": "706C20B26C94BB14",
+      "newPassword": null,
+      "realName": "超管",
+      "email": "123@11.com",
+      "landline": "2",
+      "phone": "3",
+      "department": "000300030002",
+      "role": "1",
+      "roleId": null,
+      "departmentId": null,
+      "createTime": null,
+      "token": null,
+      "menu": "28,7,27,65,45,64,63,44,62,61,59,58,43,57,56,55,54,52,50,46,51,49,48,47,42,41,66,69,76,75,74,73,72,71,70,79,78,80,81,83,85,88,89,93,95,96,",
+      "modifyUser": null,
+      "modifyTime": null,
+      "page": 0,
+      "limit": 0
+    },
+    {
+      "id": 18,
+      "code": "TLD0018",
+      "userName": "339337",
+      "password": "706C20B26C94BB14",
+      "newPassword": null,
+      "realName": "孙丰江",
+      "email": null,
+      "landline": null,
+      "phone": "15166032322",
+      "department": "000300020001",
+      "role": "9",
+      "roleId": null,
+      "departmentId": null,
+      "createTime": null,
+      "token": null,
+      "menu": null,
+      "modifyUser": null,
+      "modifyTime": null,
+      "page": 0,
+      "limit": 0
+    },
+    {
+      "id": 19,
+      "code": "TLD0019",
+      "userName": "340419",
+      "password": "706C20B26C94BB14",
+      "newPassword": null,
+      "realName": "刘鹏辉",
+      "email": null,
+      "landline": null,
+      "phone": "18661772547",
+      "department": "000300020001",
+      "role": "9",
+      "roleId": null,
+      "departmentId": null,
+      "createTime": null,
+      "token": null,
+      "menu": null,
+      "modifyUser": null,
+      "modifyTime": null,
+      "page": 0,
+      "limit": 0
+    },
+    {
+      "id": 20,
+      "code": "TLD0020",
+      "userName": "340034",
+      "password": "706C20B26C94BB14",
+      "newPassword": null,
+      "realName": "程鲲",
+      "email": null,
+      "landline": null,
+      "phone": "18669817237",
+      "department": "000300020001",
+      "role": "9",
+      "roleId": null,
+      "departmentId": null,
+      "createTime": null,
+      "token": null,
+      "menu": null,
+      "modifyUser": null,
+      "modifyTime": null,
+      "page": 0,
+      "limit": 0
+    },
+    {
+      "id": 21,
+      "code": "TLD0021",
+      "userName": "303033",
+      "password": "706C20B26C94BB14",
+      "newPassword": null,
+      "realName": "王德超",
+      "email": null,
+      "landline": null,
+      "phone": "13853243225",
+      "department": "000300020001",
+      "role": "9",
+      "roleId": null,
+      "departmentId": null,
+      "createTime": null,
+      "token": null,
+      "menu": null,
+      "modifyUser": null,
+      "modifyTime": null,
+      "page": 0,
+      "limit": 0
+    },
+    {
+      "id": 22,
+      "code": "TLD0022",
+      "userName": "304149",
+      "password": "706C20B26C94BB14",
+      "newPassword": null,
+      "realName": "卢开",
+      "email": null,
+      "landline": null,
+      "phone": "13407608981",
+      "department": "000300020001",
+      "role": "9",
+      "roleId": null,
+      "departmentId": null,
+      "createTime": null,
+      "token": null,
+      "menu": null,
+      "modifyUser": null,
+      "modifyTime": null,
+      "page": 0,
+      "limit": 0
+    },
+    {
+      "id": 23,
+      "code": "TLD0023",
+      "userName": "339857",
+      "password": "706C20B26C94BB14",
+      "newPassword": null,
+      "realName": "纪浩宇",
+      "email": null,
+      "landline": null,
+      "phone": "13658677761",
+      "department": "000300020001",
+      "role": "9",
+      "roleId": null,
+      "departmentId": null,
+      "createTime": null,
+      "token": null,
+      "menu": null,
+      "modifyUser": null,
+      "modifyTime": null,
+      "page": 0,
+      "limit": 0
+    },
+    {
+      "id": 24,
+      "code": "TLD0024",
+      "userName": "301460",
+      "password": "706C20B26C94BB14",
+      "newPassword": null,
+      "realName": "王洪征",
+      "email": null,
+      "landline": null,
+      "phone": "13553033815",
+      "department": "000300020001",
+      "role": "8",
+      "roleId": null,
+      "departmentId": null,
+      "createTime": null,
+      "token": null,
+      "menu": null,
+      "modifyUser": null,
+      "modifyTime": null,
+      "page": 0,
+      "limit": 0
+    },
+    {
+      "id": 25,
+      "code": "TLD0025",
+      "userName": "335126",
+      "password": "706C20B26C94BB14",
+      "newPassword": null,
+      "realName": "董德斌",
+      "email": null,
+      "landline": null,
+      "phone": "18562683826",
+      "department": "000300020001",
+      "role": "9",
+      "roleId": null,
+      "departmentId": null,
+      "createTime": null,
+      "token": null,
+      "menu": null,
+      "modifyUser": null,
+      "modifyTime": null,
+      "page": 0,
+      "limit": 0
+    },
+    {
+      "id": 26,
+      "code": "TLD0026",
+      "userName": "340686",
+      "password": "706C20B26C94BB14",
+      "newPassword": null,
+      "realName": "丁凯歌",
+      "email": null,
+      "landline": null,
+      "phone": "19853148981",
+      "department": "000300020001",
+      "role": "9",
+      "roleId": null,
+      "departmentId": null,
+      "createTime": null,
+      "token": null,
+      "menu": null,
+      "modifyUser": null,
+      "modifyTime": null,
+      "page": 0,
+      "limit": 0
+    },
+    {
+      "id": 27,
+      "code": "TLD0027",
+      "userName": "304531",
+      "password": "706C20B26C94BB14",
+      "newPassword": null,
+      "realName": "王孝苗",
+      "email": null,
+      "landline": null,
+      "phone": "13589350380",
+      "department": "000300020001",
+      "role": "9",
+      "roleId": null,
+      "departmentId": null,
+      "createTime": null,
+      "token": null,
+      "menu": null,
+      "modifyUser": null,
+      "modifyTime": null,
+      "page": 0,
+      "limit": 0
+    },
+    {
+      "id": 28,
+      "code": "TLD0028",
+      "userName": "300896",
+      "password": "706C20B26C94BB14",
+      "newPassword": null,
+      "realName": "王孝香",
+      "email": null,
+      "landline": null,
+      "phone": "15053296365",
+      "department": "000300020001",
+      "role": "9",
+      "roleId": null,
+      "departmentId": null,
+      "createTime": null,
+      "token": null,
+      "menu": null,
+      "modifyUser": null,
+      "modifyTime": null,
+      "page": 0,
+      "limit": 0
+    },
+    {
+      "id": 29,
+      "code": "TLD0029",
+      "userName": "316118",
+      "password": "706C20B26C94BB14",
+      "newPassword": null,
+      "realName": "杨文文",
+      "email": null,
+      "landline": null,
+      "phone": "15689115782",
+      "department": "000300020001",
+      "role": "9",
+      "roleId": null,
+      "departmentId": null,
+      "createTime": null,
+      "token": null,
+      "menu": null,
+      "modifyUser": null,
+      "modifyTime": null,
+      "page": 0,
+      "limit": 0
+    },
+    {
+      "id": 30,
+      "code": "TLD0030",
+      "userName": "300168",
+      "password": "706C20B26C94BB14",
+      "newPassword": null,
+      "realName": "丁香",
+      "email": null,
+      "landline": null,
+      "phone": "15265292582",
+      "department": "000300020001",
+      "role": "9",
+      "roleId": null,
+      "departmentId": null,
+      "createTime": null,
+      "token": null,
+      "menu": null,
+      "modifyUser": null,
+      "modifyTime": null,
+      "page": 0,
+      "limit": 0
+    },
+    {
+      "id": 31,
+      "code": "TLD0031",
+      "userName": "338310",
+      "password": "706C20B26C94BB14",
+      "newPassword": null,
+      "realName": "孙吉帅",
+      "email": null,
+      "landline": null,
+      "phone": "13780612346",
+      "department": "000300020001",
+      "role": "9",
+      "roleId": null,
+      "departmentId": null,
+      "createTime": null,
+      "token": null,
+      "menu": null,
+      "modifyUser": null,
+      "modifyTime": null,
+      "page": 0,
+      "limit": 0
+    },
+    {
+      "id": 32,
+      "code": "TLD0032",
+      "userName": "301328",
+      "password": "706C20B26C94BB14",
+      "newPassword": null,
+      "realName": "吕松",
+      "email": null,
+      "landline": null,
+      "phone": "15969847859",
+      "department": "000300020001",
+      "role": "9",
+      "roleId": null,
+      "departmentId": null,
+      "createTime": null,
+      "token": null,
+      "menu": null,
+      "modifyUser": null,
+      "modifyTime": null,
+      "page": 0,
+      "limit": 0
+    },
+    {
+      "id": 33,
+      "code": "TLD0033",
+      "userName": "315808",
+      "password": "706C20B26C94BB14",
+      "newPassword": null,
+      "realName": "于蕾",
+      "email": null,
+      "landline": null,
+      "phone": "15553435271",
+      "department": "000300020001",
+      "role": "8",
+      "roleId": null,
+      "departmentId": null,
+      "createTime": null,
+      "token": null,
+      "menu": null,
+      "modifyUser": null,
+      "modifyTime": null,
+      "page": 0,
+      "limit": 0
+    },
+    {
+      "id": 34,
+      "code": "TLD0034",
+      "userName": "339247",
+      "password": "706C20B26C94BB14",
+      "newPassword": null,
+      "realName": "常冬梅",
+      "email": null,
+      "landline": null,
+      "phone": "18330822739",
+      "department": "000300020001",
+      "role": "8",
+      "roleId": null,
+      "departmentId": null,
+      "createTime": null,
+      "token": null,
+      "menu": null,
+      "modifyUser": null,
+      "modifyTime": null,
+      "page": 0,
+      "limit": 0
+    },
+    {
+      "id": 35,
+      "code": "TLD0035",
+      "userName": "319808",
+      "password": "706C20B26C94BB14",
+      "newPassword": null,
+      "realName": "李兆峰",
+      "email": null,
+      "landline": null,
+      "phone": "15244233815",
+      "department": "000300020001",
+      "role": "9",
+      "roleId": null,
+      "departmentId": null,
+      "createTime": null,
+      "token": null,
+      "menu": null,
+      "modifyUser": null,
+      "modifyTime": null,
+      "page": 0,
+      "limit": 0
+    },
+    {
+      "id": 36,
+      "code": "YH000036",
+      "userName": "PDA",
+      "password": "A00817AAA8BE73E7",
+      "newPassword": null,
+      "realName": "PDA测试",
+      "email": "",
+      "landline": "",
+      "phone": "",
+      "department": "00030002",
+      "role": "10",
+      "roleId": null,
+      "departmentId": null,
+      "createTime": null,
+      "token": null,
+      "menu": null,
+      "modifyUser": null,
+      "modifyTime": null,
+      "page": 0,
+      "limit": 0
+    },
+    {
+      "id": 83,
+      "code": "YH000083",
+      "userName": "admin2",
+      "password": "F6BE46C2F900E518",
+      "newPassword": null,
+      "realName": "测试2",
+      "email": "",
+      "landline": null,
+      "phone": "1336131680",
+      "department": "00029999",
+      "role": "11",
+      "roleId": null,
+      "departmentId": null,
+      "createTime": null,
+      "token": null,
+      "menu": "78,93,88,79,",
+      "modifyUser": null,
+      "modifyTime": null,
+      "page": 0,
+      "limit": 0
+    }
+  ]
+}

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

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