Merge pull request 'Fix activities selector and minor QOL changes' (#12) from cas_activities_20211109 into main
Reviewed-on: #12
This commit is contained in:
commit
98ec8e0e3d
@ -128,6 +128,10 @@ class BaseTester:
|
||||
self.logout()
|
||||
self.browser.close()
|
||||
|
||||
def find_element(self, *args, **kwargs):
|
||||
"""Alias for browser.find_element"""
|
||||
return self.browser.find_element(*args, **kwargs)
|
||||
|
||||
def find_element_by_id(self, *args, **kwargs):
|
||||
"""Alias for browser.find_element_by_id"""
|
||||
return self.browser.find_element_by_id(*args, **kwargs)
|
||||
@ -144,6 +148,10 @@ class BaseTester:
|
||||
"""Alias for using inbuilt wait object for wait.until(EC.element_to_be_clickable)"""
|
||||
return self.wait.until(EC.element_to_be_clickable(locator))
|
||||
|
||||
def get_tab_selector(self, tabtitle):
|
||||
"""Return an XPATH string to the tab labelled `tablabel`."""
|
||||
return "//li/a[@title='{label}']/..".format(label=tabtitle)
|
||||
|
||||
|
||||
class SearchExportTester(BaseTester):
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
@ -14,10 +14,10 @@ class TestActivitiesTab(BaseTester):
|
||||
def _test(self, cid: str):
|
||||
self.debug("loading contact page for CID %s" % cid)
|
||||
self.browser.get(self.contact_page.format(cid))
|
||||
self.wait_until_visible((By.ID, "ui-id-10"))
|
||||
self.wait_until_visible((By.XPATH, self.get_tab_selector("Activities")))
|
||||
# Contact page as loaded
|
||||
activities_tab_button = self.find_element_by_id("ui-id-10")
|
||||
num_element = activities_tab_button.find_element_by_tag_name("em")
|
||||
activities_tab_button = self.find_element(By.XPATH, self.get_tab_selector("Activities"))
|
||||
num_element = activities_tab_button.find_element(By.TAG_NAME, "em")
|
||||
num_of_activ = int(num_element.text)
|
||||
activities_tab_button.click()
|
||||
table_row_selector = (
|
||||
|
Loading…
Reference in New Issue
Block a user