Pre*_*mar 8 testing angular cypress
我想检查我创建的登录屏幕中是否存在文本“您必须输入一个值”(附有屏幕截图)。当用户触摸输入字段,然后单击不同的字段或区域而不输入任何内容时,就会出现这种情况。所以我尝试用 cypress 测试它,但它说
".type() will not accept an empty string"
Run Code Online (Sandbox Code Playgroud)
柏:
it('Should display You must enter a value if user does not type anything', () => {
cy.get('#username').type('')
cy.contains('You must enter a value')
})
Run Code Online (Sandbox Code Playgroud)
我需要帮助来解决这个问题,谢谢。
实际上只是聚焦和模糊:
it('Should display You must enter a value if user does not type anything', () => {
cy.get('#username')
.focus()
.blur()
cy.contains('You must enter a value')
})
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4942 次 |
| 最近记录: |