e-nms_qa_automation/tests/components/test_user_modal_window.py

71 lines
2.9 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

from pages.login_page import LoginPage
from pages.main_page import MainPage
from pages.users_tab import UsersTab
from playwright.sync_api import Page
import pytest
class TestUsersModalWindow:
"""Тесты для проверки модальных окон работы с пользователями."""
@pytest.fixture(scope="function", autouse=True)
def setup(self, browser: Page) -> None:
"""Фикстура для настройки тестового окружения."""
lp = LoginPage(browser)
lp.do_login()
mp = MainPage(browser)
mp.should_be_navigation_panel()
mp.click_main_navigation_panel_item("Настройки")
mp.click_configuration_navigation_panel_item("Пользователи")
@pytest.mark.develop
def test_edit_user_window_scrolling(self, browser: Page) -> None:
"""Тест проверки прокрутки окна редактирования пользователя."""
ut = UsersTab(browser)
user_name, role = ut.open_edit_user_page_by_index(0)
modal_window = ut.get_modal_window(user_name)
is_scrollable_vertically = modal_window.check_window_vertical_scrolling()
assert is_scrollable_vertically, "Should be vertical scrolling"
modal_window.scroll_window_down()
modal_window.check_button_presence("close")
ut.wait_for_timeout(3000)
modal_window.scroll_window_up()
modal_window.check_toolbar_button_presence("close")
ut.wait_for_timeout(3000)
is_scrollable_horizontally = modal_window.check_window_horizontal_scrolling()
assert is_scrollable_horizontally, "Should be horizontal scrolling"
modal_window.scroll_window_right()
ut.wait_for_timeout(3000)
modal_window.scroll_window_left()
ut.wait_for_timeout(2000)
def test_add_user_window_scrolling(self, browser: Page) -> None:
"""Тест проверки прокрутки окна добавления пользователя."""
ut = UsersTab(browser)
ut.open_add_user_window()
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"
modal_window.scroll_window_down()
modal_window.check_button_presence("close")
ut.wait_for_timeout(3000)
modal_window.scroll_window_up()
modal_window.check_toolbar_button_presence("close")
ut.wait_for_timeout(3000)
is_scrollable_horizontally = modal_window.check_window_horizontal_scrolling()
assert is_scrollable_horizontally, "Should be horizontal scrolling"
modal_window.scroll_window_right()
ut.wait_for_timeout(3000)
modal_window.scroll_window_left()
ut.wait_for_timeout(2000)