Quellcode durchsuchen

test: 增加原材料入库明细测试

xyh vor 2 Jahren
Ursprung
Commit
4c2b6485b7

+ 82 - 0
cypress/e2e/rawInStream.cy.ts

@@ -0,0 +1,82 @@
+import {
+  beforeSetup,
+  exportIntercept,
+  generateNetworkResult,
+  intercept,
+  intoMenu,
+  selectAllFilters,
+  validateTableList,
+  validateTableSearch,
+} from './utils';
+
+const basicData = {
+  id: '156',
+  wllbCode: '3415100010390008',
+  supplierId: null,
+  supplierName: '西安特来电智能充电科技有限公司',
+  serial: '2',
+  producDate: '20221021',
+  producBatch: '20221021',
+  capacity: '1.00',
+  process: null,
+  seq: null,
+  type: '扫码入库',
+  userId: null,
+  departmentId: null,
+  storageLocationCode: null,
+  scrq: '2023-04-13 09:38:15',
+  userName: 'PDA',
+  realName: 'PDA测试',
+  departmentName: '仓库管理部',
+  storageLocationName: 'B3-10-4',
+  orderCode: '6202023040301356',
+  startTime: null,
+  endTime: null,
+  materialName: '六角螺母\\\\M16;4;彩锌;粗;GB/T41-2000\\\\',
+  page: 0,
+  limit: 0,
+  storageCode: 'RK2304130003',
+  wbs: '2',
+  accountSleeve: '8400',
+  accountName: '青岛特来电智能充电设备有限公司',
+  purchaseNum: '60',
+  transmissionType: '1',
+};
+
+describe('原材料入库明细', function () {
+  beforeEach(function () {
+    beforeSetup(true);
+    intoMenu('入库管理', '原材料入库明细');
+  });
+
+  beforeEach(function () {
+    intercept('/warehousing/warehousingFlowing', function ({reply, search}) {
+      generateNetworkResult({reply, search, basicData, title: 'storageCode'});
+    });
+
+    exportIntercept('/warehousing/export');
+  });
+
+  it('table', function () {
+    selectAllFilters('raw_in_stream_filter', 11);
+    validateTableList('raw_in_stream_table');
+
+    validateTableSearch(
+      'raw_in_stream_table',
+      [
+        'storageCode',
+        'orderCode',
+        'materialName',
+        'wllbCode',
+        'storageLocationName',
+        {id: 'supplierId', type: 'select', value: 'EC92255'},
+        'wbs',
+        'userName',
+        'realName',
+        {id: 'startTime', type: 'date'},
+        {id: 'accountSleeve', type: 'select', value: '8130'},
+      ],
+      {toolId: 'raw_in_stream_filter', url: '/warehousing/warehousingFlowing'},
+    );
+  });
+});

+ 4 - 2
cypress/e2e/utils/utils.ts

@@ -106,12 +106,14 @@ export function validateTableSearch(
       if (typeof key === 'string') {
         cy.getTestId(toolId).find(`[data-testid="filter_${key}"]`).clear();
       } else {
-        const {id} = key;
+        const {id, type} = key;
+        const clearId =
+          type === 'select' ? '.ant-select-clear' : '.ant-picker-clear';
 
         cy.getTestId(toolId)
           .find(`[data-testid="filter_${id}"]`)
           .trigger('mouseover')
-          .find('.ant-select-clear')
+          .find(clearId)
           .click();
       }
     }

+ 1 - 0
packages/app/src/pages/raw-in-stream/filter/index.tsx

@@ -52,6 +52,7 @@ const Filter: FC = function () {
         onDatesChange={onDatesChange}
         dates={dates}
         fields={fields}
+        testId='raw_in_stream_filter'
       />
 
       <FilterSelectorModal