Browse Source

test: 增加库存明细测试

xyh 2 years ago
parent
commit
d46ae75097
2 changed files with 80 additions and 0 deletions
  1. 79 0
      cypress/e2e/stock.cy.ts
  2. 1 0
      packages/app/src/pages/stock/filter/index.tsx

+ 79 - 0
cypress/e2e/stock.cy.ts

@@ -0,0 +1,79 @@
+import {
+  beforeSetup,
+  exportIntercept,
+  generateNetworkResult,
+  intercept,
+  intoMenu,
+  selectAllFilters,
+  validateExport,
+  validateTableList,
+  validateTableSearch,
+} from './utils';
+
+const basicData = {
+  unitOfMeasurement: null,
+  wllbClass: '金属紧固件',
+  companyCode: '8400',
+  supplierName: '西安特来电智能充电科技有限公司',
+  code: '3415100010390008',
+  supplierId: 'EC00276',
+  year: 2023,
+  storageLocationCode: 'B3-10-4',
+  companyName: '青岛特来电智能充电设备有限公司',
+  wbs: '2',
+  sum: 3,
+  maxNum: null,
+  warehouseName: '充电设备事业部原材料库',
+  warehouseCode: '2000',
+  month: 4,
+  accountSleeve: '8400',
+  name: '六角螺母\\\\M16;4;彩锌;粗;GB/T41-2000\\\\',
+  id: 8221,
+  storageLocationName: 'B3-10-4',
+  day: 365,
+  partType: '原材料',
+};
+
+describe('库存明细', function () {
+  beforeEach(function () {
+    beforeSetup();
+    intoMenu('库内管理', '库存明细');
+  });
+
+  beforeEach(function () {
+    intercept('/queryList/storageLocation', function ({search, reply}) {
+      generateNetworkResult({search, reply, basicData, title: 'code'});
+    });
+
+    exportIntercept('queryList/exportStorageLocation');
+  });
+
+  it('库存明细', function () {
+    selectAllFilters('stock_filter', 10);
+    validateTableList('stock_table');
+    validateTableSearch(
+      'stock_table',
+      [
+        'wllbCode',
+        'materialName',
+        'storageLocationName',
+        {id: 'companyCode', type: 'select', value: '8130'},
+        {id: 'warehouseId', type: 'select', value: '2bdf33b8-4326-47e8-b'},
+        {id: 'supplierId', type: 'select', value: 'EC92255'},
+        'wbs',
+        'partType',
+        {id: 'wllbClass', type: 'select', value: '危化品'},
+        {
+          id: 'unitOfMeasurement',
+          type: 'select',
+          value: '00000000000000000001',
+        },
+      ],
+      {
+        toolId: 'stock_filter',
+        url: '/queryList/storageLocation',
+      },
+    );
+    validateExport('stock_table');
+  });
+});

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

@@ -33,6 +33,7 @@ const Filter: FC = function () {
         sourceMap={sourceMap}
         fixedMap={fixedMap}
         onFilter={onShowModal}
+        testId='stock_filter'
       />
 
       <FilterSelectorModal