浏览代码

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

xyh 2 年之前
父节点
当前提交
ffda77d5a9

+ 134 - 0
cypress/e2e/productReport.cy.ts

@@ -0,0 +1,134 @@
+import {
+  beforeSetup,
+  generateNetworkResult,
+  intercept,
+  intoMenu,
+  selectAllFilters,
+  successIntercept,
+  validateDelete,
+  validatePut,
+  validateTableList,
+  validateTableSearch,
+} from './utils';
+
+const basicData = {
+  id: '26',
+  noticeId: 'TGD01202303230001',
+  noticeCode: 'TGD01202303230001',
+  companyNumber: '8130',
+  noticeTime: '2023-04-12',
+  sourceType: 'G',
+  moveType: '104',
+  entryNumber: '1',
+  productionCode: 'DD01',
+  materialId: '00000000000000012034',
+  wbs: '',
+  measurementId: '00000000000000000001',
+  num: '20',
+  type: '0',
+  warehousingNum: '0',
+  page: 0,
+  limit: 0,
+  startTime: null,
+  endTime: null,
+  materialName: '酒精纸\\',
+  companyName: '青岛特来电智能设备有限公司',
+  wllbClass: null,
+  materialCode: null,
+  userId: null,
+  askGoodsId: null,
+  wllbCode: '2205010010020003',
+  serial: null,
+  producBatch: null,
+  attribute: null,
+  storageLocationCode: null,
+  storageLocationName: null,
+  storageCode: null,
+  seq: null,
+  userName: null,
+  realName: null,
+  scrq: null,
+  uniqueCode: null,
+  partType: null,
+  supplierId: null,
+  capacity: null,
+  accountName: null,
+  wmsItemId: null,
+  wmsId: null,
+  code: null,
+  name: null,
+  warehouseWhere: null,
+};
+
+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('product_report_filter', 10);
+    validateTableList('product_report_table');
+
+    validateTableSearch(
+      'product_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: 'product_report_filter', url: '/warehousing/getNotice'},
+    );
+  });
+
+  it('operation', function () {
+    const {validateAdd} = validatePut(
+      'product_report_modal',
+      'product_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('product_report_table', '产成品报工单', {
+      title: basicData.noticeCode,
+      eq: 0,
+    });
+  });
+});

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

@@ -225,7 +225,7 @@ export function validateModalBtnGroup(modalName: string) {
 
 // 校验antd message内容
 export function validateMessageContent(msg: string) {
-  cy.get('.ant-message-notice-content').should('have.text', msg);
+  cy.get('.ant-message-notice-content').should('include.text', msg);
 }
 
 // 校验modal的操作结果

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

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

+ 1 - 1
packages/app/src/pages/product-report/table/index.tsx

@@ -31,7 +31,7 @@ const TableList: FC = function () {
         />
 
         <Table
-          data-testid='semi_report_table'
+          data-testid='product_report_table'
           columns={columns}
           data={data}
           pageContext={pageContext}

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

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