From b8c3b55ebd22d42fab0f97946b35c781700fa8ed Mon Sep 17 00:00:00 2001 From: nsubbot Date: Wed, 18 Feb 2026 13:46:45 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=20=D1=82=D0=B5=D1=81=D1=82=20=D0=BF=D1=80=D0=BE=D0=B2?= =?UTF-8?q?=D0=B5=D1=80=D1=8F=D1=8E=D1=89=D0=B8=D0=B9=20=D0=BD=D0=B5=D0=B2?= =?UTF-8?q?=D0=BE=D0=B7=D0=BC=D0=BE=D0=B6=D0=BD=D0=BE=D1=81=D1=82=D1=8C=20?= =?UTF-8?q?=D0=BE=D1=82=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B8=20push-=D1=83?= =?UTF-8?q?=D0=B2=D0=B5=D0=B4=D0=BE=D0=BC=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F=20?= =?UTF-8?q?=D0=BF=D1=80=D0=B8=20=D0=BD=D0=B5=D0=B7=D0=B0=D0=BF=D0=BE=D0=BB?= =?UTF-8?q?=D0=BD=D0=B5=D0=BD=D0=BD=D1=8B=D1=85=20=D0=BF=D0=BE=D0=BB=D1=8F?= =?UTF-8?q?=D1=85=20=D1=84=D0=BE=D1=80=D0=BC=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- elements/tooltip_button_element.py | 5 +++ pages/push_notifications_settings_tab.py | 14 ++++++-- .../test_push_notifications_settings_tab.py | 35 +++++++++++++++++++ 3 files changed, 51 insertions(+), 3 deletions(-) diff --git a/elements/tooltip_button_element.py b/elements/tooltip_button_element.py index 89304cb..4430f9b 100644 --- a/elements/tooltip_button_element.py +++ b/elements/tooltip_button_element.py @@ -82,3 +82,8 @@ class TooltipButton(BaseElement): f"Текст подсказки не соответствует ожидаемому. " f"Ожидалось: '{expected_text}', получено: '{actual_text}'" ) + + def is_disabled(self) -> bool: + """ Возвращает значение, отключена ли кнопка (является скрытой) """ + + return self.locator.is_disabled() diff --git a/pages/push_notifications_settings_tab.py b/pages/push_notifications_settings_tab.py index bc257e3..d53e97b 100644 --- a/pages/push_notifications_settings_tab.py +++ b/pages/push_notifications_settings_tab.py @@ -4,11 +4,9 @@ Позволяет проверять состояние и взаимодействовать с элементами вкладки. """ -import re from playwright.sync_api import Page from locators.settings_form_locators import SettingsFormLocators from elements.text_input_element import TextInput -from components.toolbar_component import ToolbarComponent from components.alert_component import AlertComponent from components_derived.settings_form_component import SettingsFormComponent from components_derived.interactive_dropdown_list import InteractiveDropdownList @@ -168,7 +166,7 @@ class PushNotificationsSettingsTab(BasePage): """Проверяет наличие сообщения об успешной отправке push-уведомления. Raises: - AssertionError: Если тулбар отсутствует. + AssertionError: Если alert отсутствует. """ alert_type = self.alert.get_alert_type() @@ -176,3 +174,13 @@ class PushNotificationsSettingsTab(BasePage): self.alert.check_alert_presence('\nPush-уведомление\nуспешно отправлено\n') self.alert.check_alert_absence('\nPush-уведомление\nуспешно отправлено\n') + + def should_be_disabled_button(self) -> None: + """Проверяет, что кнопка 'Отправить' отключена. + + Raises: + AssertionError: Если кнопка включена. + """ + + submit_button = self.settings_form.get_button_by_name("submit_button") + assert submit_button.is_disabled, "Submit button should be disabled" diff --git a/tests/e2e/notifications/test_push_notifications_settings_tab.py b/tests/e2e/notifications/test_push_notifications_settings_tab.py index c806210..aca57f2 100644 --- a/tests/e2e/notifications/test_push_notifications_settings_tab.py +++ b/tests/e2e/notifications/test_push_notifications_settings_tab.py @@ -122,3 +122,38 @@ class TestPushNotificationsSettingsTab: push_notification_settings_tab.clear_users_setting_value() selected_users = push_notification_settings_tab.get_users_setting_value() assert len(selected_users) == 0, "There should be no selected users" + + # @pytest.mark.develop + def test_send_push_notification_for_empty_fields(self, browser: Page) -> None: + """Тест содержимого вкладки настройки Push уведомлений. + + Проверяет: + запрет отправки Push уведомления при незаполненных полях формы (кнопка 'Отправить' должна быть заблокирована) + """ + + # Инициализация вкладки + push_notification_settings_tab = PushNotificationsSettingsTab(browser) + + # оставить пустым поле 'Сообщение', заполнить поле 'Пользователи' + push_notification_settings_tab.input_message("") + msg_value = push_notification_settings_tab.get_message_setting_value() + assert msg_value == "", "Actual message field is not empty" + + push_notification_settings_tab.select_users(["manager"]) + selected_users = push_notification_settings_tab.get_users_setting_value() + assert selected_users == "manager", \ + f"Actual users field value {selected_users} is not equal expected users field value 'manager'" + + push_notification_settings_tab.should_be_disabled_button() + + # заполнить поле 'Сообщение', очистить поле 'Пользователи' + push_notification_settings_tab.input_message("TEST") + msg_value = push_notification_settings_tab.get_message_setting_value() + assert msg_value == "TEST", \ + f"Actual message field value {msg_value} is not equal expected message field value 'TEST'" + + push_notification_settings_tab.deselect_users(["manager"]) + selected_users = push_notification_settings_tab.get_users_setting_value() + assert selected_users == "", "Actual users field is not empty" + + push_notification_settings_tab.should_be_disabled_button()