Skip to content

Commit

Permalink
try simplifying types to see if 3.8.10 passes
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchelbaker-cisa committed Aug 2, 2024
1 parent 9087c5e commit 98141b6
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 16 deletions.
12 changes: 5 additions & 7 deletions .github/actions/setup-dependencies-windows/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,12 @@ runs:
pip install pytest
pip install selenium
pip uninstall -y numpy
pip install numpy==1.26.4
# Below python v3.9, a lower numpy v1.24.4 is used
#$pythonVersion = [version]${{ inputs.python-version }}
#if ($pythonVersion -ge [version]"3.9") {
# pip uninstall -y numpy
# pip install numpy==1.26.4
#}
$pythonVersion = [version]${{ inputs.python-version }}
if ($pythonVersion -ge [version]"3.8.18") {
pip uninstall -y numpy
pip install numpy==1.26.4
}
- name: Download OPA executable
shell: powershell
Expand Down
2 changes: 1 addition & 1 deletion Testing/Functional/SmokeTests/smoke_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def test_scubagoggles_output(self, subjectemail):
command: str = f"scubagoggles gws --subjectemail {subjectemail} --quiet"
subprocess.run(command, shell=True)
output_path: str = get_output_path()
output: list[str] = verify_output_type(output_path, [])
output: list = verify_output_type(output_path, [])
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:
Expand Down
24 changes: 16 additions & 8 deletions Testing/Functional/SmokeTests/smoke_test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
SCUBAGOGGLES_BASELINES_URL = "https://github.com/cisagov/ScubaGoggles/tree/main/baselines"

def get_output_path() -> str:
directories: list[str] = [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("GWSBaselineConformance")]
directories.sort(key=lambda d: os.path.getctime(d), reverse=True)
return os.path.join(os.getcwd(), directories[0])

Expand All @@ -19,8 +19,8 @@ def prepend_file_protocol(path: str) -> str:
path = "file://" + path
return path

def verify_output_type(output_path: str, output: list[str]) -> list[str]:
entries: list[str] = os.listdir(output_path)
def verify_output_type(output_path: str, output: list) -> list:
entries: list = os.listdir(output_path)
for entry in entries:
output.append(entry)

Expand All @@ -44,15 +44,15 @@ def verify_output_type(output_path: str, output: list[str]) -> list[str]:
raise OSError(f"Entry is not a directory or file (symlink, etc.)")
return output

def get_required_entries(directory, required_entries) -> list[str]:
def get_required_entries(directory, required_entries) -> list:
with os.scandir(directory) as entries:
for entry in entries:
required_entries.append(entry.name)
if entry.is_dir():
get_required_entries(entry.path, required_entries)
return required_entries

def verify_all_outputs_exist(output: list[str], required_entries: list[str]):
def verify_all_outputs_exist(output: list, required_entries: list):
for required_entry in required_entries:
if required_entry in output:
assert True
Expand Down Expand Up @@ -87,10 +87,10 @@ def run_selenium(browser, domain):
assert product in products

individual_report_anchor = baseline_report.find_element(By.TAG_NAME, "a")
href = individual_report_anchor.get_attribute("href")
individual_report_anchor_href = individual_report_anchor.get_attribute("href")
individual_report_anchor.click()
current_url = browser.current_url
assert href == current_url
assert individual_report_anchor_href == current_url

# Check at the individual report level
verify_navigation_links(browser)
Expand Down Expand Up @@ -120,7 +120,15 @@ def run_selenium(browser, domain):
rows = tbody.find_elements(By.TAG_NAME, "tr")
assert len(rows) > 0

browser.back()
parent_report_anchor = (
browser.find_element(By.TAG_NAME, "header")
.find_element(By.TAG_NAME, "a")
)
parent_report_anchor_href = parent_report_anchor.get_attribute("href")
parent_report_anchor.click()
current_url = browser.current_url
assert parent_report_anchor_href == current_url

WebDriverWait(browser, 10).until(
expected_conditions.presence_of_element_located(
(By.TAG_NAME, "body")
Expand Down

0 comments on commit 98141b6

Please sign in to comment.