Skip to content
This repository has been archived by the owner on Dec 21, 2022. It is now read-only.

[WIP] Chrome #5

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Chrome Driver
yih-en committed Nov 5, 2018

Verified

This commit was signed with the committer’s verified signature.
Ana06 Ana María Martínez Gómez
commit 789b3d327f19522e562f86dc42a7fa3d1cc5b795
25 changes: 24 additions & 1 deletion lib/intransient_capybara/intransient_capybara_test.rb
Original file line number Diff line number Diff line change
@@ -14,11 +14,34 @@ class IntransientCapybaraTest < ActionDispatch::IntegrationTest
@@warm_asset_cache = Concurrent::AtomicReference.new(false)
@@warming_asset_cache = Concurrent::AtomicReference.new(false)




Capybara.register_driver :chrome do |app|
options = Selenium::WebDriver::Chrome::Options.new(
args: %w[headless disable-gpu no-sandbox]
)
driver = Capybara::Selenium::Driver.new(app, browser: :chrome, options: options)
driver_capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
# see
# https://robots.thoughtbot.com/headless-feature-specs-with-chrome
# https://developers.google.com/web/updates/2017/04/headless-chrome
chromeOptions: {
args: %w(headless disable-gpu no-sandbox),
# https://github.com/heroku/heroku-buildpack-google-chrome#selenium
binary: ENV.fetch('GOOGLE_CHROME_SHIM', nil)
}.reject { |_, v| v.nil? }
)

if ENV['SELENIUM_DRIVER_URL'].present?
Capybara::Selenium::Driver.new(
app,
browser: :remote,
url: ENV.fetch('SELENIUM_DRIVER_URL'),
desired_capabilities: driver_capabilities
)
else
Capybara::Selenium::Driver.new(app, browser: :chrome, options: options)
end
end

Capybara.default_max_wait_time = 10
2 changes: 1 addition & 1 deletion lib/intransient_capybara/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module IntransientCapybara
VERSION = "1.0.3"
VERSION = "1.0.6.pre"
end