diff --git a/.github/workflows/run_smoke_test.yml b/.github/workflows/run_smoke_test.yml index 6f337f9a..3f5f37c8 100644 --- a/.github/workflows/run_smoke_test.yml +++ b/.github/workflows/run_smoke_test.yml @@ -25,7 +25,7 @@ jobs: os: [windows-latest, macos-latest] # See https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json, # ctrl + f and search "python-3..-" for supported versions - python-version: ["3.8.10", "3.9", "3.10", "3.12"] + python-version: ["3.9", "3.10", "3.11", "3.12"] # "3.8 fails with numpy uninstall" runs-on: ${{ matrix.os }} environment: Development steps: diff --git a/Testing/Functional/SmokeTests/smoke_test.py b/Testing/Functional/SmokeTests/smoke_test.py index 8470456c..f4a95eb2 100644 --- a/Testing/Functional/SmokeTests/smoke_test.py +++ b/Testing/Functional/SmokeTests/smoke_test.py @@ -20,6 +20,11 @@ run_selenium, verify_scubaresults, ) + +SAMPLE_REPORT = "sample-report" +SCUBA_RESULTS = "ScubaResults.json" +BASELINE_REPORTS = "BaselineReports.html" + class SmokeTest: def test_scubagoggles_output(self, subjectemail): try: @@ -27,7 +32,7 @@ def test_scubagoggles_output(self, subjectemail): subprocess.run(command, shell=True) output_path: str = get_output_path() output: list = verify_output_type(output_path, []) - required_entries = get_required_entries(os.path.join(os.getcwd(), "sample-report"), []) + required_entries = get_required_entries(os.path.join(os.getcwd(), SAMPLE_REPORT), []) verify_all_outputs_exist(output, required_entries) except (OSError, ValueError, Exception) as e: pytest.fail(f"An error occurred, {e}") @@ -35,7 +40,7 @@ def test_scubagoggles_output(self, subjectemail): def test_scubaresults(self): try: output_path: str = get_output_path() - scubaresults_path: str = os.path.join(output_path, "ScubaResults.json") + scubaresults_path: str = os.path.join(output_path, SCUBA_RESULTS) with open(scubaresults_path) as jsonfile: verify_scubaresults(jsonfile) except ValueError as e: @@ -46,7 +51,7 @@ def test_scubaresults(self): def test_scubagoggles_report(self, browser, domain): try: output_path: str = get_output_path() - report_path: str = prepend_file_protocol(os.path.join(output_path, "BaselineReports.html")) + report_path: str = prepend_file_protocol(os.path.join(output_path, BASELINE_REPORTS)) browser.get(report_path) run_selenium(browser, domain) except (ValueError, Exception) as e: diff --git a/Testing/Functional/SmokeTests/smoke_test_utils.py b/Testing/Functional/SmokeTests/smoke_test_utils.py index 2aa20884..e8826661 100644 --- a/Testing/Functional/SmokeTests/smoke_test_utils.py +++ b/Testing/Functional/SmokeTests/smoke_test_utils.py @@ -6,11 +6,16 @@ from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions +OUTPUT_DIRECTORY = "GWSBaselineConformance" +BASELINE_REPORT_H1 = "SCuBA GWS Security Baseline Conformance Reports" CISA_GOV_URL = "https://www.cisa.gov/scuba" SCUBAGOGGLES_BASELINES_URL = "https://github.com/cisagov/ScubaGoggles/tree/main/baselines" def get_output_path() -> str: - directories: list = [d for d in os.listdir() if os.path.isdir(d) and d.startswith("GWSBaselineConformance")] + directories: list = [ + d for d in os.listdir() + if os.path.isdir(d) and d.startswith(OUTPUT_DIRECTORY) + ] directories.sort(key=lambda d: os.path.getctime(d), reverse=True) return os.path.join(os.getcwd(), directories[0]) @@ -68,7 +73,7 @@ def verify_scubaresults(jsonfile): def run_selenium(browser, domain): verify_navigation_links(browser) h1 = browser.find_element(By.TAG_NAME, "h1").text - assert h1 == "SCuBA GWS Security Baseline Conformance Reports" + assert h1 == BASELINE_REPORT_H1 products = { product: { "title": f"{product} Baseline Report" }