【问题标题】:WebdriverIO-Jasmine Async function did not complete within 10000msWebdriverIO-Jasmine Async 函数未在 10000ms 内完成
【发布时间】:2021-07-08 09:35:27
【问题描述】:

我正在将 WDIO 与 Jasmine 和 Chai 一起使用。

我收到以下错误,并且我已经尝试找到根本原因超过一天了。

错误:超时 - 异步函数未在 10000 毫秒内完成(由 jasmine.DEFAULT_TIMEOUT_INTERVAL 设置)

代码:

describe('Lead Routing Functionality', () => {
    beforeEach(function () {
        LightningLeadPage.open();
        LightningLeadPage.login();
        console.log('[TEST STEP INFO]: Checking Header: ');
    });
it('Verify validation', () => {
        LightningLeadPage.click_app_launcher();
});
              *************
export default class Lightning_Page {
click_app_launcher() {
    console.log("[TEST STEP INFO]: Verify App launcher icon is present. ");
    console.log('DEBUG : I am waiting...')
    this.appLauncher().waitForExist(this.waitDuration());
    console.log("[TEST STEP INFO]: Clicking on App Launcher");
    this.appLauncher().click();
  }

我注意到 console.log('DEBUG : I am waiting...') 没有打印在控制台上。

Error log:
[0-0] Error in "Verify validation"
Error: Timeout - Async function did not complete within 10000ms (set by jasmine.DEFAULT_TIMEOUT_INTERVAL)
    at <Jasmine>
    at listOnTimeout (internal/timers.js:549:17)
    at processTimers (internal/timers.js:492:7)
[0-0] DEPRECATION: An asynchronous before/it/after function took a done callback but also returned a promise. This is not supported and will stop working in the future. Either remove the done callback (recommended) or change the function to not return a promise.

config.js 值:

waitforTimeout: 10000,
    connectionRetryTimeout: 90000,
    connectionRetryCount: 3,
    wdioRetries:3,

jasmineNodeOpts: {
        defaultTimeoutInterval: (24 * 60 * 60 * 1000),
        expectationResultHandler: function(passed, assertion) {
            // do something
        }
    },

【问题讨论】:

  • 我认为this.appLauncher().waitForExist 有问题。你看到DEBUG : I am waiting... 更重要的是[TEST STEP INFO]: Click on App Launcher 的日志了吗?
  • 它没有到达 this.appLauncher().waitForExist。甚至不打印 "DEBUG : I am waiting..." 。 .失败并出现错误:[0-0] [TEST STEP INFO]:验证应用启动器图标是否存在。 [0-0]“验证验证”错误:超时 - 异步函数未在 10000 毫秒内(由 jasmine.DEFAULT_TIMEOUT_INTERVAL 设置)在 processTimers(内部/timers.js:492:7) ```
  • 好的,那我想你必须检查一下它是否卡在 openlogin 上。
  • 不是。现在我看到它到达 console.log("[TEST STEP INFO]: Verify App launcher icon is present."),然后失败。我怀疑这是一个代码问题。与 WDIO 等待有什么关系?
  • 从外观上看,10s 似乎有什么卡住了。是否有任何操作需要超过 10 秒的时间?

标签: javascript jasmine webdriver-io wdio-jasmine


【解决方案1】:

我在尝试将 WDIO 升级到 v7 时也遇到了这个问题。在进一步研究时,我注意到在 wdio 配置中指定 jasmine 选项的名称已从 jasmineNodeOpts 更改为 jasmineOpts。它也在他们的updated documentation 中。一旦我在我的 wdio 配置中更新了它,现在 v7 就很好了。

【讨论】:

    【解决方案2】:

    我发现这是 wdio/jasmine V7 及更高版本的问题。将其恢复为 6.something 并且它应该可以工作(6.7.2 对我有用)。 您可以在测试开始时进行调试,但它仍然会失败 - 可能想在 wdio git 上报告这一点

    【讨论】:

      【解决方案3】:

      在最新更新 (https://webdriver.io/docs/frameworks/#intercept-assertion) 之后,似乎区别在于 jasmineOpts 与 jasmineNodeOpts。

      我刚刚从 jasmineNodeOpts 更改为 jasmineOpts。一切都和升级前一样。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2014-10-25
        • 1970-01-01
        • 1970-01-01
        • 2021-05-22
        • 2018-09-23
        • 1970-01-01
        • 2013-07-13
        相关资源
        最近更新 更多