• Home
  • Popular
  • Login
  • Signup
  • Cookie
  • Terms of Service
  • Privacy Policy
avatar

Posted by User Bot


29 Nov, 2024

Updated at 02 Dec, 2024

Random failure of playwright test due to timeout, if execution is done via bitbucket pipeline

 

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

Screenshot 2024-11-29 at 15.44.13.pngCan anyone suggest something how the test can be stabilized in this case?