summaryrefslogtreecommitdiff
path: root/django/contrib/admin/tests.py
diff options
context:
space:
mode:
authorJon Dufresne <jon.dufresne@gmail.com>2019-11-28 20:06:42 -0800
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2019-12-02 15:06:36 +0100
commit65285d1e7dc72f10ba69ab53b6fe5eb6b9ce3123 (patch)
tree9bb0c67686f151e7e8b1ba1c838c9cc4a544eaaf /django/contrib/admin/tests.py
parent845042b3d9faaefef8855c2bab48bd9532cd00ca (diff)
Refs #29892 -- Made Selenium tests wait for popups to be ready.
Diffstat (limited to 'django/contrib/admin/tests.py')
-rw-r--r--django/contrib/admin/tests.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/django/contrib/admin/tests.py b/django/contrib/admin/tests.py
index 748e67fd3f..941d030d30 100644
--- a/django/contrib/admin/tests.py
+++ b/django/contrib/admin/tests.py
@@ -35,12 +35,15 @@ class AdminSeleniumTestCase(SeleniumTestCase, StaticLiveServerTestCase):
from selenium.webdriver.support.wait import WebDriverWait
WebDriverWait(self.selenium, timeout).until(callback)
- def wait_for_popup(self, num_windows=2, timeout=10):
+ def wait_for_and_switch_to_popup(self, num_windows=2, timeout=10):
"""
- Block until `num_windows` are present (usually 2, but can be
- overridden in the case of pop-ups opening other pop-ups).
+ Block until `num_windows` are present and are ready (usually 2, but can
+ be overridden in the case of pop-ups opening other pop-ups). Switch the
+ current window to the new pop-up.
"""
self.wait_until(lambda d: len(d.window_handles) == num_windows, timeout)
+ self.selenium.switch_to.window(self.selenium.window_handles[-1])
+ self.wait_page_ready()
def wait_for(self, css_selector, timeout=10):
"""