Добавлено поле 'Пользователи AD'
parent
5ed2aaea12
commit
c747802c86
|
|
@ -76,24 +76,37 @@ class AddADUserModalWindow(ModalWindowComponent):
|
|||
locator_button_search = self.page.get_by_role("button", name="Поиск")
|
||||
self.add_button(locator_button_search, "search")
|
||||
|
||||
loc = self.page.locator(input_form_locator).locator("xpath=div[3]").locator(text_field_locator)
|
||||
# Поле "Пользователи AD"
|
||||
user_AD_loc = self.page.locator(input_form_locator).get_by_role("combobox").nth(1)
|
||||
user_AD_input = TextInput(page, user_AD_loc, "user_AD_input")
|
||||
self.add_content_item("user_AD_input", user_AD_input)
|
||||
self.add_content_item(
|
||||
"user_AD_list",
|
||||
DropdownList(page)
|
||||
)
|
||||
|
||||
# Поле "Имя"
|
||||
loc = self.page.locator(input_form_locator).locator("xpath=div[4]").locator(text_field_locator)
|
||||
name_input = TextInput(page, loc, "name_input")
|
||||
self.add_content_item("name_input", name_input)
|
||||
|
||||
# Поле "Роль"
|
||||
role_loc = self.page.locator(input_form_locator).get_by_role("combobox").nth(2)
|
||||
role_input = TextInput(page, role_loc, "role_input")
|
||||
self.add_content_item("role_input", role_input)
|
||||
self.add_content_item("roles_list", DropdownList(page))
|
||||
|
||||
|
||||
# Поле "Комментарий"
|
||||
loc = self.page.locator(input_form_locator).locator("xpath=div[6]").locator(text_field_locator)
|
||||
commentary_input = TextInput(page, loc, "commentary_input")
|
||||
self.add_content_item("commentary_input", commentary_input)
|
||||
|
||||
# Поле "E-mail"
|
||||
loc = self.page.locator(input_form_locator).locator("xpath=div[7]").locator(text_field_locator)
|
||||
email_input = TextInput(page, loc, "email_input")
|
||||
self.add_content_item("email_input", email_input)
|
||||
|
||||
# Поле "Номер для СМС"
|
||||
loc = self.page.locator(input_form_locator).locator("xpath=div[8]").locator(text_field_locator)
|
||||
phone_input = TextInput(page, loc, "phone_input")
|
||||
self.add_content_item("phone_input", phone_input)
|
||||
|
|
@ -221,7 +234,11 @@ class AddADUserModalWindow(ModalWindowComponent):
|
|||
if group_name is None:
|
||||
assert False, "Value of 'group' is missing"
|
||||
|
||||
name = user_data.get("name")
|
||||
name_AD = user_data.get("name_AD") # Поле "Пользователи AD" - выбор из списка
|
||||
if name_AD is None:
|
||||
assert False, "Value of 'name_AD' is missing"
|
||||
|
||||
name = user_data.get("name") # Поле "Имя" - ручной ввод
|
||||
if name is None:
|
||||
assert False, "Value of 'name' is missing"
|
||||
|
||||
|
|
@ -229,6 +246,7 @@ class AddADUserModalWindow(ModalWindowComponent):
|
|||
if role is None:
|
||||
assert False, "Value of 'role' is missing"
|
||||
|
||||
# Выбор группы
|
||||
group_field = self.get_content_item("group_input")
|
||||
group_field.click()
|
||||
|
||||
|
|
@ -241,31 +259,33 @@ class AddADUserModalWindow(ModalWindowComponent):
|
|||
group_list.check_item_with_text(group_name)
|
||||
group_list.click_item_with_text(group_name)
|
||||
|
||||
# Нажатие кнопки "Поиск"
|
||||
search_button = self.get_button_by_name("search")
|
||||
search_button.click()
|
||||
|
||||
# Проверка что группа не пустая
|
||||
count = input_form_locator.get_by_role("combobox").count()
|
||||
if count == 2:
|
||||
assert False, f"Selected group {group_name} is empty. Use another group."
|
||||
|
||||
user_AD_loc = input_form_locator.get_by_role("combobox").nth(1)
|
||||
user_AD_input = TextInput(self.page, user_AD_loc, "user_AD_input")
|
||||
self.add_content_item("user_AD_input", user_AD_input)
|
||||
self.add_content_item(
|
||||
"user_AD_list",
|
||||
DropdownList(self.page)
|
||||
)
|
||||
# Выбор пользователя AD из списка (используем уже созданные элементы)
|
||||
user_AD_input = self.get_content_item("user_AD_input")
|
||||
user_AD_list = self.get_content_item("user_AD_list")
|
||||
|
||||
user_AD_input.click()
|
||||
user_AD_list = self.get_content_item("user_AD_list")
|
||||
user_AD_list.scroll_until_end(menu_locator)
|
||||
user_AD_names = group_list.get_item_names(menu_locator)
|
||||
if name not in user_AD_names:
|
||||
assert False, f"Required user name {name} is missing"
|
||||
user_AD_names = user_AD_list.get_item_names(menu_locator)
|
||||
if name_AD not in user_AD_names:
|
||||
assert False, f"Required AD user name {name_AD} is missing"
|
||||
|
||||
user_AD_list.check_item_with_text(name)
|
||||
user_AD_list.click_item_with_text(name)
|
||||
user_AD_list.check_item_with_text(name_AD)
|
||||
user_AD_list.click_item_with_text(name_AD)
|
||||
|
||||
# Заполнение поля "Имя" (ручной ввод)
|
||||
name_field = self.get_content_item("name_input")
|
||||
name_field.input_value(name) # Вводим значение из поля "name"
|
||||
|
||||
# Выбор роли
|
||||
role_field = self.get_content_item("role_input")
|
||||
role_field.click()
|
||||
|
||||
|
|
@ -330,7 +350,7 @@ class AddADUserModalWindow(ModalWindowComponent):
|
|||
self.check_toolbar_button_visibility("close")
|
||||
self.check_toolbar_button_tooltip("close", "Закрыть")
|
||||
|
||||
no_op_names = ["roles_list", "group_list"]
|
||||
no_op_names = ["roles_list", "group_list", "user_AD_list"]
|
||||
|
||||
for name in self.content_items.keys():
|
||||
item = self.get_content_item(name)
|
||||
|
|
@ -359,6 +379,15 @@ class AddADUserModalWindow(ModalWindowComponent):
|
|||
is_scrollable_vertically = group_list.check_vertical_scrolling(menu_locator)
|
||||
assert is_scrollable_vertically, "Groups list should be scrollable_vertically"
|
||||
self.page.keyboard.press("Escape")
|
||||
elif name == "user_AD_input":
|
||||
item.click()
|
||||
user_AD_list = self.get_content_item("user_AD_list")
|
||||
user_AD_list.check_visibility(menu_locator,
|
||||
"Users AD list is missing")
|
||||
|
||||
is_scrollable_vertically = user_AD_list.check_vertical_scrolling(menu_locator)
|
||||
assert is_scrollable_vertically, "Users AD list should be scrollable_vertically"
|
||||
self.page.keyboard.press("Escape")
|
||||
elif name == "role_input":
|
||||
item.click()
|
||||
roles_list = self.get_content_item("roles_list")
|
||||
|
|
@ -389,13 +418,9 @@ class AddADUserModalWindow(ModalWindowComponent):
|
|||
search_button = self.get_button_by_name("search")
|
||||
search_button.click()
|
||||
|
||||
user_AD_loc = input_form_locator.get_by_role("combobox").nth(1)
|
||||
user_AD_input = TextInput(self.page, user_AD_loc, "user_AD_input")
|
||||
self.add_content_item("user_AD_input", user_AD_input)
|
||||
self.add_content_item(
|
||||
"user_AD_list",
|
||||
DropdownList(self.page)
|
||||
)
|
||||
# Проверка что поле "Пользователи AD" появилось после поиска
|
||||
user_AD_input = self.get_content_item("user_AD_input")
|
||||
user_AD_input.check_visibility("User AD input field is missing after search")
|
||||
|
||||
user_AD_input.click()
|
||||
user_AD_list = self.get_content_item("user_AD_list")
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ class TestUsersTab:
|
|||
ut = UsersTab(browser)
|
||||
|
||||
# Удаляем тестовых пользователей
|
||||
test_users = ["tester1","TestUser", "TestUserAutoOperator", "TestUserAutoAdmin"]
|
||||
test_users = ["TestUserAD","TestUser", "TestUserAutoOperator", "TestUserAutoAdmin"]
|
||||
|
||||
for user_name in test_users:
|
||||
# Проверяем существует ли пользователь и удаляем его
|
||||
|
|
@ -207,7 +207,7 @@ class TestUsersTab:
|
|||
mp.click_subpanel_item("Пользователи")
|
||||
ut.should_not_be_user_in_table(user_data["name"], user_data["role"])
|
||||
|
||||
#@pytest.mark.develop
|
||||
@pytest.mark.develop
|
||||
def test_add_AD_user(self, browser: Page, cleanup_users: None) -> None:
|
||||
"""Проверяет добавление пользователя Active Directory.
|
||||
|
||||
|
|
@ -216,10 +216,13 @@ class TestUsersTab:
|
|||
cleanup_users: Фикстура для автоматического удаления пользователя после теста.
|
||||
"""
|
||||
|
||||
user_data: Dict[str, str] = {"auth_type":"active_directory",
|
||||
user_data: Dict[str, str] = {
|
||||
"auth_type": "active_directory",
|
||||
"group": "NMS_tester",
|
||||
"name": "tester1",
|
||||
"role": "Администратор"}
|
||||
"name_AD": "tester1", # Выбор из списка "Пользователи AD"
|
||||
"name": "TestUserAD", # Ручной ввод в поле "Имя"
|
||||
"role": "Администратор"
|
||||
}
|
||||
|
||||
ut = UsersTab(browser)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue