storage.cy.ts 3.1 KB

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