Skip to content

Commit

Permalink
Rename env var BROWSER to DRIVER to fix Launchy
Browse files Browse the repository at this point in the history
In testing found an incompatibility with setting an environment variable called BROWSER and trying to use Launchy. It seems this is a variable used by the OS for setting what the default browser is, and in turn Launchy references it when trying to open the saved page.

So this change updates the ENV VAR and corresponding code and comments to use DRIVER instead of BROWSER.
  • Loading branch information
Cruikshanks committed May 13, 2016
1 parent 9add591 commit 20c1285
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions features/support/env.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@
# or (to have a pause of 1 second between each step):
# PAUSE=1 bundle exec cucumber
# To use chrome instead of Firefox
# BROWSER=chrome bundle exec cucumber
# DRIVER=chrome bundle exec cucumber
# Else the default will use the poltergiest headless browser
# bundle exec cucumber
#
# N.B. Initially the env var was named BROWSER but it was found this was
# a key environment variable for Launchy and changing it broke Launchy.
# Therefore have settled in DRIVER as a replacement, though its not as
# clear to quke's intended audience.

# Capybara defaults to CSS3 selectors rather than XPath.
# If you'd prefer to use XPath, just uncomment this line and adjust any
Expand Down Expand Up @@ -53,19 +58,19 @@
end

# The choice of which browser to use for the tests is dependent on what the
# environment variable BROWSER is set to. If not set we default to using
# environment variable DRIVER is set to. If not set we default to using
# poltergeist
browser = case (ENV['BROWSER'] || '').downcase.strip
when 'firefox'
:firefox
when 'chrome'
:chrome
else
:poltergeist
end
driver = case (ENV['DRIVER'] || '').downcase.strip
when 'firefox'
:firefox
when 'chrome'
:chrome
else
:poltergeist
end

Capybara.default_driver = browser
Capybara.javascript_driver = browser
Capybara.default_driver = driver
Capybara.javascript_driver = driver

# We use cucumber's AfterStep hook to insert our pause between pages if
# one was set
Expand Down

0 comments on commit 20c1285

Please sign in to comment.