tests: functional: Disable smooth scrolling from Bootstrap 5

- When an item needs to be scrolled into view, the slow scrolling leads to an
early click causing the click to happen on an element that is not in view. Fix
this by disabling smooth scrolling in browser options.

-
https://salsa.debian.org/freedombox-team/freedombox/-/merge_requests/2576#note_558614
- https://github.com/SeleniumHQ/selenium/issues/11136#issuecomment-1370803713

Tests:

- Run functional tests on wordpress app.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
[vexch: Move importing from selenium into function to prevent unit tests depend
on selenium]
Signed-off-by: Veiko Aasa <veiko17@disroot.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
This commit is contained in:
Sunil Mohan Adapa 2024-12-11 10:03:26 -08:00 committed by Veiko Aasa
parent 765e3176fa
commit 2aa9f72ea1
No known key found for this signature in database
GPG Key ID: 478539CAE680674E

View File

@ -121,6 +121,15 @@ def splinter_wait_time():
return 0.01
@pytest.fixture(scope='session')
def splinter_driver_kwargs():
"""Disable smooth scrolling to fix 'Element x not clickable' errors."""
from selenium.webdriver.firefox.options import Options
driver_options = Options()
driver_options.set_preference('general.smoothScroll', False)
return {'options': driver_options}
@pytest.fixture(scope='session')
def splinter_browser_load_condition():
"""When a page it loaded, wait until <body> is available."""