goods.cy.ts 1.6 KB

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