Skip to content

Commit cad72c1

Browse files
authored
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.
1 parent 9569a96 commit cad72c1

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

@@ -228,7 +229,9 @@ def test_positive_update_login_page_footer_text(session, setting_update):
228229
session.login.login(login_details)
229230
session.settings.update(f'name = {property_name}', default_value)
230231
result = session.login.logout()
231-
assert result["login_text"] == default_value
232+
sat_version = get_sat_version()
233+
default_value_with_version_expanded = default_value.replace('$VERSION', str(sat_version))
234+
assert result["login_text"] == default_value_with_version_expanded
232235

233236
# set empty
234237
session.login.login(login_details)
@@ -531,21 +534,28 @@ def test_positive_setting_display_fqdn_for_hosts(session, target_sat):
531534
"""
532535
host_name, domain_name = target_sat.hostname.split('.', 1)
533536
default_value = target_sat.update_setting('display_fqdn_for_hosts', 'No')
534-
with target_sat.ui_session() as session:
535-
dashboard_hosts = session.dashboard.read('NewHosts')
536-
assert host_name in [h['Host'] for h in dashboard_hosts['hosts'] if h['Host'] == host_name]
537-
538-
values = session.host_new.get_details(host_name, widget_names='breadcrumb')
539-
assert values['breadcrumb'] == host_name
540-
541-
# Verify with display_fqdn_for_hosts=Yes
537+
try:
538+
with target_sat.ui_session() as session:
539+
dashboard_hosts = session.dashboard.read('NewHosts')
540+
assert host_name in [
541+
h['Host'] for h in dashboard_hosts['hosts'] if h['Host'] == host_name
542+
]
543+
544+
values = session.host_new.get_details(host_name, widget_names='breadcrumb')
545+
assert values['breadcrumb'] == host_name
546+
547+
# Verify with display_fqdn_for_hosts=Yes
548+
target_sat.update_setting('display_fqdn_for_hosts', 'Yes')
549+
full_name = '.'.join((host_name, domain_name))
550+
dashboard_hosts = session.dashboard.read('NewHosts')
551+
assert full_name in [
552+
h['Host'] for h in dashboard_hosts['hosts'] if h['Host'] == full_name
553+
]
554+
555+
values = session.host_new.get_details(target_sat.hostname, widget_names='breadcrumb')
556+
assert values['breadcrumb'] == full_name
557+
finally:
542558
target_sat.update_setting('display_fqdn_for_hosts', default_value)
543-
full_name = '.'.join((host_name, domain_name))
544-
dashboard_hosts = session.dashboard.read('NewHosts')
545-
assert full_name in [h['Host'] for h in dashboard_hosts['hosts'] if h['Host'] == full_name]
546-
547-
values = session.host_new.get_details(target_sat.hostname, widget_names='breadcrumb')
548-
assert values['breadcrumb'] == full_name
549559

550560

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

0 commit comments

Comments
 (0)