| 123456789101112131415161718192021222324252627282930313233343536373839 |
- import {loginIntercept, loginSetup, menuIntercept} from './utils';
- describe('登录页面', function() {
- beforeEach(function() {
- loginIntercept();
- menuIntercept();
- loginSetup();
- });
- it('登录', function() {
- cy.getTestId('user_name').should('contain.text', '超级管理员');
- });
- it('退出', function() {
- cy.get('.ant-dropdown-trigger').trigger('mouseover');
- cy.get('.ant-dropdown').should('be.visible');
- cy.get('.ant-dropdown-menu').children().first().click();
- cy.get('.ant-modal-confirm-btns').children().last().click();
- cy.url().should('contain', '/login');
- });
- it.only('菜单', function() {
- cy.getTestId('menu').children().should('have.length', 4);
- cy.getTestId('menu').children().first().should('include.text', '首页');
- cy.getTestId('menu').children().each(function(el, idx) {
- if (idx === 1) {
- el.find('.ant-menu-submenu-title').trigger('click');
- expect(el.children()).to.length(2);
- expect(el.find('ul.ant-menu').children()).to.length(3);
- expect(
- el.find('ul.ant-menu').children()[0].getAttribute('title'),
- ).to.be.equal('用户管理');
- }
- });
- });
- });
|