describe('The Home Page', () => { beforeEach(() => { cy.visit('http://localhost:8080') }) it('标题的文字', () => { cy.get('.login-title > span').should('have.text', "登录智慧能源") }) it('输入不规范账号密码', () => { cy.intercept( 'https://www.enesoon-saas-back-test.cn:8381/**/*', { middleware: true }, (req) => { req.on('before:response', (res) => { // force all API responses to not be cached res.headers['cache-control'] = 'no-store' }) } ).as('login'); cy.get('body > uni-app > uni-page > uni-page-wrapper > uni-page-body > uni-view > uni-view:nth-child(2) > uni-view:nth-child(1) > uni-input > div > input') .type('have.text') cy.get('body > uni-app > uni-page > uni-page-wrapper > uni-page-body > uni-view > uni-view:nth-child(2) > uni-view:nth-child(2) > uni-input > div > input') .type('have.text') cy.get('.login').click() cy.wait("@login").its('response.body').should((rep) => { expect(rep).to.have.property("code", 1) expect(rep).to.have.property("message", '用户名非邮箱手机号') }) }) })