我有一些输入
<input />
Run Code Online (Sandbox Code Playgroud)
如何断言输入具有真实值?
我认为这是可能的
cy('input').should('not.have.value', '')
Run Code Online (Sandbox Code Playgroud)
但我认为它有点不可靠。或者可能不是。但无论如何,知道一些其他方法来检查真实值会很高兴。
Ale*_*rff 19
刚刚发现调用的东西,所以可以这样做:
cy.get('input').invoke('val').should("be.ok");
cy.get('input').invoke('val').should('not.be.empty') // works in the same way.
Run Code Online (Sandbox Code Playgroud)
invoke 是调用函数的方式(在这种情况下是jquery 命令)。
| 归档时间: |
|
| 查看次数: |
8012 次 |
| 最近记录: |