Skip to content

Commit 16ed525

Browse files
committed
[tests] Selenium: increased timeout and disabled hw acceleration
1 parent bf7e38c commit 16ed525

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

openwisp_utils/test_selenium_mixins.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,23 @@ class SeleniumTestMixin:
2121
@classmethod
2222
def setUpClass(cls):
2323
super().setUpClass()
24-
firefox_options = Options()
25-
firefox_options.page_load_strategy = 'eager'
24+
options = Options()
25+
options.page_load_strategy = 'eager'
2626
if os.environ.get('SELENIUM_HEADLESS', False):
27-
firefox_options.add_argument('--headless')
27+
options.add_argument('--headless')
2828
GECKO_BIN = os.environ.get('GECKO_BIN', None)
2929
if GECKO_BIN:
30-
firefox_options.binary_location = GECKO_BIN
31-
firefox_options.set_preference(
32-
'network.stricttransportsecurity.preloadlist', False
33-
)
30+
options.binary_location = GECKO_BIN
31+
options.set_preference('network.stricttransportsecurity.preloadlist', False)
3432
# Enable detailed GeckoDriver logging
35-
firefox_options.set_capability(
36-
'moz:firefoxOptions', {'log': {'level': 'trace'}}
37-
)
38-
kwargs = dict(options=firefox_options)
33+
options.set_capability('moz:firefoxOptions', {'log': {'level': 'trace'}})
34+
# Use software rendering instead of hardware acceleration
35+
options.set_preference('gfx.webrender.force-disabled', True)
36+
options.set_preference('layers.acceleration.disabled', True)
37+
# Increase timeouts
38+
options.set_preference('marionette.defaultPrefs.update.disabled', True)
39+
options.set_preference('dom.max_script_run_time', 30)
40+
kwargs = dict(options=options)
3941
# Optional: Store logs in a file
4042
# Pass GECKO_LOG=1 when running tests
4143
GECKO_LOG = os.environ.get('GECKO_LOG', None)

0 commit comments

Comments
 (0)