class WatchDoge::Configuration

Attributes

base_dir[RW]
chrome_version[RW]
default_worker_options[R]
engine[RW]
firefox_version[RW]
hooks[RW]
host[RW]
notifications[RW]
regression_dir[RW]
sign_in_proc[RW]
sign_out_proc[RW]
web_drivers_dir[RW]
worker_options[RW]

Public Class Methods

new() click to toggle source
# File lib/watchdoge/configuration.rb, line 53
def initialize
  # base_dir is where WatchDoge stuff operating include installation or configuration
  @base_dir =
    if defined? Rails
      Rails.root.to_s
    else
      Dir.pwd
    end

  # webdrivers binaries installation directory
  @web_drivers_dir = @base_dir + "/.webdrivers"


  # framwork that Worker used, default to selenium
  @engine = Watir::Browser

  # options for worker
  @default_worker_options = {
    # default window-size of worker
    width: 1280,
    height: 768,

    # using Firfox as default browser
    browser: :firefox,

    # default to headless
    headless: true,

    # connection timeout threshold(seconds)
    timeout: 120
  }

  @worker_options = {}

  # where all cookie saved (as yaml)
  @cookie_pool = @base_dir + '/.doge_cookie'

  # map of notification sources
  #   key: must be stringify of its class name
  #   value: hash struct, will passed to constructor while push message
  @notifications = {
    # slack_webhook: {
    #   incoming_url: SLACK_WEBHOOK
    # }

    # mattermost: {
    #   host: HOST,
    #   channel_id: CHANNEL_ID,
    #   auth_token: AUTH_TOKEN
    # }
  }

  # host for relative URL in regression test.
  @host = ''

  # regression directory contains reference images and scenario scripts
  @regression_dir =
    if defined?(Rails)
      @base_dir + "/test/watchdoge"
    else
      @base_dir + "/watchdoge"
    end

  @hooks = WatchDoge::Configuration::Hooks.new

  # Proc for #sign_in_as(resource) in regression scenario
  #   worker: WatchDoge instance that executing scnario
  #   resource: passed whatever you want
  @sign_in_proc = -> (worker, resource) {}
  @sign_out_proc = -> (worker, resource) {}

  # specific webdriver version, default to latest if nil
  @chrome_version = nil
  @firefox_version = nil
end