From 147717f45db04eb38d81bed744aa683c8830f1fc Mon Sep 17 00:00:00 2001 From: Emil Ghitta Date: Mon, 23 Sep 2024 16:16:20 +0300 Subject: [PATCH] - Mark the new_message, sent_messages, mess_system_user_navbar and inbox_page page functions as public and replace super() with self. - Use composition instead of inheritance for the messaging_system_flow.py class. --- .../messaging_system_flow.py | 29 +-- .../messaging_system_pages/inbox_page.py | 120 +++++----- .../mess_system_user_navbar.py | 24 +- .../messaging_system_pages/new_message.py | 114 ++++----- .../messaging_system_pages/sent_messages.py | 136 +++++------ .../test_messaging_system.py | 225 +++++++++--------- 6 files changed, 319 insertions(+), 329 deletions(-) diff --git a/playwright_tests/flows/messaging_system_flows/messaging_system_flow.py b/playwright_tests/flows/messaging_system_flows/messaging_system_flow.py index aaa03082bf0..213ba85008f 100644 --- a/playwright_tests/flows/messaging_system_flows/messaging_system_flow.py +++ b/playwright_tests/flows/messaging_system_flows/messaging_system_flow.py @@ -1,13 +1,14 @@ from playwright.sync_api import Page -from playwright_tests.core.utilities import Utilities from playwright_tests.pages.messaging_system_pages.inbox_page import InboxPage from playwright_tests.pages.messaging_system_pages.new_message import NewMessagePage from playwright_tests.pages.messaging_system_pages.sent_messages import SentMessagePage -class MessagingSystemFlows(Utilities, NewMessagePage, SentMessagePage, InboxPage): +class MessagingSystemFlows: def __init__(self, page: Page): - super().__init__(page) + self.new_message_page = NewMessagePage(page) + self.sent_message_page = SentMessagePage(page) + self.inbox_page = InboxPage(page) # Send message form with data flow. def complete_send_message_form_with_data(self, @@ -15,19 +16,19 @@ def complete_send_message_form_with_data(self, message_body='', submit_message=True): if recipient_username != '' and not isinstance(recipient_username, list): - super()._type_into_new_message_to_input_field(recipient_username) - super()._click_on_a_searched_user(recipient_username) + self.new_message_page.type_into_new_message_to_input_field(recipient_username) + self.new_message_page.click_on_a_searched_user(recipient_username) if isinstance(recipient_username, list): for recipient in recipient_username: - super()._type_into_new_message_to_input_field(recipient) - super()._click_on_a_searched_user(recipient) + self.new_message_page.type_into_new_message_to_input_field(recipient) + self.new_message_page.click_on_a_searched_user(recipient) if message_body != '': - super()._fill_into_new_message_body_textarea(message_body) + self.new_message_page.fill_into_new_message_body_textarea(message_body) if submit_message: - super()._click_on_new_message_send_button() + self.new_message_page.click_on_new_message_send_button() def delete_message_flow(self, username='', excerpt='', @@ -35,14 +36,14 @@ def delete_message_flow(self, username='', from_sent_list=False, from_inbox_list=False): if from_sent_list and username != '': - super()._click_on_sent_message_delete_button_by_user(username) + self.sent_message_page.click_on_sent_message_delete_button_by_user(username) elif from_sent_list and excerpt != '': - super()._click_on_sent_message_delete_button_by_excerpt(excerpt) + self.sent_message_page.click_on_sent_message_delete_button_by_excerpt(excerpt) if from_inbox_list and username != '': - super()._click_on_inbox_message_delete_button_by_username(username) + self.inbox_page.click_on_inbox_message_delete_button_by_username(username) elif from_inbox_list and excerpt != '': - super()._click_on_inbox_message_delete_button_by_excerpt(excerpt) + self.inbox_page.click_on_inbox_message_delete_button_by_excerpt(excerpt) if delete_message: - super()._click_on_delete_page_delete_button() + self.sent_message_page.click_on_delete_page_delete_button() diff --git a/playwright_tests/pages/messaging_system_pages/inbox_page.py b/playwright_tests/pages/messaging_system_pages/inbox_page.py index d094043c1bc..dd85d4209b2 100644 --- a/playwright_tests/pages/messaging_system_pages/inbox_page.py +++ b/playwright_tests/pages/messaging_system_pages/inbox_page.py @@ -35,25 +35,25 @@ def __init__(self, page: Page): # Breadcrumb actions. # Inbox page scam alert actions. - def _get_text_inbox_scam_alert_banner_text(self) -> str: - return super()._get_text_of_element(self.__inbox_page_scam_alert_banner_text) + def get_text_inbox_scam_alert_banner_text(self) -> str: + return self._get_text_of_element(self.__inbox_page_scam_alert_banner_text) - def _click_on_inbox_scam_alert_close_button(self): - super()._click(self.__inbox_page_scam_alert_close_button) + def click_on_inbox_scam_alert_close_button(self): + self._click(self.__inbox_page_scam_alert_close_button) # Inbox page actions. - def _get_text_inbox_page_message_banner_text(self) -> str: - return super()._get_text_of_element(self.__inbox_page_message_action_banner) + def get_text_inbox_page_message_banner_text(self) -> str: + return self._get_text_of_element(self.__inbox_page_message_action_banner) - def _get_text_of_inbox_page_main_header(self) -> str: - return super()._get_text_of_element(self.__inbox_page_main_heading) + def get_text_of_inbox_page_main_header(self) -> str: + return self._get_text_of_element(self.__inbox_page_main_heading) - def _get_text_of_inbox_no_message_header(self) -> str: - return super()._get_text_of_element(self.__inbox_no_messages_text) + def get_text_of_inbox_no_message_header(self) -> str: + return self._get_text_of_element(self.__inbox_no_messages_text) # Inbox messages actions. - def _get_inbox_message_subject(self, username: str) -> str: - return super()._get_text_of_element(( + def get_inbox_message_subject(self, username: str) -> str: + return self._get_text_of_element(( f"//div[@class='email-cell from']//a[contains(text(),'{username}')]/../..//" f"a[@class='read']" )) @@ -62,93 +62,93 @@ def _get_inbox_message_subject(self, username: str) -> str: # self._page.locator(self.__inbox_page_message_action_banner_close_button).dispatch_event( # type='click') - def _click_on_inbox_message_delete_button_by_username(self, username: str): - super()._click(( + def click_on_inbox_message_delete_button_by_username(self, username: str): + self._click(( f"//div[@class='email-cell from']//a[contains(text(),'{username}')]/../..//" f"a[@class='delete']" )) - def _click_on_inbox_message_delete_button_by_excerpt(self, excerpt: str): - super()._click(f"//div[@class='email-cell excerpt']/a[normalize-space(text())='{excerpt}']" - f"/../..//a[@class='delete']") + def click_on_inbox_message_delete_button_by_excerpt(self, excerpt: str): + self._click(f"//div[@class='email-cell excerpt']/a[normalize-space(text())='{excerpt}']" + f"/../..//a[@class='delete']") - def _click_on_inbox_new_message_button(self): - super()._click(self.__inbox_new_message_button) + def click_on_inbox_new_message_button(self): + self._click(self.__inbox_new_message_button) - def _click_on_inbox_mark_selected_as_read_button(self): - super()._click(self.__inbox_mark_selected_as_read_button) + def click_on_inbox_mark_selected_as_read_button(self): + self._click(self.__inbox_mark_selected_as_read_button) - def _click_on_inbox_delete_selected_button(self): - super()._click(self.__inbox_delete_selected_button) + def click_on_inbox_delete_selected_button(self): + self._click(self.__inbox_delete_selected_button) - def _click_on_inbox_message_sender_username(self, username: str): - super()._click(f"//div[@class='email-cell from']//a[contains(text(),'{username}')]") + def click_on_inbox_message_sender_username(self, username: str): + self._click(f"//div[@class='email-cell from']//a[contains(text(),'{username}')]") - def _inbox_message_select_checkbox_element(self, excerpt='') -> list[ElementHandle]: + def inbox_message_select_checkbox_element(self, excerpt='') -> list[ElementHandle]: if excerpt != '': - return super()._get_element_handles(f"//div[@class='email-cell excerpt']" - f"/a[normalize-space(text())='{excerpt}']/../.." - f"/div[@class='email-cell check']/input") + return self._get_element_handles(f"//div[@class='email-cell excerpt']" + f"/a[normalize-space(text())='{excerpt}']/../.." + f"/div[@class='email-cell check']/input") else: - return super()._get_element_handles(self.__inbox_delete_checkbox) + return self._get_element_handles(self.__inbox_delete_checkbox) - def _click_on_inbox_message_subject(self, username: str): - super()._click((f"//div[@class='email-cell from']//a[contains(text(),'{username}')]/../.." - f"//a[@class='read']")) + def click_on_inbox_message_subject(self, username: str): + self._click((f"//div[@class='email-cell from']//a[contains(text(),'{username}')]/../.." + f"//a[@class='read']")) - def _click_on_delete_page_delete_button(self): - super()._click(self.__inbox_delete_page_delete_button) + def click_on_delete_page_delete_button(self): + self._click(self.__inbox_delete_page_delete_button) - def _click_on_delete_page_cancel_button(self): + def click_on_delete_page_cancel_button(self): # Hitting the "Enter" button instead of click due to an issue (the banner does not close # on click) - super()._press_a_key(self.__inbox_delete_page_cancel_button, 'Enter') + self._press_a_key(self.__inbox_delete_page_cancel_button, 'Enter') - def _is_no_message_header_displayed(self) -> bool: - return super()._is_element_visible(self.__inbox_no_messages_text) + def is_no_message_header_displayed(self) -> bool: + return self._is_element_visible(self.__inbox_no_messages_text) - def _inbox_message_banner(self) -> Locator: - return super()._get_element_locator(self.__inbox_page_scam_alert_banner_text) + def inbox_message_banner(self) -> Locator: + return self._get_element_locator(self.__inbox_page_scam_alert_banner_text) - def _inbox_message(self, username: str) -> Locator: - return super()._get_element_locator(f"//div[@class='email-cell from']//a[contains(text()," - f"'{username}')]") + def inbox_message(self, username: str) -> Locator: + return self._get_element_locator(f"//div[@class='email-cell from']//a[contains(text()," + f"'{username}')]") def _inbox_message_based_on_excerpt(self, excerpt: str) -> Locator: - return super()._get_element_locator(f"//div[@class='email-cell excerpt']/a[normalize-space" - f"(text())='{excerpt}']") + return self._get_element_locator(f"//div[@class='email-cell excerpt']/a[normalize-space" + f"(text())='{excerpt}']") def _inbox_message_element_handles(self, excerpt: str) -> list[ElementHandle]: - return super()._get_element_handles(f"//div[@class='email-cell excerpt']/a[normalize-space" - f"(text())='{excerpt}']") + return self._get_element_handles(f"//div[@class='email-cell excerpt']/a[normalize-space" + f"(text())='{excerpt}']") - def _are_inbox_messages_displayed(self) -> bool: - return super()._is_element_visible(self.__inbox_messages_section) + def are_inbox_messages_displayed(self) -> bool: + return self._is_element_visible(self.__inbox_messages_section) - def _delete_all_inbox_messages(self): - inbox_messages_count = super()._get_element_handles(self.__inbox_messages) + def delete_all_inbox_messages(self): + inbox_messages_count = self._get_element_handles(self.__inbox_messages) for i in range(len(inbox_messages_count)): - inbox_elements_delete_button = super()._get_element_handles( + inbox_elements_delete_button = self._get_element_handles( self.__inbox_messages_delete_button) delete_button = inbox_elements_delete_button[i] delete_button.click() - self._click_on_delete_page_delete_button() + self.click_on_delete_page_delete_button() - def _delete_all_inbox_messages_via_delete_selected_button(self, excerpt=''): + def delete_all_inbox_messages_via_delete_selected_button(self, excerpt=''): if excerpt != '': inbox_messages_count = self._inbox_message_element_handles(excerpt) else: - inbox_messages_count = super()._get_element_handles(self.__inbox_messages) + inbox_messages_count = self._get_element_handles(self.__inbox_messages) counter = 0 for i in range(len(inbox_messages_count)): if excerpt != '': - inbox_checkbox = self._inbox_message_select_checkbox_element(excerpt) + inbox_checkbox = self.inbox_message_select_checkbox_element(excerpt) else: - inbox_checkbox = self._inbox_message_select_checkbox_element() + inbox_checkbox = self.inbox_message_select_checkbox_element() element = inbox_checkbox[counter] element.click() counter += 1 - self._click_on_inbox_delete_selected_button() - self._click_on_delete_page_delete_button() + self.click_on_inbox_delete_selected_button() + self.click_on_delete_page_delete_button() diff --git a/playwright_tests/pages/messaging_system_pages/mess_system_user_navbar.py b/playwright_tests/pages/messaging_system_pages/mess_system_user_navbar.py index d62ea170920..1aa8b4bc4f0 100644 --- a/playwright_tests/pages/messaging_system_pages/mess_system_user_navbar.py +++ b/playwright_tests/pages/messaging_system_pages/mess_system_user_navbar.py @@ -15,22 +15,22 @@ def __init__(self, page: Page): super().__init__(page) # Messaging system navbar actions. - def _click_on_messaging_system_navbar_inbox(self): - super()._click(self.__messaging_system_user_navbar_inbox_option) + def click_on_messaging_system_navbar_inbox(self): + self._click(self.__messaging_system_user_navbar_inbox_option) - def _click_on_messaging_system_nav_sent_messages(self): - super()._click(self.__messaging_system_user_navbar_sent_messages_option) + def click_on_messaging_system_nav_sent_messages(self): + self._click(self.__messaging_system_user_navbar_sent_messages_option) - def _click_on_messaging_system_nav_new_message(self): - super()._click(self.__messaging_system_user_navbar_new_message_option) + def click_on_messaging_system_nav_new_message(self): + self._click(self.__messaging_system_user_navbar_new_message_option) # Need to add logic for fetching the background color of selected navbar elements - def _get_inbox_navbar_element(self) -> Locator: - return super()._get_element_locator(self.__messaging_system_user_navbar_inbox_option) + def get_inbox_navbar_element(self) -> Locator: + return self._get_element_locator(self.__messaging_system_user_navbar_inbox_option) - def _get_sent_messages_navbar_element(self) -> Locator: - return super()._get_element_locator( + def get_sent_messages_navbar_element(self) -> Locator: + return self._get_element_locator( self.__messaging_system_user_navbar_sent_messages_option) - def _get_new_message_navbar_element(self) -> Locator: - return super()._get_element_locator(self.__messaging_system_user_navbar_new_message_option) + def get_new_message_navbar_element(self) -> Locator: + return self._get_element_locator(self.__messaging_system_user_navbar_new_message_option) diff --git a/playwright_tests/pages/messaging_system_pages/new_message.py b/playwright_tests/pages/messaging_system_pages/new_message.py index 0c82b430e06..39e1d7908a0 100644 --- a/playwright_tests/pages/messaging_system_pages/new_message.py +++ b/playwright_tests/pages/messaging_system_pages/new_message.py @@ -39,92 +39,92 @@ def __init__(self, page: Page): super().__init__(page) # New message page actions. - def _get_text_of_test_data_first_paragraph_text(self) -> str: - return super()._get_text_of_element( + def get_text_of_test_data_first_paragraph_text(self) -> str: + return self._get_text_of_element( self.__new_message_preview_data_first_paragraph_content) - def _get_text_of_test_data_first_p_strong_text(self) -> str: - return super()._get_text_of_element( + def get_text_of_test_data_first_p_strong_text(self) -> str: + return self._get_text_of_element( self.__new_message_preview_data_first_paragraph_strong_content) - def _get_text_of_test_data_first_p_italic_text(self) -> str: - return super()._get_text_of_element( + def get_text_of_test_data_first_p_italic_text(self) -> str: + return self._get_text_of_element( self.__new_message_preview_data_first_paragraph_italic_content) - def _get_text_of_numbered_list_items(self) -> list[str]: - return super()._get_text_of_elements(self.__new_message_numbered_list_items) + def get_text_of_numbered_list_items(self) -> list[str]: + return self._get_text_of_elements(self.__new_message_numbered_list_items) - def _get_text_of_bulleted_list_items(self) -> list[str]: - return super()._get_text_of_elements(self.__new_message_bulleted_list_items) + def get_text_of_bulleted_list_items(self) -> list[str]: + return self._get_text_of_elements(self.__new_message_bulleted_list_items) - def _get_text_of_message_preview_username(self) -> str: - return super()._get_text_of_element(self.__new_message_preview_username) + def get_text_of_message_preview_username(self) -> str: + return self._get_text_of_element(self.__new_message_preview_username) - def _get_user_to_text(self) -> str: - return super()._get_text_of_element(self.__sent_message_page_to_user_text) + def get_user_to_text(self) -> str: + return self._get_text_of_element(self.__sent_message_page_to_user_text) - def _get_no_user_to_locator(self) -> Locator: - return super()._get_element_locator(self.__sent_messages_page_no_user_text) + def get_no_user_to_locator(self) -> Locator: + return self._get_element_locator(self.__sent_messages_page_no_user_text) - def _get_new_message_page_header_text(self) -> str: - return super()._get_text_of_element(self.__new_message_page_header) + def get_new_message_page_header_text(self) -> str: + return self._get_text_of_element(self.__new_message_page_header) # def _get_search_for_a_user_dropdown_text(self) -> str: - # return super()._get_text_of_element(self.__search_for_a_user_option) + # return self._get_text_of_element(self.__search_for_a_user_option) - def _get_characters_remaining_text(self) -> str: - return super()._get_text_of_element(self.__new_message_textarea_remaining_characters) + def get_characters_remaining_text(self) -> str: + return self._get_text_of_element(self.__new_message_textarea_remaining_characters) - def _get_characters_remaining_text_element(self) -> Locator: - return super()._get_element_locator(self.__new_message_textarea_remaining_characters) + def get_characters_remaining_text_element(self) -> Locator: + return self._get_element_locator(self.__new_message_textarea_remaining_characters) - def _get_text_of_new_message_preview_section(self) -> str: - return super()._get_text_of_element(self.__new_message_preview_section_content) + def get_text_of_new_message_preview_section(self) -> str: + return self._get_text_of_element(self.__new_message_preview_section_content) - def _get_text_of_search_result_bolded_character(self) -> str: - return super()._get_text_of_element(self.__new_message_search_results_bolded_characters) + def get_text_of_search_result_bolded_character(self) -> str: + return self._get_text_of_element(self.__new_message_search_results_bolded_characters) - def _get_tet_of_search_results_text(self) -> list[str]: - return super()._get_text_of_elements(self.__new_message_search_results_text) + def get_tet_of_search_results_text(self) -> list[str]: + return self._get_text_of_elements(self.__new_message_search_results_text) - def _click_on_username_to_delete_button(self): - super()._click(self.__sent_message_page_to_user_delete_button) + def click_on_username_to_delete_button(self): + self._click(self.__sent_message_page_to_user_delete_button) - def _click_on_new_message_cancel_button(self): - super()._click(self.__new_message_cancel_button) + def click_on_new_message_cancel_button(self): + self._click(self.__new_message_cancel_button) - def _click_on_new_message_preview_button(self): - super()._click(self.__new_message_preview_button) + def click_on_new_message_preview_button(self): + self._click(self.__new_message_preview_button) - def _click_on_new_message_send_button(self): - super()._click(self.__new_message_send_button) + def click_on_new_message_send_button(self): + self._click(self.__new_message_send_button) - def _click_on_a_search_result(self, username: str): - super()._click(f"//div[@class='name_search' and text()='{username}']") + def click_on_a_search_result(self, username: str): + self._click(f"//div[@class='name_search' and text()='{username}']") - def _click_on_a_searched_user(self, username: str): - super()._click(f"//div[@class='name_search' and text()='{username}']") + def click_on_a_searched_user(self, username: str): + self._click(f"//div[@class='name_search' and text()='{username}']") - def _click_on_preview_internal_link(self): - super()._click(self.__new_message_preview_internal_link) + def click_on_preview_internal_link(self): + self._click(self.__new_message_preview_internal_link) - def _type_into_new_message_to_input_field(self, text: str): - super()._type(self.__new_message_to_input_field, text, 0) + def type_into_new_message_to_input_field(self, text: str): + self._type(self.__new_message_to_input_field, text, 0) - def _fill_into_new_message_body_textarea(self, text: str): - super()._fill(self.__new_message_textarea_input_field, text) + def fill_into_new_message_body_textarea(self, text: str): + self._fill(self.__new_message_textarea_input_field, text) - def _type_into_new_message_body_textarea(self, text: str): - super()._type(self.__new_message_textarea_input_field, text, 0) + def type_into_new_message_body_textarea(self, text: str): + self._type(self.__new_message_textarea_input_field, text, 0) - def _message_preview_section_element(self) -> Locator: - return super()._get_element_locator(self.__new_message_preview_section) + def message_preview_section_element(self) -> Locator: + return self._get_element_locator(self.__new_message_preview_section) - def _is_message_preview_time_displayed(self) -> bool: - return super()._is_element_visible(self.__new_message_preview_time) + def is_message_preview_time_displayed(self) -> bool: + return self._is_element_visible(self.__new_message_preview_time) - def _new_message_preview_internal_link_test_data_element(self) -> Locator: - return super()._get_element_locator(self.__new_message_preview_internal_link) + def new_message_preview_internal_link_test_data_element(self) -> Locator: + return self._get_element_locator(self.__new_message_preview_internal_link) - def _new_message_preview_external_link_test_data_element(self) -> Locator: - return super()._get_element_locator(self.__new_message_preview_external_link) + def new_message_preview_external_link_test_data_element(self) -> Locator: + return self._get_element_locator(self.__new_message_preview_external_link) diff --git a/playwright_tests/pages/messaging_system_pages/sent_messages.py b/playwright_tests/pages/messaging_system_pages/sent_messages.py index a0367ebbced..5e46a2fecca 100644 --- a/playwright_tests/pages/messaging_system_pages/sent_messages.py +++ b/playwright_tests/pages/messaging_system_pages/sent_messages.py @@ -27,114 +27,114 @@ def __init__(self, page: Page): super().__init__(page) # Sent messages page actions. - def _get_sent_messages_page_deleted_banner_text(self) -> str: - return super()._get_text_of_element(self.__sent_messages_page_message_banner_text) + def get_sent_messages_page_deleted_banner_text(self) -> str: + return self._get_text_of_element(self.__sent_messages_page_message_banner_text) - def _get_sent_messages_page_header(self) -> str: - return super()._get_text_of_element(self.__sent_messages_page_header) + def get_sent_messages_page_header(self) -> str: + return self._get_text_of_element(self.__sent_messages_page_header) - def _get_sent_messages_no_message_text(self) -> str: - return super()._get_text_of_element(self.__sent_messages_no_messages_message) + def get_sent_messages_no_message_text(self) -> str: + return self._get_text_of_element(self.__sent_messages_no_messages_message) - def _get_sent_message_subject(self, username: str) -> str: - return super()._get_text_of_element(f"//div[@class='email-cell to']//a[contains(text()," - f"'{username}')]/../.." - f"/div[@class='email-cell excerpt']/a") + def get_sent_message_subject(self, username: str) -> str: + return self._get_text_of_element(f"//div[@class='email-cell to']//a[contains(text()," + f"'{username}')]/../.." + f"/div[@class='email-cell excerpt']/a") # Need to update this def click_on_sent_messages_page_banner_close_button(self): Hitting the # click twice because of an issue with closing the banner self._page.locator( # self.__sent_message_page_message_banner_close_button).dispatch_event(type='click') - def _click_on_delete_selected_button(self): - super()._click(self.__sent_messages_delete_selected_button) + def click_on_delete_selected_button(self): + self._click(self.__sent_messages_delete_selected_button) - def _click_on_sent_message_delete_button_by_user(self, username: str): - super()._click(f"//div[@class='email-cell to']//a[contains(text(),'{username}')]/../..//" - f"a[@class='delete']") + def click_on_sent_message_delete_button_by_user(self, username: str): + self._click(f"//div[@class='email-cell to']//a[contains(text(),'{username}')]/../..//" + f"a[@class='delete']") - def _click_on_sent_message_delete_button_by_excerpt(self, excerpt: str): - super()._click(f"//div[@class='email-cell excerpt']/a[normalize-space(text())='{excerpt}']" - f"/../..//a[@class='delete']") + def click_on_sent_message_delete_button_by_excerpt(self, excerpt: str): + self._click(f"//div[@class='email-cell excerpt']/a[normalize-space(text())='{excerpt}']" + f"/../..//a[@class='delete']") - def _click_on_sent_message_sender_username(self, username: str): - super()._click(f"//div[@class='email-cell to']//a[contains(text(),'{username}')]") + def click_on_sent_message_sender_username(self, username: str): + self._click(f"//div[@class='email-cell to']//a[contains(text(),'{username}')]") - def _sent_message_select_checkbox(self) -> list[ElementHandle]: - return super()._get_element_handles(self.__sent_messages_delete_checkbox) + def sent_message_select_checkbox(self) -> list[ElementHandle]: + return self._get_element_handles(self.__sent_messages_delete_checkbox) - def _sent_message_select_checkbox_element(self, excerpt: str) -> list[ElementHandle]: - return super()._get_element_handles(f"//div[@class='email-cell excerpt']/a[normalize-space" - f"(text())='{excerpt}']/../.." - f"/div[@class='email-cell field checkbox no-label']" - f"/label") + def sent_message_select_checkbox_element(self, excerpt: str) -> list[ElementHandle]: + return self._get_element_handles(f"//div[@class='email-cell excerpt']/a[normalize-space" + f"(text())='{excerpt}']/../.." + f"/div[@class='email-cell field checkbox no-label']" + f"/label") - def _click_on_sent_message_subject(self, text: str): - super()._click(f"//div[@class='email-cell excerpt']/a[contains(text(),'{text}')]") + def click_on_sent_message_subject(self, text: str): + self._click(f"//div[@class='email-cell excerpt']/a[contains(text(),'{text}')]") - def _click_on_sent_messages_to_group_subject(self, group_name: str): - super()._click(f"//div[@class='email-cell to-groups']/a[text()='{group_name}']/../../" - f"div[@class='email-cell excerpt']") + def click_on_sent_messages_to_group_subject(self, group_name: str): + self._click(f"//div[@class='email-cell to-groups']/a[text()='{group_name}']/../../" + f"div[@class='email-cell excerpt']") - def _click_on_delete_page_delete_button(self): - super()._click(self.__sent_messages_delete_page_delete_button) + def click_on_delete_page_delete_button(self): + self._click(self.__sent_messages_delete_page_delete_button) - def _click_on_delete_page_cancel_button(self): - super()._click(self.__sent_messages_delete_page_cancel_button) + def click_on_delete_page_cancel_button(self): + self._click(self.__sent_messages_delete_page_cancel_button) - def _sent_messages(self, username: str) -> Locator: - return super()._get_element_locator(f"//div[@class='email-cell to']//a[contains(text()," - f"'{username}')]") + def sent_messages(self, username: str) -> Locator: + return self._get_element_locator(f"//div[@class='email-cell to']//a[contains(text()," + f"'{username}')]") - def _sent_messages_by_excerpt_locator(self, excerpt: str) -> Locator: - return super()._get_element_locator(f"//div[@class='email-cell excerpt']/" - f"a[normalize-space(text())='{excerpt}']") + def sent_messages_by_excerpt_locator(self, excerpt: str) -> Locator: + return self._get_element_locator(f"//div[@class='email-cell excerpt']/" + f"a[normalize-space(text())='{excerpt}']") - def _sent_messages_by_excerpt_element_handles(self, excerpt: str) -> list[ElementHandle]: - return super()._get_element_handles(f"//div[@class='email-cell excerpt']/" - f"a[normalize-space(text())='{excerpt}']") + def sent_messages_by_excerpt_element_handles(self, excerpt: str) -> list[ElementHandle]: + return self._get_element_handles(f"//div[@class='email-cell excerpt']/" + f"a[normalize-space(text())='{excerpt}']") - def _sent_messages_to_group(self, group: str, excerpt: str) -> Locator: - return super()._get_element_locator(f"//div[@class='email-cell to-groups']//a[contains" - f"(text(),'{group}')]/../../" - f"div[@class='email-cell excerpt']/a[normalize-space" - f"(text())='{excerpt}']") + def sent_messages_to_group(self, group: str, excerpt: str) -> Locator: + return self._get_element_locator(f"//div[@class='email-cell to-groups']//a[contains" + f"(text(),'{group}')]/../../" + f"div[@class='email-cell excerpt']/a[normalize-space" + f"(text())='{excerpt}']") - def _sent_message_banner(self) -> Locator: - return super()._get_element_locator(self.__sent_messages_page_message_banner_text) + def sent_message_banner(self) -> Locator: + return self._get_element_locator(self.__sent_messages_page_message_banner_text) - def _are_sent_messages_displayed(self) -> bool: - return super()._is_element_visible(self.__sent_messages_section) + def are_sent_messages_displayed(self) -> bool: + return self._is_element_visible(self.__sent_messages_section) - def _delete_all_displayed_sent_messages(self): - sent_elements_delete_button = super()._get_element_handles( + def delete_all_displayed_sent_messages(self): + sent_elements_delete_button = self._get_element_handles( self.__sent_messages_delete_button) for i in range(len(sent_elements_delete_button)): delete_button = sent_elements_delete_button[i] delete_button.click() - self._click_on_delete_page_delete_button() + self.click_on_delete_page_delete_button() - def _delete_all_sent_messages_via_delete_selected_button(self, excerpt=''): + def delete_all_sent_messages_via_delete_selected_button(self, excerpt=''): if excerpt != '': - sent_messages_count = self._sent_messages_by_excerpt_element_handles(excerpt) + sent_messages_count = self.sent_messages_by_excerpt_element_handles(excerpt) else: - sent_messages_count = super()._get_element_handles(self.__sent_messages) + sent_messages_count = self._get_element_handles(self.__sent_messages) counter = 0 for i in range(len(sent_messages_count)): if excerpt != '': - checkbox = self._sent_message_select_checkbox_element(excerpt) + checkbox = self.sent_message_select_checkbox_element(excerpt) else: - checkbox = self._sent_message_select_checkbox() + checkbox = self.sent_message_select_checkbox() element = checkbox[counter] element.click() counter += 1 - self._click_on_delete_selected_button() - self._click_on_delete_page_delete_button() + self.click_on_delete_selected_button() + self.click_on_delete_page_delete_button() # Read Sent Message page - def _get_text_of_all_sent_groups(self) -> list[str]: - return super()._get_text_of_elements(self.__to_groups_list_items) + def get_text_of_all_sent_groups(self) -> list[str]: + return self._get_text_of_elements(self.__to_groups_list_items) - def _get_text_of_all_recipients(self) -> list[str]: - return super()._get_text_of_elements(self.__to_user_list_items) + def get_text_of_all_recipients(self) -> list[str]: + return self._get_text_of_elements(self.__to_user_list_items) diff --git a/playwright_tests/tests/messaging_system_tests/test_messaging_system.py b/playwright_tests/tests/messaging_system_tests/test_messaging_system.py index 8fc459883d7..5c7c19207d3 100644 --- a/playwright_tests/tests/messaging_system_tests/test_messaging_system.py +++ b/playwright_tests/tests/messaging_system_tests/test_messaging_system.py @@ -28,23 +28,23 @@ def test_there_are_no_messages_here_text_is_displayed_when_no_messages_are_avail with allure.step("Navigating to the inbox page"): sumo_pages.top_navbar.click_on_inbox_option() - if sumo_pages.inbox_page._are_inbox_messages_displayed(): + if sumo_pages.inbox_page.are_inbox_messages_displayed(): with allure.step("Clearing the inbox since there are some existing messages"): - sumo_pages.inbox_page._delete_all_inbox_messages() + sumo_pages.inbox_page.delete_all_inbox_messages() with check, allure.step("Verifying that the correct message is displayed"): - assert sumo_pages.inbox_page._get_text_of_inbox_no_message_header( + assert sumo_pages.inbox_page.get_text_of_inbox_no_message_header( ) == InboxPageMessages.NO_MESSAGES_IN_INBOX_TEXT with allure.step("Navigating to the 'Sent Messages' page"): - sumo_pages.mess_system_user_navbar._click_on_messaging_system_nav_sent_messages() + sumo_pages.mess_system_user_navbar.click_on_messaging_system_nav_sent_messages() - if sumo_pages.sent_message_page._are_sent_messages_displayed(): + if sumo_pages.sent_message_page.are_sent_messages_displayed(): with allure.step("Clearing sent messages list since there are some existing messages"): - sumo_pages.sent_message_page._delete_all_displayed_sent_messages() + sumo_pages.sent_message_page.delete_all_displayed_sent_messages() with check, allure.step("Verifying that the correct page message is displayed"): - assert sumo_pages.sent_message_page._get_sent_messages_no_message_text( + assert sumo_pages.sent_message_page.get_sent_messages_no_message_text( ) == SentMessagesPageMessages.NO_MESSAGES_IN_SENT_MESSAGES_TEXT @@ -76,9 +76,9 @@ def test_private_messages_can_be_sent_via_user_profiles(page: Page, is_firefox): "field"): # Firefox GH runner fails here. We are running this assertion only in Chrome for now if not is_firefox: - assert sumo_pages.new_message_page._get_user_to_text() == user_two, ( + assert sumo_pages.new_message_page.get_user_to_text() == user_two, ( f"Incorrect 'To' receiver. Expected: {user_two}. " - f"Received: {sumo_pages.new_message_page._get_user_to_text()}" + f"Received: {sumo_pages.new_message_page.get_user_to_text()}" ) with allure.step("Sending a message to the user"): @@ -86,15 +86,15 @@ def test_private_messages_can_be_sent_via_user_profiles(page: Page, is_firefox): message_body=message_body) with check, allure.step("Verifying that the correct message sent banner is displayed"): - assert sumo_pages.inbox_page._get_text_inbox_page_message_banner_text( + assert sumo_pages.inbox_page.get_text_inbox_page_message_banner_text( ) == InboxPageMessages.MESSAGE_SENT_BANNER_TEXT with allure.step("Clicking on the 'Sent Messages option"): - sumo_pages.mess_system_user_navbar._click_on_messaging_system_nav_sent_messages() + sumo_pages.mess_system_user_navbar.click_on_messaging_system_nav_sent_messages() with allure.step("Verifying that the sent message is displayed"): expect( - sumo_pages.sent_message_page._sent_messages_by_excerpt_locator(message_body) + sumo_pages.sent_message_page.sent_messages_by_excerpt_locator(message_body) ).to_be_visible() with allure.step("Deleting the message from the sent messages page"): @@ -102,11 +102,11 @@ def test_private_messages_can_be_sent_via_user_profiles(page: Page, is_firefox): excerpt=message_body, from_sent_list=True) with check, allure.step("Verifying that the correct banner is displayed"): - assert sumo_pages.sent_message_page._get_sent_messages_page_deleted_banner_text( + assert sumo_pages.sent_message_page.get_sent_messages_page_deleted_banner_text( ) == SentMessagesPageMessages.DELETE_MESSAGE_BANNER_TEXT with allure.step("Verifying that messages from user two are not displayed"): - expect(sumo_pages.sent_message_page._sent_messages_by_excerpt_locator(message_body) + expect(sumo_pages.sent_message_page.sent_messages_by_excerpt_locator(message_body) ).to_be_hidden() with allure.step("Signing in with the user which received the message"): @@ -129,7 +129,7 @@ def test_private_messages_can_be_sent_via_user_profiles(page: Page, is_firefox): ).to_be_hidden() with check, allure.step("Verifying that the correct banner is displayed"): - assert sumo_pages.sent_message_page._get_sent_messages_page_deleted_banner_text( + assert sumo_pages.sent_message_page.get_sent_messages_page_deleted_banner_text( ) == SentMessagesPageMessages.DELETE_MESSAGE_BANNER_TEXT @@ -152,20 +152,20 @@ def test_private_message_can_be_sent_via_new_message_page(page: Page): with allure.step("Accessing the New Message page and sending a message to another user"): sumo_pages.top_navbar.click_on_inbox_option() - sumo_pages.mess_system_user_navbar._click_on_messaging_system_nav_new_message() + sumo_pages.mess_system_user_navbar.click_on_messaging_system_nav_new_message() sumo_pages.messaging_system_flow.complete_send_message_form_with_data( recipient_username=test_user, message_body=message_body, ) with check, allure.step("Verifying that the correct banner is displayed"): - assert sumo_pages.inbox_page._get_text_inbox_page_message_banner_text( + assert sumo_pages.inbox_page.get_text_inbox_page_message_banner_text( ) == InboxPageMessages.MESSAGE_SENT_BANNER_TEXT with allure.step("Verifying that the sent message is displayed inside the sent messages " "page"): - sumo_pages.mess_system_user_navbar._click_on_messaging_system_nav_sent_messages() - expect(sumo_pages.sent_message_page._sent_messages_by_excerpt_locator(message_body) + sumo_pages.mess_system_user_navbar.click_on_messaging_system_nav_sent_messages() + expect(sumo_pages.sent_message_page.sent_messages_by_excerpt_locator(message_body) ).to_be_visible() with allure.step("Clearing the sent messages list"): @@ -205,11 +205,11 @@ def test_navbar_options_redirect_to_the_correct_page_and_options_are_correctly_h "option is highlighted"): expect(page).to_have_url(InboxPageMessages.INBOX_PAGE_STAGE_URL) expect( - sumo_pages.mess_system_user_navbar._get_inbox_navbar_element() + sumo_pages.mess_system_user_navbar.get_inbox_navbar_element() ).to_have_css("background-color", InboxPageMessages.NAVBAR_INBOX_SELECTED_BG_COLOR) with allure.step("Clicking on the sent messages navbar option"): - sumo_pages.mess_system_user_navbar._click_on_messaging_system_nav_sent_messages() + sumo_pages.mess_system_user_navbar.click_on_messaging_system_nav_sent_messages() with allure.step("Verifying that we are on the correct page and the 'Sent Messages' " "navbar option is highlighted"): @@ -217,29 +217,29 @@ def test_navbar_options_redirect_to_the_correct_page_and_options_are_correctly_h page ).to_have_url(SentMessagesPageMessages.SENT_MESSAGES_PAGE_URL) expect( - sumo_pages.mess_system_user_navbar._get_sent_messages_navbar_element() + sumo_pages.mess_system_user_navbar.get_sent_messages_navbar_element() ).to_have_css("background-color", SentMessagesPageMessages.NAVBAR_SENT_MESSAGES_SELECTED_BG_COLOR) with allure.step("Clicking on the 'New message' navbar option"): - sumo_pages.mess_system_user_navbar._click_on_messaging_system_nav_new_message() + sumo_pages.mess_system_user_navbar.click_on_messaging_system_nav_new_message() with allure.step("Verifying that we are on the correct page and the 'New Message' navbar " "option is successfully highlighted"): expect(page).to_have_url(NewMessagePageMessages.NEW_MESSAGE_PAGE_STAGE_URL) expect( - sumo_pages.mess_system_user_navbar._get_new_message_navbar_element() + sumo_pages.mess_system_user_navbar.get_new_message_navbar_element() ).to_have_css("background-color", NewMessagePageMessages.NAVBAR_NEW_MESSAGE_SELECTED_BG_COLOR) with allure.step("Clicking on the navbar inbox messaging system navbar option"): - sumo_pages.mess_system_user_navbar._click_on_messaging_system_navbar_inbox() + sumo_pages.mess_system_user_navbar.click_on_messaging_system_navbar_inbox() with allure.step("Verifying that we are on the correct page and the 'Inbox' navbar " "option is highlighted"): expect(page).to_have_url(InboxPageMessages.INBOX_PAGE_STAGE_URL) expect( - sumo_pages.mess_system_user_navbar._get_inbox_navbar_element() + sumo_pages.mess_system_user_navbar.get_inbox_navbar_element() ).to_have_css("background-color", InboxPageMessages.NAVBAR_INBOX_SELECTED_BG_COLOR) @@ -259,7 +259,7 @@ def test_new_message_field_validation(page: Page): with allure.step("Accessing the New Message page"): sumo_pages.top_navbar.click_on_inbox_option() - sumo_pages.mess_system_user_navbar._click_on_messaging_system_nav_new_message() + sumo_pages.mess_system_user_navbar.click_on_messaging_system_nav_new_message() with allure.step("Trying to submit the form without any data and verifying that we are " "still on the 'New Message' page"): @@ -274,39 +274,27 @@ def test_new_message_field_validation(page: Page): with check, allure.step("Verifying that the default remaining characters is the correct " "one"): - assert (sumo_pages.new_message_page._get_characters_remaining_text( + assert (sumo_pages.new_message_page.get_characters_remaining_text( ) in NewMessagePageMessages.NEW_MESSAGE_DEFAULT_REMAINING_CHARACTERS) with allure.step("Verifying that the characters remaining color is the expected one"): expect( - sumo_pages.new_message_page._get_characters_remaining_text_element() + sumo_pages.new_message_page.get_characters_remaining_text_element() ).to_have_css("color", NewMessagePageMessages.ENOUGH_CHARACTERS_REMAINING_COLOR) - # To check if firefox container crashes. If not remove this part and uncomment the if - # clause - - # if self.browser == "chrome": - # self.logger.info("Adding 9990 characters inside the input field") - # - # self.pages.new_message_page.type_into_new_message_body_textarea( - # text=super().user_message_test_data["valid_user_message"][ - # "9990_characters_long_message" - # ] - # ) - with allure.step("Adding 9990 characters inside the input field"): - sumo_pages.new_message_page._fill_into_new_message_body_textarea( + sumo_pages.new_message_page.fill_into_new_message_body_textarea( text=utilities.user_message_test_data["valid_user_message"][ "9990_characters_long_message" ]) with check, allure.step("Verifying that the correct remaining characters left message is " "displayed"): - assert sumo_pages.new_message_page._get_characters_remaining_text( + assert sumo_pages.new_message_page.get_characters_remaining_text( ) in NewMessagePageMessages.TEN_CHARACTERS_REMAINING_MESSAGE with allure.step("Verifying that the characters remaining color is the expected one"): - expect(sumo_pages.new_message_page._get_characters_remaining_text_element() + expect(sumo_pages.new_message_page.get_characters_remaining_text_element() ).to_have_css("color", NewMessagePageMessages.ENOUGH_CHARACTERS_REMAINING_COLOR) # elif self.browser == "firefox": @@ -319,17 +307,17 @@ def test_new_message_field_validation(page: Page): # ) with allure.step("Adding one character inside the textarea field"): - sumo_pages.new_message_page._type_into_new_message_body_textarea( + sumo_pages.new_message_page.type_into_new_message_body_textarea( text=utilities.user_message_test_data["valid_user_message"] ["one_character_message"] ) with check, allure.step("Verifying that the char remaining string is updated accordingly"): - assert sumo_pages.new_message_page._get_characters_remaining_text( + assert sumo_pages.new_message_page.get_characters_remaining_text( ) in NewMessagePageMessages.NINE_CHARACTERS_REMAINING_MESSAGE with allure.step("Verifying that the characters remaining color is the expected one"): - expect(sumo_pages.new_message_page._get_characters_remaining_text_element() + expect(sumo_pages.new_message_page.get_characters_remaining_text_element() ).to_have_css("color", NewMessagePageMessages.NO_CHARACTERS_REMAINING_COLOR) # elif self.browser == "firefox": @@ -342,15 +330,16 @@ def test_new_message_field_validation(page: Page): # ) with allure.step("Adding 9 characters inside the textarea field"): - sumo_pages.new_message_page._type_into_new_message_body_textarea( + sumo_pages.new_message_page.type_into_new_message_body_textarea( text=utilities.user_message_test_data["valid_user_message"] ["9_characters_message"] ) with allure.step("Verifying that the char remaining string is updated accordingly"): expect( - sumo_pages.new_message_page._get_characters_remaining_text_element() + sumo_pages.new_message_page.get_characters_remaining_text_element() ).to_have_css("color", NewMessagePageMessages.NO_CHARACTERS_REMAINING_COLOR) + # elif self.browser == "firefox": # check.equal( # self.pages.new_message_page.get_characters_remaining_text_color(), @@ -362,7 +351,7 @@ def test_new_message_field_validation(page: Page): with allure.step("Verifying that the characters remaining color is the expected one"): expect( - sumo_pages.new_message_page._get_characters_remaining_text_element() + sumo_pages.new_message_page.get_characters_remaining_text_element() ).to_have_css("color", NewMessagePageMessages.NO_CHARACTERS_REMAINING_COLOR) # elif self.browser == "firefox": @@ -394,7 +383,7 @@ def test_new_message_cancel_button(page: Page): with allure.step("Accessing the 'New Message' section"): sumo_pages.top_navbar.click_on_inbox_option() - sumo_pages.mess_system_user_navbar._click_on_messaging_system_nav_new_message() + sumo_pages.mess_system_user_navbar.click_on_messaging_system_nav_new_message() with allure.step("Filling the new message form with data"): sumo_pages.messaging_system_flow.complete_send_message_form_with_data( @@ -405,16 +394,16 @@ def test_new_message_cancel_button(page: Page): with allure.step("Clicking on the 'Cancel' button and verifying that the user is " "redirected back to the inbox page"): - sumo_pages.new_message_page._click_on_new_message_cancel_button() + sumo_pages.new_message_page.click_on_new_message_cancel_button() expect( - sumo_pages.mess_system_user_navbar._get_inbox_navbar_element() + sumo_pages.mess_system_user_navbar.get_inbox_navbar_element() ).to_have_css("background-color", InboxPageMessages.NAVBAR_INBOX_SELECTED_BG_COLOR) expect(page).to_have_url(InboxPageMessages.INBOX_PAGE_STAGE_URL) with allure.step("Navigating to the 'Sent Messages' page and verifying that the message " "was not sent"): - sumo_pages.mess_system_user_navbar._click_on_messaging_system_nav_sent_messages() - expect(sumo_pages.sent_message_page._sent_messages_by_excerpt_locator(message_body) + sumo_pages.mess_system_user_navbar.click_on_messaging_system_nav_sent_messages() + expect(sumo_pages.sent_message_page.sent_messages_by_excerpt_locator(message_body) ).to_be_hidden() with allure.step("Signing out and signing in with the receiver account"): @@ -446,7 +435,7 @@ def test_new_message_preview(page: Page): with allure.step("Accessing the inbox section and navigating to the new message page"): sumo_pages.top_navbar.click_on_inbox_option() - sumo_pages.mess_system_user_navbar._click_on_messaging_system_nav_new_message() + sumo_pages.mess_system_user_navbar.click_on_messaging_system_nav_new_message() with allure.step("Adding text inside the message content section"): sumo_pages.messaging_system_flow.complete_send_message_form_with_data( @@ -457,17 +446,17 @@ def test_new_message_preview(page: Page): with allure.step("Clicking on the 'Preview' button and verifying that the preview " "section is successfully displayed"): - sumo_pages.new_message_page._click_on_new_message_preview_button() - expect(sumo_pages.new_message_page._message_preview_section_element()).to_be_visible() + sumo_pages.new_message_page.click_on_new_message_preview_button() + expect(sumo_pages.new_message_page.message_preview_section_element()).to_be_visible() with check, allure.step("Verifying that all the preview items are displayed"): - assert sumo_pages.new_message_page._get_text_of_test_data_first_paragraph_text( + assert sumo_pages.new_message_page.get_text_of_test_data_first_paragraph_text( ) in NewMessagePageMessages.PREVIEW_MESSAGE_CONTENT_FIRST_PARAGRAPH_TEXT - assert sumo_pages.new_message_page._get_text_of_test_data_first_p_strong_text( + assert sumo_pages.new_message_page.get_text_of_test_data_first_p_strong_text( ) in NewMessagePageMessages.PREVIEW_MESSAGE_CONTENT_FIRST_PARAGRAPH_STRONG_TEXT - assert sumo_pages.new_message_page._get_text_of_test_data_first_p_italic_text( + assert sumo_pages.new_message_page.get_text_of_test_data_first_p_italic_text( ) in NewMessagePageMessages.PREVIEW_MESSAGE_CONTENT_FIRST_PARAGRAPH_ITALIC_TEXT numbered_list_items = [ @@ -482,21 +471,21 @@ def test_new_message_preview(page: Page): NewMessagePageMessages.PREVIEW_MESSAGE_UL_LI_NUMBER_THREE, ] - assert sumo_pages.new_message_page._get_text_of_numbered_list_items( + assert sumo_pages.new_message_page.get_text_of_numbered_list_items( ) == numbered_list_items - assert sumo_pages.new_message_page._get_text_of_bulleted_list_items( + assert sumo_pages.new_message_page.get_text_of_bulleted_list_items( ) == bulleted_list_items - expect(sumo_pages.new_message_page._new_message_preview_external_link_test_data_element() + expect(sumo_pages.new_message_page.new_message_preview_external_link_test_data_element() ).to_be_visible() - expect(sumo_pages.new_message_page._new_message_preview_internal_link_test_data_element() + expect(sumo_pages.new_message_page.new_message_preview_internal_link_test_data_element() ).to_be_visible() with allure.step("Clicking on the internal link and verifying that the user is " "redirected to the correct article"): - sumo_pages.new_message_page._click_on_preview_internal_link() + sumo_pages.new_message_page.click_on_preview_internal_link() assert ( sumo_pages.kb_article_page._get_text_of_article_title() == NewMessagePageMessages.PREVIEW_MESSAGE_INTERNAL_LINK_TITLE @@ -509,8 +498,8 @@ def test_new_message_preview(page: Page): with allure.step("Verifying that the message was no sent by checking the " "'Sent Messages page'"): sumo_pages.top_navbar.click_on_inbox_option() - sumo_pages.mess_system_user_navbar._click_on_messaging_system_nav_sent_messages() - expect(sumo_pages.sent_message_page._sent_messages(username=test_user)).to_be_hidden() + sumo_pages.mess_system_user_navbar.click_on_messaging_system_nav_sent_messages() + expect(sumo_pages.sent_message_page.sent_messages(username=test_user)).to_be_hidden() with allure.step("Signing in with the potential message receiver and verifying that no " "message were received"): @@ -518,7 +507,7 @@ def test_new_message_preview(page: Page): utilities.user_secrets_accounts["TEST_ACCOUNT_13"] )) sumo_pages.top_navbar.click_on_inbox_option() - expect(sumo_pages.inbox_page._inbox_message(username=username)).to_be_hidden() + expect(sumo_pages.inbox_page.inbox_message(username=username)).to_be_hidden() # C891421, C891424 @@ -541,31 +530,31 @@ def test_messages_can_be_selected_and_deleted(page: Page): with allure.step("Accessing the 'New Message' page and sending a message to a different " "user"): sumo_pages.top_navbar.click_on_inbox_option() - sumo_pages.mess_system_user_navbar._click_on_messaging_system_nav_new_message() + sumo_pages.mess_system_user_navbar.click_on_messaging_system_nav_new_message() sumo_pages.messaging_system_flow.complete_send_message_form_with_data( recipient_username=test_user, message_body=message_body, ) with allure.step("Navigating to the sent messages page"): - sumo_pages.mess_system_user_navbar._click_on_messaging_system_nav_sent_messages() + sumo_pages.mess_system_user_navbar.click_on_messaging_system_nav_sent_messages() with allure.step("Clicking on the 'Delete Selected' button"): - sumo_pages.sent_message_page._click_on_delete_selected_button() + sumo_pages.sent_message_page.click_on_delete_selected_button() with check, allure.step("Verifying that the correct message is displayed"): - assert sumo_pages.sent_message_page._get_sent_messages_page_deleted_banner_text( + assert sumo_pages.sent_message_page.get_sent_messages_page_deleted_banner_text( ) in SentMessagesPageMessages.NO_MESSAGES_SELECTED_BANNER_TEXT with allure.step("Verifying that the message is still listed inside the sent messages " "section"): expect( - sumo_pages.sent_message_page._sent_messages_by_excerpt_locator(message_body) + sumo_pages.sent_message_page.sent_messages_by_excerpt_locator(message_body) ).to_be_visible() with allure.step("Sending another message to self twice"): for i in range(2): - sumo_pages.mess_system_user_navbar._click_on_messaging_system_nav_new_message() + sumo_pages.mess_system_user_navbar.click_on_messaging_system_nav_new_message() sumo_pages.messaging_system_flow.complete_send_message_form_with_data( recipient_username=username_one, message_body=message_body, @@ -573,33 +562,33 @@ def test_messages_can_be_selected_and_deleted(page: Page): with check, allure.step("Clicking on the 'delete selected' button while no messages is " "selected and verifying that the correct banner is displayed"): - sumo_pages.mess_system_user_navbar._click_on_messaging_system_navbar_inbox() - sumo_pages.inbox_page._click_on_inbox_delete_selected_button() - assert sumo_pages.inbox_page._get_text_inbox_page_message_banner_text( + sumo_pages.mess_system_user_navbar.click_on_messaging_system_navbar_inbox() + sumo_pages.inbox_page.click_on_inbox_delete_selected_button() + assert sumo_pages.inbox_page.get_text_inbox_page_message_banner_text( ) in InboxPageMessages.NO_MESSAGES_SELECTED_BANNER_TEXT expect(sumo_pages.inbox_page._inbox_message_based_on_excerpt(message_body).first ).to_be_visible() with allure.step("Selecting the messages and deleting it via the delete selected button"): - sumo_pages.inbox_page._delete_all_inbox_messages_via_delete_selected_button(message_body) + sumo_pages.inbox_page.delete_all_inbox_messages_via_delete_selected_button(message_body) with check, allure.step("Verifying that the messages are no longer displayed"): expect(sumo_pages.inbox_page._inbox_message_based_on_excerpt(message_body)).to_be_hidden() - assert sumo_pages.inbox_page._get_text_inbox_page_message_banner_text( + assert sumo_pages.inbox_page.get_text_inbox_page_message_banner_text( ) in InboxPageMessages.MULTIPLE_MESSAGES_DELETION_BANNER_TEXT with allure.step("Navigating to the sent messages section and clearing all messages via " "the 'delete selected button'"): - sumo_pages.mess_system_user_navbar._click_on_messaging_system_nav_sent_messages() - sumo_pages.sent_message_page._delete_all_sent_messages_via_delete_selected_button( + sumo_pages.mess_system_user_navbar.click_on_messaging_system_nav_sent_messages() + sumo_pages.sent_message_page.delete_all_sent_messages_via_delete_selected_button( message_body) with allure.step("Verifying that the messages are no longer displayed"): - expect(sumo_pages.sent_message_page._sent_messages_by_excerpt_locator(message_body) + expect(sumo_pages.sent_message_page.sent_messages_by_excerpt_locator(message_body) ).to_be_hidden() with check, allure.step("Verifying that the correct banner is displayed"): - assert sumo_pages.sent_message_page._get_sent_messages_page_deleted_banner_text( + assert sumo_pages.sent_message_page.get_sent_messages_page_deleted_banner_text( ) in SentMessagesPageMessages.MULTIPLE_MESSAGES_DELETION_BANNER_TEXT with allure.step("Signing in with the receiver account and navigating to the inbox"): @@ -613,12 +602,12 @@ def test_messages_can_be_selected_and_deleted(page: Page): with allure.step("Deleting all messages from the inbox page via the delete selected " "button'"): - sumo_pages.inbox_page._delete_all_inbox_messages_via_delete_selected_button(message_body) + sumo_pages.inbox_page.delete_all_inbox_messages_via_delete_selected_button(message_body) with check, allure.step("Verifying that the messages are no longer displayed inside the " "inbox section and the correct banner is displayed"): expect(sumo_pages.inbox_page._inbox_message_based_on_excerpt(message_body)).to_be_hidden() - assert sumo_pages.inbox_page._get_text_inbox_page_message_banner_text( + assert sumo_pages.inbox_page.get_text_inbox_page_message_banner_text( ) in InboxPageMessages.MESSAGE_DELETED_BANNER_TEXT @@ -634,15 +623,15 @@ def test_group_messages_cannot_be_sent_by_non_staff_users(page: Page): with allure.step("Navigating to the new message page"): sumo_pages.top_navbar.click_on_inbox_option() - sumo_pages.mess_system_user_navbar._click_on_messaging_system_nav_new_message() + sumo_pages.mess_system_user_navbar.click_on_messaging_system_nav_new_message() with allure.step("Typing in a group name inside the To field"): - sumo_pages.new_message_page._type_into_new_message_to_input_field( + sumo_pages.new_message_page.type_into_new_message_to_input_field( utilities.user_message_test_data['test_groups'][0] ) with allure.step("Verifying that no users are returned"): - expect(sumo_pages.new_message_page._get_no_user_to_locator()).to_be_visible(timeout=10000) + expect(sumo_pages.new_message_page.get_no_user_to_locator()).to_be_visible(timeout=10000) with allure.step("Navigating to the groups page"): utilities.navigate_to_link(utilities.general_test_data['groups']) @@ -680,7 +669,7 @@ def test_staff_users_can_send_group_messages(page: Page): with allure.step("Navigating to the new messages page"): sumo_pages.top_navbar.click_on_inbox_option() - sumo_pages.mess_system_user_navbar._click_on_messaging_system_nav_new_message() + sumo_pages.mess_system_user_navbar.click_on_messaging_system_nav_new_message() with allure.step("Sending out a message to a test group"): sumo_pages.messaging_system_flow.complete_send_message_form_with_data( @@ -690,13 +679,13 @@ def test_staff_users_can_send_group_messages(page: Page): with allure.step("Navigating to the 'Sent Messages page' and verifying that the message " "was sent"): - sumo_pages.mess_system_user_navbar._click_on_messaging_system_nav_sent_messages() + sumo_pages.mess_system_user_navbar.click_on_messaging_system_nav_sent_messages() expect( - sumo_pages.sent_message_page._sent_messages_to_group(targeted_test_group, message_body) + sumo_pages.sent_message_page.sent_messages_to_group(targeted_test_group, message_body) ).to_be_visible() with allure.step("Deleting the outbox"): - sumo_pages.sent_message_page._delete_all_sent_messages_via_delete_selected_button( + sumo_pages.sent_message_page.delete_all_sent_messages_via_delete_selected_button( message_body) with allure.step("Signing in with all targeted group members, verifying that the message " @@ -709,7 +698,7 @@ def test_staff_users_can_send_group_messages(page: Page): sumo_pages.top_navbar.click_on_inbox_option() expect(sumo_pages.inbox_page._inbox_message_based_on_excerpt(message_body) ).to_be_visible() - sumo_pages.inbox_page._delete_all_inbox_messages_via_delete_selected_button( + sumo_pages.inbox_page.delete_all_inbox_messages_via_delete_selected_button( message_body) with allure.step("Signing in with users from second test group and verifying that the " @@ -738,7 +727,7 @@ def test_staff_users_can_send_messages_to_multiple_groups(page: Page): with allure.step("Navigating to the new messages page"): sumo_pages.top_navbar.click_on_inbox_option() - sumo_pages.mess_system_user_navbar._click_on_messaging_system_nav_new_message() + sumo_pages.mess_system_user_navbar.click_on_messaging_system_nav_new_message() with allure.step("Sending out a message to a test group"): sumo_pages.messaging_system_flow.complete_send_message_form_with_data( @@ -748,14 +737,14 @@ def test_staff_users_can_send_messages_to_multiple_groups(page: Page): with check, allure.step("Navigating to the 'Sent Messages page' and verifying that the " "message was sent"): - sumo_pages.mess_system_user_navbar._click_on_messaging_system_nav_sent_messages() - sumo_pages.sent_message_page._click_on_sent_message_subject(message_body) - check.equal(sumo_pages.sent_message_page._get_text_of_all_sent_groups(), + sumo_pages.mess_system_user_navbar.click_on_messaging_system_nav_sent_messages() + sumo_pages.sent_message_page.click_on_sent_message_subject(message_body) + check.equal(sumo_pages.sent_message_page.get_text_of_all_sent_groups(), targeted_test_group) with allure.step("Deleting the outbox"): utilities.navigate_back() - sumo_pages.sent_message_page._delete_all_sent_messages_via_delete_selected_button( + sumo_pages.sent_message_page.delete_all_sent_messages_via_delete_selected_button( message_body) with allure.step("Signing in with all targeted group members, verifying that the message " @@ -769,7 +758,7 @@ def test_staff_users_can_send_messages_to_multiple_groups(page: Page): sumo_pages.top_navbar.click_on_inbox_option() expect(sumo_pages.inbox_page._inbox_message_based_on_excerpt(message_body) ).to_be_visible() - sumo_pages.inbox_page._delete_all_inbox_messages_via_delete_selected_button( + sumo_pages.inbox_page.delete_all_inbox_messages_via_delete_selected_button( message_body) @@ -791,7 +780,7 @@ def test_staff_users_can_send_messages_to_both_groups_and_user(page: Page): with allure.step("Navigating to the new messages page"): sumo_pages.top_navbar.click_on_inbox_option() - sumo_pages.mess_system_user_navbar._click_on_messaging_system_nav_new_message() + sumo_pages.mess_system_user_navbar.click_on_messaging_system_nav_new_message() with allure.step("Sending out a message to a test group + user"): sumo_pages.messaging_system_flow.complete_send_message_form_with_data( @@ -801,15 +790,15 @@ def test_staff_users_can_send_messages_to_both_groups_and_user(page: Page): with check, allure.step("Navigating to the 'Sent Messages page' and verifying that the " "message was sent"): - sumo_pages.mess_system_user_navbar._click_on_messaging_system_nav_sent_messages() - sumo_pages.sent_message_page._click_on_sent_message_subject(message_body) + sumo_pages.mess_system_user_navbar.click_on_messaging_system_nav_sent_messages() + sumo_pages.sent_message_page.click_on_sent_message_subject(message_body) check.is_in(targeted_test_group, - sumo_pages.sent_message_page._get_text_of_all_sent_groups()) - check.equal(targeted_user, sumo_pages.sent_message_page._get_text_of_all_recipients()) + sumo_pages.sent_message_page.get_text_of_all_sent_groups()) + check.equal(targeted_user, sumo_pages.sent_message_page.get_text_of_all_recipients()) with allure.step("Deleting the outbox"): utilities.navigate_back() - sumo_pages.sent_message_page._delete_all_sent_messages_via_delete_selected_button( + sumo_pages.sent_message_page.delete_all_sent_messages_via_delete_selected_button( message_body) with allure.step("Signing in with all targeted group members, verifying that the message " @@ -822,7 +811,7 @@ def test_staff_users_can_send_messages_to_both_groups_and_user(page: Page): sumo_pages.top_navbar.click_on_inbox_option() expect(sumo_pages.inbox_page._inbox_message_based_on_excerpt(message_body) ).to_be_visible() - sumo_pages.inbox_page._delete_all_inbox_messages_via_delete_selected_button( + sumo_pages.inbox_page.delete_all_inbox_messages_via_delete_selected_button( message_body) @@ -851,14 +840,14 @@ def test_removed_group_users_do_not_receive_group_messages(page: Page): with allure.step("Navigating to the new message page and sending a message to the group"): sumo_pages.top_navbar.click_on_inbox_option() - sumo_pages.mess_system_user_navbar._click_on_messaging_system_nav_new_message() + sumo_pages.mess_system_user_navbar.click_on_messaging_system_nav_new_message() sumo_pages.messaging_system_flow.complete_send_message_form_with_data( recipient_username=targeted_test_group, message_body=message_body, ) with allure.step("Deleting the outbox"): - sumo_pages.sent_message_page._delete_all_sent_messages_via_delete_selected_button( + sumo_pages.sent_message_page.delete_all_sent_messages_via_delete_selected_button( message_body) with allure.step("Signing in with all targeted group members, verifying that the message " @@ -878,7 +867,7 @@ def test_removed_group_users_do_not_receive_group_messages(page: Page): else: expect(sumo_pages.inbox_page._inbox_message_based_on_excerpt(message_body) ).to_be_visible() - sumo_pages.inbox_page._delete_all_inbox_messages_via_delete_selected_button( + sumo_pages.inbox_page.delete_all_inbox_messages_via_delete_selected_button( message_body) with allure.step("Signing in with an staff account and adding the user back to the group"): @@ -902,13 +891,13 @@ def test_unable_to_send_group_messages_to_profiless_groups(page: Page): with allure.step("Navigating to the new message page"): sumo_pages.top_navbar.click_on_inbox_option() - sumo_pages.mess_system_user_navbar._click_on_messaging_system_nav_new_message() + sumo_pages.mess_system_user_navbar.click_on_messaging_system_nav_new_message() with allure.step("Typing in a profiless group name inside the To field"): - sumo_pages.new_message_page._type_into_new_message_to_input_field("kb-contributors") + sumo_pages.new_message_page.type_into_new_message_to_input_field("kb-contributors") with allure.step("Verifying that no users are returned"): - expect(sumo_pages.new_message_page._get_no_user_to_locator()).to_be_visible(timeout=10000) + expect(sumo_pages.new_message_page.get_no_user_to_locator()).to_be_visible(timeout=10000) @pytest.mark.messagingSystemCleanup @@ -933,9 +922,9 @@ def test_clear_inbox_and_outbox(page: Page): def inbox_and_outbox_deletion(page: Page): sumo_pages = SumoPages(page) - if sumo_pages.inbox_page._are_inbox_messages_displayed(): - sumo_pages.inbox_page._delete_all_inbox_messages_via_delete_selected_button() + if sumo_pages.inbox_page.are_inbox_messages_displayed(): + sumo_pages.inbox_page.delete_all_inbox_messages_via_delete_selected_button() - sumo_pages.mess_system_user_navbar._click_on_messaging_system_nav_sent_messages() - if sumo_pages.sent_message_page._are_sent_messages_displayed(): - sumo_pages.sent_message_page._delete_all_sent_messages_via_delete_selected_button() + sumo_pages.mess_system_user_navbar.click_on_messaging_system_nav_sent_messages() + if sumo_pages.sent_message_page.are_sent_messages_displayed(): + sumo_pages.sent_message_page.delete_all_sent_messages_via_delete_selected_button()