【发布时间】:2020-01-07 20:19:56
【问题描述】:
柏树说:
cy.get('[data-cy="my-checkbox"]')
.click()
.should('be.checked')
我在别处也见过:
cy.get('[data-cy="my-checkbox"]')
.click()
.should('have.attr', 'checked')
虽然上面实际上是在测试“not.have.attr”,但这可能是一个弱测试,因为这可能意味着任何事情!它在我的测试中不起作用。
使用 quasar 我无法使用“check()”,因为 quasar 呈现的不是复选框,但我使用了“click()”,它确实选中了该框。
回应:
CypressError: Timed out retrying: expected '<div.q-checkbox.cursor-pointer.no-outline.row.inline.no.wrap.items-center>' to have attribute 'checked'
【问题讨论】: