diff --git a/.rspec b/.rspec index 998ed98d..09127182 100644 --- a/.rspec +++ b/.rspec @@ -1,3 +1,2 @@ --color --order random ---format documentation diff --git a/Dockerfile b/Dockerfile index b19fdb95..330f15a5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,8 +18,6 @@ RUN apk update && apk --no-cache --quiet add \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \ && adduser -D -g '' deploy -ENV CHROMEDRIVER_PATH=/usr/bin/chromedriver - RUN gem install bundler && \ bundle config --global frozen 1 diff --git a/Gemfile b/Gemfile index e524dd73..b1746ae9 100644 --- a/Gemfile +++ b/Gemfile @@ -55,7 +55,6 @@ group :development, :test do gem "pry-byebug" gem "rspec-rails" gem "standard" - gem "webdrivers" end group :development do diff --git a/Gemfile.lock b/Gemfile.lock index ad62e7fd..55e8d28e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -67,8 +67,8 @@ GEM minitest (>= 5.1) tzinfo (~> 2.0) zeitwerk (~> 2.3) - addressable (2.8.0) - public_suffix (>= 2.0.2, < 5.0) + addressable (2.8.7) + public_suffix (>= 2.0.2, < 7.0) amq-protocol (2.3.2) artsy-auth (0.2.0) omniauth-artsy (>= 0.4.0) @@ -97,6 +97,7 @@ GEM aws-sigv4 (1.8.0) aws-eventstream (~> 1, >= 1.0.2) backport (1.2.0) + base64 (0.2.0) benchmark (0.4.0) bigdecimal (3.1.8) bootsnap (1.18.4) @@ -114,15 +115,15 @@ GEM bunny (2.17.0) amq-protocol (~> 2.3, >= 2.3.1) byebug (11.1.3) - capybara (3.35.3) + capybara (3.40.0) addressable + matrix mini_mime (>= 0.1.3) - nokogiri (~> 1.8) + nokogiri (~> 1.11) rack (>= 1.6.0) rack-test (>= 0.6.3) regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) - childprocess (3.0.0) coderay (1.1.3) coffee-rails (5.0.0) coffee-script (>= 2.2.0) @@ -272,6 +273,7 @@ GEM listen (3.4.1) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) + logger (1.6.2) loofah (2.23.1) crass (~> 1.0.2) nokogiri (>= 1.12.0) @@ -282,6 +284,7 @@ GEM net-pop net-smtp marcel (1.0.2) + matrix (0.4.2) method_source (1.0.0) mini_mime (1.1.5) mini_portile2 (2.8.8) @@ -352,11 +355,11 @@ GEM pry-byebug (3.9.0) byebug (~> 11.0) pry (~> 0.13.0) - public_suffix (4.0.6) + public_suffix (6.0.1) puma (5.6.9) nio4r (~> 2.0) racc (1.8.1) - rack (2.2.8.1) + rack (2.2.10) rack-cors (1.1.1) rack (>= 2.0.0) rack-livereload (0.3.17) @@ -409,7 +412,7 @@ GEM ffi (~> 1.0) redcarpet (3.5.1) redis (4.8.1) - regexp_parser (2.9.2) + regexp_parser (2.9.3) restforce (5.3.0) faraday (>= 0.9.0, <= 1.10.0) faraday_middleware (>= 0.8.8, <= 2.0) @@ -458,7 +461,7 @@ GEM ruby2_keywords (0.0.5) ruby_parser (3.15.1) sexp_processor (~> 4.9) - rubyzip (2.3.0) + rubyzip (2.3.2) sass (3.7.4) sass-listen (~> 4.0.0) sass-listen (4.0.0) @@ -474,9 +477,12 @@ GEM sprockets (> 3.0) sprockets-rails tilt - selenium-webdriver (3.142.7) - childprocess (>= 0.5, < 4.0) - rubyzip (>= 1.2.2) + selenium-webdriver (4.26.0) + base64 (~> 0.2) + logger (~> 1.4) + rexml (~> 3.2, >= 3.2.5) + rubyzip (>= 1.2.2, < 3.0) + websocket (~> 1.0) sentry-rails (5.21.0) railties (>= 5.0) sentry-ruby (~> 5.21.0) @@ -540,14 +546,11 @@ GEM uniform_notifier (1.16.0) unleash (4.0.0) murmurhash3 (~> 0.1.6) - webdrivers (4.6.0) - nokogiri (~> 1.6) - rubyzip (>= 1.3.0) - selenium-webdriver (>= 3.0, < 4.0) webmock (3.12.2) addressable (>= 2.3.6) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) + websocket (1.2.11) websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) @@ -618,7 +621,6 @@ DEPENDENCIES uglifier unleash watt! - webdrivers webmock yarjuf diff --git a/Rakefile b/Rakefile index e483f9a1..82e303b4 100644 --- a/Rakefile +++ b/Rakefile @@ -21,7 +21,6 @@ if Rails.env.development? || Rails.env.test? abort "schema-check failed" unless $CHILD_STATUS.exitstatus.zero? end - require "standard/rake" Rake::Task[:default].clear task default: %i[schema_check standard spec] end diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 66d2fd8c..22afc23f 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -13,8 +13,7 @@ require "rack_session_access/capybara" WebMock.disable_net_connect!( - allow_localhost: true, - allow: "chromedriver.storage.googleapis.com" + allow_localhost: true ) ActiveRecord::Migration.maintain_test_schema! @@ -53,39 +52,25 @@ end end -Capybara.server = :puma, {Silent: true} Capybara.configure do |config| - config.javascript_driver = - ENV["NO_HEADLESS"] ? :selenium_chrome : :headless_chrome + config.javascript_driver = :headless_chrome config.default_max_wait_time = 10 config.ignore_hidden_elements = false end -def prepare_chromedriver(selenium_driver_args) - if (driver_path = ENV["CHROMEDRIVER_PATH"]) - service = Selenium::WebDriver::Service.new(path: driver_path, port: 9_005) - selenium_driver_args[:service] = service - else - require "webdrivers/chromedriver" - end -end - Capybara.register_driver :headless_chrome do |app| - caps = - Selenium::WebDriver::Remote::Capabilities.chrome( - loggingPrefs: { - browser: "ALL" - } - ) - opts = Selenium::WebDriver::Chrome::Options.new(options: {"w3c" => false}) + opts = Selenium::WebDriver::Chrome::Options.new opts.add_argument("--headless") opts.add_argument("--no-sandbox") + opts.add_argument("--disable-dev-shm-usage") opts.add_argument("--window-size=1440,900") + opts.add_preference(:loggingPrefs, {browser: "ALL"}) - args = {browser: :chrome, options: opts, desired_capabilities: caps} - - prepare_chromedriver(args) + args = { + browser: :chrome, + options: opts + } Capybara::Selenium::Driver.new(app, **args) end