Актуализация тестов тестов скроллинга в соответствии с последними изменениями UI
parent
db50e80c51
commit
bfb4082a2d
|
|
@ -252,12 +252,13 @@ class NavigationPanelComponent(BaseComponent):
|
|||
assert False, "Workarea already reduced"
|
||||
|
||||
# Проверки:
|
||||
def check_item_visibility(self, locator: str | Locator, item_name: str) -> None:
|
||||
def check_item_visibility(self, locator: str | Locator, item_name: str, parent = None) -> None:
|
||||
"""Проверяет видимость элемента с указанным текстом.
|
||||
|
||||
Args:
|
||||
locator: Локатор элемента или строка с CSS/XPath.
|
||||
item_name: Текст элемента для проверки.
|
||||
parent: Текст родительского элемента (необязательный параметр)
|
||||
|
||||
Note:
|
||||
Временная обработка для элементов с текстом 'Шаблоны'.
|
||||
|
|
@ -265,17 +266,13 @@ class NavigationPanelComponent(BaseComponent):
|
|||
|
||||
msg = f"Navigation panel item '{item_name}' is not visible"
|
||||
|
||||
## временно: в навигационной панели есть две панели с именем Шаблоны
|
||||
## для их различия добавлены индексы Шаблоны_1 для Настройки/Шаблоны
|
||||
## Шаблоны_2 для Настройки/ZTP/Шаблоны
|
||||
loc = self.get_locator(locator)
|
||||
if item_name == "Шаблоны_1":
|
||||
loc = loc.get_by_text("Шаблоны").first
|
||||
elif item_name == "Шаблоны_2":
|
||||
loc = loc.get_by_text("Шаблоны").nth(1)
|
||||
else:
|
||||
loc = loc.get_by_text(item_name)
|
||||
self.check_visibility(loc, msg)
|
||||
if parent:
|
||||
parent_loc = f"//div[contains(@class, 'v-treeview-node') and contains(.,'{parent}')]"
|
||||
loc = loc.locator(parent_loc)
|
||||
item_loc = loc.get_by_text(item_name).first
|
||||
|
||||
self.check_visibility(item_loc, msg)
|
||||
|
||||
def is_item_visible(self, locator: str | Locator, item_name: str) -> bool:
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -50,7 +50,6 @@ class EditUserModalWindow(ModalWindowComponent):
|
|||
# Добавление полей формы
|
||||
elements_locators = self.get_input_fields_locators(
|
||||
self.page.locator(ModalWindowLocators.INPUT_FORM_USER_DATA))
|
||||
|
||||
# Поле Имя
|
||||
loc = elements_locators.get("Имя").locator(ModalWindowLocators.INPUT_FORM_USER_DATA_FIELD_NAME)
|
||||
name_input = TextInput(page, loc, "name_input")
|
||||
|
|
|
|||
|
|
@ -13,4 +13,4 @@ class JsonContainerLocators:
|
|||
"""
|
||||
|
||||
CONTAINER = "//div[contains(@class,'jv-container')]"
|
||||
SCROLL_CONTAINER = "//div[contains(@class, 'scrollarea__body')]"
|
||||
SCROLL_CONTAINER = "//nav[contains(@class, 'active v-toolbar')]/../following-sibling::div//div[contains(@class,'scrollarea__body')]"
|
||||
|
|
|
|||
|
|
@ -60,13 +60,13 @@ class LicenseTab(BasePage):
|
|||
def scroll_json_container_up(self) -> None:
|
||||
"""Прокручивает JSON-контейнер вверх."""
|
||||
|
||||
loc = self.page.locator(JsonContainerLocators.SCROLL_CONTAINER).first
|
||||
loc = self.page.locator(JsonContainerLocators.SCROLL_CONTAINER)
|
||||
self.json_container.scroll_up(loc)
|
||||
|
||||
def scroll_json_container_down(self) -> None:
|
||||
"""Прокручивает JSON-контейнер вниз."""
|
||||
|
||||
loc = self.page.locator(JsonContainerLocators.SCROLL_CONTAINER).first
|
||||
loc = self.page.locator(JsonContainerLocators.SCROLL_CONTAINER)
|
||||
self.json_container.scroll_down(loc)
|
||||
|
||||
# Проверки:
|
||||
|
|
@ -77,7 +77,7 @@ class LicenseTab(BasePage):
|
|||
bool: Доступность прокрутки
|
||||
"""
|
||||
|
||||
loc = self.page.locator(JsonContainerLocators.SCROLL_CONTAINER).first
|
||||
loc = self.page.locator(JsonContainerLocators.SCROLL_CONTAINER)
|
||||
return self.json_container.is_scrollable_vertically(loc)
|
||||
|
||||
def check_content(self) -> None:
|
||||
|
|
|
|||
|
|
@ -205,7 +205,7 @@ class MainPage(BasePage):
|
|||
item_name
|
||||
)
|
||||
|
||||
def check_navigation_panel_item_visibility(self, item_name: str) -> None:
|
||||
def check_navigation_panel_item_visibility(self, item_name: str, parent=None) -> None:
|
||||
"""Проверяет видимость элемента в панели навигации.
|
||||
|
||||
Args:
|
||||
|
|
@ -214,7 +214,7 @@ class MainPage(BasePage):
|
|||
|
||||
self.navigation_panel.check_item_visibility(
|
||||
NavigationPanelLocators.PANEL_MAIN,
|
||||
item_name
|
||||
item_name, parent
|
||||
)
|
||||
|
||||
def check_subpanel_item_state(self, item_name: str, parent=None) -> str|None:
|
||||
|
|
|
|||
|
|
@ -183,16 +183,14 @@ class SessionSettingsTab(BasePage):
|
|||
"""Скроллинг вниз формы настроек времени жизни сессии.
|
||||
"""
|
||||
|
||||
locator = self.page.locator(SettingsFormLocators.SETTTINGS_FORM_SCROLL_CONTAINER).filter(
|
||||
has_text="Время жизни сеанса")
|
||||
locator = self.page.locator(SettingsFormLocators.SETTINGS_FORM_INPUT_FORM_CONTAINER)
|
||||
self.settings_form.scroll_down(locator)
|
||||
|
||||
def scroll_up(self) -> None:
|
||||
"""Скроллинг вверх формы настроек времени жизни сессии.
|
||||
"""
|
||||
|
||||
locator = self.page.locator(SettingsFormLocators.SETTTINGS_FORM_SCROLL_CONTAINER).filter(
|
||||
has_text="Время жизни сеанса")
|
||||
locator = self.page.locator(SettingsFormLocators.SETTINGS_FORM_INPUT_FORM_CONTAINER)
|
||||
self.settings_form.scroll_up(locator)
|
||||
|
||||
# Проверки:
|
||||
|
|
@ -227,8 +225,7 @@ class SessionSettingsTab(BasePage):
|
|||
"""Проверка возможности вертикального скроллинга формы настроек времени жизни сессии.
|
||||
"""
|
||||
|
||||
locator = self.page.locator(SettingsFormLocators.SETTTINGS_FORM_SCROLL_CONTAINER).filter(
|
||||
has_text="Время жизни сеанса")
|
||||
locator = self.page.locator(SettingsFormLocators.SETTINGS_FORM_INPUT_FORM_CONTAINER)
|
||||
return self.settings_form.check_vertical_scrolling(locator)
|
||||
|
||||
def should_be_toolbar(self) -> None:
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
pytest -s -v --s="{'width': 300, 'height': 420}" test_navigation_panel.py
|
||||
pytest -s -v --s="{'width': 1500, 'height': 420}" test_services_table.py
|
||||
pytest -s -v --s="{'width': 300, 'height': 420}" test_json_container.py
|
||||
pytest -s -v --s="{'width': 300, 'height': 600}" test_json_container.py
|
||||
pytest -s -v --s="{'width': 300, 'height': 420}" test_user_modal_window.py
|
||||
pytest -s -v --s="{'width': 800, 'height': 200}" test_session_settings.py
|
||||
|
|
@ -54,10 +54,10 @@ class TestNavigationPanel:
|
|||
# Действия:
|
||||
# Прокручиваем вверх и проверяем видимость элемента
|
||||
mp.scroll_navigation_panel_up()
|
||||
mp.check_navigation_panel_item_visibility("Панель приборов")
|
||||
mp.check_navigation_panel_item_visibility("Панели")
|
||||
mp.wait_for_timeout(3000)
|
||||
|
||||
# Прокручиваем вниз и проверяем видимость элемента Настройки/ZTP/Шаблоны
|
||||
mp.scroll_navigation_panel_down()
|
||||
mp.check_navigation_panel_item_visibility("Шаблоны_2")
|
||||
mp.check_navigation_panel_item_visibility("Шаблоны")
|
||||
mp.wait_for_timeout(2000)
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class TestSessionSettingsForm:
|
|||
mp.click_subpanel_item("Настройки", parent="Сеансы")
|
||||
|
||||
def test_scrolling(self, browser: Page) -> None:
|
||||
"""Проверяет прокрутку таблицы статусов сервисов.
|
||||
"""Проверяет прокрутку формы редактирования настроек.
|
||||
|
||||
Args:
|
||||
browser: Экземпляр страницы Playwright.
|
||||
|
|
@ -55,5 +55,5 @@ class TestSessionSettingsForm:
|
|||
sst.wait_for_timeout(3000)
|
||||
|
||||
sst.scroll_up()
|
||||
sst.should_be_form_toolbar()
|
||||
sst.get_field_by_name('administrator').check_visibility("Text 'Администратор' should be visible")
|
||||
sst.wait_for_timeout(2000)
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ class TestUsersModalWindow:
|
|||
|
||||
ut = UsersTab(browser)
|
||||
ut.open_add_user_window()
|
||||
modal_window = ut.get_modal_window("add_local_user")
|
||||
modal_window = ut.get_modal_window("add_user")
|
||||
|
||||
is_scrollable_vertically = modal_window.check_window_vertical_scrolling()
|
||||
assert is_scrollable_vertically, "Should be vertical scrolling"
|
||||
|
|
|
|||
Loading…
Reference in New Issue