Skip to content

Magic Test and Cuprite

Andrew Culver edited this page Mar 1, 2021 · 3 revisions

For anyone googling for magic_test and cuprite, here's how @drnic configured headless: in the Cuprite::Driver:

# test/support/system/cuprite_setup.rb
require "capybara/cuprite"

Capybara.register_driver(:cuprite) do |app|
  Capybara::Cuprite::Driver.new(
    app,
    **{
      window_size: [1200, 800],
      # See additional options for Dockerized environment in the respective section of this article
      browser_options: {},
      # Increase Chrome startup wait time (required for stable CI builds)
      process_timeout: 10,
      # Enable debugging capabilities
      inspector: true,
      # Allow running Chrome in a headful mode by setting HEADLESS env
      # var to a falsey value
      headless: !ENV["HEADLESS"].in?(%w[n 0 no false]) && !ENV["MAGIC_TEST"].in?(%w[y 1 yes true])
    }
  )
end
...
Clone this wiki locally