From 2aa9f72ea1f043329faf0b9bb8bb668122d12b97 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Wed, 11 Dec 2024 10:03:26 -0800 Subject: [PATCH] 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 [vexch: Move importing from selenium into function to prevent unit tests depend on selenium] Signed-off-by: Veiko Aasa Reviewed-by: Veiko Aasa --- plinth/conftest.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/plinth/conftest.py b/plinth/conftest.py index 6ab851b0c..df8527692 100644 --- a/plinth/conftest.py +++ b/plinth/conftest.py @@ -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 is available."""