Module: EvilSystems::RegisterCuprite
- Defined in:
- lib/evil_systems/register_cuprite.rb
Overview
Cuprite is a modern Capybara driver which uses Chrome CDP API instead of Selenium & co. See github.com/rubycdp/cuprite
Class Method Summary collapse
-
.initial_setup(driver_options: {}) ⇒ void
Registers the Cuprite driver.
Class Method Details
.initial_setup(driver_options: {}) ⇒ void
This method returns an undefined value.
Registers the Cuprite driver. Can be used via: driven_by :evil_cuprite, using: :chrome, screen_size: [1400, 1400] The initial setup prior to the class ApplicationSystemTestCase, runs before the entire test suite.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/evil_systems/register_cuprite.rb', line 12 def self.initial_setup(driver_options: {}) begin require "capybara" require "capybara/cuprite" rescue LoadError return end begin process_timeout = Integer(ENV.fetch("PROCESS_TIMEOUT", 5)) rescue process_timeout = 5 end = RemoteChrome. ::Capybara.register_driver(:evil_cuprite) do |app| ::Capybara::Cuprite::Driver.new( app, **{ window_size: [1200, 800], browser_options: RemoteChrome.connected? ? {"no-sandbox" => nil} : {}, headless: ENV.fetch("CI", "true") == "true", process_timeout: process_timeout, slowmo: ENV.fetch("SLOWMO", 0).to_f, inspector: true }.merge().merge() ) end end |