Debian Codegraph @

dirsrvtests/tests/suites/webui/schema/schema_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 logging
10 import time
11 import subprocess
12 import pytest
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
19
20 pytestmark = pytest.mark.skipif(os.getenv('WEBUI') is None, reason="These tests are only for WebUI environment")
21 pytest.importorskip('playwright')
22
23 SERVER_ID = 'standalone1'
24
25
26 def test_schema_tab_visibility(topology_st, page, browser_name):
27 """ Test Schema tab visibility
28
29 :id: 4cbca624-b7be-49db-93f6-f9a9df79a9b2
30 :setup: Standalone instance
31 :steps:
32 1. Click on Schema tab and check if Add Object Class button is visible.
33 2. Click on Attributes tab and check if Add Attribute button is visible.
34 3. Click on Matching Rules tab and check if Matching Rule columnheader is visible.
35 :expectedresults:
36 1. Element is visible
37 2. Element is visible
38 3. Element is visible
39 """
40 setup_login(page)
41 time.sleep(1)
42 frame = check_frame_assignment(page, browser_name)
43
44 log.info('Click on Schema tab and check if element is loaded.')
45 frame.get_by_role('tab', name='Schema', exact=True).click()
46 frame.get_by_role('button', name='Add ObjectClass').wait_for()
47 assert frame.get_by_role('button', name='Add ObjectClass').is_visible()
48
49 log.info('Click on Attributes tab and check if element is loaded.')
50 frame.get_by_role('tab', name='Attributes').click()
51 frame.get_by_role('button', name='Add Attribute').wait_for()
52 assert frame.get_by_role('button', name='Add Attribute').is_visible()
53
54 log.info('Click on Matching Rules tab and check if element is loaded.')
55 frame.get_by_role('tab', name='Matching Rules').click()
56 frame.get_by_role('columnheader', name='Matching Rule').wait_for()
57 assert frame.get_by_role('columnheader', name='Matching Rule').is_visible()
58
59
60 if __name__ == '__main__':
61 # Run isolated
62 # -s for DEBUG mode
63 CURRENT_FILE = os.path.realpath(__file__)
64 pytest.main("-s %s" % CURRENT_FILE)