Skip to content

Commit

Permalink
[6.15.z] session name for bookmarks (#14334)
Browse files Browse the repository at this point in the history
session name for bookmarks (#14242)

(cherry picked from commit 2c2de86)

Co-authored-by: Peter Ondrejka <[email protected]>
  • Loading branch information
Satellite-QE and pondrejk authored Mar 11, 2024
1 parent bbb1c12 commit 0e6dee6
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 48 deletions.
116 changes: 78 additions & 38 deletions robottelo/constants/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1651,81 +1651,121 @@ class Colored(Box):
]

BOOKMARK_ENTITIES = [
{'name': 'ActivationKey', 'controller': 'katello_activation_keys'},
{'name': 'Dashboard', 'controller': 'dashboard', 'skip_for_ui': True},
{'name': 'Audit', 'controller': 'audits', 'skip_for_ui': True},
{'name': 'Report', 'controller': 'config_reports', 'skip_for_ui': True},
{'name': 'Task', 'controller': 'foreman_tasks_tasks', 'skip_for_ui': True},
{
'name': 'ActivationKey',
'controller': 'katello_activation_keys',
'session_name': 'activationkey',
},
{'name': 'Dashboard', 'controller': 'dashboard', 'session_name': 'dashboard'},
{'name': 'Audit', 'controller': 'audits', 'session_name': 'audit'},
{
'name': 'Report',
'controller': 'config_reports',
'setup': entities.Report,
'session_name': 'configreport',
},
{'name': 'Task', 'controller': 'foreman_tasks_tasks', 'session_name': 'task'},
# TODO Load manifest for the test_positive_end_to_end from the ui/test_bookmarks.py
# {'name': 'Subscriptions', 'controller': 'subscriptions', 'skip_for_ui': True},
{'name': 'Product', 'controller': 'katello_products'},
{'name': 'Repository', 'controller': 'katello_repositories', 'skip_for_ui': True},
{'name': 'ContentCredential', 'controller': 'katello_content_credentials'},
{'name': 'SyncPlan', 'controller': 'katello_sync_plans'},
{'name': 'ContentView', 'controller': 'katello_content_views'},
{'name': 'Errata', 'controller': 'katello_errata', 'skip_for_ui': True},
{'name': 'Package', 'controller': 'katello_erratum_packages', 'skip_for_ui': True},
{'name': 'ContainerImageTag', 'controller': 'katello_docker_tags', 'skip_for_ui': True},
{'name': 'Host', 'controller': 'hosts', 'setup': entities.Host},
{'name': 'ContentHost', 'controller': 'hosts', 'skip_for_ui': True},
{'name': 'HostCollection', 'controller': 'katello_host_collections'},
{'name': 'Architecture', 'controller': 'architectures'},
# {'name': 'Subscriptions', 'controller': 'subscriptions','session_name': 'subscription' },
{'name': 'Product', 'controller': 'katello_products', 'session_name': 'product'},
{'name': 'Repository', 'controller': 'katello_repositories', 'session_name': 'repository'},
{
'name': 'ContentCredential',
'controller': 'katello_content_credentials',
'session_name': 'contentcredential',
},
{'name': 'SyncPlan', 'controller': 'katello_sync_plans', 'session_name': 'syncplan'},
{'name': 'ContentView', 'controller': 'katello_content_views', 'session_name': 'contentview'},
{'name': 'Errata', 'controller': 'katello_errata', 'session_name': 'errata'},
{'name': 'Package', 'controller': 'katello_erratum_packages', 'session_name': 'package'},
{
'name': 'ContainerImageTag',
'controller': 'katello_docker_tags',
'session_name': 'containerimagetag',
},
{'name': 'Host', 'controller': 'hosts', 'setup': entities.Host, 'session_name': 'host_new'},
{'name': 'ContentHost', 'controller': 'hosts', 'session_name': 'contenthost'},
{
'name': 'HostCollection',
'controller': 'katello_host_collections',
'session_name': 'hostcollection',
},
{'name': 'Architecture', 'controller': 'architectures', 'session_name': 'architecture'},
{
'name': 'HardwareModel',
'controller': 'models',
'setup': entities.Model,
'skip_for_ui': True,
'session_name': 'hardwaremodel',
},
{
'name': 'InstallationMedia',
'controller': 'media',
'session_name': 'media',
'setup': entities.Media,
'skip_for_ui': True,
},
{'name': 'OperatingSystem', 'controller': 'operatingsystems'},
{
'name': 'OperatingSystem',
'controller': 'operatingsystems',
'session_name': 'operatingsystem',
},
{
'name': 'PartitionTable',
'controller': 'ptables',
'setup': entities.PartitionTable,
'skip_for_ui': False,
'session_name': 'partitiontable',
},
{
'name': 'ProvisioningTemplate',
'controller': 'provisioning_templates',
'session_name': 'provisioningtemplate',
},
{'name': 'ProvisioningTemplate', 'controller': 'provisioning_templates'},
{
'name': 'HostGroup',
'controller': 'hostgroups',
'setup': entities.HostGroup,
'skip_for_ui': True,
'session_name': 'hostgroup',
},
{
'name': 'DiscoveryRule',
'controller': 'discovery_rules',
'skip_for_ui': True,
'setup': entities.DiscoveryRule,
'session_name': 'discoveryrule',
},
{
'name': 'GlobalParameter',
'controller': 'common_parameters',
'setup': entities.CommonParameter,
'skip_for_ui': True,
},
{'name': 'Role', 'controller': 'ansible_roles', 'setup': entities.Role},
{'name': 'Variables', 'controller': 'ansible_variables', 'skip_for_ui': True},
{'name': 'SmartProxy', 'controller': 'smart_proxies', 'skip_for_ui': True},
{'name': 'Role', 'controller': 'ansible_roles', 'setup': entities.Role, 'session_name': 'role'},
{'name': 'Variables', 'controller': 'ansible_variables', 'session_name': 'ansiblevariables'},
{'name': 'Capsules', 'controller': 'smart_proxies', 'session_name': 'capsule'},
{
'name': 'ComputeResource',
'controller': 'compute_resources',
'setup': entities.LibvirtComputeResource,
'session_name': 'computeresource',
},
{
'name': 'ComputeProfile',
'controller': 'compute_profiles',
'setup': entities.ComputeProfile,
'session_name': 'computeprofile',
},
{'name': 'Subnet', 'controller': 'subnets', 'setup': entities.Subnet, 'session_name': 'subnet'},
{'name': 'Domain', 'controller': 'domains', 'setup': entities.Domain, 'session_name': 'domain'},
{'name': 'Realm', 'controller': 'realms', 'setup': entities.Realm, 'session_name': 'realm'},
{'name': 'Location', 'controller': 'locations', 'session_name': 'location'},
{'name': 'Organization', 'controller': 'organizations', 'session_name': 'organization'},
{'name': 'User', 'controller': 'users', 'session_name': 'user'},
{
'name': 'UserGroup',
'controller': 'usergroups',
'setup': entities.UserGroup,
'session_name': 'usergroup',
},
{'name': 'ComputeProfile', 'controller': 'compute_profiles', 'setup': entities.ComputeProfile},
{'name': 'Subnet', 'controller': 'subnets', 'setup': entities.Subnet},
{'name': 'Domain', 'controller': 'domains', 'setup': entities.Domain},
{'name': 'Realm', 'controller': 'realms', 'setup': entities.Realm, 'skip_for_ui': True},
{'name': 'Location', 'controller': 'locations'},
{'name': 'Organization', 'controller': 'organizations'},
{'name': 'User', 'controller': 'users'},
{'name': 'UserGroup', 'controller': 'usergroups', 'setup': entities.UserGroup},
{'name': 'Role', 'controller': 'roles'},
{'name': 'Settings', 'controller': 'settings', 'skip_for_ui': True},
{'name': 'Role', 'controller': 'roles', 'session_name': 'role'},
{'name': 'Settings', 'controller': 'settings', 'session_name': 'settings'},
]

STRING_TYPES = ['alpha', 'numeric', 'alphanumeric', 'latin1', 'utf8', 'cjk', 'html']
Expand Down
17 changes: 7 additions & 10 deletions tests/foreman/ui/test_bookmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

from robottelo.config import user_nailgun_config
from robottelo.constants import BOOKMARK_ENTITIES
from robottelo.utils.issue_handlers import is_open


@pytest.fixture(
Expand All @@ -28,23 +27,21 @@ def ui_entity(module_org, module_location, request):
required preconditions.
"""
entity = request.param
entity_name, entity_setup = entity['name'], entity.get('setup')
# Skip the entities, which can't be tested ATM (not implemented in
# airgun)
skip = entity.get('skip_for_ui')
if skip:
pytest.skip(f'{entity_name} not implemented in airgun')
# Some pages require at least 1 existing entity for search bar to
# appear. Creating 1 entity for such pages
entity_name, entity_setup = entity['name'], entity.get('setup')
if entity_setup:
# Skip the entities, which can't be tested ATM (not implemented in
# airgun or have open BZs)
skip = entity.get('skip_for_ui')
if isinstance(skip, tuple | list):
open_issues = {issue for issue in skip if is_open(issue)}
pytest.skip(f'There is/are an open issue(s) {open_issues} with entity {entity_name}')
# entities with 1 organization and location
if entity_name in ('Host',):
entity_setup(organization=module_org, location=module_location).create()
# entities with no organizations and locations
elif entity_name in (
'ComputeProfile',
'GlobalParameter',
'HardwareModel',
'UserGroup',
):
Expand Down Expand Up @@ -117,7 +114,7 @@ def test_positive_create_bookmark_public(
public_name = gen_string('alphanumeric')
nonpublic_name = gen_string('alphanumeric')
with session:
ui_lib = getattr(session, ui_entity['name'].lower())
ui_lib = getattr(session, ui_entity['session_name'])
for name in (public_name, nonpublic_name):
ui_lib.create_bookmark(
{'name': name, 'query': gen_string('alphanumeric'), 'public': name == public_name}
Expand Down

0 comments on commit 0e6dee6

Please sign in to comment.