我正在尝试将有效的柏树测试转换为打字稿。
以下行被标记为编译错误:
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 }),
但我认为这是选项的错误论点位置