import { loginIntercept, menuIntercept, loginSetup, optionsIntercept, dictionaryIntercept, intercept, successIntercept, validateTableList, validateTableSearch, validatePut, validateSelect, intoMenu, } from './utils'; describe('物料管理', function () { beforeEach(function () { loginIntercept(); menuIntercept(); loginSetup(); optionsIntercept(); dictionaryIntercept(); intoMenu('基础数据管理', '物料管理'); }); beforeEach(function () { intercept('/dictionary/getDictionaryPage', function ({search, reply}) { if (search.has('name') && search.get('name').length) return reply({fixture: 'dictonary/search1'}); if (search.has('code') && search.get('code').length) return reply({fixture: 'dictonary/search2'}); const page = search.get('page'); reply({fixture: `dictonary/list${page}`}); }); successIntercept('/materialClass/updateMaterial'); }); const TABLE_NAME = 'goods_table', MODAL_NAME = 'goods_modal'; it('表单', function () { validateTableList(TABLE_NAME); const validate = validateTableSearch(TABLE_NAME); cy.get('#filter_goodsName').type('name'); validate('search1'); cy.get('#filter_goodsName').clear(); cy.get('#filter_goodsCode').type('code'); validate('search2'); }); it.only('修改操作', function () { const {validateEdit} = validatePut(MODAL_NAME, '物料'); validateEdit(TABLE_NAME, function () { validateSelect('select_goodsType', '546'); cy.getTestId('field_goodsSize').should('have.value', '1'); validateSelect('select_goodsMixin', '是'); validateSelect('select_goodsRecommend', '是'); cy.get('#operation_goodsPartType').should('have.value', '半成品'); }); }); });