| 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_replication_availability(topology_st, page, browser_name): |
| 26 |
""" Test replication tab of Red Hat Directory Server when instance is created |
| 27 |
|
| 28 |
:id: f3451124-9764-4da1-8efb-4e3d2749e465 |
| 29 |
:setup: Standalone instance |
| 30 |
:steps: |
| 31 |
1. Go to Red Hat Directory server side tab page |
| 32 |
2. Click on replication tab |
| 33 |
3. Check there is Enable Replication button |
| 34 |
:expectedresults: |
| 35 |
1. Success |
| 36 |
2. Success |
| 37 |
3. Button is visible |
| 38 |
""" |
| 39 |
setup_login(page) |
| 40 |
time.sleep(1) |
| 41 |
frame = check_frame_assignment(page, browser_name) |
| 42 |
|
| 43 |
log.info('Click on Replication tab and check if Enable Replication button is visible') |
| 44 |
frame.get_by_role('tab', name='Replication').click() |
| 45 |
frame.get_by_role('button', name='Enable Replication').wait_for() |
| 46 |
assert frame.get_by_role('button', name='Enable Replication').is_visible() |
| 47 |
|
| 48 |
|
| 49 |
def test_enable_replication(topology_st, page, browser_name): |
| 50 |
""" Test functionality of Enable Replication button |
| 51 |
|
| 52 |
:id: 87d8f3c0-1dae-4240-826c-f633abb85cda |
| 53 |
:setup: Standalone instance |
| 54 |
:steps: |
| 55 |
1. Go to Red Hat Directory server side tab page |
| 56 |
2. Click on replication tab |
| 57 |
3. Click on Enable Replication button |
| 58 |
4. Fill password and confirm password |
| 59 |
5. Click on cancel |
| 60 |
6. Click on Enable Replication button and fill passwords again. |
| 61 |
7. Click on Enable Replication button and wait until Add Replication Manager is visible. |
| 62 |
:expectedresults: |
| 63 |
1. Success |
| 64 |
2. Success |
| 65 |
3. Success |
| 66 |
4. Success |
| 67 |
5. Success |
| 68 |
6. Success |
| 69 |
7. Success |
| 70 |
""" |
| 71 |
setup_login(page) |
| 72 |
time.sleep(1) |
| 73 |
frame = check_frame_assignment(page, browser_name) |
| 74 |
|
| 75 |
log.info('Click on Replication tab and click on Enable Replication button ') |
| 76 |
frame.get_by_role('tab', name='Replication').click() |
| 77 |
frame.get_by_role('button', name='Enable Replication').wait_for() |
| 78 |
frame.get_by_role('button', name='Enable Replication').click() |
| 79 |
|
| 80 |
log.info('Fill password, fill confirm password and click on cancel.') |
| 81 |
frame.fill('#enableBindPW', 'redhat') |
| 82 |
frame.fill('#enableBindPWConfirm', 'redhat') |
| 83 |
frame.get_by_role('button', name='Cancel').click() |
| 84 |
|
| 85 |
assert frame.get_by_role('button', name='Enable Replication').is_visible() |
| 86 |
|
| 87 |
log.info('Fill password, fill confirm password, click on enable replication' |
| 88 |
' and check Add Replication Manager button is visible.') |
| 89 |
frame.get_by_role('button', name='Enable Replication').click() |
| 90 |
frame.fill('#enableBindPW', 'redhat') |
| 91 |
frame.fill('#enableBindPWConfirm', 'redhat') |
| 92 |
frame.get_by_role("dialog", name="Enable Replication").get_by_role("button", name="Enable Replication").click() |
| 93 |
frame.get_by_role('button', name='Add Replication Manager').wait_for() |
| 94 |
|
| 95 |
assert frame.get_by_role('button', name='Add Replication Manager').is_visible() |
| 96 |
|
| 97 |
|
| 98 |
def test_suffixes_visibility(topology_st, page, browser_name): |
| 99 |
""" Test visibility of created suffixes in replication tab |
| 100 |
|
| 101 |
:id: 47141eaa-a506-4a60-a3ae-8e960f692faa |
| 102 |
:setup: Standalone instance |
| 103 |
:steps: |
| 104 |
1. Click on Replication tab check if Add Replication Manager Button is visible. |
| 105 |
2. Click on Agreements tab check if column header with Replication Agreement text is visible. |
| 106 |
3. Click on Winsync Agreements tab and check if column header with Winsync Agreements text is visible. |
| 107 |
4. Click on Change Log tab and check if label with Changelog Maximum Entries text is visible. |
| 108 |
5. Click on RUV's & Tasks tab and check if Export Changelog button is visible. |
| 109 |
:expectedresults: |
| 110 |
1. Element is visible. |
| 111 |
2. Element is visible. |
| 112 |
3. Element is visible. |
| 113 |
4. Element is visible. |
| 114 |
5. Element is visible. |
| 115 |
""" |
| 116 |
setup_login(page) |
| 117 |
time.sleep(1) |
| 118 |
frame = check_frame_assignment(page, browser_name) |
| 119 |
|
| 120 |
log.info('Click on Replication tab and check if element is loaded.') |
| 121 |
frame.get_by_role('tab', name='Replication').click() |
| 122 |
frame.get_by_role('button', name='Add Replication Manager').wait_for() |
| 123 |
assert frame.get_by_role('button', name='Add Replication Manager').is_visible() |
| 124 |
|
| 125 |
log.info('Click on Agreements tab and check if element is loaded.') |
| 126 |
frame.get_by_role('tab', name='Agreements (0)', exact=True).click() |
| 127 |
assert frame.get_by_role('columnheader', name='Replication Agreements').is_visible() |
| 128 |
|
| 129 |
log.info('Click on Winsync Agreements tab and check if element is loaded.') |
| 130 |
frame.get_by_role('tab', name='Winsync Agreements').click() |
| 131 |
assert frame.get_by_role('columnheader', name='Replication Agreements').is_visible() |
| 132 |
|
| 133 |
log.info('Click on Change Log tab and check if element is loaded.') |
| 134 |
frame.get_by_role('tab', name='Change Log').click() |
| 135 |
assert frame.get_by_text('Changelog Maximum Entries').is_visible() |
| 136 |
|
| 137 |
log.info("Click on RUV'S & Tasks tab and check if element is loaded.") |
| 138 |
frame.get_by_role('tab', name="RUV'S & Tasks").click() |
| 139 |
assert frame.get_by_role('button', name='Export Changelog') |
| 140 |
|
| 141 |
|
| 142 |
if __name__ == '__main__': |
| 143 |
# Run isolated |
| 144 |
# -s for DEBUG mode |
| 145 |
CURRENT_FILE = os.path.realpath(__file__) |
| 146 |
pytest.main("-s %s" % CURRENT_FILE) |