From a97c84b81a5d020797ab7e56d0ed3116ec1417fb Mon Sep 17 00:00:00 2001 From: John Chilton Date: Wed, 18 Sep 2024 10:24:07 -0400 Subject: [PATCH] Fix transiently failing selenium test? --- lib/galaxy/selenium/navigates_galaxy.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/lib/galaxy/selenium/navigates_galaxy.py b/lib/galaxy/selenium/navigates_galaxy.py index c26e035dc159..7fc7f9a07d25 100644 --- a/lib/galaxy/selenium/navigates_galaxy.py +++ b/lib/galaxy/selenium/navigates_galaxy.py @@ -2056,10 +2056,25 @@ def tour_wait_for_element_present(self, selector): ) return element + def _clear_tooltip(self, tooltip_component): + last_timeout: Optional[SeleniumTimeoutException] = None + for _ in range(2): + if not tooltip_component.is_absent: + move_away_chain = self.action_chains() + move_away_chain.move_by_offset(100, 100) + move_away_chain.perform() + try: + tooltip_component.wait_for_absent() + return + except SeleniumTimeoutException as e: + last_timeout = e + + message = "Failed to force current tool tip off screen, cannot test next tooltip." + raise self.prepend_timeout_message(e, message) + def get_tooltip_text(self, element, sleep=0, click_away=True): tooltip_balloon = self.components._.tooltip_balloon - tooltip_balloon.wait_for_absent() - + self._clear_tooltip(tooltip_balloon) action_chains = self.action_chains() action_chains.move_to_element(element) action_chains.perform()