material.cy.ts 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. import {
  2. beforeSetup,
  3. generateNetworkResult,
  4. intercept,
  5. intoMenu,
  6. selectAllFilters,
  7. successIntercept,
  8. validatePut,
  9. validateTableSearch,
  10. } from './utils';
  11. const basicData = {
  12. id: '84874',
  13. code: 'test_3015040242',
  14. name: '稳压二极管',
  15. tldId: '00000000000000000104',
  16. specificationAndModel:
  17. '瞬态抑制二极管-双向,CAN数据端口专用-26.2V-44V-350W-8.00A-SOT-23-/-',
  18. unitOfMeasurement: '00000000000000000001',
  19. materialId: null,
  20. num: null,
  21. type: '0',
  22. tableName: null,
  23. size: '10',
  24. materialType: null,
  25. wllbClass: '危化品',
  26. isNotDisable: '1',
  27. isRecommend: '1',
  28. partType: '产成品',
  29. page: 0,
  30. limit: 0,
  31. amount: null,
  32. minNum: '6',
  33. maxNum: '12',
  34. modifyUser: 'admin',
  35. modifyTime: '2023-04-12 17:05:01',
  36. typeVal: null,
  37. companyNumber: '0',
  38. warehouseType: null,
  39. nameOrCode: null,
  40. };
  41. describe('物料管理', function () {
  42. beforeEach(function () {
  43. beforeSetup();
  44. intoMenu('基础资料', '物料管理');
  45. });
  46. beforeEach(function () {
  47. intercept('/dictionary/getDictionaryPage', function ({search, reply}) {
  48. generateNetworkResult({
  49. search,
  50. reply,
  51. basicData,
  52. title: 'code',
  53. skipCondition(name) {
  54. return name === 'type';
  55. },
  56. });
  57. });
  58. successIntercept('/materialClass/updateMaterial');
  59. });
  60. it('table', function () {
  61. selectAllFilters('material_filter', 7);
  62. validateTableSearch(
  63. 'goods_table',
  64. [
  65. 'code',
  66. 'name',
  67. 'materialType',
  68. {id: 'wllbClass', type: 'select', value: '危化品'},
  69. {id: 'isNotDisable', type: 'select', eq: 1, value: '0'},
  70. {id: 'isRecommend', type: 'select', eq: 1, value: '0'},
  71. 'modifyUser',
  72. ],
  73. {toolId: 'material_filter', url: '/dictionary/getDictionaryPage'},
  74. );
  75. });
  76. it('operation', function () {
  77. const {validateEdit} = validatePut('goods_modal', 'goods_table', {
  78. label: '物料',
  79. });
  80. validateEdit([
  81. {id: 'goodsPartType', type: 'field', value: '产成品'},
  82. {id: 'goodsType', type: 'select', value: '危化品'},
  83. {id: 'goodsSize', type: 'field', value: '10'},
  84. {id: 'goodsMaxNum', type: 'field', value: '12'},
  85. {id: 'goodsMinNum', type: 'field', value: '6'},
  86. {id: 'goodsMixin', type: 'select', value: '是'},
  87. {id: 'goodsRecommend', type: 'select', value: '是'},
  88. ]);
  89. });
  90. });