Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manage browser drivers with webdriver gem #2097

Merged
merged 1 commit into from
Jan 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ group :test do
gem "selenium-webdriver"
gem "shoulda-matchers"
gem "timecop"
gem "webdrivers"
gem "webmock"
gem "xpath", "3.2.0"
end
Expand Down
5 changes: 5 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,10 @@ GEM
unicorn (6.0.0)
kgio (~> 2.6)
raindrops (~> 0.7)
webdrivers (5.0.0)
nokogiri (~> 1.6)
rubyzip (>= 1.3.0)
selenium-webdriver (~> 4.0)
webmock (3.14.0)
addressable (>= 2.8.0)
crack (>= 0.3.2)
Expand Down Expand Up @@ -352,6 +356,7 @@ DEPENDENCIES
timecop
uglifier
unicorn
webdrivers
webmock
xpath (= 3.2.0)
yard
Expand Down
5 changes: 0 additions & 5 deletions bin/setup
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ bundle exec rake db:setup dev:prime
# Add binstubs to PATH via export PATH=".git/safe/../../bin:$PATH" in ~/.zshenv
mkdir -p .git/safe

if ! command -v chromedriver > /dev/null; then
printf 'chromedriver is not installed.\n'
printf 'See https://chromedriver.chromium.org for install instructions.\n'
fi

# Only if this isn't CI
# if [ -z "$CI" ]; then
# fi
4 changes: 0 additions & 4 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
require "webmock/rspec"

# http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
RSpec.configure do |config|
config.expect_with :rspec do |expectations|
Expand All @@ -12,5 +10,3 @@

config.order = :random
end

WebMock.disable_net_connect!(allow_localhost: true)
11 changes: 11 additions & 0 deletions spec/support/webmock.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
require "webmock/rspec"

# Allow downloading webdrivers for Selenium
driver_hosts = Webdrivers::Common.subclasses.
map { |driver| URI(driver.base_url).host }

# Downloading the Firefox driver involves a redirect
driver_hosts += ["github-releases.githubusercontent.com"]

# Additionally, avoid conflict with Selenium (localhost)
WebMock.disable_net_connect!(allow_localhost: true, allow: driver_hosts)