Class: WatchDoge::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/watchdoge/configuration.rb

Defined Under Namespace

Classes: Hooks

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/watchdoge/configuration.rb', line 50

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

  # default browser used by engine
  @browser = :firefox

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

  # connection timeout threshold(seconds)
  @http_timeout = 120

  # 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

Instance Attribute Details

#base_dirObject

Returns the value of attribute base_dir.



29
30
31
# File 'lib/watchdoge/configuration.rb', line 29

def base_dir
  @base_dir
end

#browserObject

Returns the value of attribute browser.



34
35
36
# File 'lib/watchdoge/configuration.rb', line 34

def browser
  @browser
end

#chrome_versionObject

Returns the value of attribute chrome_version.



47
48
49
# File 'lib/watchdoge/configuration.rb', line 47

def chrome_version
  @chrome_version
end

Returns the value of attribute cookie_pool.



35
36
37
# File 'lib/watchdoge/configuration.rb', line 35

def cookie_pool
  @cookie_pool
end

#engineObject

Returns the value of attribute engine.



33
34
35
# File 'lib/watchdoge/configuration.rb', line 33

def engine
  @engine
end

#firefox_versionObject

Returns the value of attribute firefox_version.



48
49
50
# File 'lib/watchdoge/configuration.rb', line 48

def firefox_version
  @firefox_version
end

#hooksObject

Returns the value of attribute hooks.



43
44
45
# File 'lib/watchdoge/configuration.rb', line 43

def hooks
  @hooks
end

#hostObject

Returns the value of attribute host.



40
41
42
# File 'lib/watchdoge/configuration.rb', line 40

def host
  @host
end

#http_timeoutObject

Returns the value of attribute http_timeout.



36
37
38
# File 'lib/watchdoge/configuration.rb', line 36

def http_timeout
  @http_timeout
end

#notificationsObject

Returns the value of attribute notifications.



38
39
40
# File 'lib/watchdoge/configuration.rb', line 38

def notifications
  @notifications
end

#regression_dirObject

Returns the value of attribute regression_dir.



41
42
43
# File 'lib/watchdoge/configuration.rb', line 41

def regression_dir
  @regression_dir
end

#sign_in_procObject

Returns the value of attribute sign_in_proc.



44
45
46
# File 'lib/watchdoge/configuration.rb', line 44

def 
  @sign_in_proc
end

#sign_out_procObject

Returns the value of attribute sign_out_proc.



45
46
47
# File 'lib/watchdoge/configuration.rb', line 45

def sign_out_proc
  @sign_out_proc
end

#web_drivers_dirObject

Returns the value of attribute web_drivers_dir.



31
32
33
# File 'lib/watchdoge/configuration.rb', line 31

def web_drivers_dir
  @web_drivers_dir
end