1018 lines
63 KiB
Python
1018 lines
63 KiB
Python
"""Модуль вкладки настройки резервного копирования.
|
||
|
||
Содержит класс BackupSettings для работы с вкладкой настройки резервного копирования.
|
||
Позволяет проверять состояние и взаимодействовать с элементами вкладки.
|
||
"""
|
||
|
||
import re
|
||
from playwright.sync_api import Page
|
||
from locators.backup_tab_locators import BackupTabLocators
|
||
from elements.text_input_element import TextInput
|
||
from elements.text_element import Text
|
||
from elements.button_element import Button
|
||
from components.toolbar_component import ToolbarComponent
|
||
from components.alert_component import AlertComponent
|
||
from components_derived.settings_form_component import SettingsFormComponent
|
||
from components_derived.selection_bar_component import SelectionBarComponent
|
||
from pages.base_page import BasePage
|
||
|
||
|
||
class BackupSettingsTab(BasePage):
|
||
"""Класс для работы с вкладкой настройки резервного копирования.
|
||
|
||
Предоставляет методы для взаимодействия с вкладкой настройки резервного копирования.
|
||
|
||
Args:
|
||
page: Экземпляр страницы Playwright.
|
||
"""
|
||
|
||
def __init__(self, page: Page) -> None:
|
||
"""Инициализирует компоненты вкладки настройки резервного копирования."""
|
||
|
||
super().__init__(page)
|
||
|
||
# Тулбар
|
||
self.toolbar = ToolbarComponent(page, "Резервное копирование")
|
||
|
||
toolbar_button_edit = self.page.get_by_role("navigation"). \
|
||
filter(has_text=re.compile("Резервное копирование")). \
|
||
locator(BackupTabLocators.BUTTON_EDIT_TOOLBAR)
|
||
self.toolbar.add_tooltip_button(toolbar_button_edit, "edit")
|
||
|
||
toolbar_button_save = self.page.get_by_role("navigation"). \
|
||
filter(has_text=re.compile("Резервное копирование")). \
|
||
locator(BackupTabLocators.BUTTON_SAVE_TOOLBAR)
|
||
self.toolbar.add_tooltip_button(toolbar_button_save, "save")
|
||
|
||
toolbar_button_cancel = self.page.get_by_role("navigation"). \
|
||
filter(has_text=re.compile("Резервное копирование")). \
|
||
locator(BackupTabLocators.BUTTON_CANCEL_TOOLBAR)
|
||
self.toolbar.add_tooltip_button(toolbar_button_cancel, "cancel")
|
||
|
||
# Форма для отображения/редактирования полей настроек 'Инвентаризация'
|
||
self.inventory_settings = self._create_inventory_settings()
|
||
|
||
# Форма для отображения/редактирования полей настроек 'Инвентаризация/Параметры планировщика'
|
||
self.inventory_scheduler_settings = self._create_inventory_scheduler_settings()
|
||
|
||
# Форма для отображения/редактирования полей настроек 'Потоковые данные'
|
||
self.streaming_data_settings = self._create_streaming_data_settings()
|
||
|
||
# Форма для отображения/редактирования полей настроек 'Потоковые данные/Параметры планировщика'
|
||
self.streaming_data_scheduler_settings = self._create_streaming_data_scheduler_settings()
|
||
|
||
self.alert = AlertComponent(page)
|
||
|
||
# Действия:
|
||
def click_cancel_button(self) -> None:
|
||
"""Нажатие кнопки 'Отменить' на тулбаре."""
|
||
|
||
self.toolbar.check_button_visibility("cancel")
|
||
self.toolbar.get_button_by_name("cancel").click()
|
||
|
||
def click_edit_button(self) -> None:
|
||
"""Нажатие кнопки 'Редактировать' на тулбаре."""
|
||
|
||
self.toolbar.check_button_visibility("edit")
|
||
self.toolbar.get_button_by_name("edit").click()
|
||
|
||
def click_save_button(self) -> None:
|
||
"""Нажатие кнопки 'Сохранить' на тулбаре."""
|
||
|
||
self.toolbar.check_button_visibility("save")
|
||
self.toolbar.get_button_by_name("save").click()
|
||
|
||
def clear_inventory_dump_selection(self) -> None:
|
||
"""Удаление ранее выбранного имени дампа"""
|
||
|
||
dump_selector = self.inventory_settings.get_content_item("inventory_dump_selector")
|
||
dump_selector.clear_selections()
|
||
|
||
def clear_streaming_data_dump_selection(self) -> None:
|
||
"""Удаление ранее выбранного имени дампа"""
|
||
|
||
dump_selector = self.streaming_data_settings.get_content_item("streaming_data_dump_selector")
|
||
dump_selector.clear_selections()
|
||
|
||
|
||
def create_inventory_copy(self) -> None:
|
||
"""Создать резервную копию Системы."""
|
||
|
||
button_create_copy = self.inventory_settings.get_content_item("inventory_button_create_copy")
|
||
button_create_copy.check_visibility("Inventory button to create copy is missing")
|
||
button_create_copy.click()
|
||
|
||
self.page.wait_for_load_state()
|
||
|
||
alert_type = self.alert.get_alert_type()
|
||
assert alert_type == "success", f"Expected success alert, but got {alert_type} alert"
|
||
|
||
self.alert.check_alert_presence('\nРезервная копия создана\n')
|
||
self.alert.check_alert_absence('\nРезервная копия создана\n')
|
||
|
||
def create_streaming_data_copy(self) -> None:
|
||
"""Создать резервную копию потоковых данных."""
|
||
|
||
button_create_copy = self.streaming_data_settings.get_content_item("streaming_data_button_create_copy")
|
||
button_create_copy.check_visibility("Streaming data button to create copy is missing")
|
||
button_create_copy.click()
|
||
|
||
self.page.wait_for_load_state()
|
||
|
||
alert_type = self.alert.get_alert_type()
|
||
assert alert_type == "success", f"Expected success alert, but got {alert_type} alert"
|
||
|
||
self.alert.check_alert_presence('\nРезервная копия создана\n')
|
||
self.alert.check_alert_absence('\nРезервная копия создана\n')
|
||
|
||
def download_inventory_copy(self, dump: str, path_to_download: str) -> None:
|
||
"""Скачать резервную копию Системы."""
|
||
|
||
assert path_to_download.exists(), f"{path_to_download} does not exist"
|
||
|
||
dump_selector = self.inventory_settings.get_content_item("inventory_dump_selector")
|
||
if dump_selector:
|
||
dump_selector.open_values_list()
|
||
dump_selector.select_value(dump)
|
||
|
||
button_download_copy = self.inventory_settings.get_content_item("inventory_button_download_copy")
|
||
button_download_copy.check_visibility("Inventory button to download copy is missing")
|
||
|
||
with self.page.expect_download() as download_info:
|
||
button_download_copy.click()
|
||
download = download_info.value
|
||
|
||
download_error = download.failure()
|
||
assert not download_error, f"Download error: {download_error}"
|
||
|
||
download.save_as(str(path_to_download) + "/" + download.suggested_filename)
|
||
|
||
def get_inventory_scheduler_settings_values(self) -> dict:
|
||
"""Возвращает текущее значение полей настроек 'Инвентаризация/Параметры планировщика'.
|
||
|
||
Returns:
|
||
dict : Текущее значение полей настроек 'Инвентаризация/Параметры планировщика'.
|
||
"""
|
||
|
||
values = {}
|
||
field = self.inventory_scheduler_settings.get_content_item("backup_creation_time_input")
|
||
values.update({"auto_backup": field.get_input_value().strip()})
|
||
|
||
field = self.inventory_scheduler_settings.get_content_item("backups_number_input")
|
||
values.update({"backup_limitation": field.get_input_value().strip()})
|
||
|
||
return values
|
||
|
||
def get_streaming_data_settings_values(self) -> dict:
|
||
"""Возвращает текущее значение полей настроек 'Потоковые данные'.
|
||
|
||
Returns:
|
||
dict : Текущее значение полей настроек 'Потоковые данные'.
|
||
"""
|
||
|
||
values = {}
|
||
field = self.streaming_data_settings.get_content_item("audit_time_period_value")
|
||
values.update({"data_limitation_default": field.get_input_value().strip()})
|
||
interval = self.streaming_data_settings.get_content_item("audit_time_period_value_interval_selector")
|
||
interval_values = interval.get_selected_values()
|
||
values.update({"interval_limitation_default": interval_values[0]})
|
||
|
||
field = self.streaming_data_settings.get_content_item("logs_time_period_value")
|
||
values.update({"data_limitation_logs": field.get_input_value().strip()})
|
||
interval = self.streaming_data_settings.get_content_item("logs_time_period_value_interval_selector")
|
||
interval_values = interval.get_selected_values()
|
||
values.update({"interval_limitation_logs": interval_values[0]})
|
||
|
||
field = self.streaming_data_settings.get_content_item("metrics_time_period_value")
|
||
values.update({"data_limitation_metrics": field.get_input_value().strip()})
|
||
interval = self.streaming_data_settings.get_content_item("metrics_time_period_value_interval_selector")
|
||
interval_values = interval.get_selected_values()
|
||
values.update({"interval_limitation_metrics": interval_values[0]})
|
||
|
||
field = self.streaming_data_settings.get_content_item("syslog_time_period_value")
|
||
values.update({"data_limitation_syslog": field.get_input_value().strip()})
|
||
interval = self.streaming_data_settings.get_content_item("syslog_time_period_value_interval_selector")
|
||
interval_values = interval.get_selected_values()
|
||
values.update({"interval_limitation_syslog": interval_values[0]})
|
||
|
||
field = self.streaming_data_settings.get_content_item("tasks_time_period_value")
|
||
values.update({"data_limitation_tasks": field.get_input_value().strip()})
|
||
interval = self.streaming_data_settings.get_content_item("tasks_time_period_value_interval_selector")
|
||
interval_values = interval.get_selected_values()
|
||
values.update({"interval_limitation_tasks": interval_values[0]})
|
||
|
||
return values
|
||
|
||
def get_streaming_data_scheduler_settings_values(self) -> dict:
|
||
"""Возвращает текущее значение полей настроек 'Потоковые данные/Параметры планировщика'.
|
||
|
||
Returns:
|
||
dict : Текущее значение полей настроек 'Потоковые данные/Параметры планировщика'.
|
||
"""
|
||
|
||
values = {}
|
||
field = self.streaming_data_scheduler_settings.get_content_item("backup_creation_time_input")
|
||
values.update({"auto_backup": field.get_input_value().strip()})
|
||
|
||
return values
|
||
|
||
def get_inventory_dumps_list(self) -> list[str]:
|
||
"""Возвращает текущий список дампов для настроек 'Инвентаризация'.
|
||
|
||
Returns:
|
||
list[str] : Текущий список дампов для настроек 'Инвентаризация'.
|
||
"""
|
||
|
||
dump_selector = self.inventory_settings.get_content_item("inventory_dump_selector")
|
||
return dump_selector.get_available_options()
|
||
|
||
def get_streaming_data_dumps_list(self) -> list[str]:
|
||
"""Возвращает текущий список дампов для настроек 'Потоковые данные'.
|
||
|
||
Returns:
|
||
list[str] : Текущий список дампов для настроек 'Потоковые данные'.
|
||
"""
|
||
|
||
dump_selector = self.streaming_data_settings.get_content_item("streaming_data_dump_selector")
|
||
return dump_selector.get_available_options()
|
||
|
||
def input_inventory_backup_creation_time(self, value: str) -> None:
|
||
"""Заполнение поля 'Время создания резервной копии' настроек 'Инвентаризация/Параметры планировщика'"""
|
||
|
||
field = self.inventory_scheduler_settings.get_content_item("backup_creation_time_input")
|
||
field.clear()
|
||
field.input_value(value)
|
||
|
||
def input_inventory_backups_number(self, value: str) -> None:
|
||
"""Заполнение поля 'Количество резервных копий' настроек 'Инвентаризация/Параметры планировщика'"""
|
||
|
||
field = self.inventory_scheduler_settings.get_content_item("backups_number_input")
|
||
field.clear()
|
||
field.input_value(value)
|
||
|
||
def input_audit_time_period(self, time_period: str, time_interval: str) -> None:
|
||
"""Заполнение поля 'Период хранения данных' для категории 'Аудит' настроек 'Потоковые данные'"""
|
||
|
||
field = self.streaming_data_settings.get_content_item("audit_time_period_value")
|
||
field.clear()
|
||
field.input_value(time_period)
|
||
|
||
interval = self.streaming_data_settings.get_content_item("audit_time_period_value_interval_selector")
|
||
interval.open_values_list()
|
||
interval.select_value(time_interval)
|
||
|
||
def input_logs_time_period(self, time_period: str, time_interval: str) -> None:
|
||
"""Заполнение поля 'Период хранения данных' для категории 'Логи' настроек 'Потоковые данные'"""
|
||
|
||
field = self.streaming_data_settings.get_content_item("logs_time_period_value")
|
||
field.clear()
|
||
field.input_value(time_period)
|
||
|
||
interval = self.streaming_data_settings.get_content_item("logs_time_period_value_interval_selector")
|
||
interval.open_values_list()
|
||
interval.select_value(time_interval)
|
||
|
||
def input_metrics_time_period(self, time_period: str, time_interval: str) -> None:
|
||
"""Заполнение поля 'Период хранения данных' для категории 'Метрики' настроек 'Потоковые данные'"""
|
||
|
||
field = self.streaming_data_settings.get_content_item("metrics_time_period_value")
|
||
field.clear()
|
||
field.input_value(time_period)
|
||
|
||
interval = self.streaming_data_settings.get_content_item("metrics_time_period_value_interval_selector")
|
||
interval.open_values_list()
|
||
interval.select_value(time_interval)
|
||
|
||
def input_syslog_time_period(self, time_period: str, time_interval: str) -> None:
|
||
"""Заполнение поля 'Период хранения данных' для категории 'Системный лог' настроек 'Потоковые данные'"""
|
||
|
||
field = self.streaming_data_settings.get_content_item("syslog_time_period_value")
|
||
field.clear()
|
||
field.input_value(time_period)
|
||
|
||
interval = self.streaming_data_settings.get_content_item("syslog_time_period_value_interval_selector")
|
||
interval.open_values_list()
|
||
interval.select_value(time_interval)
|
||
|
||
def input_tasks_time_period(self, time_period: str, time_interval: str) -> None:
|
||
"""Заполнение поля 'Период хранения данных' для категории 'Действия' настроек 'Потоковые данные'"""
|
||
|
||
field = self.streaming_data_settings.get_content_item("tasks_time_period_value")
|
||
field.clear()
|
||
field.input_value(time_period)
|
||
|
||
interval = self.streaming_data_settings.get_content_item("tasks_time_period_value_interval_selector")
|
||
interval.open_values_list()
|
||
interval.select_value(time_interval)
|
||
|
||
def input_streaming_data_backup_creation_time(self, value: str) -> None:
|
||
"""Заполнение поля 'Время создания резервной копии' настроек 'Потоковые данные/Параметры планировщика'"""
|
||
|
||
field = self.streaming_data_scheduler_settings.get_content_item("backup_creation_time_input")
|
||
field.clear()
|
||
field.input_value(value)
|
||
|
||
def decrease_inventory_backups_number(self) -> None:
|
||
"""Уменьшение на единицу значения поля 'Количество резервных копий' настроек
|
||
'Инвентаризация/Параметры планировщика' с помощью стрелочки вниз."""
|
||
|
||
field = self.inventory_scheduler_settings.get_content_item("backups_number_input")
|
||
field.decrease_value()
|
||
|
||
def increase_inventory_backups_number(self) -> None:
|
||
"""Увеличение на единицу значения поля 'Количество резервных копий' настроек
|
||
'Инвентаризация/Параметры планировщика' с помощью стрелочки вверх."""
|
||
|
||
field = self.inventory_scheduler_settings.get_content_item("backups_number_input")
|
||
field.increase_value()
|
||
|
||
def decrease_audit_time_period(self) -> None:
|
||
"""Уменьшение на единицу значения поля 'Период хранения данных' для категории 'Аудит' настроек
|
||
'Потоковые данные' с помощью стрелочки вниз."""
|
||
|
||
field = self.streaming_data_settings.get_content_item("audit_time_period_value")
|
||
field.decrease_value()
|
||
|
||
def increase_audit_time_period(self) -> None:
|
||
"""Увеличение на единицу значения поля 'Период хранения данных' для категории 'Аудит' настроек
|
||
'Потоковые данные' с помощью стрелочки вверх."""
|
||
|
||
field = self.streaming_data_settings.get_content_item("audit_time_period_value")
|
||
field.increase_value()
|
||
|
||
def decrease_logs_time_period(self) -> None:
|
||
"""Уменьшение на единицу значения поля 'Период хранения данных' для категории 'Логи' настроек
|
||
'Потоковые данные' с помощью стрелочки вниз."""
|
||
|
||
field = self.streaming_data_settings.get_content_item("logs_time_period_value")
|
||
field.decrease_value()
|
||
|
||
def increase_logs_time_period(self) -> None:
|
||
"""Увеличение на единицу значения поля 'Период хранения данных' для категории 'Логи' настроек
|
||
'Потоковые данные' с помощью стрелочки вверх."""
|
||
|
||
field = self.streaming_data_settings.get_content_item("logs_time_period_value")
|
||
field.increase_value()
|
||
|
||
def decrease_metrics_time_period(self) -> None:
|
||
"""Уменьшение на единицу значения поля 'Период хранения данных' для категории 'Метрики' настроек
|
||
'Потоковые данные' с помощью стрелочки вниз."""
|
||
|
||
field = self.streaming_data_settings.get_content_item("metrics_time_period_value")
|
||
field.decrease_value()
|
||
|
||
def increase_metrics_time_period(self) -> None:
|
||
"""Увеличение на единицу значения поля 'Период хранения данных' для категории 'Метрики' настроек
|
||
'Потоковые данные' с помощью стрелочки вверх."""
|
||
|
||
field = self.streaming_data_settings.get_content_item("metrics_time_period_value")
|
||
field.increase_value()
|
||
|
||
def decrease_syslog_time_period(self) -> None:
|
||
"""Уменьшение на единицу значения поля 'Период хранения данных' для категории 'Системный лог' настроек
|
||
'Потоковые данные' с помощью стрелочки вниз."""
|
||
|
||
field = self.streaming_data_settings.get_content_item("syslog_time_period_value")
|
||
field.decrease_value()
|
||
|
||
def increase_syslog_time_period(self) -> None:
|
||
"""Увеличение на единицу значения поля 'Период хранения данных' для категории 'Системный лог' настроек
|
||
'Потоковые данные' с помощью стрелочки вверх."""
|
||
|
||
field = self.streaming_data_settings.get_content_item("syslog_time_period_value")
|
||
field.increase_value()
|
||
|
||
def decrease_tasks_time_period(self) -> None:
|
||
"""Уменьшение на единицу значения поля 'Период хранения данных' для категории 'Действия' настроек
|
||
'Потоковые данные' с помощью стрелочки вниз."""
|
||
|
||
field = self.streaming_data_settings.get_content_item("tasks_time_period_value")
|
||
field.decrease_value()
|
||
|
||
def increase_tasks_time_period(self) -> None:
|
||
"""Увеличение на единицу значения поля 'Период хранения данных' для категории 'Действия' настроек
|
||
'Потоковые данные' с помощью стрелочки вверх."""
|
||
|
||
field = self.streaming_data_settings.get_content_item("tasks_time_period_value")
|
||
field.increase_value()
|
||
|
||
def select_inventory_dump(self, dump: str) -> None:
|
||
"""Выбирает дамп для настроек 'Инвентаризация' из списка"""
|
||
|
||
dump_selector = self.inventory_settings.get_content_item("inventory_dump_selector")
|
||
if dump_selector:
|
||
dump_selector.open_values_list()
|
||
dump_selector.select_value(dump)
|
||
|
||
def select_streaming_data_dump(self, dump: str) -> None:
|
||
"""Выбирает дамп для настроек 'Потоковые данные' из списка"""
|
||
|
||
dump_selector = self.streaming_data_settings.get_content_item("streaming_data_dump_selector")
|
||
if dump_selector:
|
||
dump_selector.open_values_list()
|
||
dump_selector.select_value(dump)
|
||
|
||
|
||
def _create_inventory_settings(self) -> SettingsFormComponent:
|
||
""" Конструктор для набора полей 'Инвентаризация'"""
|
||
|
||
inventory_settings = SettingsFormComponent(self.page)
|
||
inventory_settings.add_toolbar_title(" Инвентаризация ")
|
||
|
||
inventory_container_locator = self.page.locator("//nav[contains(@class, 'active v-toolbar')]"). \
|
||
filter(has_text=" Инвентаризация ").locator("//following-sibling::div[1]")
|
||
|
||
# Кнопка 'Создать копию'
|
||
inventory_button_create_copy_loc = inventory_container_locator.\
|
||
locator(BackupTabLocators.BUTTON_INVENTORY_CREATE_COPY)
|
||
inventory_button_create_copy = Button(self.page, inventory_button_create_copy_loc,
|
||
"inventory_button_create_copy")
|
||
inventory_settings.add_content_item("inventory_button_create_copy", inventory_button_create_copy)
|
||
|
||
# Кнопка 'Загрузить копию'
|
||
inventory_button_upload_copy_loc = inventory_container_locator.\
|
||
locator(BackupTabLocators.BUTTON_INVENTORY_UPLOAD_COPY)
|
||
inventory_button_upload_copy = Button(self.page, inventory_button_upload_copy_loc,
|
||
"inventory_button_upload_copy")
|
||
inventory_settings.add_content_item("inventory_button_upload_copy", inventory_button_upload_copy)
|
||
|
||
# Кнопка 'Восстановить копию'
|
||
inventory_button_restore_copy_loc = inventory_container_locator.\
|
||
locator(BackupTabLocators.BUTTON_INVENTORY_RESTORE_COPY)
|
||
inventory_button_restore_copy = Button(self.page, inventory_button_restore_copy_loc,
|
||
"inventory_button_restore_copy")
|
||
inventory_settings.add_content_item("inventory_button_restore_copy", inventory_button_restore_copy)
|
||
|
||
# Кнопка 'Скачать копию'
|
||
inventory_button_download_copy_loc = inventory_container_locator.\
|
||
locator(BackupTabLocators.BUTTON_INVENTORY_DOWNLOAD_COPY)
|
||
inventory_button_download_copy = Button(self.page, inventory_button_download_copy_loc,
|
||
"inventory_button_download_copy")
|
||
inventory_settings.add_content_item("inventory_button_download_copy", inventory_button_download_copy)
|
||
|
||
# Список дампов
|
||
inventory_dump_selector_loc = inventory_container_locator.get_by_role("combobox")
|
||
inventory_settings.add_content_item("inventory_dump_selector",
|
||
SelectionBarComponent(self.page, inventory_dump_selector_loc))
|
||
|
||
return inventory_settings
|
||
|
||
def _create_inventory_scheduler_settings(self) -> SettingsFormComponent:
|
||
""" Конструктор для набора полей 'Инвентаризация/Параметры планировщика'"""
|
||
|
||
inventory_scheduler_settings = SettingsFormComponent(self.page)
|
||
inventory_scheduler_settings.add_toolbar_title(" Параметры планировщика ")
|
||
|
||
# Вспомогательные локаторы
|
||
div_locator = "div:nth-child(1) > div:nth-child(1)"
|
||
input_locator = "div.v-text-field__slot > input"
|
||
|
||
# Время создания резервной копии
|
||
container_locator = self.page.locator("//nav[contains(@class, 'active v-toolbar')]"). \
|
||
filter(has_text=" Параметры планировщика ").locator("//following-sibling::div[1]").first
|
||
|
||
loc_backup_creation_time_label = container_locator.locator(div_locator).locator(input_locator).first
|
||
|
||
backup_creation_time_label = Text(self.page, loc_backup_creation_time_label, "backup_creation_time_label")
|
||
inventory_scheduler_settings.add_content_item("backup_creation_time_label", backup_creation_time_label)
|
||
|
||
loc_backup_creation_time_input = container_locator. \
|
||
locator(BackupTabLocators.INPUT_INVENTORY_BACKUP_CREATION_TIME)
|
||
backup_creation_time_input = TextInput(self.page, loc_backup_creation_time_input, "backup_creation_time_input")
|
||
inventory_scheduler_settings.add_content_item("backup_creation_time_input", backup_creation_time_input)
|
||
|
||
# Количество резервных копий
|
||
container_locator = self.page.locator("//nav[contains(@class, 'active v-toolbar')]"). \
|
||
filter(has_text=" Параметры планировщика ").locator("//following-sibling::div[2]")
|
||
|
||
loc_backups_number_label = container_locator.locator(div_locator).locator(input_locator).first
|
||
backups_number_label = Text(self.page, loc_backups_number_label, "backups_number_label")
|
||
inventory_scheduler_settings.add_content_item("backups_number_label", backups_number_label)
|
||
|
||
loc_backups_number_input = container_locator. \
|
||
locator(BackupTabLocators.INPUT_INVENTORY_BACKUP_NUMBERS)
|
||
backups_number_input = TextInput(self.page, loc_backups_number_input, "backups_number_input")
|
||
inventory_scheduler_settings.add_content_item("backups_number_input", backups_number_input)
|
||
|
||
return inventory_scheduler_settings
|
||
|
||
def _create_streaming_data_settings(self) -> SettingsFormComponent:
|
||
""" Конструктор для набора полей 'Потоковые данные'"""
|
||
|
||
streaming_data_settings = SettingsFormComponent(self.page)
|
||
streaming_data_settings.add_toolbar_title(" Потоковые данные ")
|
||
|
||
# Вспомогательные локаторы
|
||
category_label_locator = "div:nth-child(1)"
|
||
time_period_label_locator = "div:nth-child(1) > div:nth-child(1) input"
|
||
time_period_value_locator = "div:nth-child(1) > div:nth-child(2)"
|
||
time_period_interval_locator = "div:nth-child(1) > div:nth-child(3)"
|
||
|
||
streaming_data_container_locator = self.page.locator("//nav[contains(@class, 'active v-toolbar')]"). \
|
||
filter(has_text=" Потоковые данные ").locator("//following-sibling::div[1]")
|
||
|
||
# Кнопка 'Создать копию'
|
||
streaming_data_button_create_copy_loc = streaming_data_container_locator.\
|
||
locator(BackupTabLocators.BUTTON_STREAMING_DATA_CREATE_COPY)
|
||
streaming_data_button_create_copy = Button(self.page, streaming_data_button_create_copy_loc,
|
||
"streaming_data_button_create_copy")
|
||
streaming_data_settings.add_content_item("streaming_data_button_create_copy",
|
||
streaming_data_button_create_copy)
|
||
|
||
# Кнопка 'Загрузить копию'
|
||
streaming_data_button_upload_copy_loc = streaming_data_container_locator.\
|
||
locator(BackupTabLocators.BUTTON_STREAMING_DATA_UPLOAD_COPY)
|
||
streaming_data_button_upload_copy = Button(self.page, streaming_data_button_upload_copy_loc,
|
||
"streaming_data_button_upload_copy")
|
||
streaming_data_settings.add_content_item("streaming_data_button_upload_copy",
|
||
streaming_data_button_upload_copy)
|
||
|
||
# Кнопка 'Восстановить копию'
|
||
streaming_data_button_restore_copy_loc = streaming_data_container_locator.\
|
||
locator(BackupTabLocators.BUTTON_STREAMING_DATA_RESTORE_COPY)
|
||
streaming_data_button_restore_copy = Button(self.page, streaming_data_button_restore_copy_loc,
|
||
"streaming_data_button_restore_copy")
|
||
streaming_data_settings.add_content_item("streaming_data_button_restore_copy",
|
||
streaming_data_button_restore_copy)
|
||
|
||
# Кнопка 'Скачать копию'
|
||
streaming_data_button_download_copy_loc = streaming_data_container_locator.\
|
||
locator(BackupTabLocators.BUTTON_STREAMING_DATA_DOWNLOAD_COPY)
|
||
streaming_data_button_download_copy = Button(self.page, streaming_data_button_download_copy_loc,
|
||
"streaming_data_button_download_copy")
|
||
streaming_data_settings.add_content_item("streaming_data_button_download_copy",
|
||
streaming_data_button_download_copy)
|
||
|
||
# Список дампов
|
||
streaming_data_dump_selector_loc = streaming_data_container_locator.get_by_role("combobox")
|
||
streaming_data_settings.add_content_item("streaming_data_dump_selector",
|
||
SelectionBarComponent(self.page, streaming_data_dump_selector_loc))
|
||
|
||
# Период хранения данных для категории Аудит
|
||
audit_category_locator = self.page.locator("//nav[contains(@class, 'active v-toolbar')]"). \
|
||
filter(has_text=" Потоковые данные ").locator("//following-sibling::div[2]")
|
||
audit_category_label = Text(self.page,
|
||
audit_category_locator.locator(category_label_locator).first,
|
||
"audit_category_label")
|
||
streaming_data_settings.add_content_item("audit_category_label", audit_category_label)
|
||
|
||
audit_time_period_label = Text(self.page,
|
||
audit_category_locator.locator(time_period_label_locator).first,
|
||
"audit_time_period_label")
|
||
streaming_data_settings.add_content_item("audit_time_period_label", audit_time_period_label)
|
||
|
||
audit_time_period_value = TextInput(self.page,
|
||
audit_category_locator.locator(time_period_value_locator). \
|
||
locator(BackupTabLocators.INPUT_AUDIT_TIME_PERIOD),
|
||
"audit_time_period_value")
|
||
streaming_data_settings.add_content_item("audit_time_period_value", audit_time_period_value)
|
||
|
||
audit_time_period_value_interval = TextInput(self.page,
|
||
audit_category_locator.locator(time_period_interval_locator). \
|
||
locator(BackupTabLocators.INPUT_AUDIT_TIME_PERIOD_INTERVAL),
|
||
"audit_time_period_value_interval")
|
||
streaming_data_settings.add_content_item("audit_time_period_value_interval", audit_time_period_value_interval)
|
||
|
||
audit_time_period_value_interval_selector_loc = audit_category_locator. \
|
||
locator(time_period_interval_locator). \
|
||
get_by_role("combobox")
|
||
streaming_data_settings.add_content_item("audit_time_period_value_interval_selector",
|
||
SelectionBarComponent(self.page,
|
||
audit_time_period_value_interval_selector_loc))
|
||
|
||
# Период хранения данных для категории Логи
|
||
logs_category_locator = self.page.locator("//nav[contains(@class, 'active v-toolbar')]"). \
|
||
filter(has_text=" Потоковые данные ").locator("//following-sibling::div[3]")
|
||
logs_category_label = Text(self.page,
|
||
logs_category_locator.locator(category_label_locator).first,
|
||
"logs_category_label")
|
||
streaming_data_settings.add_content_item("logs_category_label", logs_category_label)
|
||
|
||
logs_time_period_label = Text(self.page,
|
||
logs_category_locator.locator(time_period_label_locator).first,
|
||
"logs_time_period_label")
|
||
streaming_data_settings.add_content_item("logs_time_period_label", logs_time_period_label)
|
||
|
||
logs_time_period_value = TextInput(self.page,
|
||
logs_category_locator.locator(time_period_value_locator). \
|
||
locator(BackupTabLocators.INPUT_LOGS_TIME_PERIOD),
|
||
"logs_time_period_value")
|
||
streaming_data_settings.add_content_item("logs_time_period_value", logs_time_period_value)
|
||
|
||
logs_time_period_value_interval = TextInput(self.page,
|
||
logs_category_locator.locator(time_period_interval_locator). \
|
||
locator(BackupTabLocators.INPUT_LOGS_TIME_PERIOD_INTERVAL),
|
||
"logs_time_period_value")
|
||
streaming_data_settings.add_content_item("logs_time_period_value_interval", logs_time_period_value_interval)
|
||
|
||
logs_time_period_value_interval_selector_loc = logs_category_locator. \
|
||
locator(time_period_interval_locator). \
|
||
get_by_role("combobox")
|
||
streaming_data_settings.add_content_item("logs_time_period_value_interval_selector",
|
||
SelectionBarComponent(self.page,
|
||
logs_time_period_value_interval_selector_loc))
|
||
|
||
# Период хранения данных для категории Метрики
|
||
metrics_category_locator = self.page.locator("//nav[contains(@class, 'active v-toolbar')]"). \
|
||
filter(has_text=" Потоковые данные ").locator("//following-sibling::div[4]")
|
||
metrics_category_label = Text(self.page,
|
||
metrics_category_locator.locator(category_label_locator).first,
|
||
"metrics_category_label")
|
||
streaming_data_settings.add_content_item("metrics_category_label", metrics_category_label)
|
||
|
||
metrics_time_period_label = Text(self.page,
|
||
metrics_category_locator.locator(time_period_label_locator).first,
|
||
"metrics_time_period_label")
|
||
streaming_data_settings.add_content_item("metrics_time_period_label", metrics_time_period_label)
|
||
|
||
metrics_time_period_value = TextInput(self.page,
|
||
metrics_category_locator.locator(time_period_value_locator). \
|
||
locator(BackupTabLocators.INPUT_METRICS_TIME_PERIOD),
|
||
"metrics_time_period_value")
|
||
streaming_data_settings.add_content_item("metrics_time_period_value", metrics_time_period_value)
|
||
|
||
metrics_time_period_value_interval = TextInput(self.page,
|
||
metrics_category_locator.locator(time_period_interval_locator). \
|
||
locator(BackupTabLocators.INPUT_METRICS_TIME_PERIOD_INTERVAL),
|
||
"metrics_time_period_value_interval")
|
||
streaming_data_settings.add_content_item("metrics_time_period_value_interval",
|
||
metrics_time_period_value_interval)
|
||
|
||
metrics_time_period_value_interval_selector_loc = metrics_category_locator. \
|
||
locator(time_period_interval_locator). \
|
||
get_by_role("combobox")
|
||
streaming_data_settings.add_content_item("metrics_time_period_value_interval_selector",
|
||
SelectionBarComponent(self.page,
|
||
metrics_time_period_value_interval_selector_loc))
|
||
|
||
# Период хранения данных для категории Системный лог
|
||
syslog_category_locator = self.page.locator("//nav[contains(@class, 'active v-toolbar')]"). \
|
||
filter(has_text=" Потоковые данные ").locator("//following-sibling::div[5]")
|
||
syslog_category_label = Text(self.page,
|
||
syslog_category_locator.locator(category_label_locator).first,
|
||
"syslog_category_label")
|
||
streaming_data_settings.add_content_item("syslog_category_label", syslog_category_label)
|
||
|
||
syslog_time_period_label = Text(self.page,
|
||
syslog_category_locator.locator(time_period_label_locator).first,
|
||
"syslog_time_period_label")
|
||
streaming_data_settings.add_content_item("syslog_time_period_label", syslog_time_period_label)
|
||
|
||
syslog_time_period_value = TextInput(self.page,
|
||
syslog_category_locator.locator(time_period_value_locator). \
|
||
locator(BackupTabLocators.INPUT_SYSLOG_TIME_PERIOD),
|
||
"syslog_time_period_value")
|
||
streaming_data_settings.add_content_item("syslog_time_period_value", syslog_time_period_value)
|
||
|
||
syslog_time_period_value_interval = TextInput(self.page,
|
||
syslog_category_locator.locator(time_period_interval_locator). \
|
||
locator(BackupTabLocators.INPUT_SYSLOG_TIME_PERIOD_INTERVAL),
|
||
"syslog_time_period_value_interval")
|
||
streaming_data_settings.add_content_item("syslog_time_period_value_interval", syslog_time_period_value_interval)
|
||
|
||
syslog_time_period_value_interval_selector_loc = syslog_category_locator. \
|
||
locator(time_period_interval_locator). \
|
||
get_by_role("combobox")
|
||
streaming_data_settings.add_content_item("syslog_time_period_value_interval_selector",
|
||
SelectionBarComponent(self.page,
|
||
syslog_time_period_value_interval_selector_loc))
|
||
|
||
# Период хранения данных для категории Действия
|
||
tasks_category_locator = self.page.locator("//nav[contains(@class, 'active v-toolbar')]"). \
|
||
filter(has_text=" Потоковые данные ").locator("//following-sibling::div[6]")
|
||
tasks_category_label = Text(self.page,
|
||
tasks_category_locator.locator(category_label_locator).first,
|
||
"tasks_category_label")
|
||
streaming_data_settings.add_content_item("tasks_category_label", tasks_category_label)
|
||
|
||
tasks_time_period_label = Text(self.page,
|
||
tasks_category_locator.locator(time_period_label_locator).first,
|
||
"tasks_time_period_label")
|
||
streaming_data_settings.add_content_item("tasks_time_period_label", tasks_time_period_label)
|
||
|
||
tasks_time_period_value = TextInput(self.page,
|
||
tasks_category_locator.locator(time_period_value_locator). \
|
||
locator(BackupTabLocators.INPUT_TASKS_TIME_PERIOD),
|
||
"tasks_time_period_value")
|
||
streaming_data_settings.add_content_item("tasks_time_period_value", tasks_time_period_value)
|
||
|
||
tasks_time_period_value_interval = TextInput(self.page,
|
||
tasks_category_locator.locator(time_period_interval_locator). \
|
||
locator(BackupTabLocators.INPUT_TASKS_TIME_PERIOD_INTERVAL),
|
||
"tasks_time_period_value_interval")
|
||
streaming_data_settings.add_content_item("tasks_time_period_value_interval", tasks_time_period_value_interval)
|
||
|
||
tasks_time_period_value_interval_selector_loc = tasks_category_locator. \
|
||
locator(time_period_interval_locator). \
|
||
get_by_role("combobox")
|
||
streaming_data_settings.add_content_item("tasks_time_period_value_interval_selector",
|
||
SelectionBarComponent(self.page,
|
||
tasks_time_period_value_interval_selector_loc))
|
||
|
||
return streaming_data_settings
|
||
|
||
def _create_streaming_data_scheduler_settings(self) -> SettingsFormComponent:
|
||
""" Конструктор для набора полей 'Потоковые данные/Параметры планировщика'"""
|
||
|
||
streaming_data_scheduler_settings = SettingsFormComponent(self.page)
|
||
streaming_data_scheduler_settings.add_toolbar_title(" Параметры планировщика ")
|
||
|
||
# Вспомогательные локаторы
|
||
div_locator = "div:nth-child(1) > div:nth-child(1)"
|
||
input_locator = "div.v-text-field__slot > input"
|
||
|
||
# Время создания резервной копии
|
||
container_locator = self.page.locator("//nav[contains(@class, 'active v-toolbar')]"). \
|
||
filter(has_text=" Параметры планировщика ").locator("//following-sibling::div").last
|
||
|
||
loc_backup_creation_time_label = container_locator.locator(div_locator).locator(input_locator).first
|
||
backup_creation_time_label = Text(self.page, loc_backup_creation_time_label, "backup_creation_time_label")
|
||
streaming_data_scheduler_settings.add_content_item("backup_creation_time_label", backup_creation_time_label)
|
||
|
||
loc_backup_creation_time_input = container_locator. \
|
||
locator(BackupTabLocators.INPUT_STREAMING_DATA_BACKUP_CREATION_TIME)
|
||
backup_creation_time_input = TextInput(self.page, loc_backup_creation_time_input, "backup_creation_time_input")
|
||
streaming_data_scheduler_settings.add_content_item("backup_creation_time_input", backup_creation_time_input)
|
||
|
||
return streaming_data_scheduler_settings
|
||
|
||
# Проверки:
|
||
def check_content(self):
|
||
"""Проверяет наличие и корректность всех элементов страницы."""
|
||
|
||
self.should_be_toolbar()
|
||
|
||
self._check_inventory_settings_content()
|
||
self._check_inventory_scheduler_settings_content()
|
||
self._check_streaming_data_settings_content()
|
||
self._check_streaming_data_scheduler_settings_content()
|
||
|
||
def check_inventory_restore_copy_button_disabling(self) -> bool:
|
||
"""Проверяет доступность кнопки 'Восстановить копию' настройки 'Инвентаризация'"""
|
||
|
||
button_restore_copy = self.inventory_settings.get_content_item("inventory_button_restore_copy")
|
||
button_restore_copy.check_visibility("Inventory button to restore copy is missing")
|
||
return button_restore_copy.is_disabled()
|
||
|
||
def check_streaming_data_restore_copy_button_disabling(self) -> bool:
|
||
"""Проверяет доступность кнопки 'Восстановить копию' настройки 'Потоковые данные'"""
|
||
|
||
button_restore_copy = self.streaming_data_settings.get_content_item("streaming_data_button_restore_copy")
|
||
button_restore_copy.check_visibility("Streaming data button to restore copy is missing")
|
||
return button_restore_copy.is_disabled()
|
||
|
||
def should_be_toolbar(self) -> None:
|
||
"""Проверяет наличие тулбара страницы, наличие и функциональность кнопок тулбара.
|
||
|
||
Raises:
|
||
AssertionError: Если тулбар или кнопка тулбара отсутствуют.
|
||
"""
|
||
loc = self.page.get_by_role("navigation").filter(
|
||
has_text=re.compile("Резервное копирование")).locator("div").nth(1)
|
||
self.toolbar.check_toolbar_presence_by_locator(loc, "Toolbar with title 'Резервное копирование' is missing")
|
||
|
||
self.toolbar.check_button_visibility("edit")
|
||
self.toolbar.check_button_tooltip("edit", "Редактировать")
|
||
|
||
self.toolbar.get_button_by_name("edit").click()
|
||
self.toolbar.check_button_visibility("save")
|
||
self.toolbar.check_button_visibility("cancel")
|
||
self.toolbar.check_button_tooltip("save", "Сохранить")
|
||
self.toolbar.check_button_tooltip("cancel", "Отменить")
|
||
|
||
self.toolbar.get_button_by_name("cancel").click()
|
||
self.toolbar.check_button_visibility("edit")
|
||
|
||
def should_be_inventory_download_button(self) -> None:
|
||
"""Проверяет наличие кнопки 'Скачать копию' настройки 'Инвентаризация'"""
|
||
|
||
button_download_copy = self.inventory_settings.get_content_item("inventory_button_download_copy")
|
||
button_download_copy.check_visibility("Inventory button to download copy is missing")
|
||
|
||
def should_be_inventory_upload_button(self) -> None:
|
||
"""Проверяет наличие кнопки 'Загрузить копию' настройки 'Инвентаризация'"""
|
||
|
||
button_upload_copy = self.inventory_settings.get_content_item("inventory_button_upload_copy")
|
||
button_upload_copy.check_visibility("Inventory button to upload copy is missing")
|
||
|
||
def should_be_streaming_data_download_button(self) -> None:
|
||
"""Проверяет наличие кнопки 'Скачать копию' настройки 'Потоковые данные'"""
|
||
|
||
button_download_copy = self.streaming_data_settings.get_content_item("streaming_data_button_download_copy")
|
||
button_download_copy.check_visibility("Streaming data button to download copy is missing")
|
||
|
||
def should_be_streaming_data_upload_button(self) -> None:
|
||
"""Проверяет наличие кнопки 'Загрузить копию' настройки 'Потоковые данные'"""
|
||
|
||
button_upload_copy = self.streaming_data_settings.get_content_item("streaming_data_button_upload_copy")
|
||
button_upload_copy.check_visibility("Streaming data button to upload copy is missing")
|
||
|
||
|
||
def _check_inventory_settings_content(self) -> None:
|
||
"""Проверяет наличие и корректность всех элементов настройки 'Инвентаризация'."""
|
||
|
||
self.inventory_settings.should_be_toolbar()
|
||
|
||
button_create_copy = self.inventory_settings.get_content_item("inventory_button_create_copy")
|
||
button_create_copy.check_visibility("Inventory button to create copy is missing")
|
||
button_text = button_create_copy.get_text(0).strip()
|
||
assert button_text == "Создать копию", f"Unexpected inventory button to create copy text: {button_text}"
|
||
|
||
button_upload_copy = self.inventory_settings.get_content_item("inventory_button_upload_copy")
|
||
button_upload_copy.check_visibility("Inventory button to upload copy is missing")
|
||
button_text = button_upload_copy.get_text(0).strip()
|
||
assert button_text == "Загрузить копию", f"Unexpected inventory button to upload copy text: {button_text}"
|
||
|
||
button_restore_copy = self.inventory_settings.get_content_item("inventory_button_restore_copy")
|
||
button_restore_copy.check_visibility("Inventory button to restore copy is missing")
|
||
button_text = button_restore_copy.get_text(0).strip()
|
||
assert button_text == "Восстановить копию", f"Unexpected inventory button to restore copy text: {button_text}"
|
||
|
||
button_download_copy = self.inventory_settings.get_content_item("inventory_button_download_copy")
|
||
dump_selector = self.inventory_settings.get_content_item("inventory_dump_selector")
|
||
val = dump_selector.get_selected_values()
|
||
if len(val) == 0:
|
||
assert button_restore_copy.is_disabled(), "Inventory button to restore copy should be disabled"
|
||
assert button_download_copy.get_locator().count() == 0, \
|
||
"Inventory button to download copy should be missing"
|
||
else:
|
||
assert not button_restore_copy.is_disabled(), "Inventory button to restore copy should be enabled"
|
||
|
||
button_download_copy.check_visibility("Inventory button to download copy is missing")
|
||
button_text = button_download_copy.get_text(0).strip()
|
||
assert button_text == "Скачать копию", f"Unexpected inventory button to upload copy text: {button_text}"
|
||
|
||
def _check_inventory_scheduler_settings_content(self) -> None:
|
||
"""Проверяет наличие и корректность всех элементов настройки 'Инвентаризация/Параметры планировщика'."""
|
||
|
||
self.inventory_scheduler_settings.should_be_toolbar()
|
||
|
||
backup_creation_time_label = self.inventory_scheduler_settings.get_content_item("backup_creation_time_label")
|
||
backup_creation_time_label.check_visibility("Inventory backup creation time label is missing")
|
||
label_text = backup_creation_time_label.get_locator().input_value()
|
||
assert label_text == "Время создания резервной копии", "Unexpected inventory backup creation time label text"
|
||
|
||
backup_creation_time_input = self.inventory_scheduler_settings.get_content_item("backup_creation_time_input")
|
||
backup_creation_time_input.check_visibility("Inventory backup creation time input field is missing")
|
||
|
||
backups_number_label = self.inventory_scheduler_settings.get_content_item("backups_number_label")
|
||
backups_number_label.check_visibility("Inventory backups number label is missing")
|
||
label_text = backups_number_label.get_locator().input_value()
|
||
assert label_text == "Количество резервных копий", "Unexpected inventory backups number label text"
|
||
|
||
backups_number_input = self.inventory_scheduler_settings.get_content_item("backups_number_input")
|
||
backups_number_input.check_visibility("Inventory backups number input field is missing")
|
||
|
||
def _check_streaming_data_settings_content(self) -> None:
|
||
"""Проверяет наличие и корректность всех элементов настройки 'Потоковые данные'."""
|
||
|
||
self.streaming_data_settings.should_be_toolbar()
|
||
|
||
button_create_copy = self.streaming_data_settings.get_content_item("streaming_data_button_create_copy")
|
||
button_create_copy.check_visibility("Streaming data button to create copy is missing")
|
||
button_text = button_create_copy.get_text(0).strip()
|
||
assert button_text == "Создать копию", f"Unexpected streaming data button to create copy text: {button_text}"
|
||
|
||
button_upload_copy = self.streaming_data_settings.get_content_item("streaming_data_button_upload_copy")
|
||
button_upload_copy.check_visibility("Streaming data button to upload copy is missing")
|
||
button_text = button_upload_copy.get_text(0).strip()
|
||
assert button_text == "Загрузить копию", f"Unexpected streaming data button to upload copy text: {button_text}"
|
||
|
||
button_restore_copy = self.streaming_data_settings.get_content_item("streaming_data_button_restore_copy")
|
||
button_restore_copy.check_visibility("Streaming data button to restore copy is missing")
|
||
button_text = button_restore_copy.get_text(0).strip()
|
||
assert button_text == "Восстановить копию", \
|
||
f"Unexpected streaming data button to restore copy text: {button_text}"
|
||
|
||
button_download_copy = self.streaming_data_settings.get_content_item("streaming_data_button_download_copy")
|
||
dump_selector = self.streaming_data_settings.get_content_item("streaming_data_dump_selector")
|
||
val = dump_selector.get_selected_values()
|
||
if len(val) == 0:
|
||
assert button_restore_copy.is_disabled(), "Streaming data button to restore copy should be disabled"
|
||
assert button_download_copy.get_locator().count() == 0, \
|
||
"Streaming data button to download copy should be missing"
|
||
else:
|
||
assert not button_restore_copy.is_disabled(), "Streaming data button to restore copy should be enabled"
|
||
|
||
button_download_copy.check_visibility("Streaming data button to download copy is missing")
|
||
button_text = button_download_copy.get_text(0).strip()
|
||
assert button_text == "Скачать копию", \
|
||
f"Unexpected streaming data button to upload copy text: {button_text}"
|
||
|
||
audit_category_label = self.streaming_data_settings.get_content_item("audit_category_label")
|
||
audit_category_label.check_visibility("Streaming data Audit category label is missing")
|
||
audit_category_label_text = audit_category_label.get_text(0).strip()
|
||
assert audit_category_label_text == "Аудит", \
|
||
f"Unexpected streaming data Audit category label text: {audit_category_label_text}"
|
||
|
||
audit_time_period_label = self.streaming_data_settings.get_content_item("audit_time_period_label")
|
||
audit_time_period_label.check_visibility("Streaming data Audit storage time period label is missing")
|
||
audit_time_period_label_text = audit_time_period_label.get_locator().input_value()
|
||
assert audit_time_period_label_text == "Период хранения данных", \
|
||
f"Unexpected streaming data Audit storage time period label text: {audit_time_period_label_text}"
|
||
|
||
audit_time_period_value = self.streaming_data_settings.get_content_item("audit_time_period_value")
|
||
audit_time_period_value.check_visibility("Streaming data Audit storage time period input field is missing")
|
||
|
||
audit_time_period_value_interval = self.streaming_data_settings. \
|
||
get_content_item("audit_time_period_value_interval")
|
||
audit_time_period_value_interval. \
|
||
check_visibility("Streaming data Audit storage time period interval field is missing")
|
||
|
||
logs_category_label = self.streaming_data_settings.get_content_item("logs_category_label")
|
||
logs_category_label.check_visibility("Streaming data Logs category label is missing")
|
||
logs_category_label_text = logs_category_label.get_text(0).strip()
|
||
assert logs_category_label_text == "Логи", \
|
||
f"Unexpected streaming data Logs category label text: {logs_category_label_text}"
|
||
|
||
logs_time_period_label = self.streaming_data_settings.get_content_item("logs_time_period_label")
|
||
logs_time_period_label.check_visibility("Streaming data Logs storage time period label is missing")
|
||
logs_time_period_label_text = logs_time_period_label.get_locator().input_value()
|
||
assert logs_time_period_label_text == "Период хранения данных", \
|
||
f"Unexpected streaming data Logs storage time period label text: {logs_time_period_label_text}"
|
||
|
||
logs_time_period_value = self.streaming_data_settings.get_content_item("logs_time_period_value")
|
||
logs_time_period_value.check_visibility("Streaming data Logs storage time period input field is missing")
|
||
|
||
logs_time_period_value_interval = self.streaming_data_settings. \
|
||
get_content_item("logs_time_period_value_interval")
|
||
logs_time_period_value_interval. \
|
||
check_visibility("Streaming data Logs storage time period interval field is missing")
|
||
|
||
metrics_category_label = self.streaming_data_settings.get_content_item("metrics_category_label")
|
||
metrics_category_label.check_visibility("Streaming data Metrics category label is missing")
|
||
metrics_category_label_text = metrics_category_label.get_text(0).strip()
|
||
assert metrics_category_label_text == "Метрики", \
|
||
f"Unexpected streaming data Metrics category label text: {metrics_category_label_text}"
|
||
|
||
metrics_time_period_label = self.streaming_data_settings.get_content_item("metrics_time_period_label")
|
||
metrics_time_period_label.check_visibility("Streaming data Metrics storage time period label is missing")
|
||
metrics_time_period_label_text = metrics_time_period_label.get_locator().input_value()
|
||
assert metrics_time_period_label_text == "Период хранения данных", \
|
||
f"Unexpected streaming data Metrics storage time period label text: {metrics_time_period_label_text}"
|
||
|
||
metrics_time_period_value = self.streaming_data_settings.get_content_item("metrics_time_period_value")
|
||
metrics_time_period_value.check_visibility("Streaming data Metrics storage time period input field is missing")
|
||
|
||
metrics_time_period_value_interval = self.streaming_data_settings. \
|
||
get_content_item("metrics_time_period_value_interval")
|
||
metrics_time_period_value_interval. \
|
||
check_visibility("Streaming data Metrics storage time period interval field is missing")
|
||
|
||
syslog_category_label = self.streaming_data_settings.get_content_item("syslog_category_label")
|
||
syslog_category_label.check_visibility("Streaming data Sys Log category label is missing")
|
||
syslog_category_label_text = syslog_category_label.get_text(0).strip()
|
||
assert syslog_category_label_text == "Системный лог", \
|
||
f"Unexpected streaming data Sys Log category label text: {syslog_category_label_text}"
|
||
|
||
syslog_time_period_label = self.streaming_data_settings.get_content_item("syslog_time_period_label")
|
||
syslog_time_period_label.check_visibility("Streaming data Sys Log storage time period label is missing")
|
||
syslog_time_period_label_text = syslog_time_period_label.get_locator().input_value()
|
||
assert syslog_time_period_label_text == "Период хранения данных", \
|
||
f"Unexpected streaming data Sys Log storage time period label text: {syslog_time_period_label_text}"
|
||
|
||
syslog_time_period_value = self.streaming_data_settings.get_content_item("syslog_time_period_value")
|
||
syslog_time_period_value.check_visibility("Streaming data Sys Log storage time period input field is missing")
|
||
|
||
syslog_time_period_value_interval = self.streaming_data_settings. \
|
||
get_content_item("syslog_time_period_value_interval")
|
||
syslog_time_period_value_interval. \
|
||
check_visibility("Streaming data Sys Log storage time period interval field is missing")
|
||
|
||
tasks_category_label = self.streaming_data_settings.get_content_item("tasks_category_label")
|
||
tasks_category_label.check_visibility("Streaming data Actions category label is missing")
|
||
tasks_category_label_text = tasks_category_label.get_text(0).strip()
|
||
assert tasks_category_label_text == "Действия", \
|
||
f"Unexpected streaming data Actions category label text: {tasks_category_label_text}"
|
||
|
||
tasks_time_period_label = self.streaming_data_settings.get_content_item("tasks_time_period_label")
|
||
tasks_time_period_label.check_visibility("Streaming data Actions storage time period label is missing")
|
||
tasks_time_period_label_text = tasks_time_period_label.get_locator().input_value()
|
||
assert tasks_time_period_label_text == "Период хранения данных", \
|
||
f"Unexpected streaming data Actions storage time period label text: {tasks_time_period_label_text}"
|
||
|
||
tasks_time_period_value = self.streaming_data_settings.get_content_item("tasks_time_period_value")
|
||
tasks_time_period_value.check_visibility("Streaming data Actions storage time period input field is missing")
|
||
|
||
tasks_time_period_value_interval = self.streaming_data_settings. \
|
||
get_content_item("tasks_time_period_value_interval")
|
||
tasks_time_period_value_interval. \
|
||
check_visibility("Streaming data Actions storage time period interval field is missing")
|
||
|
||
|
||
def _check_streaming_data_scheduler_settings_content(self) -> None:
|
||
"""Проверяет наличие и корректность всех элементов настройки 'Потоковые данные/Параметры планировщика'."""
|
||
|
||
self.streaming_data_scheduler_settings.should_be_toolbar()
|
||
|
||
backup_creation_time_label = self.streaming_data_scheduler_settings. \
|
||
get_content_item("backup_creation_time_label")
|
||
backup_creation_time_label.check_visibility("Streaming data backup creation time label is missing")
|
||
label_text = backup_creation_time_label.get_locator().input_value()
|
||
assert label_text == "Время создания резервной копии", \
|
||
"Unexpected streaming data backup creation time label text"
|
||
|
||
backup_creation_time_input = self.streaming_data_scheduler_settings. \
|
||
get_content_item("backup_creation_time_input")
|
||
backup_creation_time_input.check_visibility("Streaming data backup creation time input field is missing")
|