123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- import {
- beforeSetup,
- generateNetworkResult,
- intercept,
- intoMenu,
- successIntercept,
- tableBtnClick,
- validateDelete,
- validatePut,
- validateTableList,
- validateTableSearch,
- } from './utils';
- const basicData = {
- id: '7',
- name: '系统设置',
- url: '.',
- pId: '0',
- idCode: null,
- type: 'PC',
- page: 0,
- limit: 0,
- orderBy: '0',
- menu: null,
- img: 'xitongguanli',
- modifyUser: 'admin',
- modifyTime: '2023-03-29 13:42:47',
- pid: '0',
- };
- const TABLE_NAME = 'menu_table',
- TABLE_NAME2 = 'child_menu_table';
- describe('菜单管理', function () {
- beforeEach(function () {
- beforeSetup(true);
- intoMenu('系统设置', '菜单管理');
- });
- beforeEach(function () {
- intercept('/menu/getPage', function ({search, reply}) {
- generateNetworkResult({
- search,
- reply,
- basicData,
- title: 'name',
- skipCondition(name) {
- return name === 'pId' || name === 'type';
- },
- });
- });
- successIntercept(['/menu/addMenu', '/menu/updateMenu', '/menu/delMenu']);
- });
- it('table', function () {
- validateTableList(TABLE_NAME);
- validateTableSearch(TABLE_NAME, ['menuName', 'modifyUser'], {
- toolId: 'menu_filter',
- url: '/menu/getPage',
- });
- });
- it('operation', function () {
- const {validateAdd, validateEdit} = validatePut('menu_modal', TABLE_NAME, {
- label: '菜单',
- });
- validateAdd(['menuName', 'menuIcon', 'menuOrderBy']);
- validateEdit([
- {id: 'menuName', type: 'field', value: basicData.name},
- {id: 'menuIcon', type: 'field', value: basicData.img},
- {id: 'menuOrderBy', type: 'field', value: basicData.orderBy},
- ]);
- validateDelete(TABLE_NAME, '菜单', {eq: 2, title: 'page-1'});
- });
- it('子菜单表格', function () {
- tableBtnClick(TABLE_NAME, 1);
- validateTableList(TABLE_NAME2);
- validateTableSearch(TABLE_NAME2, ['childMenuName', 'modifyUser'], {
- toolId: 'child_menu_filter',
- url: '/menu/getPage',
- });
- });
- it.only('子菜单操作', function () {
- tableBtnClick(TABLE_NAME, 1);
- const {validateAdd, validateEdit} = validatePut(
- 'child_menu_modal',
- TABLE_NAME2,
- {
- label: '菜单',
- },
- );
- validateAdd(['menuName', 'menuUrl', 'menuOrderBy']);
- validateEdit([
- {id: 'menuName', type: 'field', value: basicData.name},
- {id: 'menuUrl', type: 'field', value: basicData.url},
- {id: 'menuOrderBy', type: 'field', value: basicData.orderBy},
- ]);
- validateDelete(TABLE_NAME2, '菜单', {title: 'page-1'});
- });
- });
|