xyh 2 лет назад
Родитель
Сommit
f3de1c7881

+ 22 - 5
cypress/e2e/department.cy.ts

@@ -1,4 +1,5 @@
-import {loginIntercept, menuIntercept, loginSetup, menuTrigger, NETWORK_URL} from './setup';
+import {loginIntercept, menuIntercept, loginSetup, NETWORK_URL} from './utils/setup';
+import {menuTrigger} from './utils/utils';
 
 describe('部门管理', function() {
   beforeEach(function() {
@@ -16,7 +17,9 @@ describe('部门管理', function() {
         const search = new URLSearchParams(url.search);
 
         if (search.has('departmentName') && search.get('departmentName').length)
-          return reply({fixture: 'department/search'});
+          return reply({fixture: 'department/nameSearch'});
+        if (search.has('code') && search.get('code').length)
+          return reply({fixture: 'department/codeSearch'});
 
         const page = search.get('page');
         reply({fixture: page === '1' ? 'department/list1' : 'department/list2'});
@@ -36,17 +39,29 @@ describe('部门管理', function() {
 
     cy.getTestId('department_table').find('table').find('.ant-table-tbody')
       .children('.ant-table-row').should('have.length', 2);
+  });
 
-    cy.get('#filter_departmentCode').type('TLD0004');
-    cy.get('#filter_departmentName').type('admin');
+  it('搜索', function() {
+    cy.get('.ant-pagination').find('li[title="2"]').click();
 
+    cy.get('#filter_departmentCode').type('TLD0004');
+    cy.get('#filter_departmentName').clear();
     cy.getTestId('search_btn').trigger('click');
 
     cy.getTestId('department_table').find('table').find('.ant-table-tbody')
-      .children('.ant-table-row').should('have.length', 1);
+      .children('.ant-table-row').first().find('td').first()
+      .should('include.text', 'searchCode');
 
     cy.get('.ant-pagination').find('li[title="1"]')
       .should('have.class', 'ant-pagination-item-active');
+
+    cy.get('#filter_departmentName').type('name');
+    cy.get('#filter_departmentCode').clear();
+    cy.getTestId('search_btn').trigger('click');
+
+    cy.getTestId('department_table').find('table').find('.ant-table-tbody')
+      .children('.ant-table-row').first().find('td').first()
+      .should('include.text', 'searchName');
   });
 
   it('新增部门', function() {
@@ -75,6 +90,8 @@ describe('部门管理', function() {
     cy.getTestId('department_modal').find('h3')
       .should('include.text', '修改部门');
 
+    cy.getTestId('field_departmentName').should('have.value', '包装部门');
+
     cy.getTestId('department_modal').find('form').submit();
 
     cy.getTestId('modal_btn_group').find('.ant-btn-loading').should('exist');

+ 136 - 0
cypress/e2e/goods.cy.ts

@@ -0,0 +1,136 @@
+import {loginIntercept, menuIntercept, loginSetup, NETWORK_URL, optionsIntercept} from './utils/setup';
+import {menuTrigger, selectClick, selectGetValue} from './utils/utils';
+
+describe('货品管理', function() {
+  beforeEach(function() {
+    loginIntercept();
+    menuIntercept();
+    loginSetup();
+    optionsIntercept();
+    menuTrigger(2, 1);
+  });
+
+  beforeEach(function() {
+    cy.intercept(`${NETWORK_URL}/goods/getGoods*`, function({url: reqUrl, reply}) {
+      const url = new URL(reqUrl);
+      const search = new URLSearchParams(url.search);
+
+      if (search.has('itemNumber') && search.get('itemNumber').length)
+        return reply({fixture: 'goods/search'});
+
+      const page = search.get('page');
+      reply({fixture: page === '1' ? 'goods/list1' : 'goods/list2'});
+    });
+
+    cy.intercept(`${NETWORK_URL}/goods/addGoods*`, {fixture: 'success', delay: 100});
+    cy.intercept(`${NETWORK_URL}/goods/delGoods*`, {fixture: 'success', delay: 100});
+    cy.intercept(`${NETWORK_URL}/goods/updateGoods*`, {fixture: 'success', delay: 100});
+  });
+
+  it('表格', function() {
+    cy.getTestId('goods_table').find('table').find('.ant-table-tbody')
+      .children('.ant-table-row').should('have.length', 3);
+
+    cy.get('.ant-pagination').find('li[title="2"]').click();
+
+    cy.getTestId('goods_table').find('table').find('.ant-table-tbody')
+      .children('.ant-table-row').should('have.length', 2);
+  });
+
+  it('搜索', function() {
+    cy.get('.ant-pagination').find('li[title="2"]').click();
+
+    cy.get('#filter_goodsCode').type('P00012');
+    cy.getTestId('search_btn').trigger('click');
+
+    cy.getTestId('goods_table').find('table').find('.ant-table-tbody')
+      .children('.ant-table-row').children('td').first()
+      .should('have.text', 'searchCode');
+  });
+
+  it('新增', function() {
+    cy.getTestId('add_btn').click();
+
+    cy.getTestId('goods_modal').should('exist').and('be.visible');
+    cy.getTestId('goods_modal').find('h3').should('have.text', '新增货品');
+
+    cy.getTestId('field_goodsItemNumber').type('品号');
+    cy.getTestId('field_goodsName').type('goodsName');
+    cy.getTestId('field_goodsType').type('goodsType');
+    cy.getTestId('field_goodsMinAccommodate').clear().type('1');
+    cy.getTestId('field_goodsAccommodateNum').clear().type('1');
+    cy.getTestId('field_goodsMaxAccommodate').clear().type('1');
+    cy.getTestId('field_goodsSupplier').type('goodsSupplier');
+    cy.getTestId('field_goodsInputType').type('goodsInputType');
+    cy.getTestId('field_goodsLowReserves').clear().type('1');
+    cy.getTestId('field_goodsHighReserves').clear().type('1');
+    cy.getTestId('field_goodsGrade').clear().type('1');
+    cy.getTestId('field_goosdPackingType').type('goosdPackingType');
+    cy.getTestId('field_goodsUnit').type('goodsUnit');
+    selectClick('select_goodsStorageLocation');
+    selectClick('select_goodsUserDepartment');
+
+    cy.getTestId('goods_modal').find('form').submit();
+
+    cy.getTestId('modal_btn_group').find('.ant-btn').first()
+      .should('have.class', 'ant-btn-loading');
+    cy.getTestId('modal_btn_group').find('.ant-btn').last()
+      .should('have.attr', 'disabled');
+
+    cy.get('.ant-message-notice-content').should('include.text', '新增成功');
+    cy.getTestId('goods_modal').should('not.exist');
+  });
+
+  it('修改', function() {
+    cy.getTestId('goods_table').find('table').find('.ant-table-tbody')
+      .children('.ant-table-row').children('td').last().children().first().click();
+
+    cy.getTestId('goods_modal').should('exist').and('be.visible')
+      .find('h3').should('have.text', '修改货品');
+
+    cy.getTestId('field_goodsItemNumber').should('have.value', 'P00012');
+    cy.getTestId('field_goodsName').should('have.value', '测试货品');
+    cy.getTestId('field_goodsType').should('have.value', '类型1');
+    cy.getTestId('field_goodsMinAccommodate').should('have.value', '2');
+    cy.getTestId('field_goodsAccommodateNum').should('have.value', '1');
+    cy.getTestId('field_goodsMaxAccommodate').should('have.value', '4');
+    cy.getTestId('field_goodsSupplier').should('have.value', '测试1');
+    cy.getTestId('field_goodsInputType').should('have.value', '随便');
+    cy.getTestId('field_goodsLowReserves').should('have.value', '1');
+    cy.getTestId('field_goodsHighReserves').should('have.value', '3');
+    cy.getTestId('field_goodsGrade').should('have.value', '等级2');
+    cy.getTestId('field_goosdPackingType').should('have.value', '无');
+    cy.getTestId('field_goodsUnit').should('have.value', '公斤');
+    selectGetValue('select_goodsStorageLocation', '1号库位');
+    selectGetValue('select_goodsUserDepartment', '物流部门');
+
+    cy.getTestId('goods_modal').find('form').submit();
+
+    cy.getTestId('modal_btn_group').find('.ant-btn').first()
+      .should('have.class', 'ant-btn-loading');
+    cy.getTestId('modal_btn_group').find('.ant-btn').last()
+      .should('have.attr', 'disabled');
+
+    cy.get('.ant-message-notice-content').should('include.text', '修改成功');
+    cy.getTestId('goods_modal').should('not.exist');
+  });
+
+  it('删除', function() {
+    cy.getTestId('goods_table').find('table').find('.ant-table-tbody')
+      .children('.ant-table-row').first().find('td').last().children().last()
+      .trigger('click');
+
+    cy.get('.ant-modal-content').should('be.visible');
+    cy.get('.ant-modal-confirm-btns').children().last().trigger('click');
+
+    cy.getTestId('goods_table').find('table').find('.ant-table-tbody')
+      .children('.ant-table-row').first().find('td').last().children().last()
+      .should('have.class', 'ant-btn-loading');
+
+    cy.getTestId('goods_table').find('table').find('.ant-table-tbody')
+      .children('.ant-table-row').first().find('td').last().children().first()
+      .should('have.attr', 'disabled');
+
+    cy.get('.ant-message-notice-content').should('include.text', '删除成功');
+  });
+});

+ 1 - 1
cypress/e2e/login.cy.ts

@@ -1,4 +1,4 @@
-import {loginIntercept, loginSetup, menuIntercept} from './setup';
+import {loginIntercept, loginSetup, menuIntercept} from './utils/setup';
 
 describe('登录页面', function() {
   beforeEach(function() {

+ 5 - 1
cypress/e2e/role.cy.ts

@@ -1,4 +1,5 @@
-import {loginIntercept, menuIntercept, loginSetup, NETWORK_URL, menuTrigger} from './setup';
+import {loginIntercept, menuIntercept, loginSetup, NETWORK_URL} from './utils/setup';
+import {menuTrigger} from './utils/utils';
 
 describe('角色管理', function() {
   beforeEach(function() {
@@ -66,6 +67,9 @@ describe('角色管理', function() {
     cy.getTestId('role_modal').should('exist').and('be.visible');
     cy.getTestId('role_modal').find('h3').should('include.html', '修改角色');
 
+    cy.get('#operation_roleName').should('have.value', '仓库管理员');
+    cy.get('#operation_roleRemarks').should('have.value', 'cangk');
+
     cy.getTestId('role_modal').find('form').submit();
 
     cy.getTestId('modal_btn_group').find('.ant-btn-loading').should('exist');

+ 153 - 0
cypress/e2e/storage.cy.ts

@@ -0,0 +1,153 @@
+import {NETWORK_URL, loginIntercept, loginSetup, menuIntercept} from './utils/setup';
+import {menuTrigger, selectClick, selectGetValue} from './utils/utils';
+
+describe('库位管理', function() {
+  beforeEach(function() {
+    loginIntercept();
+    menuIntercept();
+    loginSetup();
+    menuTrigger(2, 0);
+  });
+
+  beforeEach(function() {
+    cy.intercept(
+      `${NETWORK_URL}/storage/getStorage*`,
+      function({url: reqUrl, reply}) {
+        const url = new URL(reqUrl);
+        const search = new URLSearchParams(url.search);
+
+        if (search.has('storageLocationName') && search.get('storageLocationName').length)
+          return reply({fixture: 'storage/nameSearch'});
+        if (search.has('storageLocationCode') && search.get('storageLocationCode').length)
+          return reply({fixture: 'storage/codeSearch'});
+        if (search.has('storageLocationType') && search.get('storageLocationType').length)
+          return reply({fixture: 'storage/typeSearch'});
+        if (search.has('isNotDisable') && search.get('isNotDisable').length)
+          return reply({fixture: 'storage/disabledSearch'});
+
+        if (search.has('id') && search.get('id').length)
+          return reply({fixture: 'storage/info'});
+
+        const page = search.get('page');
+        reply({fixture: page === '1' ? 'storage/list1' : 'storage/list2'});
+      },
+    );
+
+    cy.intercept(`${NETWORK_URL}/storage/addStorage*`, {fixture: 'success', delay: 100});
+    cy.intercept(`${NETWORK_URL}/storage/updateStorage*`, {fixture: 'success', delay: 100});
+    cy.intercept(`${NETWORK_URL}/storage/delStorage*`, {fixture: 'success', delay: 100});
+  });
+
+  it('表格', function() {
+    cy.getTestId('storage_table').find('table').find('.ant-table-tbody')
+      .children('.ant-table-row').should('have.length', 3);
+
+    cy.get('.ant-pagination').find('li[title="2"]').click();
+
+    cy.getTestId('storage_table').find('table').find('.ant-table-tbody')
+      .children('.ant-table-row').should('have.length', 2);
+  });
+
+  it('搜索', function() {
+    cy.get('.ant-pagination').find('li[title="2"]').click();
+
+    cy.get('#filter_storageName').type('库位');
+    cy.getTestId('search_btn').click();
+
+    cy.get('.ant-pagination').find('li[title="1"]')
+      .should('have.class', 'ant-pagination-item-active');
+
+    cy.getTestId('storage_table').find('table').find('.ant-table-tbody')
+      .children('.ant-table-row').first().find('td').first()
+      .should('include.html', 'searchName');
+
+    cy.get('#filter_storageName').clear();
+    cy.get('#filter_storageCode').type('code');
+    cy.getTestId('search_btn').click();
+    cy.getTestId('storage_table').find('table').find('.ant-table-tbody')
+      .children('.ant-table-row').first().find('td').first()
+      .should('include.html', 'searchCode');
+
+    cy.get('#filter_storageCode').clear();
+    cy.get('#filter_storageType').type('type');
+    cy.getTestId('search_btn').click();
+    cy.getTestId('storage_table').find('table').find('.ant-table-tbody')
+      .children('.ant-table-row').first().find('td').first()
+      .should('include.html', 'searchType');
+
+    cy.get('#filter_storageType').clear();
+    selectClick('filter_storageState', 1);
+    cy.getTestId('search_btn').click();
+    cy.getTestId('storage_table').find('table').find('.ant-table-tbody')
+      .children('.ant-table-row').first().find('td').first()
+      .should('include.html', 'searchDisabled');
+  });
+
+  it('删除', function() {
+    cy.getTestId('storage_table').find('table').find('.ant-table-tbody')
+      .children('.ant-table-row').first().find('td').last().find('.ant-btn')
+      .last().click();
+
+    cy.get('.ant-modal-content').should('be.visible');
+    cy.get('.ant-modal-confirm-btns').children().last().trigger('click');
+
+    cy.getTestId('storage_table').find('table').find('.ant-table-tbody')
+      .children('.ant-table-row').first().find('td').last().children().last()
+      .should('have.class', 'ant-btn-loading');
+
+    cy.getTestId('storage_table').find('table').find('.ant-table-tbody')
+      .children('.ant-table-row').first().find('td').last().children().first()
+      .should('have.attr', 'disabled');
+
+    cy.get('.ant-message-notice-content').should('include.text', '删除成功');
+  });
+
+  it('新增', function() {
+    cy.getTestId('add_btn').click();
+
+    cy.getTestId('storage_modal').should('exist').and('be.visible');
+    cy.getTestId('storage_modal').find('h3').should('include.text', '新增库位');
+
+    cy.getTestId('field_storageLocationCode').type('0001');
+    cy.getTestId('field_storageLocationName').type('名称');
+    cy.getTestId('field_storageLocationType').type('类型');
+    cy.getTestId('field_storageWarehouseWhere').type('1号仓库');
+
+    selectClick('select_storageIsNotDisable', 1);
+
+    cy.getTestId('storage_modal').find('form').submit();
+
+    cy.getTestId('modal_btn_group').find('.ant-btn').first()
+      .should('have.class', 'ant-btn-loading');
+    cy.getTestId('modal_btn_group').find('.ant-btn').last()
+      .should('have.attr', 'disabled');
+
+    cy.get('.ant-message-notice-content').should('include.text', '新增成功');
+    cy.getTestId('storage_modal').should('not.exist');
+  });
+
+  it('修改', function() {
+    cy.getTestId('storage_table').find('table').find('.ant-table-tbody')
+      .children('.ant-table-row').first().find('td').last().find('.ant-btn')
+      .first().click();
+
+    cy.getTestId('storage_modal').should('exist').and('be.visible');
+    cy.getTestId('storage_modal').find('h3').should('include.text', '修改库位');
+
+    cy.getTestId('field_storageLocationCode').should('have.value', '0001');
+    cy.getTestId('field_storageLocationName').should('have.value', '1号库位');
+    cy.getTestId('field_storageLocationType').should('have.value', '原材料库位');
+    cy.getTestId('field_storageWarehouseWhere').should('have.value', '1号仓库');
+    selectGetValue('select_storageIsNotDisable', '启用');
+
+    cy.getTestId('storage_modal').find('form').submit();
+
+    cy.getTestId('modal_btn_group').find('.ant-btn').first()
+      .should('have.class', 'ant-btn-loading');
+    cy.getTestId('modal_btn_group').find('.ant-btn').last()
+      .should('have.attr', 'disabled');
+
+    cy.get('.ant-message-notice-content').should('include.text', '修改成功');
+    cy.getTestId('storage_modal').should('not.exist');
+  });
+});

+ 45 - 18
cypress/e2e/user.cy.ts

@@ -1,4 +1,5 @@
-import {NETWORK_URL, loginIntercept, loginSetup, menuIntercept, menuTrigger, optionsIntercept} from './setup';
+import {NETWORK_URL, loginIntercept, loginSetup, menuIntercept, optionsIntercept} from './utils/setup';
+import {menuTrigger, selectClick, selectGetValue} from './utils/utils';
 
 describe('用户管理', function() {
   beforeEach(function() {
@@ -17,7 +18,9 @@ describe('用户管理', function() {
         const search = new URLSearchParams(url.search);
 
         if (search.has('userName') && search.get('userName').length)
-          return reply({fixture: 'user/searchList'});
+          return reply({fixture: 'user/nameSearch'});
+        if (search.has('code') && search.get('code').length)
+          return reply({fixture: 'user/codeSearch'});
 
         if (search.has('id') && search.get('id').length)
           return reply({fixture: 'user/userInfo'});
@@ -30,21 +33,21 @@ describe('用户管理', function() {
     cy.intercept(
       `${NETWORK_URL}/user/delUser*`,
       function({reply}) {
-        reply({fixture: 'success'});
+        reply({fixture: 'success', delay: 100});
       },
     );
 
     cy.intercept(
       `${NETWORK_URL}/user/addUser`,
       function({reply}) {
-        reply({fixture: 'success'});
+        reply({fixture: 'success', delay: 100});
       },
     );
 
     cy.intercept(
       `${NETWORK_URL}/user/updateUser`,
       function({reply}) {
-        reply({fixture: 'success'});
+        reply({fixture: 'success', delay: 100});
       },
     );
   });
@@ -58,18 +61,29 @@ describe('用户管理', function() {
     cy.getTestId('user_table').find('table').find('.ant-table-tbody')
       .children('.ant-table-row').first().find('td').first()
       .should('include.text', 'TLD0004');
+  });
 
-    cy.get('input[name="useName"]').type('admin');
-    cy.get('input[name="useCode"]').type('TLD0004');
+  it('搜索', function() {
+    cy.get('.ant-pagination').find('li[title="2"]').click();
 
+    cy.get('input[name="useName"]').type('admin');
+    cy.get('input[name="useCode"]').clear();
     cy.getTestId('search_btn').trigger('click');
 
     cy.getTestId('user_table').find('table').find('.ant-table-tbody')
       .children('.ant-table-row').first().find('td').first()
-      .should('include.text', 'TLDSEARCH');
+      .should('include.text', 'searchName');
 
     cy.get('.ant-pagination').find('li[title="1"]')
       .should('have.class', 'ant-pagination-item-active');
+
+    cy.get('input[name="useName"]').clear();
+    cy.get('input[name="useCode"]').type('1234');
+    cy.getTestId('search_btn').trigger('click');
+
+    cy.getTestId('user_table').find('table').find('.ant-table-tbody')
+      .children('.ant-table-row').first().find('td').first()
+      .should('include.text', 'searchCode');
   });
 
   it('删除操作', function() {
@@ -103,18 +117,16 @@ describe('用户管理', function() {
     cy.get('input[name="userEmail"]').type('email');
     cy.get('input[name="userLandline"]').type('userLandline');
     cy.get('input[name="userPhone"]').type('userPhone');
-    cy.get('input[name="userPhone"]').type('userPhone');
-
-    cy.getTestId('select_userDepartment').click();
-    cy.getTestId('select_userDepartment').find('.rc-virtual-list-holder-inner')
-      .children().first().trigger('click');
-
-    cy.getTestId('select_userRole').click();
-    cy.getTestId('select_userRole').find('.rc-virtual-list-holder-inner')
-      .children().first().trigger('click');
+    selectClick('select_userDepartment', 0);
+    selectClick('select_userRole', 0);
 
     cy.getTestId('user_add_modal').find('form').submit();
 
+    cy.getTestId('modal_btn_group').find('.ant-btn').first()
+      .should('have.class', 'ant-btn-loading');
+    cy.getTestId('modal_btn_group').find('.ant-btn').last()
+      .should('have.attr', 'disabled');
+
     cy.get('.ant-message-notice-content').should('include.text', '新增成功');
     cy.getTestId('user_add_modal').should('not.exist');
   });
@@ -124,9 +136,24 @@ describe('用户管理', function() {
       .children('.ant-table-row').first().find('td').last().children().first()
       .trigger('click');
 
-    cy.wait(200);
+    cy.get('input[name="userName"]').should('have.value', '123412');
+    cy.get('input[name="userPassword"]').should(
+      'have.value',
+      '44349BD19046F3D527D67A5D0D414B09');
+    cy.get('input[name="userRealName"]').should('have.value', '测试');
+    cy.get('input[name="userEmail"]').should('have.value', '123@adfa.com');
+    cy.get('input[name="userLandline"]').should('have.value', '1231123');
+    cy.get('input[name="userPhone"]').should('have.value', '1532');
+    selectGetValue('select_userDepartment', '物流部门');
+    selectGetValue('select_userRole', '物流管理员');
+
     cy.getTestId('user_add_modal').find('form').submit();
 
+    cy.getTestId('modal_btn_group').find('.ant-btn').first()
+      .should('have.class', 'ant-btn-loading');
+    cy.getTestId('modal_btn_group').find('.ant-btn').last()
+      .should('have.attr', 'disabled');
+
     cy.get('.ant-message-notice-content').should('include.text', '修改成功');
     cy.getTestId('user_add_modal').should('not.exist');
   });

+ 1 - 8
cypress/e2e/setup.ts

@@ -21,13 +21,6 @@ export function menuIntercept() {
 export function optionsIntercept() {
   cy.intercept(`${NETWORK_URL}/role/roleBefore*`, {fixture: 'role/options'});
   cy.intercept(`${NETWORK_URL}/department/getDepartBefor*`, {fixture: 'department/options'});
+  cy.intercept(`${NETWORK_URL}/storage/getStorageAll*`, {fixture: 'storage/options'});
 }
 
-export function menuTrigger(parent: number, child: number) {
-  cy.getTestId('menu').children().each(function(el, idx) {
-    if (idx === parent) {
-      el.find('.ant-menu-submenu-title').trigger('click');
-      el.find('ul>li').children().eq(child).trigger('click');
-    }
-  });
-}

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

@@ -0,0 +1,19 @@
+export function selectClick(testid: string, eq = 0) {
+  cy.getTestId(testid).click();
+  cy.getTestId(testid).find('.rc-virtual-list-holder-inner')
+    .children().eq(eq).click();
+}
+
+export function menuTrigger(parent: number, child: number) {
+  cy.getTestId('menu').children().each(function(el, idx) {
+    if (idx === parent) {
+      el.find('.ant-menu-submenu-title').trigger('click');
+      el.find('ul>li').children().eq(child).trigger('click');
+    }
+  });
+}
+
+export function selectGetValue(testid: string, value: string) {
+  cy.getTestId(testid).find('.ant-select-selection-item')
+    .should('have.attr', 'title', value).and('have.text', value);
+}

+ 1 - 1
cypress/fixtures/department/search.json

@@ -5,7 +5,7 @@
     "list": [
       {
         "id": "test01",
-        "code": "BH0002",
+        "code": "searchCode",
         "departmentName": "包装部门",
         "createTime": "2023-02-01",
         "page": 0,

+ 34 - 0
cypress/fixtures/department/nameSearch.json

@@ -0,0 +1,34 @@
+{
+  "msg": "200",
+  "data": {
+    "total": 1,
+    "list": [
+      {
+        "id": "test01",
+        "code": "searchName",
+        "departmentName": "包装部门",
+        "createTime": "2023-02-01",
+        "page": 0,
+        "limit": 0
+      }
+    ],
+    "pageNum": 1,
+    "pageSize": 10,
+    "size": 3,
+    "startRow": 1,
+    "endRow": 3,
+    "pages": 1,
+    "prePage": 0,
+    "nextPage": 0,
+    "isFirstPage": true,
+    "isLastPage": true,
+    "hasPreviousPage": false,
+    "hasNextPage": false,
+    "navigatePages": 8,
+    "navigatepageNums": [
+      1
+    ],
+    "navigateFirstPage": 1,
+    "navigateLastPage": 1
+  }
+}

+ 92 - 0
cypress/fixtures/goods/list1.json

@@ -0,0 +1,92 @@
+{
+  "msg": "200",
+  "data": {
+    "total": 12,
+    "list": [
+      {
+        "id": 1,
+        "itemNumber": "P00012",
+        "type": "类型1",
+        "minAccommodate": "2",
+        "accommodateNum": "1",
+        "maxAccommodate": "4",
+        "supplier": "测试1",
+        "storageLocation": "4",
+        "inputType": "随便",
+        "userDepartment": "7",
+        "lowReserves": "1",
+        "highReserves": "3",
+        "grade": "等级2",
+        "packingType": "无",
+        "unit": "公斤",
+        "name": "测试货品",
+        "userDepartmentName": "物流部门",
+        "storageLocationName": "1号库位",
+        "page": 0,
+        "limit": 0
+      },
+      {
+        "id": 2,
+        "itemNumber": "P00012",
+        "type": "类型1",
+        "minAccommodate": "2",
+        "accommodateNum": "1",
+        "maxAccommodate": "4",
+        "supplier": "测试1",
+        "storageLocation": "4",
+        "inputType": "随便",
+        "userDepartment": "7",
+        "lowReserves": "1",
+        "highReserves": "3",
+        "grade": "等级2",
+        "packingType": "无",
+        "unit": "公斤",
+        "name": "测试货品",
+        "userDepartmentName": "物流部门",
+        "storageLocationName": "1号库位",
+        "page": 0,
+        "limit": 0
+      },
+      {
+        "id": 3,
+        "itemNumber": "P00012",
+        "type": "类型1",
+        "minAccommodate": "2",
+        "accommodateNum": "1",
+        "maxAccommodate": "4",
+        "supplier": "测试1",
+        "storageLocation": "4",
+        "inputType": "随便",
+        "userDepartment": "7",
+        "lowReserves": "1",
+        "highReserves": "3",
+        "grade": "等级2",
+        "packingType": "无",
+        "unit": "公斤",
+        "name": "测试货品",
+        "userDepartmentName": "物流部门",
+        "storageLocationName": "1号库位",
+        "page": 0,
+        "limit": 0
+      }
+    ],
+    "pageNum": 1,
+    "pageSize": 10,
+    "size": 1,
+    "startRow": 1,
+    "endRow": 1,
+    "pages": 1,
+    "prePage": 0,
+    "nextPage": 0,
+    "isFirstPage": true,
+    "isLastPage": true,
+    "hasPreviousPage": false,
+    "hasNextPage": false,
+    "navigatePages": 8,
+    "navigatepageNums": [
+      1
+    ],
+    "navigateFirstPage": 1,
+    "navigateLastPage": 1
+  }
+}

+ 70 - 0
cypress/fixtures/goods/list2.json

@@ -0,0 +1,70 @@
+{
+  "msg": "200",
+  "data": {
+    "total": 12,
+    "list": [
+      {
+        "id": 1,
+        "itemNumber": "P00012",
+        "type": "类型1",
+        "minAccommodate": "2",
+        "accommodateNum": "1",
+        "maxAccommodate": "4",
+        "supplier": "测试1",
+        "storageLocation": "4",
+        "inputType": "随便",
+        "userDepartment": "7",
+        "lowReserves": "1",
+        "highReserves": "3",
+        "grade": "等级2",
+        "packingType": "无",
+        "unit": "公斤",
+        "name": "测试货品",
+        "userDepartmentName": "物流部门",
+        "storageLocationName": "1号库位",
+        "page": 0,
+        "limit": 0
+      },
+      {
+        "id": 3,
+        "itemNumber": "P00012",
+        "type": "类型1",
+        "minAccommodate": "2",
+        "accommodateNum": "1",
+        "maxAccommodate": "4",
+        "supplier": "测试1",
+        "storageLocation": "4",
+        "inputType": "随便",
+        "userDepartment": "7",
+        "lowReserves": "1",
+        "highReserves": "3",
+        "grade": "等级2",
+        "packingType": "无",
+        "unit": "公斤",
+        "name": "测试货品",
+        "userDepartmentName": "物流部门",
+        "storageLocationName": "1号库位",
+        "page": 0,
+        "limit": 0
+      }
+    ],
+    "pageNum": 1,
+    "pageSize": 10,
+    "size": 1,
+    "startRow": 1,
+    "endRow": 1,
+    "pages": 1,
+    "prePage": 0,
+    "nextPage": 0,
+    "isFirstPage": true,
+    "isLastPage": true,
+    "hasPreviousPage": false,
+    "hasNextPage": false,
+    "navigatePages": 8,
+    "navigatepageNums": [
+      1
+    ],
+    "navigateFirstPage": 1,
+    "navigateLastPage": 1
+  }
+}

+ 48 - 0
cypress/fixtures/goods/search.json

@@ -0,0 +1,48 @@
+{
+  "msg": "200",
+  "data": {
+    "total": 1,
+    "list": [
+      {
+        "id": 3,
+        "itemNumber": "searchCode",
+        "type": "类型1",
+        "minAccommodate": "2",
+        "accommodateNum": "1",
+        "maxAccommodate": "4",
+        "supplier": "测试1",
+        "storageLocation": "4",
+        "inputType": "随便",
+        "userDepartment": "7",
+        "lowReserves": "1",
+        "highReserves": "3",
+        "grade": "等级2",
+        "packingType": "无",
+        "unit": "公斤",
+        "name": "测试货品",
+        "userDepartmentName": "物流部门",
+        "storageLocationName": "1号库位",
+        "page": 0,
+        "limit": 0
+      }
+    ],
+    "pageNum": 1,
+    "pageSize": 10,
+    "size": 1,
+    "startRow": 1,
+    "endRow": 1,
+    "pages": 1,
+    "prePage": 0,
+    "nextPage": 0,
+    "isFirstPage": true,
+    "isLastPage": true,
+    "hasPreviousPage": false,
+    "hasNextPage": false,
+    "navigatePages": 8,
+    "navigatepageNums": [
+      1
+    ],
+    "navigateFirstPage": 1,
+    "navigateLastPage": 1
+  }
+}

+ 37 - 0
cypress/fixtures/storage/codeSearch.json

@@ -0,0 +1,37 @@
+{
+  "msg": "200",
+  "data": {
+    "total": 1,
+    "list": [
+      {
+        "id": "4",
+        "storageLocationCode": "searchCode",
+        "storageLocationName": "1号库位",
+        "warehouseWhere": "1号仓库",
+        "storageLocationType": "原材料库位",
+        "isNotDisable": "1",
+        "createTime": "2023-02-04",
+        "page": 0,
+        "limit": 0
+      }
+    ],
+    "pageNum": 1,
+    "pageSize": 10,
+    "size": 1,
+    "startRow": 1,
+    "endRow": 1,
+    "pages": 1,
+    "prePage": 0,
+    "nextPage": 0,
+    "isFirstPage": true,
+    "isLastPage": true,
+    "hasPreviousPage": false,
+    "hasNextPage": false,
+    "navigatePages": 8,
+    "navigatepageNums": [
+      1
+    ],
+    "navigateFirstPage": 1,
+    "navigateLastPage": 1
+  }
+}

+ 37 - 0
cypress/fixtures/storage/disabledSearch.json

@@ -0,0 +1,37 @@
+{
+  "msg": "200",
+  "data": {
+    "total": 1,
+    "list": [
+      {
+        "id": "4",
+        "storageLocationCode": "searchDisabled",
+        "storageLocationName": "1号库位",
+        "warehouseWhere": "1号仓库",
+        "storageLocationType": "原材料库位",
+        "isNotDisable": "1",
+        "createTime": "2023-02-04",
+        "page": 0,
+        "limit": 0
+      }
+    ],
+    "pageNum": 1,
+    "pageSize": 10,
+    "size": 1,
+    "startRow": 1,
+    "endRow": 1,
+    "pages": 1,
+    "prePage": 0,
+    "nextPage": 0,
+    "isFirstPage": true,
+    "isLastPage": true,
+    "hasPreviousPage": false,
+    "hasNextPage": false,
+    "navigatePages": 8,
+    "navigatepageNums": [
+      1
+    ],
+    "navigateFirstPage": 1,
+    "navigateLastPage": 1
+  }
+}

+ 37 - 0
cypress/fixtures/storage/info.json

@@ -0,0 +1,37 @@
+{
+  "msg": "200",
+  "data": {
+    "total": 1,
+    "list": [
+      {
+        "id": "4",
+        "storageLocationCode": "0001",
+        "storageLocationName": "1号库位",
+        "warehouseWhere": "1号仓库",
+        "storageLocationType": "原材料库位",
+        "isNotDisable": "1",
+        "createTime": "2023-02-04",
+        "page": 0,
+        "limit": 0
+      }
+    ],
+    "pageNum": 1,
+    "pageSize": 1,
+    "size": 1,
+    "startRow": 1,
+    "endRow": 1,
+    "pages": 1,
+    "prePage": 0,
+    "nextPage": 0,
+    "isFirstPage": true,
+    "isLastPage": true,
+    "hasPreviousPage": false,
+    "hasNextPage": false,
+    "navigatePages": 8,
+    "navigatepageNums": [
+      1
+    ],
+    "navigateFirstPage": 1,
+    "navigateLastPage": 1
+  }
+}

+ 59 - 0
cypress/fixtures/storage/list1.json

@@ -0,0 +1,59 @@
+{
+  "msg": "200",
+  "data": {
+    "total": 16,
+    "list": [
+      {
+        "id": "4",
+        "storageLocationCode": "0001",
+        "storageLocationName": "1号库位",
+        "warehouseWhere": "1号仓库",
+        "storageLocationType": "原材料库位",
+        "isNotDisable": "1",
+        "createTime": "2023-02-04",
+        "page": 0,
+        "limit": 0
+      },
+      {
+        "id": "5",
+        "storageLocationCode": "0001",
+        "storageLocationName": "1号库位",
+        "warehouseWhere": "1号仓库",
+        "storageLocationType": "原材料库位",
+        "isNotDisable": "1",
+        "createTime": "2023-02-04",
+        "page": 0,
+        "limit": 0
+      },
+      {
+        "id": "6",
+        "storageLocationCode": "0001",
+        "storageLocationName": "1号库位",
+        "warehouseWhere": "1号仓库",
+        "storageLocationType": "原材料库位",
+        "isNotDisable": "1",
+        "createTime": "2023-02-04",
+        "page": 0,
+        "limit": 0
+      }
+    ],
+    "pageNum": 1,
+    "pageSize": 10,
+    "size": 1,
+    "startRow": 1,
+    "endRow": 1,
+    "pages": 1,
+    "prePage": 0,
+    "nextPage": 0,
+    "isFirstPage": true,
+    "isLastPage": true,
+    "hasPreviousPage": false,
+    "hasNextPage": false,
+    "navigatePages": 8,
+    "navigatepageNums": [
+      1
+    ],
+    "navigateFirstPage": 1,
+    "navigateLastPage": 1
+  }
+}

+ 48 - 0
cypress/fixtures/storage/list2.json

@@ -0,0 +1,48 @@
+{
+  "msg": "200",
+  "data": {
+    "total": 16,
+    "list": [
+      {
+        "id": "4",
+        "storageLocationCode": "0001",
+        "storageLocationName": "1号库位",
+        "warehouseWhere": "1号仓库",
+        "storageLocationType": "原材料库位",
+        "isNotDisable": "1",
+        "createTime": "2023-02-04",
+        "page": 0,
+        "limit": 0
+      },
+      {
+        "id": "5",
+        "storageLocationCode": "0001",
+        "storageLocationName": "1号库位",
+        "warehouseWhere": "1号仓库",
+        "storageLocationType": "原材料库位",
+        "isNotDisable": "1",
+        "createTime": "2023-02-04",
+        "page": 0,
+        "limit": 0
+      }
+    ],
+    "pageNum": 1,
+    "pageSize": 10,
+    "size": 1,
+    "startRow": 1,
+    "endRow": 1,
+    "pages": 1,
+    "prePage": 0,
+    "nextPage": 0,
+    "isFirstPage": true,
+    "isLastPage": true,
+    "hasPreviousPage": false,
+    "hasNextPage": false,
+    "navigatePages": 8,
+    "navigatepageNums": [
+      1
+    ],
+    "navigateFirstPage": 1,
+    "navigateLastPage": 1
+  }
+}

+ 37 - 0
cypress/fixtures/storage/nameSearch.json

@@ -0,0 +1,37 @@
+{
+  "msg": "200",
+  "data": {
+    "total": 1,
+    "list": [
+      {
+        "id": "4",
+        "storageLocationCode": "searchName",
+        "storageLocationName": "1号库位",
+        "warehouseWhere": "1号仓库",
+        "storageLocationType": "原材料库位",
+        "isNotDisable": "1",
+        "createTime": "2023-02-04",
+        "page": 0,
+        "limit": 0
+      }
+    ],
+    "pageNum": 1,
+    "pageSize": 10,
+    "size": 1,
+    "startRow": 1,
+    "endRow": 1,
+    "pages": 1,
+    "prePage": 0,
+    "nextPage": 0,
+    "isFirstPage": true,
+    "isLastPage": true,
+    "hasPreviousPage": false,
+    "hasNextPage": false,
+    "navigatePages": 8,
+    "navigatepageNums": [
+      1
+    ],
+    "navigateFirstPage": 1,
+    "navigateLastPage": 1
+  }
+}

+ 16 - 0
cypress/fixtures/storage/options.json

@@ -0,0 +1,16 @@
+{
+  "msg": "200",
+  "data": [
+    {
+      "id": "4",
+      "storageLocationCode": "0001",
+      "storageLocationName": "1号库位",
+      "warehouseWhere": "1号仓库",
+      "storageLocationType": "原材料库位",
+      "isNotDisable": "1",
+      "createTime": "2023-02-04",
+      "page": 0,
+      "limit": 0
+    }
+  ]
+}

+ 37 - 0
cypress/fixtures/storage/typeSearch.json

@@ -0,0 +1,37 @@
+{
+  "msg": "200",
+  "data": {
+    "total": 1,
+    "list": [
+      {
+        "id": "4",
+        "storageLocationCode": "searchType",
+        "storageLocationName": "1号库位",
+        "warehouseWhere": "1号仓库",
+        "storageLocationType": "原材料库位",
+        "isNotDisable": "1",
+        "createTime": "2023-02-04",
+        "page": 0,
+        "limit": 0
+      }
+    ],
+    "pageNum": 1,
+    "pageSize": 10,
+    "size": 1,
+    "startRow": 1,
+    "endRow": 1,
+    "pages": 1,
+    "prePage": 0,
+    "nextPage": 0,
+    "isFirstPage": true,
+    "isLastPage": true,
+    "hasPreviousPage": false,
+    "hasNextPage": false,
+    "navigatePages": 8,
+    "navigatepageNums": [
+      1
+    ],
+    "navigateFirstPage": 1,
+    "navigateLastPage": 1
+  }
+}

+ 1 - 1
cypress/fixtures/user/searchList.json

@@ -5,7 +5,7 @@
     "list": [
       {
         "id": "test03",
-        "code": "TLDSEARCH",
+        "code": "searchCode",
         "userName": "admin",
         "password": "706C20B26C94BB14",
         "realName": "超级管理员",

+ 45 - 0
cypress/fixtures/user/nameSearch.json

@@ -0,0 +1,45 @@
+{
+  "msg": "200",
+  "data": {
+    "total": 21,
+    "list": [
+      {
+        "id": "test03",
+        "code": "searchName",
+        "userName": "admin",
+        "password": "706C20B26C94BB14",
+        "realName": "超级管理员",
+        "email": null,
+        "landline": null,
+        "phone": null,
+        "department": "包装部门",
+        "role": "超级管理员",
+        "roleId": "5",
+        "departmentId": "2",
+        "createTime": "2023-01-31",
+        "token": null,
+        "menu": null,
+        "page": 0,
+        "limit": 0
+      }
+    ],
+    "pageNum": 1,
+    "pageSize": 10,
+    "size": 2,
+    "startRow": 1,
+    "endRow": 2,
+    "pages": 1,
+    "prePage": 0,
+    "nextPage": 0,
+    "isFirstPage": true,
+    "isLastPage": true,
+    "hasPreviousPage": false,
+    "hasNextPage": false,
+    "navigatePages": 8,
+    "navigatepageNums": [
+      1
+    ],
+    "navigateFirstPage": 1,
+    "navigateLastPage": 1
+  }
+}

+ 1 - 0
packages/app/src/components/filter-field/Select.tsx

@@ -33,6 +33,7 @@ const Select: FC<Props> = function({
           <SelectOri
             style={{width: '100%'}}
             id={`filter_${name}`}
+            data-testid={`filter_${name}`}
             placeholder={placeholder ?? '请输入'}
             value={value}
             options={options}

+ 3 - 1
packages/app/src/pages/goods/table/index.tsx

@@ -15,10 +15,11 @@ const TableList: FC = function() {
     <>
       <Card className='table-wrapper'>
         <section className='table-tool'>
-          <Button type='primary' onClick={onAdd}>新增</Button>
+          <Button type='primary' onClick={onAdd} data-testid='add_btn'>新增</Button>
         </section>
 
         <Table
+          data-testid='goods_table'
           scroll={{x: 2600}}
           loading={isFetching}
           dataSource={data}
@@ -30,6 +31,7 @@ const TableList: FC = function() {
             onChange: onPageChange,
             pageSizeOptions: PAGE_SIZE_LIST,
             total: count,
+            showSizeChanger: true,
           }}
           bordered
         />

+ 2 - 2
packages/app/src/pages/goods/table/modal/hooks.ts

@@ -196,7 +196,7 @@ export function useOptions() {
       if (data.msg === '200')
         return data.data.map(function({id, departmentName}) {
           return {
-            value: id,
+            value: String(id),
             label: departmentName,
           };
         });
@@ -214,7 +214,7 @@ export function useOptions() {
       if (data.msg === '200')
         return data.data.map(function({id, storageLocationName}) {
           return {
-            value: id,
+            value: String(id),
             label: storageLocationName,
           };
         });

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

@@ -30,6 +30,7 @@ const GoodsModal: FC<Props> = function({id, visible, onClose, onFetch}) {
       style={style}
       onClose={onClose}
       onSubmit={onSubmit}
+      testId='goods_modal'
     >
       <ErrorBoundary>
         <Suspense fallback={<Loading tip='正在获取货品信息' />}>

+ 2 - 1
packages/app/src/pages/storage/table/index.tsx

@@ -16,11 +16,12 @@ const TableList: FC = function() {
       <Card className='table-wrapper'>
         <section className='table-tool'>
           <Space>
-            <Button type='primary' onClick={onAdd}>新增</Button>
+            <Button type='primary' onClick={onAdd} data-testid='add_btn'>新增</Button>
           </Space>
         </section>
 
         <Table
+          data-testid='storage_table'
           bordered
           columns={columns}
           pagination={{

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

@@ -30,6 +30,7 @@ const StorageModal: FC<Props> = function({visible, id, onClose, onFetch}) {
       onSubmit={onSubmit}
       style={style}
       onClose={onClose}
+      testId='storage_modal'
     >
       <FormProvider {...formInstance}>
         <ErrorBoundary>