如果想从头学起Cypress,可以看下面的系列文章哦
https://www.cnblogs.com/poloyy/category/1768839.html
it('错误哦做法,强制等待的栗子', function () {
cy.server()
cy.route('/commands/action/*').as('getAction')
cy.wait(3000)
cy.log(123)
});
it('正确的做法,使用别名来等待', function () {
cy.server()
cy.route('/commands/action/*').as('getAction')
cy.wait('@getAction', {timeout: 50000}).then(function (xhr) {
cy.log(xhr)
})
});