Created
December 27, 2022 16:16
-
-
Save garyharan/e11111ac47cd82804d81ff9ad7dca73b to your computer and use it in GitHub Desktop.
How to test using capybara in latest rails and chrome
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# as per https://rubydoc.info/github/teamcapybara/capybara/master#using-capybara-with-minitest | |
require 'capybara/rails' | |
require 'capybara/minitest' | |
class ActionDispatch::IntegrationTest | |
# Make the Capybara DSL available in all integration tests | |
include Capybara::DSL | |
# Make `assert_*` methods behave like Minitest assertions | |
include Capybara::Minitest::Assertions | |
# Reset sessions and driver between tests | |
teardown do | |
Capybara.reset_sessions! | |
Capybara.use_default_driver | |
end | |
end | |
# To see each step | |
Capybara.default_driver = :selenium_chrome | |
# if you want headless: | |
Capybara.default_driver = :selenium_chrome_headless |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment