Skip to content

Commit

Permalink
Add webdriver-manager to easily locate Firefox
Browse files Browse the repository at this point in the history
- Add webdriver-manager
- Update geckodriver
- Install Firefox from ppa
  • Loading branch information
mcoughlin authored and stefanv committed Jan 12, 2024
1 parent 4d4375c commit 8714c2a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ jobs:
cd baselayer
sudo apt update -y
### firefox installation
sudo snap remove firefox
sudo add-apt-repository ppa:mozillateam/ppa
printf 'Package: *\nPin: release o=LP-PPA-mozillateam\nPin-Priority: 1001' | sudo tee /etc/apt/preferences.d/mozilla-firefox
sudo apt install -y wget nodejs unzip firefox nginx
pip install --upgrade pip
Expand All @@ -84,7 +90,7 @@ jobs:
- name: Install Geckodriver / Selenium
run: |
GECKO_VER=0.30.0
GECKO_VER=0.34.0
CACHED_DOWNLOAD_DIR=~/.local/downloads
FILENAME=geckodriver-v${GECKO_VER}-linux64.tar.gz
Expand Down
6 changes: 5 additions & 1 deletion app/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ def click_css(self, css, timeout=10, scroll_parent=False):
@pytest.fixture(scope="session")
def driver(request):
from selenium import webdriver
from webdriver_manager.firefox import GeckoDriverManager

options = webdriver.FirefoxOptions()
if "BASELAYER_TEST_HEADLESS" in os.environ:
Expand All @@ -163,7 +164,10 @@ def driver(request):
),
)

driver = MyCustomWebDriver(options=options)
service = webdriver.firefox.service.Service(
executable_path=GeckoDriverManager().install()
)
driver = MyCustomWebDriver(options=options, service=service)
driver.set_window_size(1920, 1200)
login(driver)

Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ python-dateutil>=2.8.1
phonenumbers>=8.12.15
python-slugify>=4.0.1
numpy>=1.21.4
webdriver-manager>=4.0.1

0 comments on commit 8714c2a

Please sign in to comment.