如何使用 Typescript 将超时添加到 Cypress 中的 .contains?
How do I add timeouts to .contains in Cypress using Typescript?
我正在尝试将工作中的柏树测试转换为打字稿。
以下行被标记为编译错误:
cy.contains("here's where you left off...", {timeout: slowLoader })
错误消息说:
Argument of type '{ timeout: number; }' is not assignable to parameter of type 'string | number | RegExp'.
Object literal may only specify known properties, and 'timeout' does not exist in type 'string | number | RegExp'.
slowLoader 在上面定义为:
let slowLoader = 30000; // timeout time for slow loading elements
有什么建议吗?
看了文档后我明白了
contains(selector, content, options)
难道是需要传入
cy.contains("SOME SELECTOR","here's where you left off...", {timeout: slowLoader })
这个测试以前只在 JS 中有效吗?
我的第一个想法是使用关键字来强制它
cy.contains("here's where you left off...",<any> {timeout: slowLoader }),
但我认为选项的参数位置是错误的
我正在尝试将工作中的柏树测试转换为打字稿。
以下行被标记为编译错误:
cy.contains("here's where you left off...", {timeout: slowLoader })
错误消息说:
Argument of type '{ timeout: number; }' is not assignable to parameter of type 'string | number | RegExp'.
Object literal may only specify known properties, and 'timeout' does not exist in type 'string | number | RegExp'.
slowLoader 在上面定义为:
let slowLoader = 30000; // timeout time for slow loading elements
有什么建议吗?
看了文档后我明白了
contains(selector, content, options)
难道是需要传入
cy.contains("SOME SELECTOR","here's where you left off...", {timeout: slowLoader })
这个测试以前只在 JS 中有效吗?
我的第一个想法是使用关键字来强制它
cy.contains("here's where you left off...",<any> {timeout: slowLoader }),
但我认为选项的参数位置是错误的