diff --git a/pages/push_notifications_settings_tab.py b/pages/push_notifications_settings_tab.py index a5c1c59..7948e71 100644 --- a/pages/push_notifications_settings_tab.py +++ b/pages/push_notifications_settings_tab.py @@ -8,7 +8,6 @@ import re from playwright.sync_api import Page from locators.settings_form_locators import SettingsFormLocators from elements.text_input_element import TextInput -from elements.text_element import Text from components.toolbar_component import ToolbarComponent from components.alert_component import AlertComponent from components_derived.settings_form_component import SettingsFormComponent @@ -37,26 +36,24 @@ class PushNotificationsSettingsTab(BasePage): self.settings_form = SettingsFormComponent(page) self.settings_form.add_toolbar_title("Общие") - message_setting_label = Text(page, - page.locator(SettingsFormLocators.SETTTINGS_FORM_SCROLL_CONTAINER).\ - get_by_text('Сообщение'), - "message_setting_label") - self.settings_form.add_content_item("message_setting_label", message_setting_label) + css_class = "xs6" + container_locator = self.page.locator(SettingsFormLocators.SETTINGS_FORM_INPUT_FORM_CONTAINER) + self.input_fields_locators = self.settings_form.get_input_fields_locators(container_locator, css_class) - loc_message_input = page.locator(SettingsFormLocators.SETTTINGS_FORM_SCROLL_CONTAINER).\ - get_by_label('Сообщение').nth(1) + loc = self.input_fields_locators.get("Сообщение") + loc_message_input = loc.locator(SettingsFormLocators.SETTINGS_FORM_INPUT_FIELD).first message_setting_input = TextInput(page, loc_message_input, "message_setting_input") self.settings_form.add_content_item("message_setting_input", message_setting_input) - users_settings_locator = page.locator(SettingsFormLocators.SETTTINGS_FORM_SCROLL_CONTAINER).\ - get_by_label('Пользователи') - users_setting_label = Text(page, users_settings_locator, "users_setting_label") - self.settings_form.add_content_item("users_setting_label", users_setting_label) + loc = self.input_fields_locators.get("Пользователи") users_setting_input = TextInput(page, - page.locator(SettingsFormLocators.SETTTINGS_FORM_SCROLL_CONTAINER).\ - get_by_role("combobox"), + loc. get_by_role("combobox"), "users_setting_input") + # users_setting_input = TextInput(page, + # page.locator(SettingsFormLocators.SETTTINGS_FORM_SCROLL_CONTAINER).\ + # get_by_role("combobox"), + # "users_setting_input") self.settings_form.add_content_item("users_setting_input", users_setting_input) self.settings_form.add_content_item("users_list", InteractiveDropdownList(page)) @@ -143,10 +140,16 @@ class PushNotificationsSettingsTab(BasePage): def check_content(self): """Проверяет наличие и корректность всех элементов страницы.""" + expected_input_field_names = ["Сообщение", "Пользователи"] + self.should_be_toolbar() self.should_be_form_toolbar() + actual_input_field_names = self.input_fields_locators.keys() + assert set(actual_input_field_names) == set(expected_input_field_names), \ + f"Misscomparison input field names: Expected {expected_input_field_names}, Actual {actual_input_field_names}" + for name in self.settings_form.content_items.keys(): if name == "users_list": self.settings_form.get_content_item("users_setting_input").click() diff --git a/tests/e2e/test_push_notifications_settings_tab.py b/tests/e2e/test_push_notifications_settings_tab.py index 9cfecca..c806210 100644 --- a/tests/e2e/test_push_notifications_settings_tab.py +++ b/tests/e2e/test_push_notifications_settings_tab.py @@ -43,7 +43,7 @@ class TestPushNotificationsSettingsTab: main_page.click_subpanel_item("Уведомления") main_page.click_subpanel_item("Push уведомления") - # @pytest.mark.develop + # @pytest.mark.develop def test_push_notifications_settings_tab_content(self, browser: Page) -> None: """Тест содержимого вкладки настройки Push уведомлений.