watchdoge 0.1.24 → 0.1.28
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/watchdoge/configuration.rb +20 -7
- data/lib/watchdoge/notification/mattermost.rb +1 -1
- data/lib/watchdoge/notification/slack_webhook.rb +1 -1
- data/lib/watchdoge/rails/railtie.rb +2 -4
- data/lib/watchdoge/regression/dsl.rb +13 -6
- data/lib/watchdoge/regression.rb +8 -5
- data/lib/watchdoge/version.rb +1 -1
- data/lib/watchdoge/worker.rb +10 -13
- data/watchdoge.gemspec +2 -2
- metadata +21 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ae7ad3051ac5d1eb15cb6008096e707772f61b9ad52ccf34340b7df8d2ff425
|
4
|
+
data.tar.gz: 68600410dde3c1f93372a35a6e9ddb1d7f77ef2335c91ebac512f2c2e6c9ad7d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 326f1e9de08b859327fabb5b18b77a54d96c5313fe02d5306459c1803cde84e414564a30f126748c1eb889c5107c8f542ed3ea27ae55be66c25b1f737011003e
|
7
|
+
data.tar.gz: 10eb20ed919a1c6aec404951f3c4ad815d93a43f1aecdd81423d852e33c4cd137d9d53500fa01c01ade62eb3660e37540d045ae971605deff49da4aebf87f44d
|
@@ -33,9 +33,10 @@ module WatchDoge
|
|
33
33
|
attr_accessor :web_drivers_dir
|
34
34
|
|
35
35
|
attr_accessor :engine
|
36
|
-
attr_accessor :browser
|
37
36
|
attr_accessor :cookie_pool
|
38
|
-
|
37
|
+
|
38
|
+
attr_reader :default_worker_options
|
39
|
+
attr_accessor :worker_options
|
39
40
|
|
40
41
|
attr_accessor :notifications
|
41
42
|
|
@@ -65,15 +66,27 @@ module WatchDoge
|
|
65
66
|
# framwork that Worker used, default to selenium
|
66
67
|
@engine = Watir::Browser
|
67
68
|
|
68
|
-
#
|
69
|
-
@
|
69
|
+
# options for worker
|
70
|
+
@default_worker_options = {
|
71
|
+
# default window-size of worker
|
72
|
+
width: 1280,
|
73
|
+
height: 768,
|
74
|
+
|
75
|
+
# using Firfox as default browser
|
76
|
+
browser: :firefox,
|
77
|
+
|
78
|
+
# default to headless
|
79
|
+
headless: true,
|
80
|
+
|
81
|
+
# connection timeout threshold(seconds)
|
82
|
+
timeout: 120
|
83
|
+
}
|
84
|
+
|
85
|
+
@worker_options = {}
|
70
86
|
|
71
87
|
# where all cookie saved (as yaml)
|
72
88
|
@cookie_pool = @base_dir + '/.doge_cookie'
|
73
89
|
|
74
|
-
# connection timeout threshold(seconds)
|
75
|
-
@http_timeout = 120
|
76
|
-
|
77
90
|
# map of notification sources
|
78
91
|
# key: must be stringify of its class name
|
79
92
|
# value: hash struct, will passed to constructor while push message
|
@@ -6,17 +6,15 @@ module WatchDoge
|
|
6
6
|
namespace :watchdoge do
|
7
7
|
desc "generating reference images"
|
8
8
|
task :capture => :environment do
|
9
|
+
WatchDoge.initialize!
|
9
10
|
WatchDoge::Regression::Manager.run_all_scenarios :capture
|
10
11
|
end
|
11
12
|
desc "scrap screenshots and compare with reference images"
|
12
13
|
task :test => :environment do
|
14
|
+
WatchDoge.initialize!
|
13
15
|
WatchDoge::Regression::Manager.run_all_scenarios :test
|
14
16
|
end
|
15
17
|
end
|
16
18
|
end
|
17
|
-
|
18
|
-
initializer "watchdoge.initialize" do |app|
|
19
|
-
WatchDoge.initialize!
|
20
|
-
end
|
21
19
|
end
|
22
20
|
end
|
@@ -13,7 +13,14 @@ module WatchDoge
|
|
13
13
|
def use browser
|
14
14
|
puts "[use] browser #{browser}"
|
15
15
|
@worker.close
|
16
|
-
|
16
|
+
|
17
|
+
worker_options =
|
18
|
+
WatchDoge.configuration.default_worker_options.merge WatchDoge.configuration.worker_options
|
19
|
+
|
20
|
+
worker_options = worker_options.dup
|
21
|
+
worker_options[:browser] = browser
|
22
|
+
|
23
|
+
@worker = WatchDoge::Worker.new @scenario_name, worker_options
|
17
24
|
end
|
18
25
|
|
19
26
|
def sign_in_as resoruce
|
@@ -42,20 +49,20 @@ module WatchDoge
|
|
42
49
|
@setup_proc.call if @setup_proc
|
43
50
|
|
44
51
|
args = {
|
45
|
-
|
52
|
+
wait: nil
|
46
53
|
}.merge(kwargs)
|
47
54
|
|
48
|
-
args[:before].call if args[:before]
|
49
|
-
|
50
55
|
@worker.goto path
|
51
56
|
|
52
|
-
if
|
57
|
+
if args[:wait]
|
53
58
|
@view_port.merge!({
|
54
|
-
wait:
|
59
|
+
wait: args[:wait]
|
55
60
|
})
|
56
61
|
end
|
57
62
|
|
58
63
|
@worker.resize_by_viewport(@view_port) do
|
64
|
+
yield(@worker) if block_given?
|
65
|
+
|
59
66
|
case @regression_flag
|
60
67
|
when :capture
|
61
68
|
puts " -> make reference images on worker #{@worker}"
|
data/lib/watchdoge/regression.rb
CHANGED
@@ -23,17 +23,17 @@ module WatchDoge
|
|
23
23
|
WatchDoge.hooks.before_regression.each { |t| instance_exec &t }
|
24
24
|
|
25
25
|
Dir["#{WatchDoge::Regression::Utils.scenarios_dir}/*"].each do |scenario_path|
|
26
|
-
WatchDoge.hooks.before_scenario.each { |t| instance_exec &t }
|
27
|
-
|
28
26
|
mgr = self.new scenario_path, regression_flag: regression_flag
|
29
27
|
|
28
|
+
WatchDoge.hooks.before_scenario.each { |t| mgr.instance_exec &t }
|
29
|
+
|
30
30
|
if WatchDoge.hooks.around_scenario
|
31
31
|
WatchDoge.hooks.around_scenario.call(Proc.new { mgr.eval_scenario })
|
32
32
|
else
|
33
33
|
mgr.eval_scenario
|
34
34
|
end
|
35
35
|
|
36
|
-
WatchDoge.hooks.after_scenario.each { |t| instance_exec &t }
|
36
|
+
WatchDoge.hooks.after_scenario.each { |t| mgr.instance_exec &t }
|
37
37
|
end
|
38
38
|
|
39
39
|
WatchDoge.hooks.after_regression.each { |t| instance_exec &t }
|
@@ -49,14 +49,17 @@ module WatchDoge
|
|
49
49
|
@setup_proc = nil
|
50
50
|
@teardown_proc = nil
|
51
51
|
|
52
|
-
|
52
|
+
worker_options =
|
53
|
+
WatchDoge.configuration.default_worker_options.merge WatchDoge.configuration.worker_options
|
54
|
+
|
55
|
+
@worker = WatchDoge::Worker.new @scenario_name, worker_options.dup
|
53
56
|
|
54
57
|
@view_port = {}
|
55
58
|
end
|
56
59
|
|
57
60
|
def eval_scenario
|
58
61
|
puts "scenario: #{@scenario_name} begin"
|
59
|
-
|
62
|
+
instance_eval File.read(@scenario_path), @scenario_path
|
60
63
|
@worker.close
|
61
64
|
puts "scenario: #{@scenario_name} end\n"
|
62
65
|
puts ""
|
data/lib/watchdoge/version.rb
CHANGED
data/lib/watchdoge/worker.rb
CHANGED
@@ -20,27 +20,24 @@ module WatchDoge
|
|
20
20
|
# 2. height: browser's height, default to 768
|
21
21
|
# 3. http_client: instance of Selenium::WebDriver::Remote::Http
|
22
22
|
# 4. all acceptable arguments of Watir::Browser class
|
23
|
-
def initialize uid, options
|
23
|
+
def initialize uid, options
|
24
24
|
@http = Selenium::WebDriver::Remote::Http::Default.new
|
25
|
-
@browser = WatchDoge.configuration.browser
|
26
25
|
|
27
26
|
# HTTP timeout default to 120 sec
|
28
|
-
@http.read_timeout = options.delete(:timeout)
|
27
|
+
@http.read_timeout = options.delete(:timeout)
|
29
28
|
|
30
|
-
@
|
29
|
+
@browser = options[:browser]
|
31
30
|
|
32
|
-
|
33
|
-
width: 1280,
|
34
|
-
height: 768,
|
35
|
-
headless: true,
|
31
|
+
@uid = uid
|
36
32
|
|
33
|
+
options = {
|
37
34
|
# Selenium HTTP configuration
|
38
35
|
http_client: @http
|
39
|
-
}.merge(options).merge(
|
36
|
+
}.merge(options).merge(default_browser_profile)
|
40
37
|
|
41
38
|
# intall required version driver
|
42
39
|
WatchDoge::WebdriverManager.new @browser
|
43
|
-
@core = WatchDoge.configuration.engine.new @browser,
|
40
|
+
@core = WatchDoge.configuration.engine.new @browser, options
|
44
41
|
|
45
42
|
# for generate uri hash
|
46
43
|
@landed_page = nil
|
@@ -52,8 +49,8 @@ module WatchDoge
|
|
52
49
|
@cookie_loaded = false
|
53
50
|
|
54
51
|
# width/height
|
55
|
-
@width =
|
56
|
-
@height =
|
52
|
+
@width = options[:width]
|
53
|
+
@height = options[:height]
|
57
54
|
@core.window.resize_to @width, @height
|
58
55
|
end
|
59
56
|
|
@@ -105,7 +102,7 @@ module WatchDoge
|
|
105
102
|
|
106
103
|
private
|
107
104
|
|
108
|
-
def
|
105
|
+
def default_browser_profile
|
109
106
|
case @browser
|
110
107
|
when :chrome
|
111
108
|
prefs = {}
|
data/watchdoge.gemspec
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'watchdoge'
|
3
|
-
s.version = '0.1.
|
3
|
+
s.version = '0.1.28'
|
4
4
|
s.date = '2019-07-22'
|
5
5
|
s.summary = "dogi"
|
6
|
-
s.description = "WatchDoge is
|
6
|
+
s.description = "WatchDoge is RubyOnRails-friendly web frontend regression test tool"
|
7
7
|
s.authors = ["Shen Lee"]
|
8
8
|
s.email = 'no-reply@gmail.com'
|
9
9
|
s.files = ["lib/watchdoge.rb"]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: watchdoge
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.28
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shen Lee
|
@@ -48,63 +48,63 @@ dependencies:
|
|
48
48
|
name: webdrivers
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
|
-
- - ">"
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: 4.0.0
|
54
51
|
- - "~>"
|
55
52
|
- !ruby/object:Gem::Version
|
56
53
|
version: '4'
|
54
|
+
- - ">"
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: 4.0.0
|
57
57
|
type: :runtime
|
58
58
|
prerelease: false
|
59
59
|
version_requirements: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
|
-
- - ">"
|
62
|
-
- !ruby/object:Gem::Version
|
63
|
-
version: 4.0.0
|
64
61
|
- - "~>"
|
65
62
|
- !ruby/object:Gem::Version
|
66
63
|
version: '4'
|
64
|
+
- - ">"
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: 4.0.0
|
67
67
|
- !ruby/object:Gem::Dependency
|
68
68
|
name: watir
|
69
69
|
requirement: !ruby/object:Gem::Requirement
|
70
70
|
requirements:
|
71
|
-
- - ">"
|
72
|
-
- !ruby/object:Gem::Version
|
73
|
-
version: 6.16.0
|
74
71
|
- - "~>"
|
75
72
|
- !ruby/object:Gem::Version
|
76
73
|
version: '6.16'
|
74
|
+
- - ">"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 6.16.0
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
|
-
- - ">"
|
82
|
-
- !ruby/object:Gem::Version
|
83
|
-
version: 6.16.0
|
84
81
|
- - "~>"
|
85
82
|
- !ruby/object:Gem::Version
|
86
83
|
version: '6.16'
|
84
|
+
- - ">"
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: 6.16.0
|
87
87
|
- !ruby/object:Gem::Dependency
|
88
88
|
name: multipart-post
|
89
89
|
requirement: !ruby/object:Gem::Requirement
|
90
90
|
requirements:
|
91
|
-
- - ">"
|
92
|
-
- !ruby/object:Gem::Version
|
93
|
-
version: 2.1.0
|
94
91
|
- - "~>"
|
95
92
|
- !ruby/object:Gem::Version
|
96
93
|
version: '2.1'
|
94
|
+
- - ">"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 2.1.0
|
97
97
|
type: :runtime
|
98
98
|
prerelease: false
|
99
99
|
version_requirements: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - ">"
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: 2.1.0
|
104
101
|
- - "~>"
|
105
102
|
- !ruby/object:Gem::Version
|
106
103
|
version: '2.1'
|
107
|
-
|
104
|
+
- - ">"
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: 2.1.0
|
107
|
+
description: WatchDoge is RubyOnRails-friendly web frontend regression test tool
|
108
108
|
email: no-reply@gmail.com
|
109
109
|
executables: []
|
110
110
|
extensions: []
|
@@ -148,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
148
148
|
- !ruby/object:Gem::Version
|
149
149
|
version: '0'
|
150
150
|
requirements: []
|
151
|
-
rubygems_version: 3.
|
151
|
+
rubygems_version: 3.1.4
|
152
152
|
signing_key:
|
153
153
|
specification_version: 4
|
154
154
|
summary: dogi
|