Shorten some method calls, but maintain backwards compatibility

This commit is contained in:
Michael Mintz 2016-02-17 18:26:34 -05:00
parent 402195af2c
commit cb2787db56
1 changed files with 15 additions and 0 deletions

View File

@ -265,6 +265,11 @@ class BaseCase(unittest.TestCase):
return page_actions.wait_for_element_visible(
self.driver, selector, by, timeout)
def wait_for_element(self, selector, by=By.CSS_SELECTOR,
timeout=settings.LARGE_TIMEOUT):
""" The shorter version of wait_for_element_visible() """
return self.wait_for_element_visible(selector, by=by, timeout=timeout)
def wait_for_text_visible(self, text, selector, by=By.CSS_SELECTOR,
timeout=settings.LARGE_TIMEOUT):
if selector.startswith('/') or selector.startswith('./'):
@ -272,11 +277,21 @@ class BaseCase(unittest.TestCase):
return page_actions.wait_for_text_visible(
self.driver, text, selector, by, timeout)
def wait_for_text(self, text, selector, by=By.CSS_SELECTOR,
timeout=settings.LARGE_TIMEOUT):
""" The shorter version of wait_for_text_visible() """
return self.wait_for_text_visible(
text, selector, by=by, timeout=timeout)
def wait_for_link_text_visible(self, link_text,
timeout=settings.LARGE_TIMEOUT):
return self.wait_for_element_visible(
link_text, by=By.LINK_TEXT, timeout=timeout)
def wait_for_link_text(self, link_text, timeout=settings.LARGE_TIMEOUT):
""" The shorter version of wait_for_link_text_visible() """
return self.wait_for_link_text_visible(link_text, timeout=timeout)
def wait_for_element_absent(self, selector, by=By.CSS_SELECTOR,
timeout=settings.LARGE_TIMEOUT):
if selector.startswith('/') or selector.startswith('./'):