| 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 subprocess |
| 11 |
import pytest |
| 12 |
|
| 13 |
from lib389.cli_idm.account import * |
| 14 |
from lib389.tasks import * |
| 15 |
from lib389.utils import * |
| 16 |
from test389.topologies import topology_st |
| 17 |
from .. import setup_page, check_frame_assignment, setup_login |
| 18 |
|
| 19 |
pytestmark = pytest.mark.skipif(os.getenv('WEBUI') is None, reason="These tests are only for WebUI environment") |
| 20 |
pytest.importorskip('playwright') |
| 21 |
|
| 22 |
SERVER_ID = 'standalone1' |
| 23 |
|
| 24 |
|
| 25 |
def test_server_settings_availability(topology_st, page, browser_name): |
| 26 |
""" Test visibility of Server Settings in server tab |
| 27 |
|
| 28 |
:id: e87a3c6f-3fda-49fa-91c4-a8ca418f32c2 |
| 29 |
:setup: Standalone instance |
| 30 |
:steps: |
| 31 |
1. Check if General Settings tab is visible. |
| 32 |
:expectedresults: |
| 33 |
1. Element is visible |
| 34 |
""" |
| 35 |
setup_login(page) |
| 36 |
time.sleep(1) |
| 37 |
frame = check_frame_assignment(page, browser_name) |
| 38 |
|
| 39 |
log.info('Check if server settings tabs are loaded.') |
| 40 |
frame.get_by_role('tab', name='General Settings', exact=True).wait_for() |
| 41 |
assert frame.get_by_role('tab', name='General Settings').is_visible() |
| 42 |
|
| 43 |
|
| 44 |
def test_server_settings_tabs_availability(topology_st, page, browser_name): |
| 45 |
""" Test visibility of individual tabs under Server Settings |
| 46 |
|
| 47 |
:id: 08cd0f84-e233-4a94-8230-a0cc54636595 |
| 48 |
:setup: Standalone instance |
| 49 |
:steps: |
| 50 |
1. Check if Server Hostname is visible |
| 51 |
2. Click on Directory manager tab and check if Directory Manager DN is visible. |
| 52 |
3. Click on Disk Monitoring tab, click on checkbox and check if Disk Monitoring Threshold label is visible. |
| 53 |
4. Click on Advanced Settings tab and check if Anonymous Resource Limits DN text input is visible. |
| 54 |
:expectedresults: |
| 55 |
1. Element is visible. |
| 56 |
2. Element is visible. |
| 57 |
3. Element is visible. |
| 58 |
4. Element is visible. |
| 59 |
""" |
| 60 |
setup_login(page) |
| 61 |
time.sleep(1) |
| 62 |
frame = check_frame_assignment(page, browser_name) |
| 63 |
|
| 64 |
log.info('Check if General Settings tab is loaded.') |
| 65 |
frame.locator('#nsslapd-localhost').wait_for() |
| 66 |
assert frame.locator('#nsslapd-localhost').is_visible() |
| 67 |
|
| 68 |
log.info('Click on Directory Manager tab and check if element is loaded.') |
| 69 |
frame.get_by_role('tab', name='Directory Manager').click() |
| 70 |
assert frame.locator('#nsslapd-rootdn').is_visible() |
| 71 |
|
| 72 |
log.info('Click on Disk Monitoring tab and check if element is loaded.') |
| 73 |
frame.get_by_role('tab', name='Disk Monitoring').click() |
| 74 |
frame.locator('#nsslapd-disk-monitoring').click() |
| 75 |
assert frame.get_by_text('Disk Monitoring Threshold').is_visible() |
| 76 |
|
| 77 |
log.info('Click on Advanced Settings tab and check if element is loaded.') |
| 78 |
frame.get_by_role('tab', name='Advanced Settings').click() |
| 79 |
assert frame.locator('#nsslapd-anonlimitsdn').is_visible() |
| 80 |
|
| 81 |
|
| 82 |
def test_tuning_and_limits_availability(topology_st, page, browser_name): |
| 83 |
""" Test visibility of Tuning & Limits settings |
| 84 |
|
| 85 |
:id: c09af833-0359-46ad-a701-52b67f315f70 |
| 86 |
:setup: Standalone instance |
| 87 |
:steps: |
| 88 |
1. Click on Tuning & Limits button on the side panel and check if Number Of Worker Threads is visible. |
| 89 |
2. Click on Show Advanced Settings button. |
| 90 |
3. Check if Outbound IO Timeout label is visible. |
| 91 |
:expectedresults: |
| 92 |
1. Element is visible |
| 93 |
2. Success |
| 94 |
3. Element is visible |
| 95 |
""" |
| 96 |
setup_login(page) |
| 97 |
time.sleep(1) |
| 98 |
frame = check_frame_assignment(page, browser_name) |
| 99 |
|
| 100 |
log.info('Click on Tuning & Limits button and check if element is loaded.') |
| 101 |
frame.locator('#tuning-config').click() |
| 102 |
frame.get_by_text("Number Of Worker Threads").wait_for() |
| 103 |
assert frame.get_by_text("Number Of Worker Threads").is_visible() |
| 104 |
|
| 105 |
log.info('Open expandable section and check if element is loaded.') |
| 106 |
frame.get_by_role('button', name='Show Advanced Settings').click() |
| 107 |
frame.get_by_text('Outbound IO Timeout').wait_for() |
| 108 |
assert frame.get_by_text('Outbound IO Timeout').is_visible() |
| 109 |
|
| 110 |
|
| 111 |
def test_security_availability(topology_st, page, browser_name): |
| 112 |
""" Test Security Settings tabs visibility |
| 113 |
|
| 114 |
:id: 6cd72564-798c-4524-89d3-aa2691535905 |
| 115 |
:setup: Standalone instance |
| 116 |
:steps: |
| 117 |
1. Click on Security button on the side panel and check if Security Configuration tab is visible. |
| 118 |
2. Click on Certificate Management tab and check if Add CA Certificate button is visible. |
| 119 |
3. Click on Cipher Preferences and check if Enabled Ciphers heading is visible. |
| 120 |
:expectedresults: |
| 121 |
1. Element is visible |
| 122 |
2. Element is visible |
| 123 |
3. Element is visible |
| 124 |
""" |
| 125 |
setup_login(page) |
| 126 |
time.sleep(1) |
| 127 |
frame = check_frame_assignment(page, browser_name) |
| 128 |
|
| 129 |
log.info('Click on Security button and check if element is loaded.') |
| 130 |
frame.locator('#security-config').click() |
| 131 |
frame.get_by_role('tab', name='Security Configuration').wait_for() |
| 132 |
assert frame.get_by_role('tab', name='Security Configuration').is_visible() |
| 133 |
|
| 134 |
log.info('Click on Certificate Management tab and check if element is loaded.') |
| 135 |
frame.get_by_role('tab', name='Certificate Management').click() |
| 136 |
assert frame.get_by_role('button', name='Add CA Certificate').is_visible() |
| 137 |
|
| 138 |
log.info('Click on Cipher Preferences tab and check if element is loaded.') |
| 139 |
frame.get_by_role('tab', name='Cipher Preferences').click() |
| 140 |
assert frame.get_by_role('heading', name='Enabled Ciphers').is_visible() |
| 141 |
|
| 142 |
|
| 143 |
def test_sasl_settings_and_mappings_availability(topology_st, page, browser_name): |
| 144 |
""" Test SASL Settings & Mappings visibility |
| 145 |
|
| 146 |
:id: 88954828-7533-4ac9-bfc0-e9c68f95278f |
| 147 |
:setup: Standalone instance |
| 148 |
:steps: |
| 149 |
1. Click on SASL Settings & Mappings button on the side panel. |
| 150 |
2. Check if Max SASL Buffer size text input field is visible. |
| 151 |
:expectedresults: |
| 152 |
1. Success |
| 153 |
2. Element is visible |
| 154 |
""" |
| 155 |
setup_login(page) |
| 156 |
time.sleep(1) |
| 157 |
frame = check_frame_assignment(page, browser_name) |
| 158 |
|
| 159 |
log.info('Click on SASL Settings & Mappings and check if element is loaded.') |
| 160 |
frame.locator('#sasl-config').click() |
| 161 |
frame.locator('#maxBufSize').wait_for() |
| 162 |
assert frame.locator('#maxBufSize').is_visible() |
| 163 |
|
| 164 |
|
| 165 |
def test_ldapi_and_autobind_availability(topology_st, page, browser_name): |
| 166 |
""" Test LDAPI & AutoBind settings visibility |
| 167 |
|
| 168 |
:id: 505f1e3b-5d84-4734-8c64-fbb8b2805d6b |
| 169 |
:setup: Standalone instance |
| 170 |
:steps: |
| 171 |
1. Click on LDAPI & Autobind button on the side panel. |
| 172 |
2. Check if LDAPI Socket File Path is visible. |
| 173 |
:expectedresults: |
| 174 |
1. Success |
| 175 |
2. Element is visible |
| 176 |
""" |
| 177 |
setup_login(page) |
| 178 |
time.sleep(1) |
| 179 |
frame = check_frame_assignment(page, browser_name) |
| 180 |
|
| 181 |
log.info('Click on LDAPI & Autobind and check if element is loaded.') |
| 182 |
frame.locator('#ldapi-config').click() |
| 183 |
frame.locator('#nsslapd-ldapifilepath').wait_for() |
| 184 |
assert frame.locator('#nsslapd-ldapifilepath').is_visible() |
| 185 |
|
| 186 |
|
| 187 |
def test_access_log_availability(topology_st, page, browser_name): |
| 188 |
""" Test Access Log tabs visibility |
| 189 |
|
| 190 |
:id: 48f8e778-b28b-45e1-8946-29456a53cf58 |
| 191 |
:setup: Standalone instance |
| 192 |
:steps: |
| 193 |
1. Click on Access Log button on the side panel and check if Access Log Location input field is visible. |
| 194 |
2. Click on Rotation Policy tab and check if Maximum Number Of Logs label is visible. |
| 195 |
3. Click on Deletion Policy and check if Log Archive Exceeds label is visible. |
| 196 |
:expectedresults: |
| 197 |
1. Element is visible |
| 198 |
2. Element is visible |
| 199 |
3. Element is visible |
| 200 |
""" |
| 201 |
setup_login(page) |
| 202 |
time.sleep(1) |
| 203 |
frame = check_frame_assignment(page, browser_name) |
| 204 |
|
| 205 |
log.info('Click on Access Log button and check if element is loaded.') |
| 206 |
frame.locator('#access-log-config').click() |
| 207 |
frame.locator('#nsslapd-accesslog').wait_for() |
| 208 |
assert frame.locator('#nsslapd-accesslog').is_visible() |
| 209 |
|
| 210 |
log.info('Click on Rotation Policy tab and check if element is loaded.') |
| 211 |
frame.get_by_role('tab', name='Rotation Policy').click() |
| 212 |
assert frame.get_by_text('Maximum Number Of Logs').is_visible() |
| 213 |
|
| 214 |
log.info('Click on Deletion Policy tab and check if element is loaded.') |
| 215 |
frame.get_by_role('tab', name='Deletion Policy').click() |
| 216 |
assert frame.get_by_text('Log Archive Exceeds (in MB)').is_visible() |
| 217 |
|
| 218 |
|
| 219 |
def test_audit_log_availability(topology_st, page, browser_name): |
| 220 |
""" Test Audit Log tabs visibility |
| 221 |
|
| 222 |
:id: a1539010-22b8-4e6b-b377-666a10c20573 |
| 223 |
:setup: Standalone instance |
| 224 |
:steps: |
| 225 |
1. Click on Audit Log button on the side panel and check if Audit Log Location input field is visible. |
| 226 |
2. Click on Rotation Policy tab and check if Maximum Number Of Logs label is visible. |
| 227 |
3. Click on Deletion Policy and check if Log Archive Exceeds label is visible. |
| 228 |
:expectedresults: |
| 229 |
1. Element is visible |
| 230 |
2. Element is visible |
| 231 |
3. Element is visible |
| 232 |
""" |
| 233 |
setup_login(page) |
| 234 |
time.sleep(1) |
| 235 |
frame = check_frame_assignment(page, browser_name) |
| 236 |
|
| 237 |
log.info('Click on Audit Log button and check if element is loaded.') |
| 238 |
frame.locator('#audit-log-config').click() |
| 239 |
frame.locator('#nsslapd-auditlog').wait_for() |
| 240 |
assert frame.locator('#nsslapd-auditlog').is_visible() |
| 241 |
|
| 242 |
log.info('Click on Rotation Policy tab and check if element is loaded.') |
| 243 |
frame.get_by_role('tab', name='Rotation Policy').click() |
| 244 |
assert frame.get_by_text('Maximum Number Of Logs').is_visible() |
| 245 |
|
| 246 |
log.info('Click on Deletion Policy tab and check if element is loaded.') |
| 247 |
frame.get_by_role('tab', name='Deletion Policy').click() |
| 248 |
assert frame.get_by_text('Log Archive Exceeds (in MB)').is_visible() |
| 249 |
|
| 250 |
|
| 251 |
def test_audit_failure_log_availability(topology_st, page, browser_name): |
| 252 |
""" Test Audit Failure Log tabs visibility |
| 253 |
|
| 254 |
:id: 0adcd31f-98a0-4b70-9efa-e810bc971f77 |
| 255 |
:setup: Standalone instance |
| 256 |
:steps: |
| 257 |
1. Click on Audit Failure Log button on the side panel and check if Audit Log Location input field is visible. |
| 258 |
2. Click on Rotation Policy tab and check if Maximum Number Of Logs label is visible. |
| 259 |
3. Click on Deletion Policy and check if Log Archive Exceeds label is visible. |
| 260 |
:expectedresults: |
| 261 |
1. Element is visible |
| 262 |
2. Element is visible |
| 263 |
3. Element is visible |
| 264 |
""" |
| 265 |
setup_login(page) |
| 266 |
time.sleep(1) |
| 267 |
frame = check_frame_assignment(page, browser_name) |
| 268 |
|
| 269 |
log.info('Click on Audit Failure Log button and check if element is loaded.') |
| 270 |
frame.locator('#auditfail-log-config').click() |
| 271 |
frame.locator('#nsslapd-auditfaillog').wait_for() |
| 272 |
assert frame.locator('#nsslapd-auditfaillog').is_visible() |
| 273 |
|
| 274 |
log.info('Click on Rotation Policy tab and check if element is loaded.') |
| 275 |
frame.get_by_role('tab', name='Rotation Policy').click() |
| 276 |
assert frame.get_by_text('Maximum Number Of Logs').is_visible() |
| 277 |
|
| 278 |
log.info('Click on Deletion Policy tab and check if element is loaded.') |
| 279 |
frame.get_by_role('tab', name='Deletion Policy').click() |
| 280 |
assert frame.get_by_text('Log Archive Exceeds (in MB)').is_visible() |
| 281 |
|
| 282 |
|
| 283 |
def test_errors_log_availability(topology_st, page, browser_name): |
| 284 |
""" Test Errors Log tabs visibility |
| 285 |
|
| 286 |
:id: 52cac1fd-a0cd-4c6e-8963-16d764955b86 |
| 287 |
:setup: Standalone instance |
| 288 |
:steps: |
| 289 |
1. Click on Errors Log button in the side panel and check if Errors Log Location input field is visible. |
| 290 |
2. Click on Rotation Policy tab and check if Maximum Number Of Logs label is visible. |
| 291 |
3. Click on Deletion Policy and check if Log Archive Exceeds label is visible. |
| 292 |
:expectedresults: |
| 293 |
1. Element is visible |
| 294 |
2. Element is visible |
| 295 |
3. Element is visible |
| 296 |
""" |
| 297 |
setup_login(page) |
| 298 |
time.sleep(1) |
| 299 |
frame = check_frame_assignment(page, browser_name) |
| 300 |
|
| 301 |
log.info('Click on Errors Log button and check if element is loaded.') |
| 302 |
frame.locator('#error-log-config').click() |
| 303 |
frame.locator('#nsslapd-errorlog').wait_for() |
| 304 |
assert frame.locator('#nsslapd-errorlog').is_visible() |
| 305 |
|
| 306 |
log.info('Click on Rotation Policy tab and check if element is loaded.') |
| 307 |
frame.get_by_role('tab', name='Rotation Policy').click() |
| 308 |
assert frame.get_by_text('Maximum Number Of Logs').is_visible() |
| 309 |
|
| 310 |
log.info('Click on Deletion Policy tab and check if element is loaded.') |
| 311 |
frame.get_by_role('tab', name='Deletion Policy').click() |
| 312 |
assert frame.get_by_text('Log Archive Exceeds (in MB)').is_visible() |
| 313 |
|
| 314 |
|
| 315 |
def test_security_log_availability(topology_st, page, browser_name): |
| 316 |
""" Test Security Log tabs visibility |
| 317 |
|
| 318 |
:id: 1b851fa2-38c9-4865-9e24-f762ef80825f |
| 319 |
:setup: Standalone instance |
| 320 |
:steps: |
| 321 |
1. Click on Security Log button in the side panel and check if Security Log Location input field is visible. |
| 322 |
2. Click on Rotation Policy tab and check if Maximum Number Of Logs label is visible. |
| 323 |
3. Click on Deletion Policy and check if Log Archive Exceeds label is visible. |
| 324 |
:expectedresults: |
| 325 |
1. Element is visible |
| 326 |
2. Element is visible |
| 327 |
3. Element is visible |
| 328 |
""" |
| 329 |
setup_login(page) |
| 330 |
time.sleep(1) |
| 331 |
frame = check_frame_assignment(page, browser_name) |
| 332 |
|
| 333 |
log.info('Click on Security Log button and check if element is loaded.') |
| 334 |
frame.locator('#security-log-config').click() |
| 335 |
frame.locator('#nsslapd-securitylog').wait_for() |
| 336 |
assert frame.locator('#nsslapd-securitylog').is_visible() |
| 337 |
|
| 338 |
log.info('Click on Rotation Policy tab and check if element is loaded.') |
| 339 |
frame.get_by_role('tab', name='Rotation Policy').click() |
| 340 |
assert frame.get_by_text('Maximum Number Of Logs').is_visible() |
| 341 |
|
| 342 |
log.info('Click on Deletion Policy tab and check if element is loaded.') |
| 343 |
frame.get_by_role('tab', name='Deletion Policy').click() |
| 344 |
assert frame.get_by_text('Log Archive Exceeds (in MB)').is_visible() |
| 345 |
|
| 346 |
|
| 347 |
def test_security_encryption_modules_availability(topology_st, page, browser_name): |
| 348 |
""" Test Encryption Modules tab visibility and controls |
| 349 |
|
| 350 |
:id: b8a36f2e-381a-49ce-bf3a-4fe25a83f02a |
| 351 |
:setup: Standalone instance |
| 352 |
:steps: |
| 353 |
1. Click on Security button on the side panel and check if Security Configuration tab is visible. |
| 354 |
2. Click on Encryption Modules tab and check if Add Encryption Module button is visible. |
| 355 |
3. Check if table headers Module Name and Server Certificate Name are visible. |
| 356 |
:expectedresults: |
| 357 |
1. Element is visible. |
| 358 |
2. Element is visible. |
| 359 |
3. Elements are visible. |
| 360 |
""" |
| 361 |
setup_login(page) |
| 362 |
time.sleep(1) |
| 363 |
frame = check_frame_assignment(page, browser_name) |
| 364 |
|
| 365 |
log.info('Click on Security button and check if element is loaded.') |
| 366 |
frame.locator('#security-config').click() |
| 367 |
frame.get_by_role('tab', name='Security Configuration').wait_for() |
| 368 |
assert frame.get_by_role('tab', name='Security Configuration').is_visible() |
| 369 |
|
| 370 |
log.info('Click on Encryption Modules tab and check if Add Encryption Module button is visible.') |
| 371 |
frame.get_by_role('tab', name='Encryption Modules').click() |
| 372 |
frame.get_by_role('button', name='Add Encryption Module').wait_for() |
| 373 |
assert frame.get_by_role('button', name='Add Encryption Module').is_visible() |
| 374 |
|
| 375 |
log.info('Check if encryption modules table headers are visible.') |
| 376 |
assert frame.get_by_role('columnheader', name='Module Name').is_visible() |
| 377 |
assert frame.get_by_role('columnheader', name='Server Certificate Name').is_visible() |
| 378 |
|
| 379 |
|
| 380 |
if __name__ == '__main__': |
| 381 |
# Run isolated |
| 382 |
# -s for DEBUG mode |
| 383 |
CURRENT_FILE = os.path.realpath(__file__) |
| 384 |
pytest.main("-s %s" % CURRENT_FILE) |