Sha256: b0cf65a8e53382e28871704b0990864ad485395ddc281b1e97ec90821336eb11

Contents?: true

Size: 1.55 KB

Versions: 1

Compression:

Stored size: 1.55 KB

Contents

require 'minitest'
require 'minitest/unit'
require 'minitest/autorun'
require 'minitest/pride'
require 'fileutils'
require 'capybara/dsl'
require 'selenium-webdriver'

timeout = (ENV['CI'] || ENV['CI_SERVER']) ? 60 : 30

Capybara.register_driver :chrome do |app|

  capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
    # This enables access to logs with `page.driver.manage.get_log(:browser)`
    loggingPrefs: {
      browser: "ALL",
      client: "ALL",
      driver: "ALL",
      server: "ALL"
    }
  )

  #client.timeout = 10

  options = Selenium::WebDriver::Chrome::Options.new

  options.add_argument("window-size=1240,1400")

  # Chrome won't work properly in a Docker container in sandbox mode
  options.add_argument("no-sandbox")

  # Run headless by default unless CHROME_HEADLESS specified
  unless ENV['CHROME_HEADLESS'] =~ /^(false|no|0)$/i
    options.add_argument("headless")

    # Chrome documentation says this flag is needed for now
    # https://developers.google.com/web/updates/2017/04/headless-chrome#cli
    options.add_argument("disable-gpu")
  end

  # Disable /dev/shm use in CI. See https://gitlab.com/gitlab-org/gitlab-ee/issues/4252
  options.add_argument("disable-dev-shm-usage") if ENV['CI'] || ENV['CI_SERVER']

  Capybara::Selenium::Driver.new(
    app,
    browser: :chrome,
    desired_capabilities: capabilities,
    options: options
  )

end

Capybara.javascript_driver = :chrome
Capybara.default_max_wait_time = timeout
Capybara.ignore_hidden_elements = false
Capybara.app_host = ENV['BASEURL']
Capybara.default_driver = :chrome

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
capybara_typo3_browsertesting-0.1.5 lib/capybara_typo3_browsertesting/init_dependencies.rb