Добавлен чекбокс 'Блокировка'
parent
6b633a9c73
commit
3cb8eabfd0
|
|
@ -25,7 +25,7 @@ class AddADUserModalWindow(ModalWindowComponent):
|
||||||
|
|
||||||
Наследует ModalWindowComponent и добавляет элементы формы:
|
Наследует ModalWindowComponent и добавляет элементы формы:
|
||||||
- Поля ввода (имя, пароль, email и др.)
|
- Поля ввода (имя, пароль, email и др.)
|
||||||
- Чекбоксы (Active Directory, Push-уведомления)
|
- Чекбоксы (Active Directory, Блокировка, Push-уведомления)
|
||||||
- Выпадающие списки групп, пользователей AD, ролей
|
- Выпадающие списки групп, пользователей AD, ролей
|
||||||
- Кнопки действий
|
- Кнопки действий
|
||||||
"""
|
"""
|
||||||
|
|
@ -36,7 +36,7 @@ class AddADUserModalWindow(ModalWindowComponent):
|
||||||
super().__init__(page)
|
super().__init__(page)
|
||||||
|
|
||||||
# Локаторы элементов формы
|
# Локаторы элементов формы
|
||||||
input_form_locator = page.locator(ModalWindowLocators.INPUT_FORM_USER_DATA)
|
input_form_locator = ModalWindowLocators.INPUT_FORM_USER_DATA
|
||||||
text_field_locator = ModalWindowLocators.TEXT_FIELD_INPUT_FORM_USER_DATA
|
text_field_locator = ModalWindowLocators.TEXT_FIELD_INPUT_FORM_USER_DATA
|
||||||
label_locator = ModalWindowLocators.LABEL_INPUT_FORM_USER_DATA
|
label_locator = ModalWindowLocators.LABEL_INPUT_FORM_USER_DATA
|
||||||
|
|
||||||
|
|
@ -52,7 +52,7 @@ class AddADUserModalWindow(ModalWindowComponent):
|
||||||
# Добавление элементов формы
|
# Добавление элементов формы
|
||||||
checkbox_1 = Checkbox(
|
checkbox_1 = Checkbox(
|
||||||
page,
|
page,
|
||||||
self.page.get_by_role("checkbox").nth(0),
|
self.page.locator(input_form_locator).get_by_role("checkbox").nth(0),
|
||||||
"active_directory"
|
"active_directory"
|
||||||
)
|
)
|
||||||
self.add_content_item("active_directory_checkbox", checkbox_1)
|
self.add_content_item("active_directory_checkbox", checkbox_1)
|
||||||
|
|
@ -65,7 +65,7 @@ class AddADUserModalWindow(ModalWindowComponent):
|
||||||
self.add_content_item("active_directory_checkbox_label", label_1)
|
self.add_content_item("active_directory_checkbox_label", label_1)
|
||||||
|
|
||||||
# Начальный набор полей формы
|
# Начальный набор полей формы
|
||||||
group_loc = input_form_locator.get_by_role("combobox").nth(0)
|
group_loc = self.page.locator(input_form_locator).get_by_role("combobox").nth(0)
|
||||||
group_input = TextInput(page, group_loc, "group_input")
|
group_input = TextInput(page, group_loc, "group_input")
|
||||||
self.add_content_item("group_input", group_input)
|
self.add_content_item("group_input", group_input)
|
||||||
self.add_content_item(
|
self.add_content_item(
|
||||||
|
|
@ -76,43 +76,59 @@ class AddADUserModalWindow(ModalWindowComponent):
|
||||||
locator_button_search = self.page.get_by_role("button", name="Поиск")
|
locator_button_search = self.page.get_by_role("button", name="Поиск")
|
||||||
self.add_button(locator_button_search, "search")
|
self.add_button(locator_button_search, "search")
|
||||||
|
|
||||||
loc = input_form_locator.locator("xpath=div[3]").locator(text_field_locator)
|
loc = self.page.locator(input_form_locator).locator("xpath=div[3]").locator(text_field_locator)
|
||||||
name_input = TextInput(page, loc, "name_input")
|
name_input = TextInput(page, loc, "name_input")
|
||||||
self.add_content_item("name_input", name_input)
|
self.add_content_item("name_input", name_input)
|
||||||
|
|
||||||
role_loc = input_form_locator.get_by_role("combobox").nth(1)
|
role_loc = self.page.locator(input_form_locator).get_by_role("combobox").nth(2)
|
||||||
role_input = TextInput(page, role_loc, "role_input")
|
role_input = TextInput(page, role_loc, "role_input")
|
||||||
self.add_content_item("role_input", role_input)
|
self.add_content_item("role_input", role_input)
|
||||||
self.add_content_item(
|
self.add_content_item("roles_list", DropdownList(page))
|
||||||
"roles_list",
|
|
||||||
DropdownList(page)
|
|
||||||
)
|
|
||||||
|
|
||||||
loc = input_form_locator.locator("xpath=div[6]").locator(text_field_locator)
|
|
||||||
|
loc = self.page.locator(input_form_locator).locator("xpath=div[6]").locator(text_field_locator)
|
||||||
commentary_input = TextInput(page, loc, "commentary_input")
|
commentary_input = TextInput(page, loc, "commentary_input")
|
||||||
self.add_content_item("commentary_input", commentary_input)
|
self.add_content_item("commentary_input", commentary_input)
|
||||||
|
|
||||||
loc = input_form_locator.locator("xpath=div[7]").locator(text_field_locator)
|
loc = self.page.locator(input_form_locator).locator("xpath=div[7]").locator(text_field_locator)
|
||||||
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)
|
||||||
|
|
||||||
loc = input_form_locator.locator("xpath=div[8]").locator(text_field_locator)
|
loc = self.page.locator(input_form_locator).locator("xpath=div[8]").locator(text_field_locator)
|
||||||
phone_input = TextInput(page, loc, "phone_input")
|
phone_input = TextInput(page, loc, "phone_input")
|
||||||
self.add_content_item("phone_input", phone_input)
|
self.add_content_item("phone_input", phone_input)
|
||||||
|
|
||||||
|
# Чекбокс "Блокировка" - индекс 1
|
||||||
checkbox_2 = Checkbox(
|
checkbox_2 = Checkbox(
|
||||||
page,
|
page,
|
||||||
page.get_by_role("checkbox").nth(1),
|
self.page.locator(input_form_locator).get_by_role("checkbox").nth(1),
|
||||||
"push_notification"
|
"blocking"
|
||||||
)
|
)
|
||||||
self.add_content_item("push_notification_checkbox", checkbox_2)
|
self.add_content_item("blocking_checkbox", checkbox_2)
|
||||||
|
|
||||||
|
# Метка "Блокировка" - индекс 1
|
||||||
label_2 = Text(
|
label_2 = Text(
|
||||||
page,
|
page,
|
||||||
self.page.locator(label_locator).nth(1),
|
self.page.locator(label_locator).nth(1),
|
||||||
|
"blocking_checkbox_label"
|
||||||
|
)
|
||||||
|
self.add_content_item("blocking_checkbox_label", label_2)
|
||||||
|
|
||||||
|
# Чекбокс "Push-уведомления" - индекс 2
|
||||||
|
checkbox_3 = Checkbox(
|
||||||
|
page,
|
||||||
|
self.page.locator(input_form_locator).get_by_role("checkbox").nth(2),
|
||||||
|
"push_notification"
|
||||||
|
)
|
||||||
|
self.add_content_item("push_notification_checkbox", checkbox_3)
|
||||||
|
|
||||||
|
# Метка "Push-уведомления" - индекс 2
|
||||||
|
label_3 = Text(
|
||||||
|
page,
|
||||||
|
self.page.locator(label_locator).nth(2),
|
||||||
"push_notification_checkbox_label"
|
"push_notification_checkbox_label"
|
||||||
)
|
)
|
||||||
self.add_content_item("push_notification_checkbox_label", label_2)
|
self.add_content_item("push_notification_checkbox_label", label_3)
|
||||||
|
|
||||||
# Добавление кнопок действий
|
# Добавление кнопок действий
|
||||||
locator_button_add = self.page.get_by_role("button", name="Добавить")
|
locator_button_add = self.page.get_by_role("button", name="Добавить")
|
||||||
|
|
@ -134,6 +150,26 @@ class AddADUserModalWindow(ModalWindowComponent):
|
||||||
|
|
||||||
self.get_content_item("active_directory_checkbox").uncheck(force=True)
|
self.get_content_item("active_directory_checkbox").uncheck(force=True)
|
||||||
|
|
||||||
|
def check_blocking_checkbox(self):
|
||||||
|
"""Включает чек-бокс Блокировка."""
|
||||||
|
|
||||||
|
self.get_content_item("blocking_checkbox").check(force=True)
|
||||||
|
|
||||||
|
def uncheck_blocking_checkbox(self):
|
||||||
|
"""Выключает чек-бокс Блокировка."""
|
||||||
|
|
||||||
|
self.get_content_item("blocking_checkbox").uncheck(force=True)
|
||||||
|
|
||||||
|
def check_push_notification_checkbox(self):
|
||||||
|
"""Включает чек-бокс Push-уведомления."""
|
||||||
|
|
||||||
|
self.get_content_item("push_notification_checkbox").check(force=True)
|
||||||
|
|
||||||
|
def uncheck_push_notification_checkbox(self):
|
||||||
|
"""Выключает чек-бокс Push-уведомления."""
|
||||||
|
|
||||||
|
self.get_content_item("push_notification_checkbox").uncheck(force=True)
|
||||||
|
|
||||||
def update_input_form_fields(self, expand):
|
def update_input_form_fields(self, expand):
|
||||||
"""Персчитывает локаторы полей формы ввода при добавлении/удалении дополнительного поля. """
|
"""Персчитывает локаторы полей формы ввода при добавлении/удалении дополнительного поля. """
|
||||||
|
|
||||||
|
|
@ -237,6 +273,22 @@ class AddADUserModalWindow(ModalWindowComponent):
|
||||||
roles_list.check_item_with_text(user_data["role"])
|
roles_list.check_item_with_text(user_data["role"])
|
||||||
roles_list.click_item_with_text(user_data["role"])
|
roles_list.click_item_with_text(user_data["role"])
|
||||||
|
|
||||||
|
# Управление чекбоксом "Блокировка"
|
||||||
|
if "blocking_checked" in user_data:
|
||||||
|
checkbox = self.get_content_item("blocking_checkbox")
|
||||||
|
if user_data["blocking_checked"]:
|
||||||
|
checkbox.check()
|
||||||
|
else:
|
||||||
|
checkbox.uncheck()
|
||||||
|
|
||||||
|
# Управление чекбоксом "Push-уведомления"
|
||||||
|
if "push_notification_checked" in user_data:
|
||||||
|
checkbox = self.get_content_item("push_notification_checkbox")
|
||||||
|
if user_data["push_notification_checked"]:
|
||||||
|
checkbox.check()
|
||||||
|
else:
|
||||||
|
checkbox.uncheck()
|
||||||
|
|
||||||
# Отправка формы
|
# Отправка формы
|
||||||
add_button = self.get_button_by_name("add")
|
add_button = self.get_button_by_name("add")
|
||||||
add_button.click()
|
add_button.click()
|
||||||
|
|
@ -248,9 +300,7 @@ class AddADUserModalWindow(ModalWindowComponent):
|
||||||
f"Confirmation dialog window with title '{title}' is missing"
|
f"Confirmation dialog window with title '{title}' is missing"
|
||||||
)
|
)
|
||||||
|
|
||||||
# На первом этапе реального пользователя не создаем
|
self.new_user_confirm.click_allow_button()
|
||||||
self.new_user_confirm.click_cancel_button()
|
|
||||||
self.close_window()
|
|
||||||
|
|
||||||
def close_window(self):
|
def close_window(self):
|
||||||
"""Закрывает модальное окно через кнопку 'Закрыть'."""
|
"""Закрывает модальное окно через кнопку 'Закрыть'."""
|
||||||
|
|
@ -290,6 +340,11 @@ class AddADUserModalWindow(ModalWindowComponent):
|
||||||
"Active Directory",
|
"Active Directory",
|
||||||
"Label 'Active Directory' is missing"
|
"Label 'Active Directory' is missing"
|
||||||
)
|
)
|
||||||
|
elif name == "blocking_checkbox_label":
|
||||||
|
item.check_have_text(
|
||||||
|
"Блокировка",
|
||||||
|
"Label 'Блокировка' is missing"
|
||||||
|
)
|
||||||
elif name == "push_notification_checkbox_label":
|
elif name == "push_notification_checkbox_label":
|
||||||
item.check_have_text(
|
item.check_have_text(
|
||||||
"Подписка на Push-уведомления",
|
"Подписка на Push-уведомления",
|
||||||
|
|
|
||||||
|
|
@ -81,43 +81,26 @@ class AddLocalUserModalWindow(ModalWindowComponent):
|
||||||
self.add_content_item("role_input", role_input)
|
self.add_content_item("role_input", role_input)
|
||||||
self.add_content_item("roles_list", DropdownList(page))
|
self.add_content_item("roles_list", DropdownList(page))
|
||||||
|
|
||||||
loc = (
|
loc = self.page.locator(input_form_locator).locator("xpath=div[5]").locator(text_field_locator)
|
||||||
self.page.locator(input_form_locator)
|
|
||||||
.locator("xpath=div[5]")
|
|
||||||
.locator(text_field_locator)
|
|
||||||
)
|
|
||||||
password_input = TextInput(page, loc, "password_input")
|
password_input = TextInput(page, loc, "password_input")
|
||||||
self.add_content_item("password_input", password_input)
|
self.add_content_item("password_input", password_input)
|
||||||
|
|
||||||
loc = (
|
loc = self.page.locator(input_form_locator).locator("xpath=div[6]").locator(text_field_locator)
|
||||||
self.page.locator(input_form_locator)
|
|
||||||
.locator("xpath=div[6]")
|
|
||||||
.locator(text_field_locator)
|
|
||||||
)
|
|
||||||
commentary_input = TextInput(page, loc, "commentary_input")
|
commentary_input = TextInput(page, loc, "commentary_input")
|
||||||
self.add_content_item("commentary_input", commentary_input)
|
self.add_content_item("commentary_input", commentary_input)
|
||||||
|
|
||||||
loc = (
|
loc = self.page.locator(input_form_locator).locator("xpath=div[7]").locator(text_field_locator)
|
||||||
self.page.locator(input_form_locator)
|
|
||||||
.locator("xpath=div[7]")
|
|
||||||
.locator(text_field_locator)
|
|
||||||
)
|
|
||||||
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)
|
||||||
|
|
||||||
loc = (
|
loc = self.page.locator(input_form_locator).locator("xpath=div[8]").locator(text_field_locator)
|
||||||
self.page.locator(input_form_locator)
|
|
||||||
.locator("xpath=div[8]")
|
|
||||||
.locator(text_field_locator)
|
|
||||||
)
|
|
||||||
phone_input = TextInput(page, loc, "phone_input")
|
phone_input = TextInput(page, loc, "phone_input")
|
||||||
self.add_content_item("phone_input", phone_input)
|
self.add_content_item("phone_input", phone_input)
|
||||||
|
|
||||||
# Чекбокс "Блокировка" - индекс 1
|
# Чекбокс "Блокировка" - индекс 1
|
||||||
checkbox_2 = Checkbox(
|
checkbox_2 = Checkbox(
|
||||||
page,
|
page,
|
||||||
self.page.locator(ModalWindowLocators.INPUT_FORM_USER_DATA)
|
self.page.locator(input_form_locator).get_by_role("checkbox").nth(1),
|
||||||
.get_by_role("checkbox").nth(1),
|
|
||||||
"blocking"
|
"blocking"
|
||||||
)
|
)
|
||||||
self.add_content_item("blocking_checkbox", checkbox_2)
|
self.add_content_item("blocking_checkbox", checkbox_2)
|
||||||
|
|
@ -130,16 +113,15 @@ class AddLocalUserModalWindow(ModalWindowComponent):
|
||||||
)
|
)
|
||||||
self.add_content_item("blocking_checkbox_label", label_2)
|
self.add_content_item("blocking_checkbox_label", label_2)
|
||||||
|
|
||||||
# Чекбокс "Подписка на Push-уведомления" - индекс 2
|
# Чекбокс "Push-уведомления" - индекс 2
|
||||||
checkbox_3 = Checkbox(
|
checkbox_3 = Checkbox(
|
||||||
page,
|
page,
|
||||||
self.page.locator(ModalWindowLocators.INPUT_FORM_USER_DATA)
|
self.page.locator(input_form_locator).get_by_role("checkbox").nth(2),
|
||||||
.get_by_role("checkbox").nth(2),
|
|
||||||
"push_notification"
|
"push_notification"
|
||||||
)
|
)
|
||||||
self.add_content_item("push_notification_checkbox", checkbox_3)
|
self.add_content_item("push_notification_checkbox", checkbox_3)
|
||||||
|
|
||||||
# Метка "Подписка на Push-уведомления" - индекс 2
|
# Метка "Push-уведомления" - индекс 2
|
||||||
label_3 = Text(
|
label_3 = Text(
|
||||||
page,
|
page,
|
||||||
self.page.locator(label_locator).nth(2),
|
self.page.locator(label_locator).nth(2),
|
||||||
|
|
@ -167,6 +149,26 @@ class AddLocalUserModalWindow(ModalWindowComponent):
|
||||||
|
|
||||||
self.get_content_item("active_directory_checkbox").uncheck(force=True)
|
self.get_content_item("active_directory_checkbox").uncheck(force=True)
|
||||||
|
|
||||||
|
def check_blocking_checkbox(self):
|
||||||
|
"""Включает чек-бокс Блокировка."""
|
||||||
|
|
||||||
|
self.get_content_item("blocking_checkbox").check(force=True)
|
||||||
|
|
||||||
|
def uncheck_blocking_checkbox(self):
|
||||||
|
"""Выключает чек-бокс Блокировка."""
|
||||||
|
|
||||||
|
self.get_content_item("blocking_checkbox").uncheck(force=True)
|
||||||
|
|
||||||
|
def check_push_notification_checkbox(self):
|
||||||
|
"""Включает чек-бокс Push-уведомления."""
|
||||||
|
|
||||||
|
self.get_content_item("push_notification_checkbox").check(force=True)
|
||||||
|
|
||||||
|
def uncheck_push_notification_checkbox(self):
|
||||||
|
"""Выключает чек-бокс Push-уведомления."""
|
||||||
|
|
||||||
|
self.get_content_item("push_notification_checkbox").uncheck(force=True)
|
||||||
|
|
||||||
def new_user(self, user_data):
|
def new_user(self, user_data):
|
||||||
"""Заполняет форму и добавляет нового пользователя.
|
"""Заполняет форму и добавляет нового пользователя.
|
||||||
|
|
||||||
|
|
@ -299,18 +301,5 @@ class AddLocalUserModalWindow(ModalWindowComponent):
|
||||||
f"Modal window content item with name '{name}' is missing"
|
f"Modal window content item with name '{name}' is missing"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Дополнительная проверка состояния чекбоксов
|
|
||||||
blocking_checkbox = self.get_content_item("blocking_checkbox")
|
|
||||||
is_blocking_checked = blocking_checkbox.is_checked()
|
|
||||||
assert not is_blocking_checked, (
|
|
||||||
"Checkbox 'Блокировка' should not be checked by default"
|
|
||||||
)
|
|
||||||
|
|
||||||
push_checkbox = self.get_content_item("push_notification_checkbox")
|
|
||||||
is_push_checked = push_checkbox.is_checked()
|
|
||||||
assert not is_push_checked, (
|
|
||||||
"Checkbox 'Подписка на Push-уведомления' should not be checked by default"
|
|
||||||
)
|
|
||||||
|
|
||||||
self.check_button_visibility("add")
|
self.check_button_visibility("add")
|
||||||
self.check_button_visibility("close")
|
self.check_button_visibility("close")
|
||||||
|
|
|
||||||
|
|
@ -50,11 +50,7 @@ class EditUserModalWindow(ModalWindowComponent):
|
||||||
self.add_toolbar_button(locator_button_toolbar_close, "close")
|
self.add_toolbar_button(locator_button_toolbar_close, "close")
|
||||||
|
|
||||||
# Добавление полей формы
|
# Добавление полей формы
|
||||||
loc = (
|
loc = self.page.locator(input_form_locator).locator("xpath=div[1]").locator(text_field_locator)
|
||||||
self.page.locator(input_form_locator)
|
|
||||||
.locator("xpath=div[1]")
|
|
||||||
.locator(text_field_locator)
|
|
||||||
)
|
|
||||||
name_input = TextInput(page, loc, "name_input")
|
name_input = TextInput(page, loc, "name_input")
|
||||||
self.add_content_item("name_input", name_input)
|
self.add_content_item("name_input", name_input)
|
||||||
|
|
||||||
|
|
@ -63,37 +59,24 @@ class EditUserModalWindow(ModalWindowComponent):
|
||||||
self.add_content_item("role_input", role_input)
|
self.add_content_item("role_input", role_input)
|
||||||
self.add_content_item("roles_list", DropdownList(page))
|
self.add_content_item("roles_list", DropdownList(page))
|
||||||
|
|
||||||
loc = (
|
loc = self.page.locator(input_form_locator).locator("xpath=div[4]").locator(text_field_locator)
|
||||||
self.page.locator(input_form_locator)
|
|
||||||
.locator("xpath=div[4]")
|
|
||||||
.locator(text_field_locator)
|
|
||||||
)
|
|
||||||
commentary_input = TextInput(page, loc, "commentary_input")
|
commentary_input = TextInput(page, loc, "commentary_input")
|
||||||
self.add_content_item("commentary_input", commentary_input)
|
self.add_content_item("commentary_input", commentary_input)
|
||||||
|
|
||||||
loc = (
|
loc = self.page.locator(input_form_locator).locator("xpath=div[5]").locator(text_field_locator)
|
||||||
self.page.locator(input_form_locator)
|
|
||||||
.locator("xpath=div[5]")
|
|
||||||
.locator(text_field_locator)
|
|
||||||
)
|
|
||||||
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)
|
||||||
|
|
||||||
loc = (
|
loc = self.page.locator(input_form_locator).locator("xpath=div[6]").locator(text_field_locator)
|
||||||
self.page.locator(input_form_locator)
|
|
||||||
.locator("xpath=div[6]")
|
|
||||||
.locator(text_field_locator)
|
|
||||||
)
|
|
||||||
phone_input = TextInput(page, loc, "phone_input")
|
phone_input = TextInput(page, loc, "phone_input")
|
||||||
self.add_content_item("phone_input", phone_input)
|
self.add_content_item("phone_input", phone_input)
|
||||||
|
|
||||||
# Добавление чекбоксов и их меток
|
# Добавление чекбоксов и их меток
|
||||||
|
|
||||||
# Чекбокс "Блокировка" - теперь индекс 0 (т.к. нет Active Directory)
|
# Чекбокс "Блокировка" - индекс 0
|
||||||
checkbox_1 = Checkbox(
|
checkbox_1 = Checkbox(
|
||||||
page,
|
page,
|
||||||
self.page.locator(ModalWindowLocators.INPUT_FORM_USER_DATA)
|
self.page.locator(input_form_locator).get_by_role("checkbox").nth(0),
|
||||||
.get_by_role("checkbox").nth(0),
|
|
||||||
"blocking"
|
"blocking"
|
||||||
)
|
)
|
||||||
self.add_content_item("blocking_checkbox", checkbox_1)
|
self.add_content_item("blocking_checkbox", checkbox_1)
|
||||||
|
|
@ -106,16 +89,15 @@ class EditUserModalWindow(ModalWindowComponent):
|
||||||
)
|
)
|
||||||
self.add_content_item("blocking_checkbox_label", label_1)
|
self.add_content_item("blocking_checkbox_label", label_1)
|
||||||
|
|
||||||
# Чекбокс "Подписка на Push-уведомления" - индекс 1
|
# Чекбокс "Push-уведомления" - индекс 1
|
||||||
checkbox_2 = Checkbox(
|
checkbox_2 = Checkbox(
|
||||||
page,
|
page,
|
||||||
self.page.locator(ModalWindowLocators.INPUT_FORM_USER_DATA)
|
self.page.locator(input_form_locator).get_by_role("checkbox").nth(1),
|
||||||
.get_by_role("checkbox").nth(1),
|
|
||||||
"push_notification"
|
"push_notification"
|
||||||
)
|
)
|
||||||
self.add_content_item("push_notification_checkbox", checkbox_2)
|
self.add_content_item("push_notification_checkbox", checkbox_2)
|
||||||
|
|
||||||
# Метка "Подписка на Push-уведомления" - индекс 1
|
# Метка "Push-уведомления" - индекс 1
|
||||||
label_2 = Text(
|
label_2 = Text(
|
||||||
page,
|
page,
|
||||||
self.page.locator(label_locator).nth(1),
|
self.page.locator(label_locator).nth(1),
|
||||||
|
|
@ -140,6 +122,26 @@ class EditUserModalWindow(ModalWindowComponent):
|
||||||
self.save_user_confirm = ConfirmComponent(page, " Отмена ", " Сохранить ")
|
self.save_user_confirm = ConfirmComponent(page, " Отмена ", " Сохранить ")
|
||||||
self.delete_user_confirm = ConfirmComponent(page, " Отмена ", " Удалить ")
|
self.delete_user_confirm = ConfirmComponent(page, " Отмена ", " Удалить ")
|
||||||
|
|
||||||
|
def check_blocking_checkbox(self):
|
||||||
|
"""Включает чек-бокс Блокировка."""
|
||||||
|
|
||||||
|
self.get_content_item("blocking_checkbox").check(force=True)
|
||||||
|
|
||||||
|
def uncheck_blocking_checkbox(self):
|
||||||
|
"""Выключает чек-бокс Блокировка."""
|
||||||
|
|
||||||
|
self.get_content_item("blocking_checkbox").uncheck(force=True)
|
||||||
|
|
||||||
|
def check_push_notification_checkbox(self):
|
||||||
|
"""Включает чек-бокс Push-уведомления."""
|
||||||
|
|
||||||
|
self.get_content_item("push_notification_checkbox").check(force=True)
|
||||||
|
|
||||||
|
def uncheck_push_notification_checkbox(self):
|
||||||
|
"""Выключает чек-бокс Push-уведомления."""
|
||||||
|
|
||||||
|
self.get_content_item("push_notification_checkbox").uncheck(force=True)
|
||||||
|
|
||||||
def close_window(self):
|
def close_window(self):
|
||||||
"""Закрывает окно через кнопку 'Закрыть'."""
|
"""Закрывает окно через кнопку 'Закрыть'."""
|
||||||
|
|
||||||
|
|
@ -273,19 +275,6 @@ class EditUserModalWindow(ModalWindowComponent):
|
||||||
f"Modal window content item with name '{name}' is missing"
|
f"Modal window content item with name '{name}' is missing"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Дополнительная проверка состояния чекбоксов
|
|
||||||
blocking_checkbox = self.get_content_item("blocking_checkbox")
|
|
||||||
is_blocking_checked = blocking_checkbox.is_checked()
|
|
||||||
assert not is_blocking_checked, (
|
|
||||||
"Checkbox 'Блокировка' should not be checked by default"
|
|
||||||
)
|
|
||||||
|
|
||||||
push_checkbox = self.get_content_item("push_notification_checkbox")
|
|
||||||
is_push_checked = push_checkbox.is_checked()
|
|
||||||
assert not is_push_checked, (
|
|
||||||
"Checkbox 'Подписка на Push-уведомления' should be checked by default"
|
|
||||||
)
|
|
||||||
|
|
||||||
self.check_button_visibility("save")
|
self.check_button_visibility("save")
|
||||||
self.check_button_visibility("delete")
|
self.check_button_visibility("delete")
|
||||||
self.check_button_visibility("reset_password")
|
self.check_button_visibility("reset_password")
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ class TestUsersTab:
|
||||||
ut = UsersTab(browser)
|
ut = UsersTab(browser)
|
||||||
|
|
||||||
# Удаляем тестовых пользователей
|
# Удаляем тестовых пользователей
|
||||||
test_users = ["TestUser", "TestUserAutoOperator", "TestUserAutoAdmin"]
|
test_users = ["tester1","TestUser", "TestUserAutoOperator", "TestUserAutoAdmin"]
|
||||||
|
|
||||||
for user_name in test_users:
|
for user_name in test_users:
|
||||||
# Проверяем существует ли пользователь и удаляем его
|
# Проверяем существует ли пользователь и удаляем его
|
||||||
|
|
@ -76,7 +76,6 @@ class TestUsersTab:
|
||||||
ut.open_edit_user_page_by_user(user_name, "Администратор")
|
ut.open_edit_user_page_by_user(user_name, "Администратор")
|
||||||
ut.delete_user(user_name)
|
ut.delete_user(user_name)
|
||||||
|
|
||||||
#@pytest.mark.skip(reason=" Временно исключено из тестирования")
|
|
||||||
def test_users_tab_content(self, browser: Page) -> None:
|
def test_users_tab_content(self, browser: Page) -> None:
|
||||||
"""Проверяет содержимое вкладки 'Пользователи'.
|
"""Проверяет содержимое вкладки 'Пользователи'.
|
||||||
|
|
||||||
|
|
@ -89,7 +88,6 @@ class TestUsersTab:
|
||||||
ut.should_be_users_table()
|
ut.should_be_users_table()
|
||||||
ut.check_users_table_content(True)
|
ut.check_users_table_content(True)
|
||||||
|
|
||||||
#@pytest.mark.skip(reason=" Временно исключено из тестирования")
|
|
||||||
def test_users_tab_toolbar_buttons(self, browser: Page) -> None:
|
def test_users_tab_toolbar_buttons(self, browser: Page) -> None:
|
||||||
"""Проверяет кнопки на панели инструментов.
|
"""Проверяет кнопки на панели инструментов.
|
||||||
|
|
||||||
|
|
@ -101,7 +99,6 @@ class TestUsersTab:
|
||||||
ut.should_be_toolbar_buttons()
|
ut.should_be_toolbar_buttons()
|
||||||
|
|
||||||
# @pytest.mark.develop
|
# @pytest.mark.develop
|
||||||
#@pytest.mark.skip(reason=" Временно исключено из тестирования")
|
|
||||||
def test_add_user_window_content(self, browser: Page) -> None:
|
def test_add_user_window_content(self, browser: Page) -> None:
|
||||||
"""Проверяет содержимое окна добавления пользователя.
|
"""Проверяет содержимое окна добавления пользователя.
|
||||||
|
|
||||||
|
|
@ -115,7 +112,6 @@ class TestUsersTab:
|
||||||
ut.transform_to_add_AD_user_window()
|
ut.transform_to_add_AD_user_window()
|
||||||
ut.check_add_AD_user_window_content()
|
ut.check_add_AD_user_window_content()
|
||||||
|
|
||||||
#@pytest.mark.skip(reason=" Временно исключено из тестирования")
|
|
||||||
def test_add_user_window_close_buttons(self, browser: Page) -> None:
|
def test_add_user_window_close_buttons(self, browser: Page) -> None:
|
||||||
"""Проверяет кнопки закрытия окна добавления.
|
"""Проверяет кнопки закрытия окна добавления.
|
||||||
|
|
||||||
|
|
@ -138,7 +134,6 @@ class TestUsersTab:
|
||||||
ut.transform_to_add_AD_user_window()
|
ut.transform_to_add_AD_user_window()
|
||||||
ut.close_add_AD_user_window()
|
ut.close_add_AD_user_window()
|
||||||
|
|
||||||
#@pytest.mark.skip(reason=" Временно исключено из тестирования")
|
|
||||||
def test_edit_user_window_content(self, browser: Page) -> None:
|
def test_edit_user_window_content(self, browser: Page) -> None:
|
||||||
"""Проверяет содержимое окна редактирования.
|
"""Проверяет содержимое окна редактирования.
|
||||||
|
|
||||||
|
|
@ -150,7 +145,6 @@ class TestUsersTab:
|
||||||
user_name, role = ut.open_edit_user_page_by_index(0)
|
user_name, role = ut.open_edit_user_page_by_index(0)
|
||||||
ut.check_edit_user_window_content(user_name, role)
|
ut.check_edit_user_window_content(user_name, role)
|
||||||
|
|
||||||
#@pytest.mark.skip(reason=" Временно исключено из тестирования")
|
|
||||||
def test_edit_user_window_close_buttons(self, browser: Page) -> None:
|
def test_edit_user_window_close_buttons(self, browser: Page) -> None:
|
||||||
"""Проверяет кнопки закрытия окна редактирования.
|
"""Проверяет кнопки закрытия окна редактирования.
|
||||||
|
|
||||||
|
|
@ -164,8 +158,8 @@ class TestUsersTab:
|
||||||
user_name, _ = ut.open_edit_user_page_by_index(0)
|
user_name, _ = ut.open_edit_user_page_by_index(0)
|
||||||
ut.close_edit_user_window(user_name)
|
ut.close_edit_user_window(user_name)
|
||||||
|
|
||||||
# @pytest.mark.develop
|
#@pytest.mark.develop
|
||||||
#@pytest.mark.skip(reason=" Временно исключено из тестирования")
|
@pytest.mark.skip(reason="Временно исключено из тестирования")
|
||||||
def test_add_and_delete_user(self, browser: Page, cleanup_users: None) -> None:
|
def test_add_and_delete_user(self, browser: Page, cleanup_users: None) -> None:
|
||||||
"""Проверяет добавление и удаление пользователя.
|
"""Проверяет добавление и удаление пользователя.
|
||||||
|
|
||||||
|
|
@ -213,8 +207,7 @@ class TestUsersTab:
|
||||||
mp.click_subpanel_item("Пользователи")
|
mp.click_subpanel_item("Пользователи")
|
||||||
ut.should_not_be_user_in_table(user_data["name"], user_data["role"])
|
ut.should_not_be_user_in_table(user_data["name"], user_data["role"])
|
||||||
|
|
||||||
# @pytest.mark.develop
|
#@pytest.mark.develop
|
||||||
@pytest.mark.skip(reason=" Временно исключено из тестирования")
|
|
||||||
def test_add_AD_user(self, browser: Page, cleanup_users: None) -> None:
|
def test_add_AD_user(self, browser: Page, cleanup_users: None) -> None:
|
||||||
"""Проверяет добавление пользователя Active Directory.
|
"""Проверяет добавление пользователя Active Directory.
|
||||||
|
|
||||||
|
|
@ -224,8 +217,8 @@ class TestUsersTab:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
user_data: Dict[str, str] = {"auth_type":"active_directory",
|
user_data: Dict[str, str] = {"auth_type":"active_directory",
|
||||||
"group": "Администраторы",
|
"group": "NMS_tester",
|
||||||
"name": "Администратор",
|
"name": "tester1",
|
||||||
"role": "Администратор"}
|
"role": "Администратор"}
|
||||||
|
|
||||||
ut = UsersTab(browser)
|
ut = UsersTab(browser)
|
||||||
|
|
@ -233,7 +226,6 @@ class TestUsersTab:
|
||||||
ut.open_add_user_window()
|
ut.open_add_user_window()
|
||||||
ut.add_new_user(user_data)
|
ut.add_new_user(user_data)
|
||||||
|
|
||||||
#@pytest.mark.skip(reason=" Временно исключено из тестирования")
|
|
||||||
def test_reset_password(self, browser: Page, cleanup_users: None) -> None:
|
def test_reset_password(self, browser: Page, cleanup_users: None) -> None:
|
||||||
"""Проверяет сброс пароля пользователя.
|
"""Проверяет сброс пароля пользователя.
|
||||||
|
|
||||||
|
|
@ -274,7 +266,6 @@ class TestUsersTab:
|
||||||
mp_1.click_subpanel_item("Пользователи")
|
mp_1.click_subpanel_item("Пользователи")
|
||||||
ut_1.should_not_be_user_in_table(user_data["name"], user_data["role"])
|
ut_1.should_not_be_user_in_table(user_data["name"], user_data["role"])
|
||||||
|
|
||||||
#@pytest.mark.skip(reason=" Временно исключено из тестирования")
|
|
||||||
def test_edit_user_role(self, browser: Page, cleanup_users: None) -> None:
|
def test_edit_user_role(self, browser: Page, cleanup_users: None) -> None:
|
||||||
"""Проверяет изменение роли пользователя.
|
"""Проверяет изменение роли пользователя.
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue