From d61e26567d81d0163c606519ecd0ecc0d6a62e4b Mon Sep 17 00:00:00 2001 From: Robert Sparks Date: Thu, 24 Jun 2021 16:39:36 +0000 Subject: [PATCH] Scroll to buttons before clicking on them in Selenium tests. Fixes #3314. Commit ready for merge. - Legacy-Id: 19153 --- ietf/group/tests_js.py | 2 ++ ietf/meeting/tests_js.py | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/ietf/group/tests_js.py b/ietf/group/tests_js.py index 4200efeff..f73121b08 100644 --- a/ietf/group/tests_js.py +++ b/ietf/group/tests_js.py @@ -45,6 +45,7 @@ class MilestoneTests(IetfSeleniumTestCase): expected_conditions.element_to_be_clickable((By.CSS_SELECTOR, submit_button_selector)) ) self.assertIn(label, submit_button.text) + self.scroll_to_element(submit_button) submit_button.click() def _assert_milestone_changed(self): @@ -80,6 +81,7 @@ class MilestoneTests(IetfSeleniumTestCase): expected_conditions.element_to_be_clickable( (By.CSS_SELECTOR, 'button.add-milestone') )) + self.scroll_to_element(add_milestone_button) add_milestone_button.click() edit_div = self.wait.until( diff --git a/ietf/meeting/tests_js.py b/ietf/meeting/tests_js.py index 3087c8597..383b09c9e 100644 --- a/ietf/meeting/tests_js.py +++ b/ietf/meeting/tests_js.py @@ -862,6 +862,7 @@ class AgendaTests(IetfSeleniumTestCase): # Click the group button group_button = self.get_agenda_filter_group_button(wait, group_acronym) + self.scroll_to_element(group_button) group_button.click() # Check visibility @@ -927,6 +928,7 @@ class AgendaTests(IetfSeleniumTestCase): # enable hackathon group group_button = self.get_agenda_filter_group_button(wait, 'hackathon') + self.scroll_to_element(group_button) group_button.click() self.assert_agenda_item_visibility(['mars', 'hackathon']) @@ -968,6 +970,7 @@ class AgendaTests(IetfSeleniumTestCase): # Be sure we're at the URL we think we're at before we click self.assertEqual(self.driver.current_url, url) + self.scroll_to_element(group_button) group_button.click() # click! expected_url = '%s?show=%s' % (url, group_acronym) @@ -1077,6 +1080,7 @@ class AgendaTests(IetfSeleniumTestCase): ), 'Modal open button not found or not clickable', ) + self.scroll_to_element(open_modal_button) open_modal_button.click() WebDriverWait(self.driver, 2).until( expected_conditions.visibility_of(modal_div), @@ -1109,6 +1113,7 @@ class AgendaTests(IetfSeleniumTestCase): ), 'Modal close button not found or not clickable', ) + self.scroll_to_element(close_modal_button) close_modal_button.click() WebDriverWait(self.driver, 2).until( expected_conditions.invisibility_of_element(modal_div), @@ -1128,6 +1133,7 @@ class AgendaTests(IetfSeleniumTestCase): ), 'Modal open button not found or not clickable for refresh test', ) + self.scroll_to_element(open_modal_button) open_modal_button.click() WebDriverWait(self.driver, 2).until( expected_conditions.visibility_of(modal_div), @@ -1585,6 +1591,7 @@ class InterimTests(IetfSeleniumTestCase): button = WebDriverWait(self.driver, 2).until( expected_conditions.element_to_be_clickable( (By.CSS_SELECTOR, 'div#calendar button.fc-next-button'))) + self.scroll_to_element(button) button.click() seen = set()