WebdriverIO-Jasmine Async function did not complete within 10000ms

2.2k Views Asked by At

I am using WDIO with Jasmine and Chai.

I am getting the below error and I have been trying to find the root cause for more than a day now.

Error: Timeout - Async function did not complete within 10000ms (set by jasmine.DEFAULT_TIMEOUT_INTERVAL)

Code:

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();
  }

I noticed console.log('DEBUG : I am waiting...') is not printed on console.

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 values:

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

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

There are 3 best solutions below

0
On

I came across this as well while trying to upgrade WDIO to v7. While looking into this further, I noticed that the name to specify jasmine options in wdio config has changed from jasmineNodeOpts to jasmineOpts. It is in their updated documentation as well. Once I updated that in my wdio configs, it is now good with v7.

0
On

I found this to be an issue with wdio/jasmine V7 and up. Revert it to 6.something and it should work (6.7.2 works for me). You can put a debug at the very beginning of the test and it will still fail - might want to report this on the wdio git

0
On

Looks like the difference was jasmineOpts vs jasmineNodeOpts after the latest update (https://webdriver.io/docs/frameworks/#intercept-assertion).

I just changed from jasmineNodeOpts to jasmineOpts. And everything worked like before the upgrade.