From 4a4d0498d6a371dc8ddaa226d33ff5cf0a897e69 Mon Sep 17 00:00:00 2001 From: John Chilton Date: Sun, 24 Sep 2017 15:10:13 -0400 Subject: [PATCH] Selenium - better fix for upload build click before callback registered. Should fix this transient failure. https://jenkins.galaxyproject.org/job/selenium/568/artifact/568-test-errors/test_upload_paired_list2017092319301506209412/stacktrace.txt --- test/galaxy_selenium/navigates_galaxy.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/test/galaxy_selenium/navigates_galaxy.py b/test/galaxy_selenium/navigates_galaxy.py index c238e23ab8a..3900ebfebe8 100644 --- a/test/galaxy_selenium/navigates_galaxy.py +++ b/test/galaxy_selenium/navigates_galaxy.py @@ -460,13 +460,19 @@ class NavigatesGalaxy(HasDriver): @retry_during_transitions def upload_build(self): - build_button = self.wait_for_selector_clickable("div#collection button#btn-build") - # TODO: Eliminate the need for this hack. This hack is in here because the test - # occasionally fails at the next step because the UI has not transitioned to the - # new content. I assume that means this click is sent before the callback is - # registered. + build_selector = "div#collection button#btn-build" + # Pause a bit to let the callback on the build button be registered. time.sleep(.5) - build_button.click() + # Click the Build button and make sure it disappears. + self.wait_for_and_click_selector(build_selector) + try: + self.wait_for_selector_absent_or_hidden(build_selector) + except TimeoutException: + # Sometimes the callback in the JS hasn't be registered by the + # time that the build button is clicked. By the time the timeout + # has been registered - it should have been. + self.wait_for_and_click_selector(build_selector) + self.wait_for_selector_absent_or_hidden(build_selector) def upload_queue_local_file(self, test_path, tab_id="regular"): self.wait_for_and_click_selector("div#%s button#btn-local" % tab_id)