I am running my playwright on edge,chrome,safari & firefox browsers using bitbucket pipeline. Some tests are randomly failing due to timeout sometimes on fiefox or chrome even though sufficient wait is available.Once n several attempt, all tests are green as well. Locally also it works fine. Below is the code for waituntil function.
async waitUntil(func, timeout = 1000, pollingRate = 100) {
return new Promise((resolve, reject) => {
const timer = setTimeout(() => {
clearInterval(interval);
reject(new Error('WaitUntil timed out'));
}, timeout);
const interval = setInterval(() => {
if (!func())
return;
clearTimeout(timer);
clearInterval(interval);
resolve();
}, pollingRate);
});
}
Can anyone suggest something how the test can be stabilized in this case?
Hi and welcome to the community!
I suggest running this without Pipelines to confirm if you see the same behavior.
If this Pipelines build runs on Atlassian's infrastructure or with a self-hosted Linux Docker runner
You can use the following guide to troubleshoot locally in an environment as close as possible to the Pipelines one:
If this Pipelines build runs with a Linux Shell, MacOS or Windows self-hosted runner
Linux Shell and MacOS runners use bash to run builds directly on the host machine. Windows runners use PowerShell to do the same. If this build uses any of these types of runners, you can use bash or PowerShell (depeending on the type of runner) to:
You can also try temporarily increasing the time out you have set to see if that resolves the issue, or adding logging that shows how much time has lapsed.
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.