@@ -7,7 +7,11 @@ def __init__(self, page: Page):
77 super ().__init__ (page )
88
99 """Locators belonging to the View All deactivated users page."""
10- self .view_all_deactivated_users_button = page .locator ("div[class='sumo-button-wrap'] a" )
10+ self .view_all_deactivated_users_button = page .get_by_role (
11+ "link" , name = "View all deactivated users" , exact = True )
12+ self .deactivation_log_deactivated_user = lambda username : page .locator (
13+ f"//table[@id='deactivations-log']/tbody/tr/td[2]/a[normalize-space(text())="
14+ f"'{ username } ']" )
1115
1216 """Locators belonging to the flagged questions page."""
1317 self .flagged_question = lambda question_info : page .locator ("p" ).get_by_text (
@@ -18,13 +22,13 @@ def __init__(self, page: Page):
1822 question_title , exact = True ).locator ("> div[class='content'] p" )
1923 self .created_by_link_text = lambda question_info : page .locator (
2024 f"//p[normalize-space(text())='{ question_info } ']/ancestor::div"
21- f"[@class='flagged-item-content']//h3[text()='Created:']/following-sibling::p/a" )
25+ f"[@class='flagged-item-content']//h3[text()='Created:']/following-sibling::p[1] /a" )
2226 self .flagged_by_link_text = lambda question_info : page .locator (
2327 f"//p[normalize-space(text())='{ question_info } ']/ancestor::div"
24- f"[@class='flagged-item-content']//h3[text()='Flagged:']/following-sibling::p/a" )
25- self .take_action_view_option = lambda question_info : page .get_by_role (
26- "paragraph" , name = question_info , exact = True ). locator ( "+ div" ). get_by_role (
27- "link" , name = " View" , exact = True )
28+ f"[@class='flagged-item-content']//h3[text()='Flagged:']/following-sibling::p[1] /a" )
29+ self .take_action_view_option = lambda flagged_info : page .locator (
30+ f"//li[.//*[normalize-space(text())=' { flagged_info } ']]"
31+ f"//a[normalize-space(text())=' View']" )
2832 self .take_action_edit_option = lambda question_info : page .locator (
2933 f"//p[normalize-space(text())='{ question_info } ']/ancestor::"
3034 f"div[@class='flagged-item-content']//a[text()='Edit']" )
@@ -37,9 +41,23 @@ def __init__(self, page: Page):
3741 self .update_status_button = lambda question_info : page .locator (
3842 f"//p[normalize-space(text())='{ question_info } ']/ancestor::div"
3943 f"[@class='flagged-item-content']//following-sibling::form/input[@value='Update']" )
44+ # Profile tickets render the flagged username inside an <h2> (rather than a <p>), so the
45+ # profile update-status controls are anchored on that heading instead.
46+ self .update_profile_status_option = lambda username : page .locator (
47+ f"//h2[@class='sumo-page-subheading' and text()='{ username } ']/ancestor::div"
48+ f"[@class='flagged-item-content']//following-sibling::form/select" )
49+ self .update_profile_status_button = lambda username : page .locator (
50+ f"//h2[@class='sumo-page-subheading' and text()='{ username } ']/ancestor::div"
51+ f"[@class='flagged-item-content']//following-sibling::form/input[@value='Update']" )
4052 self .paginator_section = page .locator ("//ol[@class='pagination cf']" )
4153 self .last_paginator_option = page .locator ("//ol[@class='pagination cf']/li/a" ).last
4254
55+ """Locators belonging to the 'Filter by reason' and 'Filter by type' dropdowns."""
56+ self .filter_by_reason_dropdown = page .locator ("select#flagit-reason-filter" )
57+ self .filter_by_type_dropdown = page .locator ("select#flagit-content-type-filter" )
58+ self .filter_by_type_option = lambda type_name : page .locator (
59+ f"//select[@id='flagit-content-type-filter']/option[normalize-space()='{ type_name } ']" )
60+
4361 """Locators belonging to the flagged profile tickets"""
4462 self .profile_flagged_ticket = lambda username : page .locator (
4563 f"//h2[@class='sumo-page-subheading' and text()='{ username } ']" )
@@ -57,8 +75,8 @@ def click_created_by_link(self, question_info: str):
5775 def click_flagged_by_link (self , question_info : str ):
5876 self ._click (self .flagged_by_link_text (question_info ))
5977
60- def click_take_action_view_option (self , question_info : str ):
61- self ._click (self .take_action_view_option (question_info ))
78+ def click_take_action_view_option (self , flagged_info : str ):
79+ self ._click (self .take_action_view_option (flagged_info ))
6280
6381 def click_take_action_edit_option (self , question_info : str ):
6482 self ._click (self .take_action_edit_option (question_info ))
@@ -72,9 +90,22 @@ def select_update_status_option(self, question_info: str, select_value: str):
7290 def click_on_the_update_button (self , question_info : str ):
7391 self ._click (self .update_status_button (question_info ))
7492
93+ def select_update_profile_status_option (self , username : str , select_value : str ):
94+ self ._select_option_by_value (self .update_profile_status_option (username ), select_value )
95+
96+ def click_on_the_update_profile_button (self , username : str ):
97+ self ._click (self .update_profile_status_button (username ))
98+
7599 def click_view_all_deactivated_users_button (self ):
76100 self ._click (self .view_all_deactivated_users_button )
77101
102+ def filter_flagged_content_by_reason (self , reason_value : str ):
103+ self ._select_option_by_value (self .filter_by_reason_dropdown , reason_value )
104+
105+ def filter_flagged_content_by_type (self , type_name : str ):
106+ value = self ._get_element_attribute_value (self .filter_by_type_option (type_name ), "value" )
107+ self ._select_option_by_value (self .filter_by_type_dropdown , value )
108+
78109 def is_paginator_visible (self ) -> bool :
79110 self .wait_for_dom_to_load ()
80111 return self ._is_element_visible (self .paginator_section )
0 commit comments