storage.cy.ts 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. import {
  2. beforeSetup,
  3. exportIntercept,
  4. generateNetworkResult,
  5. intercept,
  6. intoMenu,
  7. selectAllFilters,
  8. successIntercept,
  9. validateDelete,
  10. validateExport,
  11. validatePut,
  12. validateTableList,
  13. validateTableSearch,
  14. } from './utils';
  15. const basicData = {
  16. id: '734',
  17. storageLocationCode: 'D6-3-51',
  18. storageLocationName: 'D6-3-51',
  19. warehouseWhere: 'e7f6bff1-e6ab-49e7-9',
  20. storageLocationType: '包装类',
  21. materialName: '包装类',
  22. materialId: null,
  23. storageLocationCapacity: null,
  24. isNotDisable: '1',
  25. isProduct: '1',
  26. wareHouseName: '充电设备事业部原材料库',
  27. tldId: 'e7f6bff1-e6ab-49e7-9',
  28. createTime: '2023-04-11 14:32:59',
  29. modifyUser: 'admin',
  30. modifyTime: '2023-04-11 14:32:59',
  31. materialTypeId: null,
  32. page: 0,
  33. limit: 0,
  34. };
  35. const TABLE_NAME = 'storage_table';
  36. describe('库位管理', function() {
  37. beforeEach(function() {
  38. beforeSetup();
  39. intoMenu('基础资料', '库位管理');
  40. });
  41. beforeEach(function() {
  42. intercept('/storage/getStorage', function({search, reply}) {
  43. generateNetworkResult({
  44. search,
  45. reply,
  46. basicData,
  47. title: 'storageLocationCode',
  48. });
  49. });
  50. exportIntercept('/storage/export');
  51. successIntercept([
  52. '/storage/addStorage',
  53. '/storage/updateStorage',
  54. '/storage/delStorage',
  55. ]);
  56. });
  57. it('table', function() {
  58. selectAllFilters('storage_filter', 7);
  59. validateTableList(TABLE_NAME);
  60. validateTableSearch(
  61. TABLE_NAME,
  62. [
  63. 'storageLocationName',
  64. 'storageLocationCode',
  65. {id: 'warehouseWhere', type: 'select', value: '2bdf33b8-4326-47e8-b'},
  66. {
  67. id: 'storageLocationType',
  68. type: 'select',
  69. value: '危化品',
  70. },
  71. {
  72. id: 'isNotDisable',
  73. type: 'select',
  74. value: '0',
  75. eq: 1,
  76. },
  77. {
  78. id: 'isProduct',
  79. type: 'select',
  80. value: '0',
  81. eq: 1,
  82. },
  83. 'modifyUser',
  84. ],
  85. {toolId: 'storage_filter', url: '/storage/getStorage'},
  86. );
  87. });
  88. it('operation', function() {
  89. validateExport(TABLE_NAME);
  90. const {validateAdd, validateEdit} = validatePut(
  91. 'storage_modal',
  92. TABLE_NAME,
  93. {
  94. label: '库位',
  95. },
  96. );
  97. validateAdd([
  98. 'storageLocationCode',
  99. 'storageLocationName',
  100. {id: 'storageWarehouse', type: 'select'},
  101. {id: 'storageIsNotDisable', type: 'select'},
  102. {id: 'storageIsProduct', type: 'select'},
  103. {id: 'storageMaterialType', type: 'select'},
  104. ]);
  105. validateEdit([
  106. {
  107. id: 'storageLocationCode',
  108. value: basicData.storageLocationCode,
  109. type: 'field',
  110. },
  111. {
  112. id: 'storageLocationName',
  113. value: basicData.storageLocationName,
  114. type: 'field',
  115. },
  116. {
  117. id: 'storageWarehouse',
  118. value: basicData.wareHouseName,
  119. type: 'select',
  120. },
  121. {
  122. id: 'storageIsNotDisable',
  123. value: '是',
  124. type: 'select',
  125. },
  126. {
  127. id: 'storageIsProduct',
  128. value: '是',
  129. type: 'select',
  130. },
  131. ]);
  132. validateDelete(TABLE_NAME, '库位', {title: 'D6-3-51'});
  133. });
  134. });