| 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_plugins_tab_visibility(topology_st, page, browser_name): |
| 26 |
""" Test visibility of Plugins tab. |
| 27 |
|
| 28 |
:id: 5b80bd5d-9294-4521-af0e-cd37ce9264a6 |
| 29 |
:setup: Standalone instance |
| 30 |
:steps: |
| 31 |
1. Click on Plugins tab. |
| 32 |
2. Check if search input is visible |
| 33 |
:expectedresults: |
| 34 |
1. Success |
| 35 |
2. Element is visible |
| 36 |
""" |
| 37 |
setup_login(page) |
| 38 |
time.sleep(1) |
| 39 |
frame = check_frame_assignment(page, browser_name) |
| 40 |
|
| 41 |
log.info('Check if Plugins tab is loaded.') |
| 42 |
frame.get_by_role('tab', name='Plugins', exact=True).click() |
| 43 |
frame.get_by_placeholder('Search Plugins').wait_for() |
| 44 |
assert frame.get_by_placeholder('Search Plugins').is_visible() |
| 45 |
|
| 46 |
|
| 47 |
def test_account_policy_plugin_visibility(topology_st, page, browser_name): |
| 48 |
""" Test Account Policy Plugin visibility. |
| 49 |
|
| 50 |
:id: 6e8a27cb-32a2-46f1-918e-4c3f91c8f34e |
| 51 |
:setup: Standalone instance |
| 52 |
:steps: |
| 53 |
1. Click on Plugins tab. |
| 54 |
2. Click on Account Policy button on the side panel. |
| 55 |
3. Check if Shared Config Entry text input field is visible. |
| 56 |
:expectedresults: |
| 57 |
1. Success |
| 58 |
2. Success |
| 59 |
3. Element is visible |
| 60 |
""" |
| 61 |
setup_login(page) |
| 62 |
time.sleep(1) |
| 63 |
frame = check_frame_assignment(page, browser_name) |
| 64 |
|
| 65 |
log.info('Click on Plugins tab, click on Account Policy plugin and check if element is loaded.') |
| 66 |
frame.get_by_role('tab', name='Plugins', exact=True).click() |
| 67 |
frame.get_by_text('Plugin is disabledAccount Policy', exact=True).wait_for() |
| 68 |
frame.get_by_text('Plugin is disabledAccount Policy', exact=True).click() |
| 69 |
frame.locator('#configArea').wait_for() |
| 70 |
assert frame.locator('#configArea').is_visible() |
| 71 |
|
| 72 |
|
| 73 |
def test_attribute_uniqueness_plugin_visibility(topology_st, page, browser_name): |
| 74 |
""" Test Attribute Uniqueness plugin visibility. |
| 75 |
|
| 76 |
:id: f6e49e13-7820-40fa-b2ae-d5e48dd03d2c |
| 77 |
:setup: Standalone instance |
| 78 |
:steps: |
| 79 |
1. Click on Plugins tab. |
| 80 |
2. Click on Attribute Uniqueness button on the side panel. |
| 81 |
3. Check if Add Config button is visible. |
| 82 |
:expectedresults: |
| 83 |
1. Success |
| 84 |
2. Success |
| 85 |
3. Element is visible |
| 86 |
""" |
| 87 |
setup_login(page) |
| 88 |
time.sleep(1) |
| 89 |
frame = check_frame_assignment(page, browser_name) |
| 90 |
|
| 91 |
log.info('Click on Plugins tab, click on Attribute Uniqueness plugin and check if element is loaded.') |
| 92 |
frame.get_by_role('tab', name='Plugins', exact=True).click() |
| 93 |
frame.get_by_text('Plugin is disabledAttribute Uniqueness', exact=True).wait_for() |
| 94 |
frame.get_by_text('Plugin is disabledAttribute Uniqueness', exact=True).click() |
| 95 |
frame.get_by_role('button', name='Add Config').wait_for() |
| 96 |
assert frame.get_by_role('button', name='Add Config').is_visible() |
| 97 |
|
| 98 |
|
| 99 |
def test_auto_membership_plugin_visibility(topology_st, page, browser_name): |
| 100 |
""" Test Auto Membership plugin visibility |
| 101 |
|
| 102 |
:id: 5c05617a-8a23-46cb-83ce-3bdd30388e0b |
| 103 |
:setup: Standalone instance |
| 104 |
:steps: |
| 105 |
1. Click on Plugins tab. |
| 106 |
2. Click on Auto Membership button on the side panel. |
| 107 |
3. Check if Add Definition button is visible. |
| 108 |
:expectedresults: |
| 109 |
1. Success |
| 110 |
2. Success |
| 111 |
3. Element is visible |
| 112 |
""" |
| 113 |
setup_login(page) |
| 114 |
time.sleep(1) |
| 115 |
frame = check_frame_assignment(page, browser_name) |
| 116 |
|
| 117 |
log.info('Click on Plugins tab, click on Auto Membership plugin and check if element is loaded.') |
| 118 |
frame.get_by_role('tab', name='Plugins', exact=True).click() |
| 119 |
frame.get_by_text('Plugin is enabledAuto Membership').wait_for() |
| 120 |
frame.get_by_text('Plugin is enabledAuto Membership').click() |
| 121 |
frame.get_by_role('button', name='Add Definition').wait_for() |
| 122 |
assert frame.get_by_role('button', name='Add Definition').is_visible() |
| 123 |
|
| 124 |
|
| 125 |
def test_dna_plugin_visibility(topology_st, page, browser_name): |
| 126 |
""" Test DNA plugin visibility. |
| 127 |
|
| 128 |
:id: b246682b-c41d-4ae9-9c64-38bd8e665a71 |
| 129 |
:setup: Standalone instance |
| 130 |
:steps: |
| 131 |
1. Click on Plugins tab. |
| 132 |
2. Click on DNA button on the side panel. |
| 133 |
3. Check if Add Config button is visible. |
| 134 |
:expectedresults: |
| 135 |
1. Success |
| 136 |
2. Success |
| 137 |
3. Element is visible |
| 138 |
""" |
| 139 |
setup_login(page) |
| 140 |
time.sleep(1) |
| 141 |
frame = check_frame_assignment(page, browser_name) |
| 142 |
|
| 143 |
log.info('Click on Plugins tab, click on DNA plugin and check if element is loaded.') |
| 144 |
frame.get_by_role('tab', name='Plugins', exact=True).click() |
| 145 |
frame.get_by_text('Plugin is disabledDNA').wait_for() |
| 146 |
frame.get_by_text('Plugin is disabledDNA').click() |
| 147 |
frame.get_by_role('button', name='Add Config').wait_for() |
| 148 |
assert frame.get_by_role('button', name='Add Config').is_visible() |
| 149 |
|
| 150 |
|
| 151 |
def test_linked_attributes_plugin_visibility(topology_st, page, browser_name): |
| 152 |
""" Test Linked Attributes plugin visibility |
| 153 |
|
| 154 |
:id: 21cb6021-dc6f-4f26-a6a3-f4311c9afe2e |
| 155 |
:setup: Standalone instance |
| 156 |
:steps: |
| 157 |
1. Click on Plugins tab. |
| 158 |
2. Click on Linked Attributes button on the side panel. |
| 159 |
3. Check if Add Config button is visible. |
| 160 |
:expectedresults: |
| 161 |
1. Success |
| 162 |
2. Success |
| 163 |
3. Element is visible |
| 164 |
""" |
| 165 |
setup_login(page) |
| 166 |
time.sleep(1) |
| 167 |
frame = check_frame_assignment(page, browser_name) |
| 168 |
|
| 169 |
log.info('Click on Plugins tab, click on Linked Attributes plugin and check if element is loaded.') |
| 170 |
frame.get_by_role('tab', name='Plugins', exact=True).click() |
| 171 |
frame.locator('[data-ouia-component-id="linkedAttributes"]').wait_for() |
| 172 |
frame.locator('[data-ouia-component-id="linkedAttributes"]').click() |
| 173 |
frame.get_by_role('button', name='Add Config').wait_for() |
| 174 |
assert frame.get_by_role('button', name='Add Config').is_visible() |
| 175 |
|
| 176 |
|
| 177 |
def test_managed_entries_plugin_visibility(topology_st, page, browser_name): |
| 178 |
""" Test Managed Entries plugin visibility |
| 179 |
|
| 180 |
:id: fd2dcaf9-422b-4d17-85f2-bc12427adc1c |
| 181 |
:setup: Standalone instance |
| 182 |
:steps: |
| 183 |
1. Click on Plugins tab. |
| 184 |
2. Click on Managed Entries button on the side panel. |
| 185 |
3. Check if Create Template button is visible. |
| 186 |
4. Click on Definitions tab. |
| 187 |
5. Check if Add Definition button is visible. |
| 188 |
:expectedresults: |
| 189 |
1. Success |
| 190 |
2. Success |
| 191 |
3. Element is visible |
| 192 |
4. Success |
| 193 |
5. Element is visible |
| 194 |
""" |
| 195 |
setup_login(page) |
| 196 |
time.sleep(1) |
| 197 |
frame = check_frame_assignment(page, browser_name) |
| 198 |
|
| 199 |
log.info('Click on Plugins tab, click on Managed Entries plugin and check if element is loaded.') |
| 200 |
frame.get_by_role('tab', name='Plugins', exact=True).click() |
| 201 |
frame.get_by_text('Plugin is enabledManaged Entries').wait_for() |
| 202 |
frame.get_by_text('Plugin is enabledManaged Entries').click() |
| 203 |
frame.get_by_role('button', name='Create Template').wait_for() |
| 204 |
assert frame.get_by_role('button', name='Create Template').is_visible() |
| 205 |
|
| 206 |
log.info('Click on Definitions tab and check if element is loaded.') |
| 207 |
frame.get_by_role('tab', name='Definitions').click() |
| 208 |
assert frame.get_by_role('button', name='Add Definition').is_visible() |
| 209 |
|
| 210 |
|
| 211 |
def test_memberof_plugin_visibility(topology_st, page, browser_name): |
| 212 |
""" Test MemberOf plugin visibility |
| 213 |
|
| 214 |
:id: 865db69f-6e6b-4beb-b456-8e055fc0b14b |
| 215 |
:setup: Standalone instance |
| 216 |
:steps: |
| 217 |
1. Click on Plugins tab. |
| 218 |
2. Click on MemberOf button on the side panel. |
| 219 |
3. Check if Shared Config Entry text input field is visible. |
| 220 |
:expectedresults: |
| 221 |
1. Success |
| 222 |
2. Success |
| 223 |
3. Element is visible |
| 224 |
""" |
| 225 |
setup_login(page) |
| 226 |
time.sleep(1) |
| 227 |
frame = check_frame_assignment(page, browser_name) |
| 228 |
|
| 229 |
log.info('Click on Plugins tab, click on MemberOf plugin and check if element is loaded.') |
| 230 |
frame.get_by_role('tab', name='Plugins', exact=True).click() |
| 231 |
frame.get_by_text('Plugin is disabledMemberOf').wait_for() |
| 232 |
frame.get_by_text('Plugin is disabledMemberOf').click() |
| 233 |
frame.get_by_role('button', name='Create Config').wait_for() |
| 234 |
assert frame.get_by_role('button', name='Create Config').is_visible() |
| 235 |
|
| 236 |
|
| 237 |
def test_ldap_pass_through_auth_plugin_visibility(topology_st, page, browser_name): |
| 238 |
""" test LDAP Pass Through Auth plugin visibility |
| 239 |
|
| 240 |
:id: a47c4054-233f-4398-aaf6-eddfb442e53d |
| 241 |
:setup: Standalone instance |
| 242 |
:steps: |
| 243 |
1. Click on Plugins tab. |
| 244 |
2. Click on LDAP Pass Through Auth button on the side panel. |
| 245 |
3. Check if Add URL button is visible. |
| 246 |
:expectedresults: |
| 247 |
1. Success |
| 248 |
2. Success |
| 249 |
3. Element is visible |
| 250 |
""" |
| 251 |
setup_login(page) |
| 252 |
time.sleep(1) |
| 253 |
frame = check_frame_assignment(page, browser_name) |
| 254 |
|
| 255 |
log.info('Click on Plugins tab, click on LDAP Pass Through Auth plugin and check if element is loaded.') |
| 256 |
frame.get_by_role('tab', name='Plugins', exact=True).click() |
| 257 |
frame.locator('[data-ouia-component-id="passthroughAuthentication"]').wait_for() |
| 258 |
frame.locator('[data-ouia-component-id="passthroughAuthentication"]').click() |
| 259 |
frame.get_by_role('button', name='Add URL').wait_for() |
| 260 |
assert frame.get_by_role('button', name='Add URL').is_visible() |
| 261 |
|
| 262 |
|
| 263 |
def test_pam_pass_through_auth_plugin_visibility(topology_st, page, browser_name): |
| 264 |
""" Test PAM Pass Through Auth visibility. |
| 265 |
|
| 266 |
:id: 99c72177-6c86-4b24-b754-38f9698bd70c |
| 267 |
:setup: Standalone instance |
| 268 |
:steps: |
| 269 |
1. Click on Plugins tab. |
| 270 |
2. Click on PAM Pass Through Auth button on the side panel. |
| 271 |
3. Check if Add Config button is visible. |
| 272 |
:expectedresults: |
| 273 |
1. Success |
| 274 |
2. Success |
| 275 |
3. Element is visible |
| 276 |
""" |
| 277 |
setup_login(page) |
| 278 |
time.sleep(1) |
| 279 |
frame = check_frame_assignment(page, browser_name) |
| 280 |
|
| 281 |
log.info('Click on Plugins tab, click on PAM Pass Through Auth plugin and check if element is loaded.') |
| 282 |
frame.get_by_role('tab', name='Plugins', exact=True).click() |
| 283 |
frame.locator('[data-ouia-component-id="pamPassthroughAuthentication"]').wait_for() |
| 284 |
frame.locator('[data-ouia-component-id="pamPassthroughAuthentication"]').click() |
| 285 |
frame.get_by_role('button', name='Add Config').wait_for() |
| 286 |
assert frame.get_by_role('button', name='Add Config').is_visible() |
| 287 |
|
| 288 |
|
| 289 |
def test_posix_winsync_plugin_visibility(topology_st, page, browser_name): |
| 290 |
""" Test Posix Winsync plugin visibility. |
| 291 |
|
| 292 |
:id: 9998d23c-d550-4605-bcbe-d501f26d8a66 |
| 293 |
:setup: Standalone instance |
| 294 |
:steps: |
| 295 |
1. Click on Plugins tab. |
| 296 |
2. Click on Posix Winsync button on the side panel. |
| 297 |
3. Check if Create MemberOf Task checkbox is visible. |
| 298 |
:expectedresults: |
| 299 |
1. Success |
| 300 |
2. Success |
| 301 |
3. Element is visible |
| 302 |
""" |
| 303 |
setup_login(page) |
| 304 |
time.sleep(1) |
| 305 |
frame = check_frame_assignment(page, browser_name) |
| 306 |
|
| 307 |
log.info('Click on Plugins tab, click on Posix Winsync plugin and check if element is loaded.') |
| 308 |
frame.get_by_role('tab', name='Plugins', exact=True).click() |
| 309 |
frame.locator('[data-ouia-component-id="winsync"]').wait_for() |
| 310 |
frame.locator('[data-ouia-component-id="winsync"]').click() |
| 311 |
frame.locator('#posixWinsyncCreateMemberOfTask').wait_for() |
| 312 |
assert frame.locator('#posixWinsyncCreateMemberOfTask').is_visible() |
| 313 |
|
| 314 |
|
| 315 |
def test_referential_integrity_plugin_visibility(topology_st, page, browser_name): |
| 316 |
""" Test Referential Integrity plugin visibility. |
| 317 |
|
| 318 |
:id: e868f520-a409-4ec8-b086-c86cf1f8855b |
| 319 |
:setup: Standalone instance |
| 320 |
:steps: |
| 321 |
1. Click on Plugins tab. |
| 322 |
2. Click on Referential Integrity button on the side panel. |
| 323 |
3. Check if Entry Scope text input field is visible. |
| 324 |
:expectedresults: |
| 325 |
1. Success |
| 326 |
2. Success |
| 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 Plugins tab, click on Referential Integrity plugin and check if element is loaded.') |
| 334 |
frame.get_by_role('tab', name='Plugins', exact=True).click() |
| 335 |
frame.locator('[data-ouia-component-id="referentialIntegrity"]').wait_for() |
| 336 |
frame.locator('[data-ouia-component-id="referentialIntegrity"]').click() |
| 337 |
frame.locator('#entryScope').wait_for() |
| 338 |
assert frame.locator('#entryScope').is_visible() |
| 339 |
|
| 340 |
|
| 341 |
def test_retro_changelog_plugin_visibility(topology_st, page, browser_name): |
| 342 |
""" Test Retro Changelog plugin visibility. |
| 343 |
|
| 344 |
:id: b1813138-25d9-4b73-ab99-1e27d51d0c53 |
| 345 |
:setup: Standalone instance |
| 346 |
:steps: |
| 347 |
1. Click on Plugins tab. |
| 348 |
2. Click on Retro Changelog button on the side panel. |
| 349 |
3. Check if Is Replicated checkbox is visible. |
| 350 |
:expectedresults: |
| 351 |
1. Success |
| 352 |
2. Success |
| 353 |
3. Element is visible |
| 354 |
""" |
| 355 |
setup_login(page) |
| 356 |
time.sleep(1) |
| 357 |
frame = check_frame_assignment(page, browser_name) |
| 358 |
|
| 359 |
log.info('Click on Plugins tab, click on Retro Changelog plugin and check if element is loaded.') |
| 360 |
frame.get_by_role('tab', name='Plugins', exact=True).click() |
| 361 |
frame.locator('[data-ouia-component-id="retroChangelog"]').wait_for() |
| 362 |
frame.locator('[data-ouia-component-id="retroChangelog"]').click() |
| 363 |
frame.locator('#isReplicated').wait_for() |
| 364 |
assert frame.locator('#isReplicated').is_visible() |
| 365 |
|
| 366 |
|
| 367 |
def test_rootdn_access_control_plugin_visibility(topology_st, page, browser_name): |
| 368 |
""" Test RootDN Access Control plugin visibility |
| 369 |
|
| 370 |
:id: 3d57131f-a23e-4030-b51b-1dd3ebac95c9 |
| 371 |
:setup: Standalone instance |
| 372 |
:steps: |
| 373 |
1. Click on Plugins tab. |
| 374 |
2. Click on RootDN Access Control button on the side panel. |
| 375 |
3. Check if Monday checkbox is visible. |
| 376 |
:expectedresults: |
| 377 |
1. Success |
| 378 |
2. Success |
| 379 |
3. Element is visible |
| 380 |
""" |
| 381 |
setup_login(page) |
| 382 |
time.sleep(1) |
| 383 |
frame = check_frame_assignment(page, browser_name) |
| 384 |
|
| 385 |
log.info('Click on Plugins tab, click on RootDN Access Control plugin and check if element is loaded.') |
| 386 |
frame.get_by_role('tab', name='Plugins', exact=True).click() |
| 387 |
frame.locator('[data-ouia-component-id="rootDnaAccessControl"]').wait_for() |
| 388 |
frame.locator('[data-ouia-component-id="rootDnaAccessControl"]').click() |
| 389 |
frame.locator('#allowMon').wait_for() |
| 390 |
assert frame.locator('#allowMon').is_visible() |
| 391 |
|
| 392 |
|
| 393 |
def test_usn_plugin_visibility(topology_st, page, browser_name): |
| 394 |
""" Test USN plugin visibility |
| 395 |
|
| 396 |
:id: e1a60298-694e-4d04-ace9-164290a3786b |
| 397 |
:setup: Standalone instance |
| 398 |
:steps: |
| 399 |
1. Click on Plugins tab. |
| 400 |
2. Click on USN button on the side panel. |
| 401 |
3. Check if USN Global label is visible. |
| 402 |
:expectedresults: |
| 403 |
1. Success |
| 404 |
2. Success |
| 405 |
3. Element is visible |
| 406 |
""" |
| 407 |
setup_login(page) |
| 408 |
time.sleep(1) |
| 409 |
frame = check_frame_assignment(page, browser_name) |
| 410 |
|
| 411 |
log.info('Click on Plugins tab, click on USN Access Control plugin and check if element is loaded.') |
| 412 |
frame.get_by_role('tab', name='Plugins', exact=True).click() |
| 413 |
frame.get_by_text('Plugin is disabledUSN').wait_for() |
| 414 |
frame.get_by_text('Plugin is disabledUSN').click() |
| 415 |
frame.get_by_text('USN Global').wait_for() |
| 416 |
assert frame.get_by_text('USN Global').is_visible() |
| 417 |
|
| 418 |
|
| 419 |
if __name__ == '__main__': |
| 420 |
# Run isolated |
| 421 |
# -s for DEBUG mode |
| 422 |
CURRENT_FILE = os.path.realpath(__file__) |
| 423 |
pytest.main("-s %s" % CURRENT_FILE) |