Актуализация тестов после перехода на версию 1.29

ra4/management_rack
nsubbot 2026-01-30 14:01:39 +03:00
parent 3a09e0d602
commit 4e39172bc7
9 changed files with 26 additions and 24 deletions

View File

@ -51,14 +51,14 @@ class BaseComponent:
fields_locators = {} fields_locators = {}
layouts = container_locator.locator("div.layout") layouts = container_locator.locator("div.layout > div.flex").locator("..")
for i in range(layouts.count()): for i in range(layouts.count()):
layout = layouts.nth(i) layout = layouts.nth(i)
flex_containers = layout.locator("div.flex") flex_containers = layout.locator("div.flex")
# Обрабатываем пары контейнеров # Обрабатываем пары контейнеров
for j in range(0, flex_containers.count() - 1): for j in range(0, flex_containers.count() - 1, 2):
label_container = flex_containers.nth(j) label_container = flex_containers.nth(j)
input_container = flex_containers.nth(j + 1) input_container = flex_containers.nth(j + 1)
@ -72,7 +72,9 @@ class BaseComponent:
"input, textarea, select" "input, textarea, select"
).count() > 0 ).count() > 0
if has_input: not_found = fields_locators.get(label_text) is None
if has_input and not_found:
fields_locators[label_text] = input_container fields_locators[label_text] = input_container
return fields_locators return fields_locators

View File

@ -82,7 +82,12 @@ class DropdownList(BaseComponent):
loc = self.get_locator(locator) loc = self.get_locator(locator)
texts = loc.all_inner_texts() texts = loc.all_inner_texts()
return texts[0].splitlines() if len(texts) == 1 and texts[0].find("\n") != -1:
names = list(texts[0].splitlines())
else:
names = list(texts)
return names
def get_selected_combobox_value(self, combobox_locator: str | Locator, def get_selected_combobox_value(self, combobox_locator: str | Locator,
value_locator: str | Locator = None) -> str: value_locator: str | Locator = None) -> str:

View File

@ -158,12 +158,12 @@ class EventPanelComponent(BaseComponent):
"""Возвращает текущее положение панели событий относительно страницы: "top", "center","bottom".""" """Возвращает текущее положение панели событий относительно страницы: "top", "center","bottom"."""
style_attr = self.page.locator(EventPanelLocators.AREA_EVENTS).get_attribute("style") style_attr = self.page.locator(EventPanelLocators.AREA_EVENTS).get_attribute("style")
position = "bottom" position = "top"
if style_attr.find("display: none;") == -1: if style_attr.find("display: none;") == -1:
height = style_attr.replace("height: ","").replace(";", "") height = style_attr.replace("position: relative;","").replace("height: ","").replace(";", "").lstrip()
if height == "100%": if height == "100%":
position = "top" position = "bottom"
else: else:
position = "center" position = "center"

View File

@ -49,11 +49,12 @@ class AddUserModalWindow(ModalWindowComponent):
self.add_toolbar_button(locator_button_toolbar_close, "close") self.add_toolbar_button(locator_button_toolbar_close, "close")
elements_locators = self.get_input_fields_locators(page.locator(input_form_locator)) elements_locators = self.get_input_fields_locators(page.locator(input_form_locator))
# print(elements_locators)
# Поле Тип авторизации # Поле Тип авторизации
loc = elements_locators.get("Тип авторизации") auth_type_loc = elements_locators.get("Тип авторизации")
if loc: if auth_type_loc:
auth_type_selector = SelectionBarComponent(page, loc.get_by_role("combobox")) auth_type_selector = SelectionBarComponent(page, auth_type_loc.get_by_role("combobox").first)
self.add_content_item("auth_type_selector", auth_type_selector) self.add_content_item("auth_type_selector", auth_type_selector)
# Поле Имя # Поле Имя
@ -352,13 +353,12 @@ class AddUserModalWindow(ModalWindowComponent):
Форма для создания keycloack пользователя имеет тот же набор полей. Форма для создания keycloack пользователя имеет тот же набор полей.
""" """
expected_auth_types = ['local', 'LDAP', 'keycloack'] expected_auth_types = ['local', 'LDAP', 'keycloak']
expected_roles = ['$collector', 'Администратор', expected_roles = ['$collector', 'Администратор',
'Специалист информационной безопасности', 'Специалист информационной безопасности',
'Контактное лицо', 'Оператор'] 'Контактное лицо', 'Оператор']
menu_locator = self.page.locator(ModalWindowLocators.MENU_ACTIVE_INPUT_FORM) menu_locator = self.page.locator(ModalWindowLocators.MENU_ACTIVE_INPUT_FORM)
items_locator = menu_locator.locator(ModalWindowLocators.MENU_ACTIVE_ITEMS)
self.check_by_window_title() self.check_by_window_title()
@ -387,7 +387,7 @@ class AddUserModalWindow(ModalWindowComponent):
continue continue
assert current_auth_type == 'local', "Default Auth Type value should be 'local'" assert current_auth_type == 'local', "Default Auth Type value should be 'local'"
actual_auth_types = item.get_available_options(items_locator) actual_auth_types = item.get_available_options()
assert actual_auth_types == expected_auth_types, \ assert actual_auth_types == expected_auth_types, \
f"Actual auth types {actual_auth_types} are not equal expected values {expected_auth_types}." f"Actual auth types {actual_auth_types} are not equal expected values {expected_auth_types}."
elif name == "role_input": elif name == "role_input":

View File

@ -39,8 +39,7 @@ class SendTestEmailModalWindow(ModalWindowComponent):
self.add_toolbar_button(toolbar_button_close_locator, "close") self.add_toolbar_button(toolbar_button_close_locator, "close")
# Поле ввода адреса # Поле ввода адреса
elements_locators = self.get_input_fields_locators(window_locator) loc = window_locator.locator("//input[@data-testid='E_MAIL_CARD__text-field_text__email']")
loc = elements_locators.get("E-mail").locator("div.v-text-field__slot > input")
email_input = TextInput(page, loc, "email_input") email_input = TextInput(page, loc, "email_input")
self.add_content_item("email_input", email_input) self.add_content_item("email_input", email_input)

View File

@ -44,6 +44,7 @@ class SelectionBarComponent(BaseComponent):
# При нажатии на панель появляется выпадающий список с параметрами фильтрации для выбора # При нажатии на панель появляется выпадающий список с параметрами фильтрации для выбора
self.selected_values_list = DropdownList(self.page) self.selected_values_list = DropdownList(self.page)
print(self.selection_bar_locator)
# Действия: # Действия:
def clear_selections(self) -> None: def clear_selections(self) -> None:

View File

@ -22,7 +22,7 @@ class EventPanelLocators:
CONTAINER_SYSTEM_LOG_EVENTS (str): контейнера с событиями Системного журнала. CONTAINER_SYSTEM_LOG_EVENTS (str): контейнера с событиями Системного журнала.
""" """
AREA_EVENTS = "#app > div.application--wrap > div > div:nth-child(3)" AREA_EVENTS = "#app > div.application--wrap > div > div:nth-child(1)"
BUTTON_EXPAND_LESS = "//button[contains(@data-testid, 'BASELINE__btn__toolbar_close')]" BUTTON_EXPAND_LESS = "//button[contains(@data-testid, 'BASELINE__btn__toolbar_close')]"
BUTTON_EXPAND_MORE = "//button[contains(@data-testid, 'BASELINE__btn__toolbar_open')]" BUTTON_EXPAND_MORE = "//button[contains(@data-testid, 'BASELINE__btn__toolbar_open')]"

View File

@ -20,7 +20,7 @@ class SelectionBarLocators:
# Локаторы для элементов выпадающего списка # Локаторы для элементов выпадающего списка
LISTBOX = "//div[@role='list']" LISTBOX = "//div[@role='list']"
LIST_ITEMS = "//div[@role='list']//div[@role='listitem']" LIST_ITEMS = "//div[contains(@class, 'menuable__content__active')]//div[@role='list']//div[@role='listitem']"
# Локатор для родительского контейнера поля ввода # Локатор для родительского контейнера поля ввода
INPUT_PARENT_CONTAINER = "xpath=./ancestor::div[contains(@class, 'v-input')]" INPUT_PARENT_CONTAINER = "xpath=./ancestor::div[contains(@class, 'v-input')]"

View File

@ -83,11 +83,6 @@ class TestUsersTabAddUser:
ut.open_add_user_window() ut.open_add_user_window()
ut.check_add_user_window_content() ut.check_add_user_window_content()
# skip as unsupported
# ut.transform_to_add_AD_user_window()
# ut.check_add_AD_user_window_content()
# ut.close_add_AD_user_window()
ut.close_add_user_window() ut.close_add_user_window()
# @pytest.mark.develop # @pytest.mark.develop