Класс тестов для проверки панели событий.
Тесты покрывают следующие сценарии:
1. test_event_panel_content: Проверяет содержимое панели событий
2. test_event_panel_expand_buttons: Проверяет состояние и количество кнопок расширения рабочей области панели событий
Атрибуты
browser: Фикстура для работы с браузером.
Source code in tests\e2e\test_event_panel.py
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119 | class TestEventPanel:
"""Класс тестов для проверки панели событий.
Тесты покрывают следующие сценарии:
1. test_event_panel_content: Проверяет содержимое панели событий
2. test_event_panel_expand_buttons: Проверяет состояние и количество кнопок расширения рабочей области панели событий
Атрибуты:
browser: Фикстура для работы с браузером.
"""
def test_event_panel_content(self, browser: Page) -> None:
"""Проверяет содержимое панели событий.
Args:
browser: Экземпляр страницы Playwright.
"""
lp = LoginPage(browser)
lp.do_login()
mp = MainPage(browser)
mp.should_be_event_panel()
# Проверяем соответствие тултипов информации на кнопках
tooltip_event_counters = mp.get_event_counters_by_tooltips()
button_event_counters = mp.get_event_counters_by_tooltips()
for event, counter in tooltip_event_counters.items():
button_counter = button_event_counters.get(event)
if button_counter is None:
assert False, f"Found unexpected tooltip {event} for event button"
if button_counter != counter:
assert False, f"Expected tooltip value {counter} is not equal button value {button_counter} for event button {event}"
# @pytest.mark.develop
def test_event_panel_expand_buttons(self, browser: Page) -> None:
"""Проверяет состояние и количество кнопок расширения рабочей области панели событий.
Args:
browser: Экземпляр страницы Playwright.
"""
lp = LoginPage(browser)
lp.do_login()
mp = MainPage(browser)
# Проверяем начальное состояние - панель событий внизу, видна одна кнопка expand less
current_position = mp.get_events_panel_position()
assert current_position == "bottom", \
"Events panel should be located on main page bottom"
assert mp.check_expand_less_button(), \
"Expand less button should be present"
assert mp.check_expand_more_button(), \
"Expand more button should be absent"
mp.click_events_panel_expand_less_button()
mp.wait_for_timeout(500)
# Проверяем, что панель событий переместилась в середину экрана,
# видна обе кнопки expand less и expand more
current_position = mp.get_events_panel_position()
assert current_position == "center", \
"Events panel should be located on main page center"
assert mp.check_expand_less_button(), \
"Expand less button should be present"
assert mp.check_expand_more_button(), \
"Expand more button should be present"
mp.click_events_panel_expand_less_button()
mp.wait_for_timeout(500)
# Проверяем, что панель событий находится вверху экрана,
# видна кнопки expand more и отсутствует expand less
current_position = mp.get_events_panel_position()
assert current_position == "top", \
"Events panel should be located on main page top"
assert mp.check_expand_less_button(), \
"Expand less button should be absent"
assert mp.check_expand_more_button(), \
"Expand more button should be present"
# перемещение в отратном напрвлении сверху вниз
mp.click_events_panel_expand_more_button()
mp.wait_for_timeout(500)
current_position = mp.get_events_panel_position()
assert current_position == "center", \
"Events panel should be located on main page center"
assert mp.check_expand_less_button(), \
"Expand less button should be present"
assert mp.check_expand_more_button(), \
"Expand more button should be present"
mp.click_events_panel_expand_more_button()
mp.wait_for_timeout(500)
current_position = mp.get_events_panel_position()
assert current_position == "bottom", \
"Events panel should be located on main page bottom"
assert mp.check_expand_less_button(), \
"Expand less button should be present"
assert mp.check_expand_more_button(), \
"Expand more button should be absent"
|
test_event_panel_content(browser)
Проверяет содержимое панели событий.
Parameters:
| Name |
Type |
Description |
Default |
browser
|
Page
|
Экземпляр страницы Playwright.
|
required
|
Source code in tests\e2e\test_event_panel.py
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48 | def test_event_panel_content(self, browser: Page) -> None:
"""Проверяет содержимое панели событий.
Args:
browser: Экземпляр страницы Playwright.
"""
lp = LoginPage(browser)
lp.do_login()
mp = MainPage(browser)
mp.should_be_event_panel()
# Проверяем соответствие тултипов информации на кнопках
tooltip_event_counters = mp.get_event_counters_by_tooltips()
button_event_counters = mp.get_event_counters_by_tooltips()
for event, counter in tooltip_event_counters.items():
button_counter = button_event_counters.get(event)
if button_counter is None:
assert False, f"Found unexpected tooltip {event} for event button"
if button_counter != counter:
assert False, f"Expected tooltip value {counter} is not equal button value {button_counter} for event button {event}"
|
Проверяет состояние и количество кнопок расширения рабочей области панели событий.
Parameters:
| Name |
Type |
Description |
Default |
browser
|
Page
|
Экземпляр страницы Playwright.
|
required
|
Source code in tests\e2e\test_event_panel.py
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119 | def test_event_panel_expand_buttons(self, browser: Page) -> None:
"""Проверяет состояние и количество кнопок расширения рабочей области панели событий.
Args:
browser: Экземпляр страницы Playwright.
"""
lp = LoginPage(browser)
lp.do_login()
mp = MainPage(browser)
# Проверяем начальное состояние - панель событий внизу, видна одна кнопка expand less
current_position = mp.get_events_panel_position()
assert current_position == "bottom", \
"Events panel should be located on main page bottom"
assert mp.check_expand_less_button(), \
"Expand less button should be present"
assert mp.check_expand_more_button(), \
"Expand more button should be absent"
mp.click_events_panel_expand_less_button()
mp.wait_for_timeout(500)
# Проверяем, что панель событий переместилась в середину экрана,
# видна обе кнопки expand less и expand more
current_position = mp.get_events_panel_position()
assert current_position == "center", \
"Events panel should be located on main page center"
assert mp.check_expand_less_button(), \
"Expand less button should be present"
assert mp.check_expand_more_button(), \
"Expand more button should be present"
mp.click_events_panel_expand_less_button()
mp.wait_for_timeout(500)
# Проверяем, что панель событий находится вверху экрана,
# видна кнопки expand more и отсутствует expand less
current_position = mp.get_events_panel_position()
assert current_position == "top", \
"Events panel should be located on main page top"
assert mp.check_expand_less_button(), \
"Expand less button should be absent"
assert mp.check_expand_more_button(), \
"Expand more button should be present"
# перемещение в отратном напрвлении сверху вниз
mp.click_events_panel_expand_more_button()
mp.wait_for_timeout(500)
current_position = mp.get_events_panel_position()
assert current_position == "center", \
"Events panel should be located on main page center"
assert mp.check_expand_less_button(), \
"Expand less button should be present"
assert mp.check_expand_more_button(), \
"Expand more button should be present"
mp.click_events_panel_expand_more_button()
mp.wait_for_timeout(500)
current_position = mp.get_events_panel_position()
assert current_position == "bottom", \
"Events panel should be located on main page bottom"
assert mp.check_expand_less_button(), \
"Expand less button should be present"
assert mp.check_expand_more_button(), \
"Expand more button should be absent"
|