Skip to content

Commit

Permalink
configure selenium to run headless
Browse files Browse the repository at this point in the history
  • Loading branch information
dwelch-spike committed Jan 8, 2025
1 parent 16bc049 commit 1b9e234
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion prism-image-search/tests/e2e/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

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

##########################################
###### GLOBALS
Expand All @@ -29,7 +30,17 @@ def app(request):

@pytest.fixture(scope='function')
def browser():
driver = webdriver.Chrome()

# Configure Chrome options
# We do this mostly so that we can run headless in github actions
chrome_options = Options()
chrome_options.add_argument("--headless")
chrome_options.add_argument("--no-sandbox")
chrome_options.add_argument("--disable-dev-shm-usage")
chrome_options.add_argument("--disable-gpu")
chrome_options.add_argument("--window-size=1920,1080")

driver = webdriver.Chrome(options=chrome_options)
# Wait up to 30 seconds for elements to appear
driver.implicitly_wait(30)
yield driver
Expand Down

0 comments on commit 1b9e234

Please sign in to comment.