Skip to content

Commit

Permalink
start addressing pylint warnings for selenium_browser.py
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchelbaker-cisa committed Aug 5, 2024
1 parent d802c51 commit f321a4b
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 18 deletions.
8 changes: 6 additions & 2 deletions .github/actions/setup-dependencies-macos/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ inputs:
runs:
using: "composite"
steps:
- name: Install pytest and selenium
shell: bash
run: |
pip install pytest
pip install selenium
- name: Setup virtualenv
shell: bash
run: |
Expand All @@ -24,8 +30,6 @@ runs:
run: |
python -m pip install .
pip install -r requirements.txt
pip install pytest
pip install selenium
pip uninstall -y numpy
pip install numpy==1.26.4
Expand Down
10 changes: 7 additions & 3 deletions .github/actions/setup-dependencies-windows/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ inputs:
runs:
using: "composite"
steps:
- name: Install pytest and selenium
shell: powershell
run: |
pip install pytest
pip install selenium
- name: Setup virtualenv
shell: powershell
run: |
Expand All @@ -24,11 +30,9 @@ runs:
run: |
python -m pip install .
pip install -r requirements.txt
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.8.18") {
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/run_smoke_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ on:
pull_request_review:
types: [submitted]
push:
paths:
- ".github/workflows/run_smoke_test.yml"
- ".github/actions/setup-dependencies-windows/action.yml"
- ".github/actions/setup-dependencies-macos/action.yml"
# Uncomment when testing locally
#paths:
# - ".github/workflows/run_smoke_test.yml"
# - ".github/actions/setup-dependencies-windows/action.yml"
# - ".github/actions/setup-dependencies-macos/action.yml"
branches:
- "main"
- "*smoke*"
Expand All @@ -25,7 +26,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.<minor>.<patch>-<darwin-arm64/win32/linux>" for supported versions
python-version: ["3.9", "3.10", "3.11", "3.12"] # "3.8 fails with numpy uninstall"
python-version: ["3.9", "3.12"] # "3.8 fails with numpy uninstall"
runs-on: ${{ matrix.os }}
environment: Development
steps:
Expand Down
22 changes: 14 additions & 8 deletions Testing/Functional/SmokeTests/selenium_browser.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
"""
The Browser class encapsulates the setup, usage, and teardown of a
Selenium WebDriver instance for automated browser interactions.
"""

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

class Browser:
"""
The Browser class encapsulates the setup, usage, and teardown of a
Selenium WebDriver instance for automated browser interactions.
"""

def __init__(self):
chrome_options = Options()
chrome_options.add_argument("--headless")
Expand All @@ -16,14 +16,20 @@ def __init__(self):
self.driver = webdriver.Chrome(options=chrome_options)

def get(self, url):
"""
Load a new web page in the current browser window.
Args:
url: The URL to load. Bust be a fully qualified URL
"""
self.driver.get(url)

def quit(self):
self.driver.quit()

def find_element(self, by, value):
return self.driver.find_element(by, value)

def find_elements(self, by, value):
return self.driver.find_elements(by, value)

Expand Down

0 comments on commit f321a4b

Please sign in to comment.