Skip to content
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: 0 additions & 1 deletion .github/workflows/next-rails.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ jobs:
- name: Prepare spec
run: |
bundle exec rake db:setup --trace
bundle exec bin/rails webdrivers:chromedriver:update
- name: spec/${{ matrix.suite }}
run: bundle exec rake spec:${{ matrix.suite }}
- name: coverage upload ${{ matrix.suite }}
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ jobs:
- name: Prepare spec
run: |
bundle exec rake db:setup --trace
bundle exec bin/rails webdrivers:chromedriver:update
# FIXME: This flickers...
# bundle exec rake factory_bot:lint RAILS_ENV=test --trace
- name: spec/${{ matrix.suite }}
Expand Down
5 changes: 2 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,8 @@ end
group :development, :test do
# n+1 query logging
gem 'bullet'
# as capybara driver
gem 'webdrivers'
gem 'geckodriver-helper'
# as capybara driver; Selenium Manager downloads matching browsers and drivers
gem 'selenium-webdriver'
# as debugger
gem 'byebug'
# to test new rails version
Expand Down
19 changes: 5 additions & 14 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,6 @@ GEM
rake (>= 10.4, < 14.0)
anonymous_loader (0.1.3)
version_gem (~> 1.1, >= 1.1.14)
archive-zip (0.13.1)
io-like (~> 0.4.0)
ast (2.4.3)
auth-sanitizer (0.2.3)
version_gem (~> 1.1, >= 1.1.14)
Expand Down Expand Up @@ -272,8 +270,6 @@ GEM
ffi (1.17.4-x86_64-linux-gnu)
font-awesome-sass (6.7.2)
sassc (~> 2.0)
geckodriver-helper (0.24.0)
archive-zip (~> 0.7)
gitlab (4.20.1)
httparty (~> 0.20)
terminal-table (>= 1.5.1)
Expand Down Expand Up @@ -317,7 +313,6 @@ GEM
mini_magick (>= 4.9.5, < 6)
ruby-vips (>= 2.0.17, < 3)
io-console (0.9.5)
io-like (0.4.0)
irb (1.19.0)
pp (>= 0.6.0)
prism (>= 1.3.0)
Expand Down Expand Up @@ -678,9 +673,10 @@ GEM
faraday (>= 0.17.3, < 3)
securerandom (0.4.1)
selectize-rails (0.12.6)
selenium-webdriver (4.10.0)
rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2, < 3.0)
selenium-webdriver (4.52.0)
base64 (~> 0.2)
logger (~> 1.4)
rubyzip (>= 1.2.2, < 4.0)
websocket (~> 1.0)
sentry-delayed_job (5.26.0)
delayed_job (>= 4.0)
Expand Down Expand Up @@ -754,10 +750,6 @@ GEM
activemodel (>= 6.0.0)
bindex (>= 0.4.0)
railties (>= 6.0.0)
webdrivers (5.3.1)
nokogiri (~> 1.6)
rubyzip (>= 1.3.0)
selenium-webdriver (~> 4.0, < 4.11)
webmock (3.14.0)
addressable (>= 2.8.0)
crack (>= 0.3.2)
Expand Down Expand Up @@ -821,7 +813,6 @@ DEPENDENCIES
faraday-retry
feature
font-awesome-sass
geckodriver-helper
gravtastic
haml-rails
haml_lint
Expand Down Expand Up @@ -882,6 +873,7 @@ DEPENDENCIES
ruby-oembed
sass-rails (>= 4.0.2)
selectize-rails
selenium-webdriver
sentry-delayed_job
sentry-rails
sentry-ruby
Expand All @@ -898,7 +890,6 @@ DEPENDENCIES
uglifier (>= 1.3.0)
unobtrusive_flash (>= 3)
web-console
webdrivers
webmock
whenever

Expand Down
19 changes: 5 additions & 14 deletions Gemfile.next.lock
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,6 @@ GEM
annotate (2.6.5)
activerecord (>= 2.3.0)
rake (>= 0.8.7)
archive-zip (0.12.0)
io-like (~> 0.3.0)
ast (2.4.3)
autoprefixer-rails (10.3.1.0)
execjs (~> 2)
Expand Down Expand Up @@ -271,8 +269,6 @@ GEM
ffi (1.15.3)
font-awesome-sass (6.7.2)
sassc (~> 2.0)
geckodriver-helper (0.24.0)
archive-zip (~> 0.7)
gitlab (4.20.1)
httparty (~> 0.20)
terminal-table (>= 1.5.1)
Expand Down Expand Up @@ -320,7 +316,6 @@ GEM
mini_magick (>= 4.9.5, < 5)
ruby-vips (>= 2.0.17, < 3)
io-console (0.8.1)
io-like (0.3.1)
irb (1.15.2)
pp (>= 0.6.0)
rdoc (>= 4.0.0)
Expand Down Expand Up @@ -662,9 +657,10 @@ GEM
faraday (>= 0.17.3, < 3)
securerandom (0.4.1)
selectize-rails (0.12.6)
selenium-webdriver (4.10.0)
rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2, < 3.0)
selenium-webdriver (4.52.0)
base64 (~> 0.2)
logger (~> 1.4)
rubyzip (>= 1.2.2, < 4.0)
websocket (~> 1.0)
sentry-delayed_job (5.8.0)
delayed_job (>= 4.0)
Expand Down Expand Up @@ -742,10 +738,6 @@ GEM
activemodel (>= 6.0.0)
bindex (>= 0.4.0)
railties (>= 6.0.0)
webdrivers (5.3.1)
nokogiri (~> 1.6)
rubyzip (>= 1.3.0)
selenium-webdriver (~> 4.0, < 4.11)
webmock (3.14.0)
addressable (>= 2.8.0)
crack (>= 0.3.2)
Expand Down Expand Up @@ -803,7 +795,6 @@ DEPENDENCIES
faraday-retry
feature
font-awesome-sass
geckodriver-helper
gravtastic
haml-rails
haml_lint
Expand Down Expand Up @@ -864,6 +855,7 @@ DEPENDENCIES
ruby-oembed
sass-rails (>= 4.0.2)
selectize-rails
selenium-webdriver
sentry-delayed_job
sentry-rails
sentry-ruby
Expand All @@ -880,7 +872,6 @@ DEPENDENCIES
uglifier (>= 1.3.0)
unobtrusive_flash (>= 3)
web-console
webdrivers
webmock
whenever

Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

require 'rspec/rails'
require 'shoulda/matchers'
require 'webdrivers'
require 'selenium-webdriver'

# To avoid confusion on missed migrations - use Rails 4 checker to ensure
# all migrations applied
Expand Down
9 changes: 1 addition & 8 deletions spec/support/external_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,7 @@
# Mock external requests to youtube
require 'webmock/rspec'

driver_urls = Webdrivers::Common.subclasses.map do |driver|
Addressable::URI.parse(driver.base_url).host
end
# Local chromedriver pings many sites. :(
driver_urls << 'googlechromelabs.github.io'
driver_urls << 'edgedl.me.gvt1.com' # The fuck, Google?
driver_urls << 'storage.googleapis.com'
WebMock.disable_net_connect!(allow_localhost: true, allow: [*driver_urls, /stripe.com/])
WebMock.disable_net_connect!(allow_localhost: true, allow: [/stripe.com/])

RSpec.configure do |config|
config.before do
Expand Down
20 changes: 20 additions & 0 deletions spec/support/stale_node_retry.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# frozen_string_literal: true

# Chrome 157's chromedriver reports an element from a replaced document
# (e.g. after a Turbolinks visit) as an "unknown error" instead of a stale
# element reference. Capybara only retries the latter, so translate it.
module StaleNodeAsStaleElement
STALE_NODE = /Node with given id does not belong to the document/

private

def execute(*)
super
rescue Selenium::WebDriver::Error::UnknownError => e
raise unless e.message.match?(STALE_NODE)

raise Selenium::WebDriver::Error::StaleElementReferenceError.new(e.message)
end
end

Selenium::WebDriver::Remote::Bridge.prepend(StaleNodeAsStaleElement)
12 changes: 3 additions & 9 deletions spec/support/webmock.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
# frozen_string_literal: true

# Allow webdriver update urls
# from https://github.com/titusfortner/webdrivers/wiki/Using-with-VCR-or-WebMock
allowed_urls = Webdrivers::Common.subclasses.map(&:base_url)
allowed_urls << /geckodriver/
# We've seen [a redirect](https://github.com/titusfortner/webdrivers/issues/204) to this domain
allowed_urls += ['github-releases.githubusercontent.com']
allowed_urls += ['googlechromelabs.github.io']
allowed_urls += ['storage.googleapis.com']
# Selenium Manager fetches browsers and drivers in its own process,
# so WebMock never sees those requests.

# Allow stripe.com for stripe integration tests
allowed_urls += ['stripe.com']
allowed_urls = ['stripe.com']

WebMock.disable_net_connect!(allow_localhost: true, allow: allowed_urls)
Loading