Skip to content

Commit

Permalink
Fix capy
Browse files Browse the repository at this point in the history
  • Loading branch information
hunchr committed Nov 6, 2024
1 parent a42bccf commit da7ed04
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions spec/dummy/spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
# frozen_string_literal: true

ENV["RAILS_ENV"] = "test"
DRIVER = ENV.fetch("SELENIUM_DRIVER", "firefox_headless").to_sym

require_relative "../config/environment"
require "database_cleaner-active_record"
require "rspec/rails"
require "selenium-webdriver"

ActiveRecord::Migration.maintain_test_schema!

%i[firefox firefox_headless].each do |driver|
Capybara.register_driver driver do |app|
options = Selenium::WebDriver::Firefox::Options.new.tap do |opts|
opts.args << "--headless" if driver.to_s.include? "headless"
opts.page_load_strategy = :none
end

args = ["--headless"] if driver == :firefox_headless
options = Selenium::WebDriver::Firefox::Options.new args: args
Capybara::Selenium::Driver.new app, browser: :firefox, options: options
end
end

Capybara.default_driver = :rack_test
Capybara.javascript_driver = DRIVER
ActiveRecord::Migration.maintain_test_schema!

RSpec.configure do |config|
Kernel.srand config.seed

Expand All @@ -34,7 +34,7 @@

config.before :all, type: :system do
FileUtils.rm_rf Rails.root.join "tmp/capybara"
driven_by ENV.fetch("SELENIUM_DRIVER", "firefox_headless").to_sym, screen_size: [1280, 800]
driven_by DRIVER, screen_size: [1280, 800]
end

config.before :each, type: :system do
Expand Down

0 comments on commit da7ed04

Please sign in to comment.