each(($el, index, $list) => { ... }
, $el文档说是jquery元素, 但是直接用jquery方法不行( 比如click)
解决方法: 用cy.wrap传入元素
cy.get('@item').each(($el, index, $list) => {
cy.wrap($el).click().find('li:first').click();
});
等价于
cy.get('@item').eq(0).click().find('li:first').click(); cy.get('@item').eq(1).click().find('li:first').click(); cy.get('@item').eq(2).click().find('li:first').click();
不支持原生的promise.all,需要用Cypress.Promise.all
讨论:https://github.com/cypress-io/cypress/issues/915
new Cypress.Promise.all([ promise1, promise2 ]).then( ()=>{ ... } )
原文:https://www.cnblogs.com/catsinwinter/p/11529985.html