当我尝试通过 cypress 执行断言并且只需要一些帮助时,我收到了一个奇怪的错误。我要做的只是显示一个选项已添加到投注单中。
我收到的错误是:
get Object{5}
assert expected { Object (0, length) } to be visible
Timed out retrying after 4000ms: Cannot read properties of undefined (reading 'toLowerCase')
这发生在这一步:
And ("The number of elements is {string}", (number) => {
cy.get(elements.selection()).should('be.visible').should('have.length', number);
})
它指向的元素是:
class Elements {
selection(){
return cy.get('.__selection')
}
}
export default Elements