Skip to content

Commit 73a3d80

Browse files
[6.16.z] Two Settings UI test fixes (#19078)
Two Settings UI test fixes (#19043) The settings field contains "Version $VERSION" and $VERSION should be replaced by actual version, e.g. 6.18.0. When the test compares "Version $VERSION" - the content of the field - with the actually shown footer text, it fails. For some mysterious reason not yet known to me, the test sometimes got actual text "Version 6.18.0" instead of the unexpanded variable so this actually passed pre-6.18. I don't understand, but this fix should work for both cases. The test somehow presumes the original value to be Yes, even though it doesn't need to be. Fixed. (cherry picked from commit cad72c1) Co-authored-by: Lukáš Hellebrandt <lhellebr@redhat.com>
1 parent 61e1855 commit 73a3d80

1 file changed

Lines changed: 25 additions & 15 deletions

File tree

tests/foreman/ui/test_settings.py

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import pytest
1919

2020
from robottelo.config import settings
21+
from robottelo.hosts import get_sat_version
2122
from robottelo.utils.datafactory import filtered_datapoint, gen_string
2223

2324

@@ -221,7 +222,9 @@ def test_positive_update_login_page_footer_text(session, setting_update):
221222
session.login.login(login_details)
222223
session.settings.update(f'name = {property_name}', default_value)
223224
result = session.login.logout()
224-
assert result["login_text"] == default_value
225+
sat_version = get_sat_version()
226+
default_value_with_version_expanded = default_value.replace('$VERSION', str(sat_version))
227+
assert result["login_text"] == default_value_with_version_expanded
225228

226229
# set empty
227230
session.login.login(login_details)
@@ -524,21 +527,28 @@ def test_positive_setting_display_fqdn_for_hosts(session, target_sat):
524527
"""
525528
host_name, domain_name = target_sat.hostname.split('.', 1)
526529
default_value = target_sat.update_setting('display_fqdn_for_hosts', 'No')
527-
with target_sat.ui_session() as session:
528-
dashboard_hosts = session.dashboard.read('NewHosts')
529-
assert host_name in [h['Host'] for h in dashboard_hosts['hosts'] if h['Host'] == host_name]
530-
531-
values = session.host_new.get_details(host_name, widget_names='breadcrumb')
532-
assert values['breadcrumb'] == host_name
533-
534-
# Verify with display_fqdn_for_hosts=Yes
530+
try:
531+
with target_sat.ui_session() as session:
532+
dashboard_hosts = session.dashboard.read('NewHosts')
533+
assert host_name in [
534+
h['Host'] for h in dashboard_hosts['hosts'] if h['Host'] == host_name
535+
]
536+
537+
values = session.host_new.get_details(host_name, widget_names='breadcrumb')
538+
assert values['breadcrumb'] == host_name
539+
540+
# Verify with display_fqdn_for_hosts=Yes
541+
target_sat.update_setting('display_fqdn_for_hosts', 'Yes')
542+
full_name = '.'.join((host_name, domain_name))
543+
dashboard_hosts = session.dashboard.read('NewHosts')
544+
assert full_name in [
545+
h['Host'] for h in dashboard_hosts['hosts'] if h['Host'] == full_name
546+
]
547+
548+
values = session.host_new.get_details(target_sat.hostname, widget_names='breadcrumb')
549+
assert values['breadcrumb'] == full_name
550+
finally:
535551
target_sat.update_setting('display_fqdn_for_hosts', default_value)
536-
full_name = '.'.join((host_name, domain_name))
537-
dashboard_hosts = session.dashboard.read('NewHosts')
538-
assert full_name in [h['Host'] for h in dashboard_hosts['hosts'] if h['Host'] == full_name]
539-
540-
values = session.host_new.get_details(target_sat.hostname, widget_names='breadcrumb')
541-
assert values['breadcrumb'] == full_name
542552

543553

544554
def test_positive_show_unsupported_templates(request, target_sat, module_org, module_location):

0 commit comments

Comments
 (0)