WebdriverIO waitUntil 示例不起作用

WebdriverIO waitUntil example is not working

我正在尝试使用 Webdriverio v5,但在 运行 waitUntil https://webdriver.io/docs/api/browser/waitUntil.html

示例中遇到问题
it('should wait until text has changed', () => {
    browser.waitUntil(() => {
      return $('#someText').getText() === 'I am now different'
    }, 5000, 'expected text to be different after 5s');
});

错误是说

Type 'boolean' is not assignable to type 'Promise<boolean>'

还有其他人遇到同样的问题吗?

或者如何解决?

而在 v4 中一切正常

您似乎在测试中使用了打字稿。确保您已完成整个 typescript/webdriverio 设置:https://webdriver.io/docs/typescript.html

在这种情况下,我认为您需要将 wdio-sync 添加到 compilerOptions types 设置中。

"compilerOptions": {
    "types": ["node", "@wdio/sync"]
}