Open HannaTarasevich opened 8 months ago
@erwinheitzman what do you think?
Thanks for reporting!
We greatly appreciate any contributions that help resolve the bug. While we understand that active contributors have their own priorities, we kindly request your assistance if you rely on this bug being fixed. We encourage you to take a look at our contribution guidelines or join our friendly Discord development server, where you can ask any questions you may have. Thank you for your support, and cheers!
It would be pretty much useful not to fail the method, since actually animations are working in the application even in such cases (e.g., some animation after clicking on other elements like animated dropdown menu appearing).
No. If the browser tab is inactive, the real browser may slow down or even stop the animation.
We cannot detect if there is an active animation due to Policies in place to aid background page performance
Most browsers stop sending `requestAnimationFrame()` callbacks to background tabs or hidden in order to improve performance and battery life.
So if we remove the check
if (document.visibilityState === 'hidden') {
throw Error('You are are checking for animations on an inactive tab, animations do not run for inactive tabs')
}
You just get weird javacript timeout error instead of actual meaningful error.
@BorisOsipov any ideas how the script can be improved?
@HannaTarasevich
Improved in what direction? We can detect animation only via requestAnimationFrame()
callback. Such callback never calls in hidden browser.
If we ignore that the browser is hidden and return true in such a case - we lie to people because actually animation may still be in progress and vice-versa.
I think there may some chromium\ff browser startup args to prevent background trolling, but that is outside the scope of wdio and this script.
E.g. for chromium it seems --disable-renderer-backgrounding
arg.
Got it, thanks. Looks like there is no way to use the method for such cases Animations are working with visibilityState = hidden for my case, so the flag won't help
Have you read the Contributing Guidelines on issues?
WebdriverIO Version
latest
Node.js Version
latest
Mode
Standalone Mode
Which capabilities are you using?
What happened?
Suppose the tests are running in the browser in the background (fully covered by any other window), or the browser with running tests is minimized to tray. In that case, isStable method fails with an error
AssertionError: javascript error: You are are checking for animations on an inactive tab, animations do not run for inactive tabs
.It would be pretty much useful not to fail the method, since actually animations are working in the application even in such cases (e.g., some animation after clicking on other elements like animated dropdown menu appearing).
What is your expected behavior?
isStable is working even if browser tests execution is in the background or in the tray.
How to reproduce the bug.
https://github.com/HannaTarasevich/wdio-timeout-issue
Steps: 1) npm run wdio 2) minimize appeared Chrome for testing browser to the tray right after it appears
Relevant log output
Code of Conduct
Is there an existing issue for this?