From bd9768dc4e8b774e399d97ea0221a24163af3342 Mon Sep 17 00:00:00 2001 From: nsubbot Date: Fri, 16 Jan 2026 14:27:37 +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=B2=D0=B5?= =?UTF-8?q?=D1=80=D1=81=D0=B8=D1=8E=201.27.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/table_component.py | 18 ++++++++++++++---- components_derived/date_input_component.py | 2 +- components_derived/events_filter_panel.py | 2 +- components_derived/modal_change_password.py | 8 ++++---- locators/modal_window_locators.py | 4 ++++ pages/users_tab.py | 12 +++++++++--- .../test_push_notifications_settings_tab.py | 0 tests/e2e/test_service_status_tab.py | 4 ++-- tests/e2e/{ => ztp}/test_ztp_config_tab.py | 0 tests/e2e/{ => ztp}/test_ztp_templates_tab.py | 0 10 files changed, 35 insertions(+), 15 deletions(-) rename tests/e2e/{ => notifications}/test_push_notifications_settings_tab.py (100%) rename tests/e2e/{ => ztp}/test_ztp_config_tab.py (100%) rename tests/e2e/{ => ztp}/test_ztp_templates_tab.py (100%) diff --git a/components/table_component.py b/components/table_component.py index e749d9d..a07c5da 100644 --- a/components/table_component.py +++ b/components/table_component.py @@ -342,15 +342,18 @@ class TableComponent(BaseComponent): scale_x, scale_y: коээфициенты масштабирования (причина: несовпадение масштабов контента страницы и фрейма) """ + print("row_index: "+str(row_index)) table = self.get_locator(locator) row = table.locator("tbody").locator(".MuiTableRow-root").nth(row_index) + # print(row) # Прокручиваем и ждем - row.scroll_into_view_if_needed() - self.page.wait_for_timeout(1000) + # row.scroll_into_view_if_needed() + # self.page.wait_for_timeout(5000) # Получение "ограничительной рамки" строки bounding_box = row.evaluate("el => el.getBoundingClientRect()") + print(bounding_box) assert bounding_box, "Requested row is not visible" # Получение текущего цвета фона @@ -364,9 +367,16 @@ class TableComponent(BaseComponent): center_x = (bounding_box["x"] + bounding_box["width"] / 2) * scale_x + offset_x center_y = (bounding_box["y"] + bounding_box["height"] / 2) * scale_y + offset_y - + + # Прокручиваем и ждем + row.scroll_into_view_if_needed() + self.page.wait_for_timeout(3000) + self.page.mouse.move(math.ceil(center_x), math.ceil(center_y), steps=5) - self.page.wait_for_timeout(1000) + self.page.wait_for_timeout(3000) + # print(math.ceil(center_y)) + # print(offset_y) + # print(scale_y) # Получение текущего цвета фона new_color = row.evaluate("el => window.getComputedStyle(el).backgroundColor") diff --git a/components_derived/date_input_component.py b/components_derived/date_input_component.py index 0d35d1d..a8a16a7 100644 --- a/components_derived/date_input_component.py +++ b/components_derived/date_input_component.py @@ -153,7 +153,7 @@ class DateInput(BaseComponent): expect(label_locator).to_be_visible() self.time_input_field.check_visibility("Text field for time input is missing") current_time_value = self.get_time_field_value() - assert current_time_value == "00:00", \ + assert current_time_value == "", \ "Should be empty time input field" def check_switch_mode_button_visibility(self) -> None: diff --git a/components_derived/events_filter_panel.py b/components_derived/events_filter_panel.py index 636d514..be674fe 100644 --- a/components_derived/events_filter_panel.py +++ b/components_derived/events_filter_panel.py @@ -30,7 +30,7 @@ class EventsFilterPanel(BaseComponent): locator("div.menuable__content__active div.scrollarea__body > div:nth-child(1) > div:nth-child(1)") self.start_time_filter = DateInput(page, loc) loc = self.page. \ - locator("div.menuable__content__active div.scrollarea__body > div:nth-child(1) > div:nth-child(3)") + locator("div.menuable__content__active div.scrollarea__body > div:nth-child(1) > div:nth-child(2)") self.finish_time_filter = DateInput(page, loc) # Поля задания параметров фильтрации (произвольное количество) diff --git a/components_derived/modal_change_password.py b/components_derived/modal_change_password.py index f66dc59..4534dc6 100644 --- a/components_derived/modal_change_password.py +++ b/components_derived/modal_change_password.py @@ -38,7 +38,7 @@ class ChangePasswordModalWindow(ModalWindowComponent): self.add_toolbar_title(f"Изменить пароль для пользователя {user_name}?") # Поля ввода пароля - loc = modal_window_locator.get_by_label("Введите текущий пароль *") + loc = page.locator(ModalWindowLocators.CHANDE_PASSWORD_WINDOW_CURRENT_PASSWORD) old_password_input = TextInput(page, loc, "old_password_input") self.add_content_item("old_password_input", old_password_input) @@ -47,7 +47,7 @@ class ChangePasswordModalWindow(ModalWindowComponent): "old password hidden icon") self.add_content_item("old_password_hidden_icon", old_password_hidden_icon) - loc = modal_window_locator.get_by_label("Введите новый пароль *") + loc = loc = page.locator(ModalWindowLocators.CHANDE_PASSWORD_WINDOW_NEW_PASSWORD) new_password_input = TextInput(page, loc, "new_password_input") self.add_content_item("new_password_input", new_password_input) @@ -56,7 +56,7 @@ class ChangePasswordModalWindow(ModalWindowComponent): "new password hidden icon") self.add_content_item("new_password_hidden_icon", new_password_hidden_icon) - loc = modal_window_locator.get_by_label("Введите повторно новый пароль *") + loc = loc = page.locator(ModalWindowLocators.CHANDE_PASSWORD_WINDOW_CHECK_PASSWORD) confirm_password_input = TextInput(page, loc, "confirm_password_input") self.add_content_item("confirm_password_input", confirm_password_input) @@ -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/locators/modal_window_locators.py b/locators/modal_window_locators.py index 020b079..3b61298 100644 --- a/locators/modal_window_locators.py +++ b/locators/modal_window_locators.py @@ -31,3 +31,7 @@ class ModalWindowLocators: LABEL_INPUT_FORM_USER_DATA = "//label[contains(@class,'v-label')]/span" TASK_MODAL_WINDOW = "//div[@data-testid='BASELINE__dialog-drag__modal_0']" + + CHANDE_PASSWORD_WINDOW_CURRENT_PASSWORD = "//input[@data-testid='CHANGE_PASS_CARD__text-field__current_password']" + CHANDE_PASSWORD_WINDOW_NEW_PASSWORD = "//input[@data-testid='CHANGE_PASS_CARD__text-field__new_password']" + CHANDE_PASSWORD_WINDOW_CHECK_PASSWORD = "//input[@data-testid='CHANGE_PASS_CARD__text-field__check_password']" diff --git a/pages/users_tab.py b/pages/users_tab.py index 79dc17a..c00b8aa 100644 --- a/pages/users_tab.py +++ b/pages/users_tab.py @@ -298,7 +298,7 @@ class UsersTab(BasePage): if user_name == val: user_name = key - role = table_content[row_index][2] + role = table_content[row_index][3] self.page.locator(TableLocators.TABLE_WORK_AREA).locator( "//tbody/tr").nth(row_index).click() @@ -374,8 +374,9 @@ class UsersTab(BasePage): """ self.page.wait_for_timeout(2000) - expected_headers = ['Имя пользователя', 'Тип авторизации', 'Роль', - 'E-mail', 'Номер для СМС'] + expected_headers = ['Имя пользователя', 'Идентификатор', 'Тип авторизации', + 'Роль', 'E-mail', 'Номер для СМС'] + table_content = self.users_table.read(TableLocators.TABLE_WORK_AREA) if len(table_content) == 0: @@ -492,6 +493,11 @@ class UsersTab(BasePage): # НЕ преобразуем имя пользователя - оставляем как есть из БД user_info.append(user_name) + if item["id"] is not None: + user_info.append(str(item["id"])) + else: + user_info.append("") + if item["type_auth"] is not None: user_info.append(item["type_auth"]) else: diff --git a/tests/e2e/test_push_notifications_settings_tab.py b/tests/e2e/notifications/test_push_notifications_settings_tab.py similarity index 100% rename from tests/e2e/test_push_notifications_settings_tab.py rename to tests/e2e/notifications/test_push_notifications_settings_tab.py diff --git a/tests/e2e/test_service_status_tab.py b/tests/e2e/test_service_status_tab.py index 9e488e6..6321de9 100644 --- a/tests/e2e/test_service_status_tab.py +++ b/tests/e2e/test_service_status_tab.py @@ -50,7 +50,7 @@ class TestServiceStatusTab: # Клик по пункту 'Статус обслуживания' в панели навигации обслуживания mp.click_subpanel_item("Статус обслуживания") - @pytest.mark.develop + # @pytest.mark.develop def test_service_status_tab_content(self, browser: Page): """Проверяет содержимое вкладки 'Статус обслуживания'. @@ -96,8 +96,8 @@ class TestServiceStatusTab: # Проверка выделения строк sst.check_services_table_row_highlighting(0) - sst.check_services_table_row_highlighting(rows_count - 1) sst.check_services_table_row_highlighting(int(rows_count / 2)) + sst.check_services_table_row_highlighting(rows_count - 1) # @pytest.mark.develop def test_service_status_tab_resize(self, browser: Page): diff --git a/tests/e2e/test_ztp_config_tab.py b/tests/e2e/ztp/test_ztp_config_tab.py similarity index 100% rename from tests/e2e/test_ztp_config_tab.py rename to tests/e2e/ztp/test_ztp_config_tab.py diff --git a/tests/e2e/test_ztp_templates_tab.py b/tests/e2e/ztp/test_ztp_templates_tab.py similarity index 100% rename from tests/e2e/test_ztp_templates_tab.py rename to tests/e2e/ztp/test_ztp_templates_tab.py