gun.cy.ts 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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: '1',
  14. code: '4M',
  15. name: '4M',
  16. type: '0',
  17. };
  18. describe('枪线管理', function() {
  19. beforeEach(function() {
  20. beforeSetup();
  21. intoMenu('基础资料', '枪线管理');
  22. });
  23. beforeEach(function() {
  24. intercept('/dictionary/getGunLine', function({reply, search}) {
  25. generateNetworkResult({
  26. search,
  27. reply,
  28. basicData,
  29. title: 'code',
  30. skipCondition: val => val === 'type',
  31. });
  32. });
  33. successIntercept(['/dictionary/editGunLine', '/dictionary/delGunLine']);
  34. });
  35. it('table', function() {
  36. validateTableList('gun_table');
  37. validateTableSearch(
  38. 'gun_table',
  39. [
  40. 'code',
  41. 'name',
  42. ],
  43. {toolId: 'gun_filter', url: '/dictionary/getGunLine'},
  44. );
  45. });
  46. it('operation', function() {
  47. const {validateAdd, validateEdit} = validatePut(
  48. 'gun_modal',
  49. 'gun_table',
  50. {label: '信息'},
  51. );
  52. validateAdd(['name', 'code']);
  53. validateEdit([{type: 'field', value: basicData.name, id: 'name'}]);
  54. validateDelete('gun_table', '枪线信息', {title: 'page-1'});
  55. });
  56. });