Skip to content

Commit

Permalink
duplicate bookmark negative test fix (#14232)
Browse files Browse the repository at this point in the history
  • Loading branch information
pondrejk authored Mar 20, 2024
1 parent dd5de39 commit e44a553
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 7 deletions.
22 changes: 18 additions & 4 deletions robottelo/constants/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1655,6 +1655,7 @@ class Colored(Box):
'name': 'ActivationKey',
'controller': 'katello_activation_keys',
'session_name': 'activationkey',
'old_ui': True,
},
{'name': 'Dashboard', 'controller': 'dashboard', 'session_name': 'dashboard'},
{'name': 'Audit', 'controller': 'audits', 'session_name': 'audit'},
Expand All @@ -1667,28 +1668,41 @@ class Colored(Box):
{'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','session_name': 'subscription' },
{'name': 'Product', 'controller': 'katello_products', 'session_name': 'product'},
{
'name': 'Product',
'controller': 'katello_products',
'session_name': 'product',
'old_ui': True,
},
{'name': 'Repository', 'controller': 'katello_repositories', 'session_name': 'repository'},
{
'name': 'ContentCredential',
'controller': 'katello_content_credentials',
'session_name': 'contentcredential',
'old_ui': True,
},
{
'name': 'SyncPlan',
'controller': 'katello_sync_plans',
'session_name': 'syncplan',
'old_ui': True,
},
{'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': 'Errata', 'controller': 'katello_errata', 'session_name': 'errata', 'old_ui': True},
{'name': 'Package', 'controller': 'katello_erratum_packages', 'session_name': 'package'},
{
'name': 'ContainerImageTag',
'controller': 'katello_docker_tags',
'session_name': 'containerimagetag',
'old_ui': True,
},
{'name': 'Host', 'controller': 'hosts', 'setup': entities.Host, 'session_name': 'host_new'},
{'name': 'ContentHost', 'controller': 'hosts', 'session_name': 'contenthost'},
{'name': 'ContentHost', 'controller': 'hosts', 'session_name': 'contenthost', 'old_ui': True},
{
'name': 'HostCollection',
'controller': 'katello_host_collections',
'session_name': 'hostcollection',
'old_ui': True,
},
{'name': 'Architecture', 'controller': 'architectures', 'session_name': 'architecture'},
{
Expand Down
12 changes: 9 additions & 3 deletions tests/foreman/ui/test_bookmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
:CaseImportance: High
"""
from airgun.exceptions import NoSuchElementException
from airgun.exceptions import DisabledWidgetError, NoSuchElementException
from fauxfactory import gen_string
import pytest

Expand Down Expand Up @@ -256,8 +256,14 @@ def test_negative_create_with_duplicate_name(session, ui_entity, module_target_s
existing_bookmark = session.bookmark.search(bookmark.name)[0]
assert existing_bookmark['Name'] == bookmark.name
ui_lib = getattr(session, ui_entity['name'].lower())
# this fails but does not raise UI error, BZ#1992652 closed wontfix
ui_lib.create_bookmark({'name': bookmark.name, 'query': query, 'public': True})
# this fails but does not raise UI error in old style dialog, BZ#1992652 closed
# wontfix, but new style dialog raises error, both situations occur
old_ui = ui_entity.get('old_ui')
if old_ui:
ui_lib.create_bookmark({'name': bookmark.name, 'query': query, 'public': True})
else:
with pytest.raises((DisabledWidgetError, NoSuchElementException)):
ui_lib.create_bookmark({'name': bookmark.name, 'query': query, 'public': True})
# assert there are no duplicate bookmarks
new_search = session.bookmark.search(bookmark.name)
assert len(new_search) == 1
Expand Down

0 comments on commit e44a553

Please sign in to comment.