With the Automated Testing Framework, high performance is necessary from a browser tab or window that does not have the focus. However, several browser manufacturers, in an effort to avoid CPU overuse, dramatically throttle back the amount of CPU allocated to tabs that do not have focus, windows that are completely occluded by other windows, and the entire browser when the system lock screen is displayed.
In the case of the ATF, CPU resources are desired for the tab/window but browser providers do not provide a mechanism to indicate that preference. For automated testing, this often means that laptops or unattended machines with the sole responsibility of running tests are configured so that tests run so slowly that timeouts become commonplace.
At this time of this writing, the affected supported browsers are Chrome, Firefox, and Safari: Mac OS X.
Steps to Reproduce
- Run a test in Chrome.
- Open the Client Test Runner.
- Return to the original tab.
Note that the test completes far more slowly than if it had focus.
There are several ways in which customers can avoid this issue:
- Run unattended tests on a machine that does not automatically turn on a lock screen.
- Use a browser that does not have a built-in throttle, especially for systems where a lock screen must be on for compliance reasons.
- Browser test through the ATF either by leaving the Client Test Runner as the foreground window or by making sure that the browser tab for the ATF is in its own window and has sufficient screen real estate, showing through to the user in a large enough percentage of the screen, that the browser grants it the full allotment of CPU time.
- OS X - Chrome 57 and later: start the application from command prompt with these parameters:
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --disable-background-timer-throttling --disable-renderer-backgrounding
- Windows - Chrome 57 and later: update the application shortcut with a command-line flag to disable the throttling behavior
Shortcut target: "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" -disable-background-timer-throttling -disable-renderer-backgrounding
|Note: Information provided here can be rendered inaccurate at any time as the browser providers release new versions. Throttles may be added to or removed from browsers at any time.|
Related Problem: PRB822056