From 9a5308bf7d3ee674830968c45902800ef8f521b4 Mon Sep 17 00:00:00 2001 From: nsubbot Date: Tue, 16 Dec 2025 11:27:07 +0300 Subject: [PATCH] =?UTF-8?q?=D0=90=D0=BA=D1=82=D1=83=D0=B0=D0=BB=D0=B8?= =?UTF-8?q?=D0=B7=D0=B0=D1=86=D0=B8=D1=8F=20=D1=82=D0=B5=D1=81=D1=82=D0=BE?= =?UTF-8?q?=D0=B2=20=D0=BF=D0=BE=D1=81=D0=BB=D0=B5=20=D0=BF=D0=B5=D1=80?= =?UTF-8?q?=D0=B5=D1=85=D0=BE=D0=B4=D0=B0=20=D0=BD=D0=B0=20=D0=BD=D0=BE?= =?UTF-8?q?=D0=B2=D1=83=D1=8E=20=D0=B2=D0=B5=D1=80=D1=81=D0=B8=D1=8E=20?= =?UTF-8?q?=D0=BF=D1=80=D0=B8=D0=BB=D0=BE=D0=B6=D0=B5=D0=BD=D0=B8=D1=8F=20?= =?UTF-8?q?1.25?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/eventbar_component.py | 5 ----- components_derived/modal_add_local_user.py | 10 +++++----- components_derived/modal_change_password.py | 2 +- components_derived/modal_edit_user.py | 8 ++++---- components_derived/user_card.py | 2 +- pages/current_session_tab.py | 2 +- pages/main_page.py | 2 +- tests/e2e/users/test_user_card.py | 9 ++++++++- 8 files changed, 21 insertions(+), 19 deletions(-) diff --git a/components/eventbar_component.py b/components/eventbar_component.py index 219c228..b92b615 100644 --- a/components/eventbar_component.py +++ b/components/eventbar_component.py @@ -152,11 +152,6 @@ class EventPanelComponent(BaseComponent): self.user_button.check_visibility("User button is missing on event panel") - def should_be_search_button(self) -> None: - """Проверяет наличие кнопки поиска.""" - - self.search_button.check_visibility("Search button is missing on event panel") - def should_be_tab_buttons(self) -> None: """Проверяет наличие блока tab-кнопок Состояния, Действия, События, Обслуживание, Системный журнал.""" diff --git a/components_derived/modal_add_local_user.py b/components_derived/modal_add_local_user.py index fd04d28..03029c1 100644 --- a/components_derived/modal_add_local_user.py +++ b/components_derived/modal_add_local_user.py @@ -52,7 +52,7 @@ class AddLocalUserModalWindow(ModalWindowComponent): self.add_toolbar_button(locator_button_toolbar_close, "close") # Поле Имя - loc = f"{input_form_locator}/div[1]/{text_field_locator}" + loc = f"{input_form_locator}/div[2]/{text_field_locator}" name_input = TextInput(page, self.page.locator(loc), "name_input") self.add_content_item("name_input", name_input) @@ -83,22 +83,22 @@ class AddLocalUserModalWindow(ModalWindowComponent): self.add_content_item("roles_list", DropdownList(page)) # Поле Пароль - loc = f"{input_form_locator}/div[4]/{text_field_locator}" + loc = f"{input_form_locator}/div[5]/{text_field_locator}" password_input = TextInput(page, self.page.locator(loc), "password_input") self.add_content_item("password_input", password_input) # Поле Комментарий - loc = f"{input_form_locator}/div[5]/{text_field_locator}" + loc = f"{input_form_locator}/div[6]/{text_field_locator}" commentary_input = TextInput(page, self.page.locator(loc), "commentary_input") self.add_content_item("commentary_input", commentary_input) # Поле E-mail - loc = f"{input_form_locator}/div[6]/{text_field_locator}" + loc = f"{input_form_locator}/div[7]/{text_field_locator}" email_input = TextInput(page, self.page.locator(loc), "email_input") self.add_content_item("email_input", email_input) # Поле Номер для СМС - loc = f"{input_form_locator}/div[7]/{text_field_locator}" + loc = f"{input_form_locator}/div[8]/{text_field_locator}" phone_input = TextInput(page, self.page.locator(loc), "phone_input") self.add_content_item("phone_input", phone_input) diff --git a/components_derived/modal_change_password.py b/components_derived/modal_change_password.py index daeb3e6..f66dc59 100644 --- a/components_derived/modal_change_password.py +++ b/components_derived/modal_change_password.py @@ -100,7 +100,7 @@ class ChangePasswordModalWindow(ModalWindowComponent): """Нажатие на иконку скрытия пароля подтверждения.""" self.get_content_item("confirm_password_hidden_icon").click() - + def change_password(self, old_password: str, new_password: str): """Заполняет элементы формы, нажимает кнопку 'Сохранить'""" diff --git a/components_derived/modal_edit_user.py b/components_derived/modal_edit_user.py index dcf9b85..6973f6b 100644 --- a/components_derived/modal_edit_user.py +++ b/components_derived/modal_edit_user.py @@ -54,7 +54,7 @@ class EditUserModalWindow(ModalWindowComponent): # Поле Имя loc = ( self.page.locator(input_form_locator) - .locator("xpath=div[1]") + .locator("xpath=div[2]") .locator(text_field_locator) ) name_input = TextInput(page, loc, "name_input") @@ -69,7 +69,7 @@ class EditUserModalWindow(ModalWindowComponent): # Поле Комментарий loc = ( self.page.locator(input_form_locator) - .locator("xpath=div[4]") + .locator("xpath=div[5]") .locator(text_field_locator) ) commentary_input = TextInput(page, loc, "commentary_input") @@ -78,7 +78,7 @@ class EditUserModalWindow(ModalWindowComponent): # Поле E-mail loc = ( self.page.locator(input_form_locator) - .locator("xpath=div[5]") + .locator("xpath=div[6]") .locator(text_field_locator) ) email_input = TextInput(page, loc, "email_input") @@ -87,7 +87,7 @@ class EditUserModalWindow(ModalWindowComponent): # Поле Номер для СМС loc = ( self.page.locator(input_form_locator) - .locator("xpath=div[6]") + .locator("xpath=div[7]") .locator(text_field_locator) ) phone_input = TextInput(page, loc, "phone_input") diff --git a/components_derived/user_card.py b/components_derived/user_card.py index 6deda43..52e1965 100644 --- a/components_derived/user_card.py +++ b/components_derived/user_card.py @@ -127,7 +127,7 @@ class UserCard(BaseComponent): "Expected text 'Время входа:' is missing in user card" ) session_time_str = self.session_time.get_text(0) - assert session_time_str.find("Время сессии:") != -1, ( + assert session_time_str.find("Время сеанса:") != -1, ( "Expected text 'Время сессии:' is missing in user card" ) diff --git a/pages/current_session_tab.py b/pages/current_session_tab.py index c52d28a..110670a 100644 --- a/pages/current_session_tab.py +++ b/pages/current_session_tab.py @@ -218,7 +218,7 @@ class CurrentSessionsTab(BasePage): expected_headers = [ 'ID сеанса', 'ID пользователя', - 'Время жизни', + 'Время сеанса', 'Роль', 'Адрес' ] diff --git a/pages/main_page.py b/pages/main_page.py index 773e561..89dd0cb 100644 --- a/pages/main_page.py +++ b/pages/main_page.py @@ -156,6 +156,7 @@ class MainPage(BasePage): return self.event_panel.check_expand_more_button() + def check_navigation_item_exists(self, item_name: str) -> bool: """Проверяет существование элемента в навигационной панели. @@ -199,7 +200,6 @@ class MainPage(BasePage): ## to-do: кнопки галочки??? self.event_panel.should_be_tab_buttons() self.event_panel.should_be_event_buttons() - self.event_panel.should_be_search_button() self.event_panel.should_be_user_button() def should_be_navigation_panel(self) -> None: diff --git a/tests/e2e/users/test_user_card.py b/tests/e2e/users/test_user_card.py index c0c09ec..88a40ef 100644 --- a/tests/e2e/users/test_user_card.py +++ b/tests/e2e/users/test_user_card.py @@ -63,9 +63,14 @@ class TestUserCard: """Фикстура для удаления тестового пользователя после теста.""" yield + # Выход из системы текущего пользователя mp = MainPage(browser) - mp.wait_for_timeout(1000) + + # Принудительное закрытике окна изменения пароля если оно все еще открыто + if mp.page.locator("div.v-dialog--active").is_visible(): + mp.page.locator("div.v-dialog--active").get_by_role("button", name="Отменить").click() + mp.do_logout() # Авторизация администратором для очистки @@ -153,6 +158,7 @@ class TestUserCard: change_password_window = user_card.click_change_password_button() change_password_window.check_content() + # @pytest.mark.develop def test_change_password_successful(self, browser: Page, create_user: None, cleanup_user: None) -> None: @@ -174,6 +180,7 @@ class TestUserCard: is_changed, error = change_password_window.change_password(user_data["password"], user_data["new_password"]) assert is_changed, f"Unsucessful attempt to change password: {error}" + # @pytest.mark.develop def test_change_password_unsuccessful(self, browser: Page, create_user: None, cleanup_user: None) -> None: