From 611a5f5677cd25f4e4700ef0322713a8f5f7a494 Mon Sep 17 00:00:00 2001 From: Jameer Pathan <21165044+jameerpathan111@users.noreply.github.com> Date: Thu, 7 Nov 2024 15:02:58 +0100 Subject: [PATCH] Update test_positive_documentation_links to test stage doc links --- conf/robottelo.yaml.template | 2 ++ robottelo/config/validators.py | 1 + tests/foreman/ui/test_documentation_links.py | 11 +++++++---- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/conf/robottelo.yaml.template b/conf/robottelo.yaml.template index bb67c31a3d3..200563d55e4 100644 --- a/conf/robottelo.yaml.template +++ b/conf/robottelo.yaml.template @@ -29,3 +29,5 @@ ROBOTTELO: SETTINGS: GET_FRESH: true IGNORE_VALIDATION_ERRORS: false + # Stage docs url + STAGE_DOCS_URL: https://docs.redhat.com diff --git a/robottelo/config/validators.py b/robottelo/config/validators.py index b7c3817b420..47b13ba41a0 100644 --- a/robottelo/config/validators.py +++ b/robottelo/config/validators.py @@ -321,6 +321,7 @@ Validator('remotedb.port', default=5432), ], robottelo=[ + Validator('robottelo.stage_docs_url', default='https://docs.redhat.com'), Validator('robottelo.settings.ignore_validation_errors', is_type_of=bool, default=False), Validator('robottelo.rhel_source', default='ga', is_in=['ga', 'internal']), Validator( diff --git a/tests/foreman/ui/test_documentation_links.py b/tests/foreman/ui/test_documentation_links.py index b1e34b7ea8a..3d11b8cd865 100644 --- a/tests/foreman/ui/test_documentation_links.py +++ b/tests/foreman/ui/test_documentation_links.py @@ -22,10 +22,6 @@ @pytest.mark.e2e -@pytest.mark.skipif( - (settings.server.version.release.split('.')[0:2] in settings.robottelo.sat_non_ga_versions), - reason="The test don't yet support verifying documentation links for non GA'ed Satellite release.", -) def test_positive_documentation_links(target_sat): """Verify that Satellite documentation links are working. Note: At the moment, the test doesn't support verifying links hidden behind a button. @@ -67,6 +63,7 @@ def test_positive_documentation_links(target_sat): 'factvalue', 'dashboard', ] + sat_version = ".".join(target_sat.version.split('.')[0:2]) all_links = defaultdict(list) pages_with_broken_links = defaultdict(list) with target_sat.ui_session() as session: @@ -86,6 +83,12 @@ def test_positive_documentation_links(target_sat): ) for page in pages: for link in all_links[page]: + # Test stage docs url for Non-GA'ed Satellite + if sat_version in settings.robottelo.sat_non_ga_versions: + link = link.replace( + 'https://docs.redhat.com', settings.robottelo.stage_docs_url + ) + link = link.replace('html', 'html-single') if requests.get(link, verify=False).status_code != 200: pages_with_broken_links[page].append(link) logger.info(f"Following link on {page} page seems broken: \n {link}")