Skip to content

Commit 61462c5

Browse files
committed
Merge update-to-chromedriver-for-js-tests into update-to-react-16
2 parents 57f7adc + 44e52af commit 61462c5

File tree

4 files changed

+24
-20
lines changed

4 files changed

+24
-20
lines changed

.travis.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
language: ruby
22
sudo: required
33
dist: trusty
4+
addons:
5+
chrome: stable
46
cache:
57
bundler: true
68
yarn: true
@@ -32,9 +34,9 @@ matrix:
3234
- rvm: 2.1
3335
gemfile: gemfiles/rails_3.2.gemfile
3436
- rvm: 2.1
35-
gemfile: rails_4.0.5.gemfile
37+
gemfile: gemfiles/rails_4.0.5.gemfile
3638
- rvm: 2.1
37-
gemfile: rails_4.0_with_therubyracer.gemfile
39+
gemfile: gemfiles/rails_4.0_with_therubyracer.gemfile
3840
- rvm: 2.1
3941
gemfile: gemfiles/rails_4.2_sprockets_2.gemfile
4042
- rvm: 2.1
@@ -76,12 +78,6 @@ matrix:
7678
- rvm: jruby-9.1.9.0
7779

7880
before_install:
79-
- nvm install 7.8.0 && nvm use 7.8.0
80-
- mkdir travis-phantomjs
81-
- wget https://rmosolgo.github.io/assets/phantomjs-2.1.1-linux-x86_64.tar.bz2 -O $PWD/travis-phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2
82-
- tar -xvf $PWD/travis-phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2 -C $PWD/travis-phantomjs
83-
- export PATH=$PWD/travis-phantomjs/phantomjs-2.1.1-linux-x86_64/bin:$PATH
84-
- phantomjs --version
8581
# Repo for Yarn
8682
- sudo apt-key adv --fetch-keys http://dl.yarnpkg.com/debian/pubkey.gpg
8783
- echo "deb http://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ You can also specify this option in `react_component`:
475475
## Related Projects
476476

477477
- [react\_on\_rails Gem](https://github.com/shakacode/react_on_rails): Integration of React with Rails utilizing Webpack, Babel, React, Redux, React-Router.
478-
- [Ruby Hyperloop](http://ruby-hyperloop.io/): Use Ruby to build reactive user interfaces with React.
478+
- [Ruby Hyperloop](http://ruby-hyperloop.org/): Use Ruby to build reactive user interfaces with React.
479479
- [react-rails-hot-loader](https://github.com/rmosolgo/react-rails-hot-loader) is a simple live-reloader for `react-rails`.
480480
- [react-rails-benchmark_renderer](https://github.com/pboling/react-rails-benchmark_renderer) adds performance instrumentation to server rendering.
481481
- [The Free React on Rails Course](https://learnetto.com/users/hrishio/courses/the-free-react-on-rails-5-course) A free video course which teaches the basics of React and how to get started using it in Rails with `react-rails`.

react-rails.gemspec

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ Gem::Specification.new do |s|
2323
s.add_development_dependency 'guard-minitest'
2424
s.add_development_dependency 'jbuilder'
2525
s.add_development_dependency 'listen', '~> 3.0.0' # support Ruby 2.1
26-
s.add_development_dependency 'poltergeist', '>= 0.3.3'
26+
s.add_development_dependency 'chromedriver-helper'
27+
s.add_development_dependency 'capybara'
28+
s.add_development_dependency 'selenium-webdriver'
2729
s.add_development_dependency 'test-unit', '~> 2.5'
2830
s.add_development_dependency 'rails', '>= 3.2'
2931

test/test_helper.rb

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,29 @@
2929
require 'pathname'
3030
require 'minitest/mock'
3131
require 'capybara/rails'
32-
require 'capybara/poltergeist'
32+
require 'selenium/webdriver'
3333
Dummy::Application.load_tasks
3434

3535
WebpackerHelpers.clear_webpacker_packs
3636

3737
Capybara.app = Rails.application
3838

39-
Capybara.register_driver :poltergeist_debug do |app|
40-
poltergeist_options = {
41-
# `page.driver.debug` will cause Poltergeist to open a browser window
42-
inspector: true,
43-
# hide warnings from React.js whitespace changes:
44-
js_errors: false
45-
}
46-
Capybara::Poltergeist::Driver.new(app, poltergeist_options)
39+
Capybara.register_driver :chrome do |app|
40+
Capybara::Selenium::Driver.new(app, browser: :chrome)
4741
end
48-
Capybara.javascript_driver = :poltergeist_debug
42+
43+
Capybara.register_driver :headless_chrome do |app|
44+
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
45+
chromeOptions: { args: %w(headless disable-gpu) }
46+
)
47+
48+
Capybara::Selenium::Driver.new(app,
49+
browser: :chrome,
50+
desired_capabilities: capabilities
51+
)
52+
end
53+
54+
Capybara.javascript_driver = :headless_chrome
4955
Capybara.current_driver = Capybara.javascript_driver
5056

5157
CACHE_PATH = Pathname.new File.expand_path("../#{DUMMY_LOCATION}/tmp/cache", __FILE__)

0 commit comments

Comments
 (0)