Skip to content

Commit f7e566e

Browse files
committed
Use PhantomJS instead of Chrome, still document Chrome usage though
1 parent d48485f commit f7e566e

File tree

5 files changed

+20
-26
lines changed

5 files changed

+20
-26
lines changed

Gemfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ gem 'uglifier', '>= 1.3.0'
1414
group :development, :test do
1515
gem 'byebug' # Call 'byebug' in code to stop execution and get a debugger console
1616
gem 'capybara'
17-
gem 'chromedriver-helper' # used by JavaScript-dependent feature specs (`js: true`)
17+
# gem 'chromedriver-helper' # helps with using Chrome in feature specs
1818
gem 'factory_girl_rails', '~> 4.5'
1919
gem 'pry'
2020
gem 'pry-rails'
@@ -31,6 +31,7 @@ end
3131
group :test do
3232
gem 'database_cleaner'
3333
gem 'email_spec'
34+
gem 'poltergeist' # helps with using PhantomJS headless browser in feature specs
3435
gem 'shoulda-matchers', require: false
3536
gem 'vcr'
3637
gem 'webmock'

Gemfile.lock

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ GEM
3636
minitest (~> 5.1)
3737
thread_safe (~> 0.3, >= 0.3.4)
3838
tzinfo (~> 1.1)
39-
addressable (2.3.6)
39+
addressable (2.3.8)
4040
arel (6.0.0)
4141
bcrypt (3.1.9)
4242
binding_of_caller (0.7.2)
@@ -54,9 +54,7 @@ GEM
5454
xpath (~> 2.0)
5555
childprocess (0.5.5)
5656
ffi (~> 1.0, >= 1.0.11)
57-
chromedriver-helper (0.0.8)
58-
nokogiri (~> 1.6)
59-
version_sorter (~> 1.1)
57+
cliver (0.3.2)
6058
coderay (1.1.0)
6159
coffee-rails (4.1.0)
6260
coffee-script (>= 2.2.0)
@@ -128,6 +126,11 @@ GEM
128126
nokogiri (1.6.6.2)
129127
mini_portile (~> 0.6.0)
130128
orm_adapter (0.5.0)
129+
poltergeist (1.6.0)
130+
capybara (~> 2.1)
131+
cliver (~> 0.3.1)
132+
multi_json (~> 1.0)
133+
websocket-driver (>= 0.2.0)
131134
pry (0.10.1)
132135
coderay (~> 1.1.0)
133136
method_source (~> 0.8.1)
@@ -140,7 +143,7 @@ GEM
140143
pry-stack_explorer (0.4.9.1)
141144
binding_of_caller (>= 0.7)
142145
pry (>= 0.9.11)
143-
puffing-billy (0.5.0)
146+
puffing-billy (0.5.1)
144147
addressable
145148
em-http-request (~> 1.1.0)
146149
em-synchrony
@@ -235,7 +238,6 @@ GEM
235238
execjs (>= 0.3.0)
236239
json (>= 1.8.0)
237240
vcr (2.9.3)
238-
version_sorter (1.1.1)
239241
warden (1.2.3)
240242
rack (>= 1.0)
241243
web-console (2.0.0)
@@ -247,6 +249,9 @@ GEM
247249
addressable (>= 2.3.6)
248250
crack (>= 0.3.2)
249251
websocket (1.2.1)
252+
websocket-driver (0.5.4)
253+
websocket-extensions (>= 0.1.0)
254+
websocket-extensions (0.1.2)
250255
xpath (2.0.0)
251256
nokogiri (~> 1.3)
252257

@@ -256,14 +261,14 @@ PLATFORMS
256261
DEPENDENCIES
257262
byebug
258263
capybara
259-
chromedriver-helper
260264
coffee-rails (~> 4.1.0)
261265
database_cleaner
262266
devise
263267
email_spec
264268
factory_girl_rails (~> 4.5)
265269
jquery-rails
266270
nokogiri
271+
poltergeist
267272
pry
268273
pry-rails
269274
pry-rescue

spec/support/capybara.rb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,12 @@
22

33
# 0. Check spec/support dir is auto-required in spec/rails_helper.rb.
44
#
5-
# 1. Add capybara, selenium-webdriver, and chromedriver-helper to Gemfile:
5+
# 1. Add these to your Gemfile:
66
#
77
# group :development, :test do
88
# gem 'capybara'
9-
# # selenium-webdriver & chromedriver-helper used by
10-
# # JavaScript-dependent feature specs (`js: true`):
11-
# gem 'selenium-webdriver'
12-
# gem 'chromedriver-helper'
9+
# gem 'selenium-webdriver' # For Firefox
10+
# # gem 'chromedriver-helper' # Install to use Chrome in feature specs
1311
# end
1412
#
1513
# 2. Create a file like this one you're reading in spec/support/capybara.rb:

spec/support/capybara_driver_resolver.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,14 @@
44
# with descriptive names related to the underlying browser's HTML5 support.
55
module CapybaraDriverResolver
66

7-
# At time of writing: These drivers wrap chrome or phantomjs and they both support
7+
# At time of writing: These drivers wrap phantomjs or chrome and they both support
88
# native date inputs.
9-
WITH_NATIVE_DATE_INPUT = [:selenium_chrome_billy, :poltergeist_billy, :poltergeist]
9+
WITH_NATIVE_DATE_INPUT = [:poltergeist_billy, :poltergeist, :selenium_chrome_billy]
1010

1111
# At time of writing: These drivers wrap Firefox browsers that don't support native
1212
# date inputs.
1313
WITHOUT_NATIVE_DATE_INPUT = [:selenium_billy, :selenium]
1414

15-
1615
def driver_with(options)
1716

1817
potential_drivers = options[:native_date_input] ? WITH_NATIVE_DATE_INPUT : WITHOUT_NATIVE_DATE_INPUT

spec/support/puffing_billy.rb

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,9 @@
3737

3838
# 5. Uncomment the *_billy driver for your desired browser:
3939
Capybara.javascript_driver = :selenium_billy # Uses Firefox
40+
# Capybara.javascript_driver = :selenium_chrome_billy
4041
# Capybara.javascript_driver = :webkit_billy
4142
# Capybara.javascript_driver = :poltergeist_billy
42-
Capybara.register_driver :selenium_chrome_billy do |app|
43-
Capybara::Selenium::Driver.new(
44-
app, browser: :chrome,
45-
switches: [
46-
"--proxy-server=#{Billy.proxy.host}:#{Billy.proxy.port}"
47-
# "--ignore-certificate-errors" # May be needed in future
48-
]
49-
)
50-
end
51-
# Capybara.javascript_driver = :selenium_chrome_billy
5243

5344
# 6. Start using Puffing Billy. See spec/features/share_page_spec.rb for an example,
5445
# and find your cached responses in spec/support/http_cache/billy

0 commit comments

Comments
 (0)