Skip to content

Commit

Permalink
Configurable phantomjs path
Browse files Browse the repository at this point in the history
  • Loading branch information
dcramer committed Sep 7, 2016
1 parent a3337b7 commit f429f47
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ addopts = --tb=native -p no:doctest
norecursedirs = bin dist docs htmlcov script hooks node_modules .* {args}
looponfailroots = src/sentry tests
selenium_driver = phantomjs
phantomjs_path = node_modules/phantomjs-prebuilt/bin/phantomjs

[flake8]
ignore = F999,E501,E128,E124,E402,W503,E731,C901
Expand Down
17 changes: 11 additions & 6 deletions src/sentry/utils/pytest/selenium.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ def pytest_addoption(parser):
group._addoption('--selenium-driver',
dest='selenium_driver',
help='selenium driver (phantomjs or firefox)')
group._addoption('--phantomjs-path',
dest='phantomjs_path',
help='path to phantomjs driver')


def pytest_configure(config):
Expand Down Expand Up @@ -161,12 +164,14 @@ def browser(request, percy, live_server):
if driver_type == 'firefox':
driver = webdriver.Firefox()
elif driver_type == 'phantomjs':
phantomjs_path = os.path.join(
settings.NODE_MODULES_ROOT,
'phantomjs-prebuilt',
'bin',
'phantomjs',
)
phantomjs_path = request.config.getoption('phantomjs_path')
if not phantomjs_path:
phantomjs_path = os.path.join(
'node_modules',
'phantomjs-prebuilt',
'bin',
'phantomjs',
)
driver = webdriver.PhantomJS(executable_path=phantomjs_path)
driver.set_window_size(1280, 800)
else:
Expand Down

0 comments on commit f429f47

Please sign in to comment.