Skip to content

Commit 31adcf5

Browse files
committed
fix selenium specs
1 parent 1e8553d commit 31adcf5

File tree

4 files changed

+14
-19
lines changed

4 files changed

+14
-19
lines changed

Gemfile

+1
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ group :development, :test do
7272
end
7373

7474
group :test do
75+
gem 'webrick'
7576
gem 'capybara'
7677
gem 'selenium-webdriver'
7778
gem 'webdrivers'

Gemfile.lock

+4-2
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ GEM
159159
devise-i18n (1.11.0)
160160
devise (>= 4.9.0)
161161
diff-lcs (1.5.0)
162-
dynamic_form (1.1.4)
162+
dynamic_form (1.2.0)
163163
email_reply_parser_ffcrm (0.5.0)
164164
erubi (1.12.0)
165165
execjs (2.8.1)
@@ -403,7 +403,7 @@ GEM
403403
sprockets-rails
404404
tilt
405405
select2-rails (4.0.13)
406-
selenium-webdriver (4.9.0)
406+
selenium-webdriver (4.10.0)
407407
rexml (~> 3.2, >= 3.2.5)
408408
rubyzip (>= 1.2.2, < 3.0)
409409
websocket (~> 1.0)
@@ -439,6 +439,7 @@ GEM
439439
nokogiri (~> 1.6)
440440
rubyzip (>= 1.3.0)
441441
selenium-webdriver (~> 4.0)
442+
webrick (1.8.1)
442443
websocket (1.2.9)
443444
websocket-driver (0.7.5)
444445
websocket-extensions (>= 0.1.0)
@@ -529,6 +530,7 @@ DEPENDENCIES
529530
tzinfo-data
530531
uglifier
531532
webdrivers
533+
webrick
532534
will_paginate
533535
zeus
534536

lib/fat_free_crm/errors.rb

+2-10
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,8 @@ def self.included(base)
2121
end
2222
end
2323

24-
def each_with_explicit_error
25-
attribute_names.each do |attribute|
26-
self[attribute].each do |error|
27-
if error.start_with?('^')
28-
yield :base, error[1..-1] # Drop the attribute.
29-
else
30-
yield attribute, error # This is default Rails3 behavior.
31-
end
32-
end
33-
end
24+
def each_with_explicit_error(&block)
25+
@errors.each(&block)
3426
end
3527
end
3628
end

spec/features/support/browser.rb

+7-7
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@
1111

1212
if ENV['BROWSER'] == 'chrome'
1313
Capybara.register_driver :selenium do |app|
14-
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(chromeOptions: { args: %w[no-sandbox headless disable-gpu] })
15-
Capybara::Selenium::Driver.new(app, browser: :chrome, desired_capabilities: capabilities)
14+
options = Selenium::WebDriver::Remote::Capabilities.chrome(chromeOptions: { args: %w[no-sandbox headless disable-gpu] })
15+
Capybara::Selenium::Driver.new(app, browser: :chrome, options: options)
1616
end
1717
else
1818
# For local testing in an environment with a display or remote X server configured
1919
# such as WSL2, use NO_HEADLESS=1 bundle exec rspec spec/features
2020
#
21-
# For modern firefox, use MARIONETTE=1 bundle exec rspec spec/features
21+
# NB the marionette setting is deprecated. For modern firefox, install the geckodriver.
2222
Capybara.register_driver :selenium do |app|
23-
options = Selenium::WebDriver::Firefox::Options.new
24-
options.args << '--headless' unless ENV['NO_HEADLESS'].present?
25-
capabilities = Selenium::WebDriver::Remote::Capabilities.firefox(marionette: ENV['MARIONETTE'].present?)
26-
Capybara::Selenium::Driver.new(app, browser: :firefox, options: options, desired_capabilities: capabilities)
23+
options = Selenium::WebDriver::Options.firefox
24+
options.add_argument('-headless') unless ENV['NO_HEADLESS'].present?
25+
26+
Capybara::Selenium::Driver.new(app, browser: :firefox, options: options)
2727
end
2828
end

0 commit comments

Comments
 (0)