Bläddra i källkod

test: 增加半成品报工管理测试

xyh 2 år sedan
förälder
incheckning
2ce717bbf5

+ 93 - 1
cypress/e2e/semiReport.cy.ts

@@ -1,4 +1,18 @@
-import {beforeSetup} from './utils';
+import {
+  beforeSetup,
+  generateNetworkResult,
+  intercept,
+  intoMenu,
+  selectAllFilters,
+  selectClick,
+  successIntercept,
+  tableBtnClick,
+  validateDelete,
+  validateModalOperation,
+  validatePut,
+  validateTableList,
+  validateTableSearch,
+} from './utils';
 
 const basicData = {
   id: '26',
@@ -52,5 +66,83 @@ const basicData = {
 describe('半成品报工单管理', function () {
   beforeEach(function () {
     beforeSetup();
+    intoMenu('入库管理', '半成品报工单管理');
+  });
+
+  beforeEach(function () {
+    intercept('/warehousing/getNotice', function ({search, reply}) {
+      generateNetworkResult({
+        search,
+        reply,
+        basicData,
+        title: 'productionCode',
+        skipCondition: name => name === 'partType',
+      });
+    });
+
+    successIntercept([
+      '/warehousing/addInventoryNotice',
+      '/warehousing/delInventoryNotice',
+    ]);
+  });
+
+  it('table', function () {
+    selectAllFilters('semi_report_filter', 10);
+    validateTableList('semi_report_table');
+
+    validateTableSearch(
+      'semi_report_table',
+      [
+        'productionCode',
+        'noticeCode',
+        'materialName',
+        'wllbCode',
+        {id: 'endTime', type: 'date'},
+        'entryNumber',
+        {id: 'companyNumber', type: 'select', value: '8130'},
+        'moveType',
+        'sourceType',
+        {id: 'type', type: 'select', value: '0'},
+      ],
+      {toolId: 'semi_report_filter', url: '/warehousing/getNotice'},
+    );
+  });
+
+  it('operation', function () {
+    const {validateAdd} = validatePut(
+      'semi_report_modal',
+      'semi_report_table',
+      {label: '报工单'},
+    );
+
+    validateAdd([
+      'stockInNoticeId',
+      'stockInNoticeNo',
+      'prodOrderNo',
+      {id: 'materialId', type: 'keySelect'},
+      'notificationTypeName',
+      'notificationTypeNumber',
+      {id: 'measUnitId', type: 'keySelect'},
+      {id: 'orderCount', type: 'field', value: '10'},
+      {id: 'companyNo', type: 'keySelect'},
+      'entryNumber',
+      'WBS',
+    ]);
+
+    validateDelete('semi_report_table', '半成品报工单', {
+      title: basicData.noticeCode,
+    });
+
+    // 入库操作
+    tableBtnClick('semi_report_table', 0);
+
+    cy.getTestId('semi_report_modal')
+      .find('h3')
+      .should('have.text', '选择库位信息');
+
+    selectClick('field_warehouse');
+    selectClick('field_location');
+
+    validateModalOperation('semi_report_modal', '入库完成');
   });
 });

+ 1 - 3
packages/app/src/components/filter-field/Tool.tsx

@@ -169,9 +169,7 @@ function FilterTool<S extends Record<string, string>>({
               );
             }
             case 'select': {
-              const options = state.excludeAll
-                ? state.options
-                : [{label: '全部', value: ''}, ...state.options];
+              const options = state.excludeAll ? state.options : state.options;
 
               return (
                 <FilterSelect

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

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

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

@@ -27,6 +27,7 @@ const AddModal: FC<Props> = function (props) {
       title='新增报工单'
       onSubmit={onSubmit}
       isLoading={isLoading}
+      testId='semi_report_modal'
     >
       <ModalField label='报工单ID' name='stockInNoticeId' control={control} />
       <ModalField label='报工单编号' name='stockInNoticeNo' control={control} />

+ 1 - 0
packages/app/src/pages/semi-report/table/put-in-modal/index.tsx

@@ -35,6 +35,7 @@ const PutInModal: FC<Props> = function (props) {
       title='选择库位信息'
       onSubmit={onSubmit}
       isLoading={isLoading}
+      testId='semi_report_modal'
     >
       <ModalSelect
         data={warehouseOptions}