我需要should
在赛普拉斯的特定命令中具有自定义超时。我有这个具有全局超时的json文件:
{
"viewportWidth": 1600,
"defaultCommandTimeout": 10000
}
在特定情况下,我需要更长的超时时间,我想要这样的事情:
cy.get('body').should('contain','success', {timeout: 30000})
我该怎么做呢?顺便说一句,我不想覆盖默认命令超时,我需要一个特定的超时。
只需将超时传递给get
,它将传递给should
。
cy.get('body', {timeout: 30000}).should('contain','success')
should
超时部分的官方文档对此进行了说明:
.should()
将继续重试其指定的断言,直到超时。cy.get('input', { timeout: 10000 }).should('have.value', '10') // timeout here will be passed down to the '.should()' // and it will retry for up to 10 secs
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句