semiReport.cy.ts 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. import {
  2. loginIntercept,
  3. menuIntercept,
  4. loginSetup,
  5. intoMenu,
  6. intercept,
  7. successIntercept,
  8. validateTableList,
  9. validateTableSearch,
  10. selectClick,
  11. clickDatePicker,
  12. tableBtnClick,
  13. validateModalOperation,
  14. } from './utils';
  15. describe('半成品入库申请', function () {
  16. beforeEach(function () {
  17. loginIntercept();
  18. menuIntercept();
  19. loginSetup();
  20. intoMenu('入库管理', '半成品报工单管理');
  21. });
  22. beforeEach(function () {
  23. intercept('/warehousing/getNotice', function ({search, reply}) {
  24. if (search.has('materialCode') && search.get('materialCode').length)
  25. return reply({fixture: 'semi-report/search1'});
  26. if (search.has('type') && search.get('type').length)
  27. return reply({fixture: 'semi-report/search2'});
  28. if (
  29. search.has('startTime') &&
  30. search.get('startTime').length &&
  31. search.has('endTime') &&
  32. search.get('endTime').length
  33. )
  34. return reply({fixture: 'semi-report/search3'});
  35. const page = search.get('page');
  36. reply({fixture: `semi-report/list${page}`});
  37. });
  38. successIntercept('/warehousing/addInventoryNotice');
  39. });
  40. const tableName = 'semi_report_table';
  41. it('表格', function () {
  42. validateTableList(tableName);
  43. const validate = validateTableSearch(tableName);
  44. cy.get('#filter_semiReportCode').type('code');
  45. validate('search1');
  46. cy.get('#filter_semiReportCode').clear();
  47. selectClick('filter_semiReportType', 1);
  48. validate('search2');
  49. selectClick('filter_semiReportType', 0);
  50. clickDatePicker('date_filter_rawMaterialDates');
  51. validate('search3');
  52. });
  53. it('入库操作', function () {
  54. tableBtnClick(tableName, 0);
  55. cy.getTestId('field_putInStoragenum').should('have.value', '80');
  56. validateModalOperation('semi_report_modal', '入库成功');
  57. });
  58. });