I am creating a new Appium WebDriver session using WebdriverIO API:
const options = {...};
const driver: Browser<"async">;
try {
driver = await remote(options);
} catch (error) {
console.log("Error:", error);
}
In BrowserStack there is a limit on the number of parallel tests that one can run. I am hitting that limit and my call to remote
errors and, in the catch, I get this inside variable error
:
Failed to create session.
Which does not give me much info on why the call failed. On the other hand, the driver is emitting logs that give such an answer:
XXXX-XX-XXTXX:XX:XX.XXXZ ERROR webdriver: [BROWSERSTACK_ALL_PARALLELS_IN_USE] All parallel tests are currently in use, including the queued tests. Please wait to finish or upgrade your plan to add more sessions.: [BROWSERSTACK_ALL_PARALLELS_IN_USE] All parallel tests are currently in use, including the queued tests. Please wait to finish or upgrade your plan to add more sessions.
at Object.getErrorFromResponseBody (/home/vsts/work/1/s/node_modules/webdriverio/node_modules/webdriver/build/utils.js:189:12)
at /home/vsts/work/1/s/node_modules/webdriverio/node_modules/webdriver/build/request.js:168:31
at Generator.next (<anonymous>)
at asyncGeneratorStep (/home/vsts/work/1/s/node_modules/webdriverio/node_modules/webdriver/build/request.js:9:103)
at _next (/home/vsts/work/1/s/node_modules/webdriverio/node_modules/webdriver/build/request.js:11:194)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
Question
How can I get more information about the nature of the error as I am calling remote
? I want to detect the occurrence of BROWSERSTACK_ALL_PARALLELS_IN_USE
so that I can implement, in code, some strategies around this issue (like retrying after some randomized time).
The error
BROWSERSTACK_ALL_PARALLELS_IN_USE
indicates that all your running threads and queued threads are full and no more test can be triggered.Once you have maxed out your running + queued threads, any new sessions initiated are dropped with
BROWSERSTACK_ALL_PARALLELS_IN_USE
.You will not be able to trigger any more tests until there are threads available.
You can take a look at https://webdriver.io/docs/organizingsuites/ by setting
maxInstances
. This will allow you to limit the number of tests triggered.