Debian Codegraph @

dirsrvtests/tests/suites/webui/monitoring/monitoring_test.py

raw
1 # --- BEGIN COPYRIGHT BLOCK ---
2 # Copyright (C) 2023 Red Hat, Inc.
3 # All rights reserved.
4 #
5 # License: GPL (version 3 or any later version).
6 # See LICENSE for details.
7 # --- END COPYRIGHT BLOCK ---
8 #
9 import time
10 import pytest
11 import logging
12 import os
13
14 from lib389.cli_idm.account import *
15 from lib389.tasks import *
16 from lib389.utils import *
17 from test389.topologies import topology_st
18 from .. import setup_page, check_frame_assignment, setup_login, enable_replication
19
20 log = logging.getLogger(__name__)
21
22 pytestmark = pytest.mark.skipif(os.getenv('WEBUI') is None, reason="These tests are only for WebUI environment")
23 pytest.importorskip('playwright')
24
25 SERVER_ID = 'standalone1'
26
27
28 def test_monitoring_tab_visibility(topology_st, page, browser_name):
29 """ Test Monitoring tab visibility
30
31 :id: e16be05a-4465-4a2b-bfe2-7c5aafb55c91
32 :setup: Standalone instance
33 :steps:
34 1. Click on Monitoring tab.
35 2. Check if Resource Charts tab is visible.
36 :expectedresults:
37 1. Success
38 2. Element is visible
39 """
40 setup_login(page)
41 time.sleep(1)
42 frame = check_frame_assignment(page, browser_name)
43
44 log.info('Check if Monitoring tab is loaded.')
45 frame.get_by_role('tab', name='Monitoring', exact=True).click()
46 frame.get_by_role('tab', name='Resource Charts').wait_for()
47 assert frame.get_by_role('tab', name='Resource Charts').is_visible()
48
49
50 def test_server_statistics_visibility(topology_st, page, browser_name):
51 """ Test Server Statistics monitoring visibility
52
53 :id: 90e964e8-99d7-45e5-ad20-520099db054e
54 :setup: Standalone instance
55 :steps:
56 1. Click on Monitoring tab and check if Connections heading is visible.
57 2. Click on Server Stats tab and check if Server Instance label is visible.
58 3. Click on Connection Table tab and check if Client Connections heading is visible.
59 4. Click on Disk Space tab and check if Refresh button is visible.
60 5. Click on SNMP Counters and check if Bytes Sent label is visible.
61 :expectedresults:
62 1. Element is visible
63 2. Element is visible
64 3. Element is visible
65 4. Element is visible
66 5. Element is visible
67 """
68 setup_login(page)
69 time.sleep(1)
70 frame = check_frame_assignment(page, browser_name)
71
72 log.info('Click on Monitoring tab and check if element in Server Statistics is loaded.')
73 frame.get_by_role('tab', name='Monitoring', exact=True).click()
74 frame.get_by_role('heading', name='Connections').wait_for()
75 assert frame.get_by_role('heading', name='Connections').is_visible()
76
77 log.info('Click on Server Stats tab and check if element is loaded.')
78 frame.get_by_role('tab', name='Server Stats').click()
79 assert frame.get_by_text('Server Instance').is_visible()
80
81 log.info('Click on Connection Table tab and check if element is loaded.')
82 frame.get_by_role('tab', name='Connection Table').click()
83 assert frame.get_by_role('heading', name='Client Connections').is_visible()
84
85 log.info('Click on Disk Space tab and check if element is loaded.')
86 frame.get_by_role('tab', name='Disk Space').click()
87 assert frame.get_by_text('Refresh').is_visible()
88
89 log.info('Click on SNMP Counters tab and check if element is loaded.')
90 frame.get_by_role('tab', name='SNMP Counters').click()
91 assert frame.get_by_text('Data Sent', exact=True).is_visible()
92
93
94 def test_replication_visibility(topology_st, page, browser_name):
95 """ Test Replication monitoring visibility
96
97 :id: 65b271e5-a172-461b-ad36-605706d68780
98 :setup: Standalone instance
99 :steps:
100 1. Click on Replication Tab, Click on Enable Replication.
101 2. Fill Password and Confirm password.
102 3. Click on Enable Replication button and wait until Add Replication Manager is visible.
103 4. Click on Monitoring tab, click on Replication button on the side panel.
104 5. Check if Generate Report button is visible.
105 6. Click on Agreements tab and check if Replication Agreements columnheader is visible.
106 7. Click on Winsync tab and check if Winsync Agreements columnheader is visible.
107 8. Click on Tasks tab and check if CleanAllRUV Tasks columnheader is visible.
108 9. Click on Conflict Entries tab and check if Replication Conflict Entries columnheader is visible.
109 :expectedresults:
110 1. Success
111 2. Success
112 3. Success
113 4. Success
114 5. Element is visible
115 6. Element is visible
116 7. Element is visible
117 8. Element is visible
118 9. Element is visible
119 """
120 setup_login(page)
121 time.sleep(1)
122 frame = check_frame_assignment(page, browser_name)
123 enable_replication(frame)
124
125 log.info('Click on Monitoring tab and then on Replication in the menu and check if element is loaded.')
126 frame.get_by_role('tab', name='Monitoring', exact=True).click()
127 frame.locator('#replication-monitor').click()
128 frame.get_by_role('button', name='Synchronization Report').wait_for()
129 frame.locator('#sync-report').click()
130 frame.get_by_role('tab', name='Prepare New Report').click()
131 frame.get_by_role('button', name='Generate Report').wait_for()
132 assert frame.get_by_role('button', name='Generate Report').is_visible()
133
134 log.info('Click on Agreements tab and check if element is loaded.')
135 assert frame.locator('#replication-suffix-dc\\=example\\,dc\\=com').is_visible()
136
137
138 def test_database_visibility(topology_st, page, browser_name):
139 """ Test Database monitoring visibility
140
141 :id: bf3f3e42-e748-41b8-bda2-a1856343a995
142 :setup: Standalone instance
143 :steps:
144 1. Click on Monitoring tab, click on dc=example,dc=com button on the side panel.
145 2. Check if Entry Cache Hit Ratio label is visible.
146 3. Click on DN Cache tab and check if DN Cache Hit Ratio label is visible.
147 :expectedresults:
148 1. Success
149 2. Element is visible
150 3. Element is visible
151 """
152 setup_login(page)
153 time.sleep(1)
154 frame = check_frame_assignment(page, browser_name)
155 instance = topology_st.standalone
156
157 log.info('Click on Monitoring tab, then click on database button and check if element is loaded.')
158 frame.get_by_role('tab', name='Monitoring', exact=True).click()
159 frame.get_by_label("Monitoring", exact=True).get_by_text("Database").click()
160
161 log.info('Click on Database tab and check if element is loaded.')
162 if instance.get_db_lib() == 'bdb':
163 frame.get_by_role('tab', name='Normalized DN Cache').click()
164
165 frame.get_by_text('NDN Cache Hit Ratio').wait_for()
166 assert frame.get_by_text('NDN Cache Hit Ratio').is_visible()
167
168 frame.locator('#dc\\=example\\,dc\\=com').click()
169 frame.get_by_text('Entry Cache Hit Ratio').wait_for()
170 assert frame.get_by_text('Entry Cache Hit Ratio').is_visible()
171
172 if instance.get_db_lib() == 'bdb':
173 frame.get_by_role('tab', name='DN Cache').click()
174 assert frame.get_by_text('DN Cache Hit Ratio').is_visible()
175
176
177 def test_logging_visibility(topology_st, page, browser_name):
178 """ Test Logging monitoring visibility
179
180 :id: c3e91cd4-569e-45e2-adc7-cbffb4ee7b6c
181 :setup: Standalone instance
182 :steps:
183 1. Click on Monitoring tab, click on Access Log button on side panel.
184 2. Check if Access Log text field is visible.
185 3. Click on Audit Log button on side panel.
186 4. Check if Audit Log text field is visible.
187 5. Click on Audit Failure Log button on side panel.
188 6. Check if Audit Failure Log text field is visible.
189 7. Click on Errors Log button on side panel.
190 8. Check if Errors Log text field is visible.
191 9. Click on Security Log button on side panel.
192 10. Check if Security Log text field is visible.
193 :expectedresults:
194 1. Success
195 2. Element is visible
196 3. Success
197 4. Element is visible
198 5. Success
199 6. Element is visible
200 7. Success
201 8. Element is visible
202 9. Success
203 10. Element is visible
204 """
205 setup_login(page)
206 time.sleep(1)
207 frame = check_frame_assignment(page, browser_name)
208
209 log.info('Click on Monitoring tab, then click on Access Log button and check if element is loaded.')
210 frame.get_by_role('tab', name='Monitoring', exact=True).click()
211 frame.locator('#access-log-monitor').click()
212 frame.locator('#monitor-log-access-page').wait_for()
213 assert frame.locator('#monitor-log-access-page').is_visible()
214
215 log.info('Click on Audit Log button and check if element is loaded.')
216 frame.locator('#audit-log-monitor').click()
217 frame.locator('#monitor-log-audit-page').wait_for()
218 assert frame.locator('#monitor-log-audit-page').is_visible()
219
220 log.info('Click on Audit Failure Log button and check if element is loaded.')
221 frame.locator('#auditfail-log-monitor').click()
222 frame.locator('#monitor-log-auditfail-page').wait_for()
223 assert frame.locator('#monitor-log-auditfail-page').is_visible()
224
225 log.info('Click on Errors Log button and check if element is loaded.')
226 frame.locator('#error-log-monitor').click()
227 frame.locator('#monitor-log-errors-page').wait_for()
228 assert frame.locator('#monitor-log-errors-page').is_visible()
229
230 log.info('Click on Security Log button and check if element is loaded.')
231 frame.locator('#security-log-monitor').click()
232 frame.locator('#monitor-log-security-page').wait_for()
233 assert frame.locator('#monitor-log-security-page').is_visible()
234
235
236 def test_create_credential_and_alias(topology_st, page, browser_name):
237 """ Test check that you are able to give input to input field in pop up windows when creating credential or alias
238
239 :id: 8908405c-47b9-470e-a906-42790b131e9f
240 :setup: Standalone instance
241 :steps:
242 1. Check if replication is enabled, if not enable it.
243 2. Click on Monitoring tab, click on Replication Log button on side panel.
244 3. Click on Add Credentials button and fill Hostname and Password, then click on save.
245 4. Check if new credential appeared in the credentials list.
246 5. Click on Add Alias button and fill alias name and alias hostname, click on Save button.
247 6. Check if new alias appeared in the alias list.
248 :expectedresults:
249 1. Success
250 2. Success
251 3. Success
252 4. Element is visible
253 5. Success
254 6. Element is visible
255 """
256 setup_login(page)
257 time.sleep(1)
258 frame = check_frame_assignment(page, browser_name)
259 enable_replication(frame)
260
261 log.info('Click on Monitoring tab, click on replication button, create new credential and check if it is created')
262 frame.get_by_role('tab', name='Monitoring', exact=True).click()
263 frame.locator('#sync-report').click()
264 frame.locator('#pf-tab-1-prepare-new-report').click()
265 frame.get_by_role('button', name='Add Credentials').click()
266 frame.locator('#credsHostname').fill('credential.test')
267 frame.locator('#credsBindpw').fill('redhat')
268 frame.get_by_role('button', name='Save', exact=True).click()
269 assert frame.get_by_role("gridcell", name="credential.test:389").is_visible()
270
271 log.info('Click on Add Alias, create new alias, check if new alias is created.')
272 frame.get_by_role('button', name='Add Alias').click()
273 frame.locator('#aliasName').fill('alias.test')
274 frame.locator('#aliasHostname').fill('example.com')
275 frame.get_by_role('button', name='Save', exact=True).click()
276 assert frame.get_by_role("gridcell", name="alias.test").is_visible()
277
278
279 if __name__ == '__main__':
280 # Run isolated
281 # -s for DEBUG mode
282 CURRENT_FILE = os.path.realpath(__file__)
283 pytest.main("-s %s" % CURRENT_FILE)