123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- import {beforeSetup} from './utils';
- describe('登录测试', function () {
- beforeEach(function () {
- beforeSetup();
- });
- function inputLogin() {
- cy.get('input[name="accountName"]').clear().type('admin');
- cy.get('input[name="accountPassword"]').clear().type('tld123');
- cy.getTestId('login_form').submit();
- cy.get('.ant-message-notice-content').should('include.text', '登录成功');
- }
- function logOut() {
- cy.get('.ant-dropdown-trigger').trigger('mouseover');
- cy.get('.ant-dropdown-menu-item').eq(1).click();
- cy.get('.ant-modal-confirm-btns').find('.ant-btn-primary').click();
- cy.get('h2').should('include.text', '你特别,我来电');
- }
- it('登录测试', function () {
- cy.visit('/');
- inputLogin();
- logOut();
- cy.getTestId('memo_user_name').check();
- inputLogin();
- logOut();
- cy.getTestId('memo_user_name').should('be.checked');
- cy.getTestId('memo_all').should('not.be.checked');
- cy.get('input[name="accountName"]').should('have.value', 'admin');
- cy.get('input[name="accountPassword"]').should('have.value', '');
- cy.getTestId('memo_user_name').uncheck();
- cy.getTestId('memo_all').check();
- inputLogin();
- logOut();
- cy.getTestId('memo_all').should('be.checked');
- cy.getTestId('memo_user_name').should('not.be.checked');
- cy.get('input[name="accountName"]').should('have.value', 'admin');
- cy.get('input[name="accountPassword"]').should('have.value', 'tld123');
- });
- });
|