Goodbye phantomjs, hello (again) selenium.
This commit is contained in:
parent
078031e679
commit
9eae73c7e4
4 changed files with 56 additions and 22 deletions
5
Gemfile
5
Gemfile
|
|
@ -252,10 +252,11 @@ end
|
||||||
group :test do
|
group :test do
|
||||||
# as test framework
|
# as test framework
|
||||||
gem 'capybara'
|
gem 'capybara'
|
||||||
|
gem 'chromedriver-helper'
|
||||||
gem 'database_cleaner'
|
gem 'database_cleaner'
|
||||||
gem 'phantomjs', :require => 'phantomjs/poltergeist'
|
gem 'geckodriver-helper'
|
||||||
gem 'poltergeist'
|
|
||||||
gem 'rspec-rails', '~> 3.5', '>= 3.5.2'
|
gem 'rspec-rails', '~> 3.5', '>= 3.5.2'
|
||||||
|
gem 'selenium-webdriver'
|
||||||
# for measuring test coverage
|
# for measuring test coverage
|
||||||
gem 'codecov', require: false
|
gem 'codecov', require: false
|
||||||
# for describing models
|
# for describing models
|
||||||
|
|
|
||||||
25
Gemfile.lock
25
Gemfile.lock
|
|
@ -64,6 +64,8 @@ GEM
|
||||||
airbrake-ruby (2.12.0)
|
airbrake-ruby (2.12.0)
|
||||||
ajax-datatables-rails (0.4.3)
|
ajax-datatables-rails (0.4.3)
|
||||||
railties (>= 4.0)
|
railties (>= 4.0)
|
||||||
|
archive-zip (0.11.0)
|
||||||
|
io-like (~> 0.3.0)
|
||||||
arel (7.1.4)
|
arel (7.1.4)
|
||||||
ast (2.4.0)
|
ast (2.4.0)
|
||||||
autoprefixer-rails (9.3.1)
|
autoprefixer-rails (9.3.1)
|
||||||
|
|
@ -104,10 +106,14 @@ GEM
|
||||||
chart-js-rails (0.1.6)
|
chart-js-rails (0.1.6)
|
||||||
railties (> 3.1)
|
railties (> 3.1)
|
||||||
chartkick (3.0.1)
|
chartkick (3.0.1)
|
||||||
|
childprocess (0.9.0)
|
||||||
|
ffi (~> 1.0, >= 1.0.11)
|
||||||
|
chromedriver-helper (2.1.0)
|
||||||
|
archive-zip (~> 0.10)
|
||||||
|
nokogiri (~> 1.8)
|
||||||
chronic (0.10.2)
|
chronic (0.10.2)
|
||||||
chunky_png (1.3.8)
|
chunky_png (1.3.8)
|
||||||
climate_control (0.2.0)
|
climate_control (0.2.0)
|
||||||
cliver (0.3.2)
|
|
||||||
cloudinary (1.9.1)
|
cloudinary (1.9.1)
|
||||||
aws_cf_signer
|
aws_cf_signer
|
||||||
rest-client
|
rest-client
|
||||||
|
|
@ -179,6 +185,8 @@ GEM
|
||||||
actionpack (>= 3.2.13)
|
actionpack (>= 3.2.13)
|
||||||
formtastic-bootstrap (3.1.1)
|
formtastic-bootstrap (3.1.1)
|
||||||
formtastic (>= 3.0)
|
formtastic (>= 3.0)
|
||||||
|
geckodriver-helper (0.21.0)
|
||||||
|
archive-zip (~> 0.7)
|
||||||
globalid (0.4.1)
|
globalid (0.4.1)
|
||||||
activesupport (>= 4.2.0)
|
activesupport (>= 4.2.0)
|
||||||
gravtastic (3.2.6)
|
gravtastic (3.2.6)
|
||||||
|
|
@ -225,6 +233,7 @@ GEM
|
||||||
i18n_data (0.8.0)
|
i18n_data (0.8.0)
|
||||||
inversion (1.1.1)
|
inversion (1.1.1)
|
||||||
loggability (~> 0.12)
|
loggability (~> 0.12)
|
||||||
|
io-like (0.3.0)
|
||||||
iso-639 (0.2.8)
|
iso-639 (0.2.8)
|
||||||
jaro_winkler (1.5.1)
|
jaro_winkler (1.5.1)
|
||||||
jquery-datatables-rails (3.4.0)
|
jquery-datatables-rails (3.4.0)
|
||||||
|
|
@ -334,16 +343,10 @@ GEM
|
||||||
ast (~> 2.4.0)
|
ast (~> 2.4.0)
|
||||||
pdf-core (0.2.5)
|
pdf-core (0.2.5)
|
||||||
pg (1.1.2)
|
pg (1.1.2)
|
||||||
phantomjs (2.1.1.0)
|
|
||||||
piwik_analytics (1.0.2)
|
piwik_analytics (1.0.2)
|
||||||
actionpack
|
actionpack
|
||||||
activesupport
|
activesupport
|
||||||
rails (>= 3.0.0)
|
rails (>= 3.0.0)
|
||||||
poltergeist (1.9.0)
|
|
||||||
capybara (~> 2.1)
|
|
||||||
cliver (~> 0.3.1)
|
|
||||||
multi_json (~> 1.0)
|
|
||||||
websocket-driver (>= 0.2.0)
|
|
||||||
powerpack (0.1.2)
|
powerpack (0.1.2)
|
||||||
prawn (1.0.0)
|
prawn (1.0.0)
|
||||||
pdf-core (~> 0.2.2)
|
pdf-core (~> 0.2.2)
|
||||||
|
|
@ -502,6 +505,9 @@ GEM
|
||||||
sprockets-rails (>= 2.0, < 4.0)
|
sprockets-rails (>= 2.0, < 4.0)
|
||||||
tilt (>= 1.1, < 3)
|
tilt (>= 1.1, < 3)
|
||||||
selectize-rails (0.12.6)
|
selectize-rails (0.12.6)
|
||||||
|
selenium-webdriver (3.14.1)
|
||||||
|
childprocess (~> 0.5)
|
||||||
|
rubyzip (~> 1.2, >= 1.2.2)
|
||||||
sexp_processor (4.11.0)
|
sexp_processor (4.11.0)
|
||||||
shellany (0.0.1)
|
shellany (0.0.1)
|
||||||
shoulda-matchers (2.8.0)
|
shoulda-matchers (2.8.0)
|
||||||
|
|
@ -602,6 +608,7 @@ DEPENDENCIES
|
||||||
carrierwave-bombshelter
|
carrierwave-bombshelter
|
||||||
chart-js-rails
|
chart-js-rails
|
||||||
chartkick
|
chartkick
|
||||||
|
chromedriver-helper
|
||||||
climate_control
|
climate_control
|
||||||
cloudinary
|
cloudinary
|
||||||
cocoon
|
cocoon
|
||||||
|
|
@ -621,6 +628,7 @@ DEPENDENCIES
|
||||||
font-awesome-rails
|
font-awesome-rails
|
||||||
formtastic (~> 3.1.5)
|
formtastic (~> 3.1.5)
|
||||||
formtastic-bootstrap
|
formtastic-bootstrap
|
||||||
|
geckodriver-helper
|
||||||
gravtastic
|
gravtastic
|
||||||
guard-rspec
|
guard-rspec
|
||||||
haml-rails
|
haml-rails
|
||||||
|
|
@ -645,9 +653,7 @@ DEPENDENCIES
|
||||||
omniauth-openid
|
omniauth-openid
|
||||||
paper_trail
|
paper_trail
|
||||||
pg
|
pg
|
||||||
phantomjs
|
|
||||||
piwik_analytics (~> 1.0.1)
|
piwik_analytics (~> 1.0.1)
|
||||||
poltergeist
|
|
||||||
prawn-qrcode (~> 0.2.2.1)
|
prawn-qrcode (~> 0.2.2.1)
|
||||||
prawn_rails
|
prawn_rails
|
||||||
puma (~> 3.0)
|
puma (~> 3.0)
|
||||||
|
|
@ -680,6 +686,7 @@ DEPENDENCIES
|
||||||
ruby-oembed (~> 0.12.0)
|
ruby-oembed (~> 0.12.0)
|
||||||
sass-rails (>= 4.0.2)
|
sass-rails (>= 4.0.2)
|
||||||
selectize-rails
|
selectize-rails
|
||||||
|
selenium-webdriver
|
||||||
shoulda-matchers
|
shoulda-matchers
|
||||||
skylight
|
skylight
|
||||||
spring-commands-rspec
|
spring-commands-rspec
|
||||||
|
|
|
||||||
|
|
@ -115,3 +115,12 @@
|
||||||
# Speeds up turn around times of tests
|
# Speeds up turn around times of tests
|
||||||
# OSEM_FACTORY_LINT=false
|
# OSEM_FACTORY_LINT=false
|
||||||
|
|
||||||
|
# How should browser tests be performed?
|
||||||
|
# For headless Chrome (default):
|
||||||
|
# OSEM_TEST_DRIVER=chrome_headless
|
||||||
|
# For Chrome:
|
||||||
|
# OSEM_TEST_DRIVER=chrome
|
||||||
|
# For headless Firefox:
|
||||||
|
# OSEM_TEST_DRIVER=firefox_headless
|
||||||
|
# For Firefox:
|
||||||
|
# OSEM_TEST_DRIVER=firefox
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,7 @@ require 'shoulda/matchers'
|
||||||
# all migrations applied
|
# all migrations applied
|
||||||
ActiveRecord::Migration.maintain_test_schema!
|
ActiveRecord::Migration.maintain_test_schema!
|
||||||
|
|
||||||
# Add poltergeist to use it as JS driver
|
require 'selenium/webdriver'
|
||||||
require 'capybara/poltergeist'
|
|
||||||
require 'phantomjs'
|
|
||||||
|
|
||||||
# Adds rspec helper provided by paper_trail
|
# Adds rspec helper provided by paper_trail
|
||||||
# makes it easier to control when PaperTrail is enabled during testing.
|
# makes it easier to control when PaperTrail is enabled during testing.
|
||||||
|
|
@ -59,18 +57,37 @@ RSpec.configure do |config|
|
||||||
# --seed 1234
|
# --seed 1234
|
||||||
config.order = 'random'
|
config.order = 'random'
|
||||||
|
|
||||||
# poltergeist as a underlying mech for Capybara
|
Capybara.register_driver :firefox do |app|
|
||||||
Capybara.javascript_driver = :poltergeist
|
Capybara::Selenium::Driver.new(app, browser: :firefox)
|
||||||
|
end
|
||||||
|
|
||||||
Capybara.register_driver :poltergeist do |app|
|
Capybara.register_driver :chrome do |app|
|
||||||
Capybara::Poltergeist::Driver.new(
|
Capybara::Selenium::Driver.new(app, browser: :chrome)
|
||||||
app,
|
end
|
||||||
phantomjs: Phantomjs.path,
|
|
||||||
js_errors: false,
|
Capybara.register_driver :firefox_headless do |app|
|
||||||
window_size: [1920, 1080]
|
options = Selenium::WebDriver::Firefox::Options.new
|
||||||
|
options.args << '--headless'
|
||||||
|
options.args << '--window-size=1920,1080'
|
||||||
|
Capybara::Selenium::Driver.new(app, browser: :firefox, options: options)
|
||||||
|
end
|
||||||
|
|
||||||
|
Capybara.register_driver :chrome_headless do |app|
|
||||||
|
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
|
||||||
|
chromeOptions: { args: %w(headless disable-gpu) }
|
||||||
|
)
|
||||||
|
Capybara::Selenium::Driver.new(
|
||||||
|
app, browser: :chrome, desired_capabilities: capabilities
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Capybara.default_max_wait_time = 10 # seconds
|
||||||
|
|
||||||
|
# use a real browser for JS tests
|
||||||
|
Capybara.javascript_driver = (
|
||||||
|
ENV['OSEM_TEST_DRIVER'].try(:to_sym) || :chrome_headless
|
||||||
|
)
|
||||||
|
|
||||||
# Includes helpers and connect them to specific types of tests
|
# Includes helpers and connect them to specific types of tests
|
||||||
config.include FactoryBot::Syntax::Methods
|
config.include FactoryBot::Syntax::Methods
|
||||||
config.include OmniauthMacros
|
config.include OmniauthMacros
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue