I mainly recorded it because I had trouble installing the chrome driver.
Gemfile
group :test do
gem 'rspec-rails'
gem 'capybara'
gem 'selenium-webdriver'
end
①
$ brew install chromedriver
Run'brew install chromedriver' on terminal Note: (Run in the root directory of your PC)
② Update to the latest version
$ brew update chromedriver
spec/rails_helper.rb
RSpec.configure dp |config|
#Other description
config.before(:each) do |example|
if example.metadata[:type] == :system
if example.metadata[:js]
driven_by :selenium_chrome_headless, screen_size: [1400, 1400]
else
driven_by :rack_test
end
end
end
#Description for using capybara
config.include Capybara::DSL
end
I wrote an article like this I don't know why, but in rails_helper.rb It worked fine with metadata [: js].
I would be grateful if anyone could give me some advice.
Recommended Posts