Created
October 23, 2021 04:15
-
-
Save nishio-dens/c64245eb143e9c3b22b9d7b9f93f25d2 to your computer and use it in GitHub Desktop.
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
require "bundler/inline" | |
gemfile(true) do | |
source "https://rubygems.org" | |
git_source(:github) { |repo| "https://github.com/#{repo}.git" } | |
gem "capybara" | |
gem "rspec" | |
gem "webdrivers" | |
gem "debug" | |
end | |
require "debug" | |
require "capybara/rspec" | |
require "capybara/dsl" | |
Capybara.configure do |config| | |
config.run_server = false | |
config.default_driver = :selenium_chrome | |
config.javascript_driver = :selenium_chrome | |
config.app_host = "https://example.com" | |
end | |
require "rspec/expectations" | |
require "rspec/autorun" | |
RSpec.configure do |config| | |
config.include Capybara::DSL | |
config.before(:each) do |example| | |
if example.metadata[:session] == :another_session | |
Capybara.session_name = :another_session | |
else | |
Capybara.session_name = :session | |
end | |
end | |
end | |
RSpec.describe "Debug Test" do | |
it "access 1" do | |
visit "/" | |
end | |
it "access 2", session: :another_session do | |
# does not end Chrome normally | |
visit "/" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment