dictionary.cy.ts 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. import {
  2. beforeSetup,
  3. generateNetworkResult,
  4. intercept,
  5. intoMenu,
  6. successIntercept,
  7. validateDelete,
  8. validatePut,
  9. validateTableList,
  10. validateTableSearch,
  11. } from './utils';
  12. const basicData = {
  13. id: '23',
  14. code: '1000',
  15. name: '充电设备事业部成品库',
  16. tldId: 'fa4e9d0a-8dac-4d8d-9',
  17. specificationAndModel: null,
  18. unitOfMeasurement: null,
  19. materialId: null,
  20. num: null,
  21. type: '0',
  22. tableName: null,
  23. size: null,
  24. materialType: null,
  25. wllbClass: null,
  26. isNotDisable: null,
  27. isRecommend: null,
  28. partType: null,
  29. page: 0,
  30. limit: 0,
  31. amount: null,
  32. minNum: null,
  33. maxNum: null,
  34. modifyUser: null,
  35. modifyTime: null,
  36. typeVal: null,
  37. companyNumber: null,
  38. warehouseType: '产成品仓库',
  39. nameOrCode: null,
  40. };
  41. describe('字典列表, 只用仓库管理做测试', function() {
  42. beforeEach(function() {
  43. beforeSetup();
  44. intoMenu('基础资料', '仓库管理');
  45. });
  46. beforeEach(function() {
  47. intercept('/dictionary/getDictionaryPage', function({reply, search}) {
  48. generateNetworkResult({
  49. reply,
  50. search,
  51. basicData,
  52. title: 'tldId',
  53. skipCondition: name => name === 'type',
  54. });
  55. });
  56. successIntercept([
  57. '/dictionary/updateDictionary',
  58. '/dictionary/addDictionary',
  59. '/dictionary/deleteDictionary',
  60. '/maintenance/updateWarehouse',
  61. ]);
  62. });
  63. it('table', function() {
  64. validateTableList('dictionary_table');
  65. validateTableSearch(
  66. 'dictionary_table',
  67. [
  68. 'dictionaryName',
  69. 'dictionaryCode',
  70. {id: 'warehouseType', type: 'select', value: '0'},
  71. ],
  72. {toolId: 'dictionary_filter', url: '/dictionary/getDictionaryPage'},
  73. );
  74. });
  75. it('operation', function() {
  76. const {validateAdd, validateEdit} = validatePut(
  77. 'dicionary_modal',
  78. 'dictionary_table',
  79. {label: '仓库'},
  80. );
  81. validateAdd(['dictionaryId', 'dictionaryName', 'dictionaryCode']);
  82. validateEdit([{id: 'storageType', type: 'select', value: '产成品仓库'}]);
  83. validateDelete('dictionary_table', '仓库', {title: basicData.name});
  84. });
  85. });