Skip to content

Commit

Permalink
QA-5485 steps updated for worker_activity testcase and methods
Browse files Browse the repository at this point in the history
  • Loading branch information
kbo001 committed Jan 11, 2024
1 parent bb577a7 commit d610bd5
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 16 deletions.
5 changes: 3 additions & 2 deletions ElasticSearchTests/testCases/test_01_worker_activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,14 @@ def test_case_07_email_report(driver, settings):

@pytest.mark.login
@pytest.mark.reports
@pytest.mark.xfail
def test_case_08_case_assign(driver, settings):
home = HomePage(driver, settings)
home.reports_menu()
activity = WorkerActivityPage(driver)
actives, totals = activity.worker_activity_case_assign_data()
actives, totals, text = activity.worker_activity_case_assign_data()
home.data_menu()
reassign = ReassignCasesPage(driver, settings)
reassign.reassign_case()
reassign.reassign_case(text)
home.reports_menu()
activity.verify_assigned_cases_count(actives, totals)
9 changes: 6 additions & 3 deletions ElasticSearchTests/testPages/data/reassign_cases_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,21 @@ def __init__(self, driver, settings):
self.last_modified_ascending = (By.XPATH, "(//text()[contains(.,'Last Modified')]//preceding-sibling::i[@class='icon-white fa dt-sort-icon'])[1]//parent::div//parent::th[@aria-sort='ascending']")
self.last_modified_descending = (By.XPATH, "(//text()[contains(.,'Last Modified')]//preceding-sibling::i[@class='icon-white fa dt-sort-icon'])[1]//parent::div//parent::th[@aria-sort='descending']")

def get_cases(self):
def get_cases(self, text):
self.wait_to_click(self.reassign_cases_menu)
self.wait_for_element(self.case_owner_field)
self.wait_to_click(self.remove_project_data)
self.send_keys(self.case_owner_field, UserData.user_group)
self.wait_to_click((By.XPATH, self.user_from_list.format(UserData.user_group_shared)))
time.sleep(2)
ActionChains(self.driver).send_keys(Keys.TAB).perform()
self.send_keys(self.search_query, text)
self.wait_to_click(self.apply)
print("Sleeping for the list to load")
time.sleep(20)

def reassign_case(self):
self.get_cases()
def reassign_case(self, text):
self.get_cases(text)
copy = CopyCasesPage(self.driver, self.settings)
copy.sort_for_latest_on_top()
time.sleep(5)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -667,11 +667,13 @@ def compare_wa_with_email(self, link, web_data):
for i in range(len(list)):
print("Comparing ", html.unescape(str(list[i])), " with ", str(web_data[i]))
if str(web_data[i]) == '---' and str(list[i]) == 'nan':
assert True, "Cpmparision failed for " + list[i] + " and " + web_data[i]
assert True, "Comparision failed for " + list[i] + " and " + web_data[i]
elif self.is_date(str(web_data[i])) == self.is_date(str(list[i])):
assert True, "Cpmparision failed for " + list[i] + " and " + web_data[i]
assert True, "Comparision failed for " + list[i] + " and " + web_data[i]
elif "%" in str(web_data[i]):
assert str(round(int(list[i]))) == str(web_data[i]).replace("%",""), "Comparision failed for " + list[i] + " and " + web_data[i]
else:
assert html.unescape(str(list[i])) == str(web_data[i]), "Cpmparision failed for " + list[i] + " and " + \
assert html.unescape(str(list[i])) == str(web_data[i]), "Comparision failed for " + list[i] + " and " + \
web_data[i]

def export_worker_activity_email(self):
Expand Down Expand Up @@ -742,15 +744,22 @@ def worker_activity_case_assign_data(self):
self.wait_to_click((By.XPATH, self.user_from_list.format(UserData.user_group)))
time.sleep(1)
self.select_by_text(self.view_by_dropdown, UserData.view_by[0])
# self.wait_to_click(self.case_type_textarea)
# time.sleep(2)
# self.wait_to_click((By.XPATH, self.case_type_list_item.format(UserData.sub_case)))
self.wait_to_click(self.date_input)
self.wait_to_click((By.XPATH, self.date_range_type.format(UserData.date_range[0])))
self.wait_to_click((By.XPATH, self.date_range_type.format(UserData.date_range[2])))
date_string, start_date, end_date = self.value_date_range_30_days()
# date_string, start_date, end_date = self.get_custom_dates_past(0, 0, 1)
# self.select_date_from_picker(start_date, end_date)
time.sleep(2)
self.wait_to_click(self.apply_id)
time.sleep(10)
self.wait_for_element(self.result_table, 300)
assert self.is_visible_and_displayed(self.report_content_id, 120), "Report not loaded"
print("Report loaded successfully!")
self.scroll_to_bottom()
self.verify_users_in_the_group()
# self.verify_users_in_the_group()
active_cases = self.find_elements(self.active_cases_column_list)
actives = []
for items in active_cases:
Expand All @@ -760,8 +769,10 @@ def worker_activity_case_assign_data(self):
for items in total_cases:
totals.append(items.text)
print("Active Case: ", actives)
print("Total shared case: ",totals)
return actives, totals
print("Total shared case: ", totals)
text = ("opened_on: [{} TO {}]").format(start_date, end_date)
print(text)
return actives, totals, text


def verify_assigned_cases_count(self, actives, totals):
Expand All @@ -774,15 +785,19 @@ def verify_assigned_cases_count(self, actives, totals):
self.wait_to_click((By.XPATH, self.user_from_list.format(UserData.user_group)))
time.sleep(1)
self.select_by_text(self.view_by_dropdown, UserData.view_by[0])
# self.wait_to_click(self.case_type_textarea)
# time.sleep(2)
# self.wait_to_click((By.XPATH, self.case_type_list_item.format(UserData.sub_case)))
self.wait_to_click(self.date_input)
self.wait_to_click((By.XPATH, self.date_range_type.format(UserData.date_range[2])))
time.sleep(2)
self.wait_to_click(self.apply_id)
time.sleep(10)
self.wait_for_element(self.result_table, 300)
assert self.is_visible_and_displayed(self.report_content_id, 120), "Report not loaded"
print("Report loaded successfully!")
self.scroll_to_bottom()
self.verify_users_in_the_group()
# self.verify_users_in_the_group()
active_cases = self.find_elements(self.active_cases_column_list)
actives_new = []
for items in active_cases:
Expand All @@ -797,7 +812,7 @@ def verify_assigned_cases_count(self, actives, totals):
# assert int(actives[i])-10 == actives_new[i], "Active Cases not reduced"
# print("Active cases reduced")
for i in range(len(totals_new)):
print(int(totals[i])-10, int(totals_new[i]))
assert int(totals[i])-10 == int(totals_new[i]), "Total Shared Cases not reduced"
print("Total Shared cases reduced")
# print(int(totals[i]), int(totals_new[i])-10)
assert int(totals[i]) != int(totals_new[i]), "Total Shared Cases not changed"
print("Total Shared cases changed")
print("Cases successfully assigned")

0 comments on commit d610bd5

Please sign in to comment.