summaryrefslogtreecommitdiff
path: root/django/contrib/admin/tests.py
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2016-01-11 12:25:56 -0500
committerTim Graham <timograham@gmail.com>2016-01-11 14:16:17 -0500
commit99d2469e75f1567cbe5ee753563edb68cd51d74a (patch)
treef4a8f3cb1bf743ca84fc0452fc47c6b26bf9853e /django/contrib/admin/tests.py
parent294d0d88158fa83eb095d663d054038ce9dfc3d4 (diff)
Refs #494 -- Fixed a flaky admin_inlines tests.
Diffstat (limited to 'django/contrib/admin/tests.py')
-rw-r--r--django/contrib/admin/tests.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/django/contrib/admin/tests.py b/django/contrib/admin/tests.py
index bcdc747571..f234fc2393 100644
--- a/django/contrib/admin/tests.py
+++ b/django/contrib/admin/tests.py
@@ -99,6 +99,28 @@ class AdminSeleniumWebDriverTestCase(StaticLiveServerTestCase):
timeout
)
+ def wait_until_visible(self, css_selector, timeout=10):
+ """
+ Block until the element described by the CSS selector is visible.
+ """
+ from selenium.webdriver.common.by import By
+ from selenium.webdriver.support import expected_conditions as ec
+ self.wait_until(
+ ec.visibility_of_element_located((By.CSS_SELECTOR, css_selector)),
+ timeout
+ )
+
+ def wait_until_invisible(self, css_selector, timeout=10):
+ """
+ Block until the element described by the CSS selector is invisible.
+ """
+ from selenium.webdriver.common.by import By
+ from selenium.webdriver.support import expected_conditions as ec
+ self.wait_until(
+ ec.invisibility_of_element_located((By.CSS_SELECTOR, css_selector)),
+ timeout
+ )
+
def wait_page_loaded(self):
"""
Block until page has started to load.