'WDIO - Maximum call stack size exceeded in SauceLab but not in Local Runs

I have automated UI tests (WDIO) that tests whether a form saves and displays the correct data.

All my tests pass when I run it locally, but when I try running it in SauceLab I get this error for some, not all of my tests

RangeError: Maximum call stack size exceeded

I have waitUntil checks to make sure the page is loaded before I navigate to the next page. To navigate to the next page, I click on a dropdown and then the page name, which I also checked it exists and is clickable before clicking it.

 await browser.waitUntil(async () =>
      (await title).waitForExist({
        timeout: 30000,
        timeoutMsg: `Couldn't find title`,
      })
    );

// Wait to click button to show dropdown
(await this.pageButton).waitForClickable(); 
await this.pageButton.click();

// In dropdown, find the page name we want to click
 await pageNameElement.waitForClickable(); 
 await pageNameElement.click();

Does anyone how to fix this?

It works in local runs, but not in SauceLabs and I don't notice any codes going in a loop calling each other. I don't think it's a problem with Saucelab setup since some of the tests pass

Any help? Thank you



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source