goods.cy.ts 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import {
  2. loginIntercept,
  3. menuIntercept,
  4. loginSetup,
  5. optionsIntercept,
  6. dictionaryIntercept,
  7. menuTrigger,
  8. intercept,
  9. successIntercept,
  10. selectClick,
  11. validateTableList,
  12. validateTableSearch,
  13. validatePut,
  14. validateSelect,
  15. } from './utils';
  16. describe('物料管理', function() {
  17. beforeEach(function() {
  18. loginIntercept();
  19. menuIntercept();
  20. loginSetup();
  21. optionsIntercept();
  22. dictionaryIntercept();
  23. menuTrigger(2, 2);
  24. });
  25. beforeEach(function() {
  26. intercept('/dictionary/getDictionaryPage', function({search, reply}) {
  27. if (search.has('name') && search.get('name').length)
  28. return reply({fixture: 'dictonary/search1'});
  29. if (search.has('code') && search.get('code').length)
  30. return reply({fixture: 'dictonary/search2'});
  31. const page = search.get('page');
  32. reply({fixture: `dictonary/list${page}`});
  33. });
  34. successIntercept('/materialClass/updateMaterial');
  35. });
  36. const TABLE_NAME = 'goods_table',
  37. MODAL_NAME = 'goods_modal';
  38. it('表单', function() {
  39. validateTableList(TABLE_NAME);
  40. const validate = validateTableSearch(TABLE_NAME);
  41. cy.get('#filter_goodsName').type('name');
  42. validate('search1');
  43. cy.get('#filter_goodsName').clear();
  44. cy.get('#filter_goodsCode').type('code');
  45. validate('search2');
  46. });
  47. it.only('修改操作', function() {
  48. const {validateEdit} = validatePut(MODAL_NAME, '物料');
  49. validateEdit(TABLE_NAME, function() {
  50. validateSelect('select_goodsType', '546');
  51. cy.getTestId('field_goodsSize').should('have.value', '1');
  52. validateSelect('select_goodsMixin', '是');
  53. });
  54. });
  55. });