webdrone 1.10.0 → 1.18.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.relaxed.yml +3 -24
- data/.rubocop.yml +3 -2
- data/.tool-versions +1 -1
- data/.travis.yml +3 -2
- data/CHANGELOG.md +78 -0
- data/Gemfile +3 -0
- data/README.md +0 -2
- data/Rakefile +1 -1
- data/lib/webdrone.rb +2 -2
- data/lib/webdrone/browser.rb +4 -3
- data/lib/webdrone/clic.rb +1 -1
- data/lib/webdrone/conf.rb +1 -1
- data/lib/webdrone/ctxt.rb +34 -0
- data/lib/webdrone/error.rb +4 -4
- data/lib/webdrone/find.rb +10 -9
- data/lib/webdrone/form.rb +7 -7
- data/lib/webdrone/html.rb +1 -1
- data/lib/webdrone/logg.rb +12 -9
- data/lib/webdrone/mark.rb +1 -1
- data/lib/webdrone/text.rb +1 -1
- data/lib/webdrone/version.rb +1 -1
- data/lib/webdrone/vrfy.rb +1 -1
- data/lib/webdrone/wait.rb +2 -4
- data/lib/webdrone/xpath.rb +2 -4
- data/webdrone.gemspec +7 -5
- metadata +7 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3280a123629a2b7fe840fe9bbecf008505491bd91ea26fca460d75bdcd1e0954
|
4
|
+
data.tar.gz: 28cc5a4b420bbc4ddf6366770a026520226a57c43bd9d77f5ee637e1ba226a95
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66a68b1424ae2b20c147737d1fb9d7558c25fef7ecfab9e246efd7c44783b2862774b6a69ab43f29e137a100bf2fcc9121299a37360a42ace9da8740cda1ae0c
|
7
|
+
data.tar.gz: 931af4c68353750296c315a54fcffdda78447f5b0e2311372f233fd9131b6071c86986f8cf44083fb77a34d88373ea1c0cd9c3b67553e91907a6a797886bd9bd
|
data/.rubocop.relaxed.yml
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# Relaxed.Ruby.Style
|
2
|
-
## Version 2.
|
2
|
+
## Version 2.5
|
3
3
|
|
4
4
|
Style/Alias:
|
5
5
|
Enabled: false
|
@@ -145,29 +145,8 @@ Lint/AssignmentInCondition:
|
|
145
145
|
Enabled: false
|
146
146
|
StyleGuide: https://relaxed.ruby.style/#lintassignmentincondition
|
147
147
|
|
148
|
-
|
148
|
+
Layout/LineLength:
|
149
149
|
Enabled: false
|
150
150
|
|
151
|
-
Metrics
|
152
|
-
Enabled: false
|
153
|
-
|
154
|
-
Metrics/ClassLength:
|
155
|
-
Enabled: false
|
156
|
-
|
157
|
-
Metrics/ModuleLength:
|
158
|
-
Enabled: false
|
159
|
-
|
160
|
-
Metrics/CyclomaticComplexity:
|
161
|
-
Enabled: false
|
162
|
-
|
163
|
-
Metrics/LineLength:
|
164
|
-
Enabled: false
|
165
|
-
|
166
|
-
Metrics/MethodLength:
|
167
|
-
Enabled: false
|
168
|
-
|
169
|
-
Metrics/ParameterLists:
|
170
|
-
Enabled: false
|
171
|
-
|
172
|
-
Metrics/PerceivedComplexity:
|
151
|
+
Metrics:
|
173
152
|
Enabled: false
|
data/.rubocop.yml
CHANGED
data/.tool-versions
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby 2.
|
1
|
+
ruby 2.7.3
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,84 @@ New features are summarized here.
|
|
4
4
|
|
5
5
|
|
6
6
|
|
7
|
+
## v.1.18.0 - 2021-04-24
|
8
|
+
### Changed
|
9
|
+
- Minimum Ruby version supported is now >= 2.6
|
10
|
+
- Added support to Ruby version 3.0
|
11
|
+
|
12
|
+
|
13
|
+
|
14
|
+
## v.1.16.2 - 2021-03-19
|
15
|
+
### Fixed
|
16
|
+
- Remove rspec from runtime_dependencies.
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
## v.1.16.0 - 2021-03-19
|
21
|
+
### Changed
|
22
|
+
- Webdrone will not start a developer console when an exception is raised an a0.conf.error is set to :raise, only when it is set to :raise_report
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
## v.1.14.0 - 2021-03-19
|
27
|
+
### Changed
|
28
|
+
- New option for logger: :quiet that supress the normal stdout log, but not the log sent to webdrone_output dir.
|
29
|
+
```ruby
|
30
|
+
a0 = Webdrone.create logger: :quiet
|
31
|
+
```
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
## v.1.12.0 - 2019-12-04
|
36
|
+
### Added
|
37
|
+
- Added a new a0.conf.parent option, so instead of setting `parent:` in every method like:
|
38
|
+
```ruby
|
39
|
+
modal = a0.find.css '.modal-dialog'
|
40
|
+
|
41
|
+
a0.form.set 'field', 'value', parent: modal
|
42
|
+
a0.clic.on 'button', parent: modal
|
43
|
+
```
|
44
|
+
you can setup a default parent from now on with `a0.conf.parent=` like:
|
45
|
+
```ruby
|
46
|
+
a0.conf.parent = a0.find.css '.modal-dialog'
|
47
|
+
|
48
|
+
a0.form.set 'field', 'value' # uses a0.conf.parent as default parent
|
49
|
+
a0.clic.on 'button'
|
50
|
+
|
51
|
+
a0.conf.parent = nil # resets default parent
|
52
|
+
```
|
53
|
+
- Added the following methods to `a0.ctxt`:
|
54
|
+
- `a0.ctxt.id`
|
55
|
+
- `a0.ctxt.css`
|
56
|
+
- `a0.ctxt.link`
|
57
|
+
- `a0.ctxt.button`
|
58
|
+
- `a0.ctxt.on`
|
59
|
+
- `a0.ctxt.option`
|
60
|
+
- `a0.ctxt.xpath`
|
61
|
+
|
62
|
+
So instead of code like the above, we can use give a block of code to automatically switch in a stack of parents like:
|
63
|
+
```ruby
|
64
|
+
a0.ctxt.css '.modal-dialog' do
|
65
|
+
# sets a0.conf.parent = the found .modal-dialog
|
66
|
+
a0.form.set 'field', 'value'
|
67
|
+
a0.clic.on 'button'
|
68
|
+
|
69
|
+
a0.ctxt.css '.modal-footer' do
|
70
|
+
# sets a0.conf.parent to the found .modal-footer within the previous .modal-dialog
|
71
|
+
end
|
72
|
+
# sets a0.conf.parent back to the found .modal-dialog
|
73
|
+
end
|
74
|
+
# sets a0.conf.parent back to nil (the default) or whatever it was before calling a0.ctxt.css
|
75
|
+
```
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
## v.1.10.0
|
80
|
+
### Fixed
|
81
|
+
- Warnings for chrome and firefox
|
82
|
+
|
83
|
+
|
84
|
+
|
7
85
|
## v.1.8.12 - 2019-02-22
|
8
86
|
### Fixed
|
9
87
|
- Fixing null terminal column size when used without a terminal, caused by highlight 2.0.1.
|
data/Gemfile
CHANGED
data/README.md
CHANGED
data/Rakefile
CHANGED
data/lib/webdrone.rb
CHANGED
@@ -36,8 +36,8 @@ module Webdrone
|
|
36
36
|
class << self
|
37
37
|
attr_accessor :running_pry, :irb_setup_done
|
38
38
|
|
39
|
-
def create(*args)
|
40
|
-
a0 = Webdrone::Browser.new(*args)
|
39
|
+
def create(*args, **kwargs)
|
40
|
+
a0 = Webdrone::Browser.new(*args, **kwargs)
|
41
41
|
if block_given?
|
42
42
|
begin
|
43
43
|
yield a0
|
data/lib/webdrone/browser.rb
CHANGED
@@ -145,9 +145,10 @@ module Webdrone
|
|
145
145
|
protected
|
146
146
|
|
147
147
|
def env_update_bool(binding, var, val_old, val_new)
|
148
|
-
|
148
|
+
case val_new
|
149
|
+
when 'true'
|
149
150
|
val_new = true
|
150
|
-
|
151
|
+
when 'false'
|
151
152
|
val_new = false
|
152
153
|
else
|
153
154
|
puts "Webdrone: ignoring value '#{val_new}' for boolean parameter #{var}."
|
@@ -160,7 +161,7 @@ module Webdrone
|
|
160
161
|
def env_update(binding)
|
161
162
|
bool_vars = %i[create_outdir developer quit_at_exit maximize headless]
|
162
163
|
ENV.keys.select { |env| env.start_with? 'WEBDRONE_' }.each do |env|
|
163
|
-
var = env[9
|
164
|
+
var = env[9..].downcase.to_sym
|
164
165
|
if binding.local_variable_defined? var
|
165
166
|
val_old = binding.local_variable_get(var)
|
166
167
|
val_new = ENV[env]
|
data/lib/webdrone/clic.rb
CHANGED
@@ -14,7 +14,7 @@ module Webdrone
|
|
14
14
|
@a0 = a0
|
15
15
|
end
|
16
16
|
|
17
|
-
def clic(text, n: 1, all: false, visible: true, scroll: false, parent:
|
17
|
+
def clic(text, n: 1, all: false, visible: true, scroll: false, parent: a0.conf.parent, color: '#af1616', times: nil, delay: nil, shot: nil, mark: false)
|
18
18
|
item = @a0.find.send __callee__, text, n: n, all: all, visible: visible, scroll: scroll, parent: parent
|
19
19
|
@a0.mark.mark_item(item, color: color, times: times, delay: delay, shot: shot, text: text) if mark
|
20
20
|
@a0.shot.screen shot.is_a?(String) ? shot : text if shot
|
data/lib/webdrone/conf.rb
CHANGED
data/lib/webdrone/ctxt.rb
CHANGED
@@ -13,6 +13,7 @@ module Webdrone
|
|
13
13
|
def initialize(a0)
|
14
14
|
@a0 = a0
|
15
15
|
@framestack = []
|
16
|
+
@parent_stack = []
|
16
17
|
end
|
17
18
|
|
18
19
|
def create_tab
|
@@ -83,5 +84,38 @@ module Webdrone
|
|
83
84
|
@a0.conf.send "#{k}=", v
|
84
85
|
end
|
85
86
|
end
|
87
|
+
|
88
|
+
def ctxt(text, n: 1, visible: true, scroll: false, parent: @a0.conf.parent, color: '#3db116', times: nil, delay: nil, shot: nil, mark: true)
|
89
|
+
item = @a0.find.send __callee__, text, n: n, all: false, visible: visible, scroll: scroll, parent: parent
|
90
|
+
@a0.mark.mark_item(item, color: color, times: times, delay: delay, shot: shot, text: text) if mark
|
91
|
+
@a0.shot.screen shot.is_a?(String) ? shot : text if shot
|
92
|
+
|
93
|
+
@parent_stack << @a0.conf.parent
|
94
|
+
@a0.conf.parent = item
|
95
|
+
|
96
|
+
if block_given?
|
97
|
+
begin
|
98
|
+
yield
|
99
|
+
ensure
|
100
|
+
parent_pop
|
101
|
+
end
|
102
|
+
end
|
103
|
+
rescue StandardError => error
|
104
|
+
Webdrone.report_error(@a0, error)
|
105
|
+
end
|
106
|
+
|
107
|
+
def parent_pop
|
108
|
+
@a0.conf.parent = @parent_stack.pop
|
109
|
+
end
|
110
|
+
|
111
|
+
alias_method :id, :ctxt
|
112
|
+
alias_method :css, :ctxt
|
113
|
+
alias_method :link, :ctxt
|
114
|
+
alias_method :button, :ctxt
|
115
|
+
alias_method :on, :ctxt
|
116
|
+
alias_method :option, :ctxt
|
117
|
+
alias_method :xpath, :ctxt
|
118
|
+
|
119
|
+
protected :ctxt
|
86
120
|
end
|
87
121
|
end
|
data/lib/webdrone/error.rb
CHANGED
@@ -14,8 +14,8 @@ module Webdrone
|
|
14
14
|
|
15
15
|
begin
|
16
16
|
# find location of user error
|
17
|
-
bindings[0
|
18
|
-
location = { path: binding.
|
17
|
+
bindings[0..].each do |binding|
|
18
|
+
location = { path: binding.source_location[0], lineno: binding.source_location[1] }
|
19
19
|
next unless Gem.path.none? { |path| location[:path].include? path }
|
20
20
|
|
21
21
|
@location = location
|
@@ -65,7 +65,7 @@ module Webdrone
|
|
65
65
|
ini = 0 if ini.negative?
|
66
66
|
|
67
67
|
write_title "LOCATION OF ERROR"
|
68
|
-
write_line "#{@location[:path]} AT LINE #{sprintf '
|
68
|
+
write_line "#{@location[:path]} AT LINE #{sprintf '%<location>3d', location: @location[:lineno]}"
|
69
69
|
File.readlines(@location[:path])[ini..fin].each_with_index do |line, index|
|
70
70
|
lno = index + ini + 1
|
71
71
|
if lno == @location[:lineno]
|
@@ -136,7 +136,7 @@ module Webdrone
|
|
136
136
|
|
137
137
|
if exception.class != WebdroneError
|
138
138
|
exception = WebdroneError.new(exception.message, exception, a0, Kernel.binding.callers)
|
139
|
-
if a0.conf.developer && exception.binding
|
139
|
+
if a0.conf.developer && exception.binding && %i[raise_report].include?(a0.conf.error)
|
140
140
|
exception.write_title "STARTING DEVELOPER CONSOLE ON ERROR"
|
141
141
|
exception.dump_error_report
|
142
142
|
a0.console exception.binding
|
data/lib/webdrone/find.rb
CHANGED
@@ -14,7 +14,7 @@ module Webdrone
|
|
14
14
|
@a0 = a0
|
15
15
|
end
|
16
16
|
|
17
|
-
def id(text, n: 1, all: false, visible: true, scroll: false, parent:
|
17
|
+
def id(text, n: 1, all: false, visible: true, scroll: false, parent: a0.conf.parent)
|
18
18
|
@a0.wait.for do
|
19
19
|
items = (parent || @a0.driver).find_elements :id, text
|
20
20
|
choose(items, n, all, visible, scroll)
|
@@ -23,7 +23,7 @@ module Webdrone
|
|
23
23
|
Webdrone.report_error(@a0, error)
|
24
24
|
end
|
25
25
|
|
26
|
-
def css(text, n: 1, all: false, visible: true, scroll: false, parent:
|
26
|
+
def css(text, n: 1, all: false, visible: true, scroll: false, parent: a0.conf.parent)
|
27
27
|
@a0.wait.for do
|
28
28
|
items = (parent || @a0.driver).find_elements :css, text
|
29
29
|
choose(items, n, all, visible, scroll)
|
@@ -32,31 +32,31 @@ module Webdrone
|
|
32
32
|
Webdrone.report_error(@a0, error)
|
33
33
|
end
|
34
34
|
|
35
|
-
def link(text, n: 1, all: false, visible: true, scroll: false, parent:
|
35
|
+
def link(text, n: 1, all: false, visible: true, scroll: false, parent: a0.conf.parent)
|
36
36
|
xpath Webdrone::XPath.link(text).to_s, n: n, all: all, visible: visible, scroll: scroll, parent: parent
|
37
37
|
rescue StandardError => error
|
38
38
|
Webdrone.report_error(@a0, error)
|
39
39
|
end
|
40
40
|
|
41
|
-
def button(text, n: 1, all: false, visible: true, scroll: false, parent:
|
41
|
+
def button(text, n: 1, all: false, visible: true, scroll: false, parent: a0.conf.parent)
|
42
42
|
xpath Webdrone::XPath.button(text).to_s, n: n, all: all, visible: visible, scroll: scroll, parent: parent
|
43
43
|
rescue StandardError => error
|
44
44
|
Webdrone.report_error(@a0, error)
|
45
45
|
end
|
46
46
|
|
47
|
-
def on(text, n: 1, all: false, visible: true, scroll: false, parent:
|
47
|
+
def on(text, n: 1, all: false, visible: true, scroll: false, parent: a0.conf.parent)
|
48
48
|
xpath Webdrone::XPath.link_or_button(text).to_s, n: n, all: all, visible: visible, scroll: scroll, parent: parent
|
49
49
|
rescue StandardError => error
|
50
50
|
Webdrone.report_error(@a0, error)
|
51
51
|
end
|
52
52
|
|
53
|
-
def option(text, n: 1, all: false, visible: true, scroll: false, parent:
|
53
|
+
def option(text, n: 1, all: false, visible: true, scroll: false, parent: a0.conf.parent)
|
54
54
|
xpath Webdrone::XPath.option(text).to_s, n: n, all: all, visible: visible, scroll: scroll, parent: parent
|
55
55
|
rescue StandardError => error
|
56
56
|
Webdrone.report_error(@a0, error)
|
57
57
|
end
|
58
58
|
|
59
|
-
def xpath(text, n: 1, all: false, visible: true, scroll: false, parent:
|
59
|
+
def xpath(text, n: 1, all: false, visible: true, scroll: false, parent: a0.conf.parent)
|
60
60
|
@a0.wait.for do
|
61
61
|
items = (parent || @a0.driver).find_elements :xpath, text
|
62
62
|
choose(items, n, all, visible, scroll)
|
@@ -69,9 +69,10 @@ module Webdrone
|
|
69
69
|
|
70
70
|
def choose(list, n, all, visible, scroll)
|
71
71
|
list = list.select do |x|
|
72
|
-
|
72
|
+
case visible
|
73
|
+
when true
|
73
74
|
x.displayed?
|
74
|
-
|
75
|
+
when false
|
75
76
|
!x.displayed?
|
76
77
|
else
|
77
78
|
true
|
data/lib/webdrone/form.rb
CHANGED
@@ -90,7 +90,7 @@ module Webdrone
|
|
90
90
|
@data = prev
|
91
91
|
end
|
92
92
|
|
93
|
-
def set(key, val, n: 1, visible: true, scroll: false, parent:
|
93
|
+
def set(key, val, n: 1, visible: true, scroll: false, parent: a0.conf.parent, mark: false)
|
94
94
|
item = find_item(key, n: n, visible: visible, scroll: scroll, parent: parent)
|
95
95
|
@a0.mark.mark_item item if mark
|
96
96
|
if item.tag_name == 'select'
|
@@ -114,7 +114,7 @@ module Webdrone
|
|
114
114
|
Webdrone.report_error(@a0, error)
|
115
115
|
end
|
116
116
|
|
117
|
-
def get(key, n: 1, visible: true, scroll: false, parent:
|
117
|
+
def get(key, n: 1, visible: true, scroll: false, parent: a0.conf.parent, mark: false)
|
118
118
|
item = find_item(key, n: n, visible: visible, scroll: scroll, parent: parent)
|
119
119
|
@a0.mark.mark_item item if mark
|
120
120
|
item[:value]
|
@@ -122,7 +122,7 @@ module Webdrone
|
|
122
122
|
Webdrone.report_error(@a0, error)
|
123
123
|
end
|
124
124
|
|
125
|
-
def clic(key, n: 1, visible: true, scroll: false, parent:
|
125
|
+
def clic(key, n: 1, visible: true, scroll: false, parent: a0.conf.parent, mark: false)
|
126
126
|
item = find_item(key, n: n, visible: visible, scroll: scroll, parent: parent)
|
127
127
|
@a0.mark.mark_item item if mark
|
128
128
|
item.click
|
@@ -130,7 +130,7 @@ module Webdrone
|
|
130
130
|
Webdrone.report_error(@a0, error)
|
131
131
|
end
|
132
132
|
|
133
|
-
def selected?(key, n: 1, visible: true, scroll: false, parent:
|
133
|
+
def selected?(key, n: 1, visible: true, scroll: false, parent: a0.conf.parent, mark: false)
|
134
134
|
item = find_item(key, n: n, visible: visible, scroll: scroll, parent: parent)
|
135
135
|
@a0.mark.mark_item item if mark
|
136
136
|
item.selected?
|
@@ -138,13 +138,13 @@ module Webdrone
|
|
138
138
|
Webdrone.report_error(@a0, error)
|
139
139
|
end
|
140
140
|
|
141
|
-
def mark(key, n: 1, visible: true, scroll: false, parent:
|
141
|
+
def mark(key, n: 1, visible: true, scroll: false, parent: a0.conf.parent, color: '#af1616', times: nil, delay: nil, shot: nil)
|
142
142
|
@a0.mark.mark_item find_item(key, n: n, visible: visible, scroll: scroll, parent: parent), color: color, times: times, delay: delay, shot: shot
|
143
143
|
rescue StandardError => error
|
144
144
|
Webdrone.report_error(@a0, error)
|
145
145
|
end
|
146
146
|
|
147
|
-
def submit(key = nil, n: 1, visible: true, scroll: false, parent:
|
147
|
+
def submit(key = nil, n: 1, visible: true, scroll: false, parent: a0.conf.parent, mark: false)
|
148
148
|
item = find_item(key, n: n, visible: visible, scroll: scroll, parent: parent) if key
|
149
149
|
@a0.mark.mark_item item if mark
|
150
150
|
@lastitem.submit
|
@@ -160,7 +160,7 @@ module Webdrone
|
|
160
160
|
Webdrone.report_error(@a0, error)
|
161
161
|
end
|
162
162
|
|
163
|
-
def find_item(key, n: 1, visible: true, scroll: false, parent:
|
163
|
+
def find_item(key, n: 1, visible: true, scroll: false, parent: a0.conf.parent)
|
164
164
|
@lastitem = \
|
165
165
|
if @xpath.respond_to? :call
|
166
166
|
@a0.find.xpath @xpath.call(key).to_s, n: n, visible: visible, scroll: scroll, parent: parent
|
data/lib/webdrone/html.rb
CHANGED
@@ -14,7 +14,7 @@ module Webdrone
|
|
14
14
|
@a0 = a0
|
15
15
|
end
|
16
16
|
|
17
|
-
def find_html(text, n: 1, all: false, visible: true, scroll: false, parent:
|
17
|
+
def find_html(text, n: 1, all: false, visible: true, scroll: false, parent: a0.conf.parent)
|
18
18
|
item = @a0.find.send __callee__, text, n: n, all: all, visible: visible, scroll: scroll, parent: parent
|
19
19
|
if item.is_a? Array
|
20
20
|
item.collect { |x| x.attribute 'innerHTML' }
|
data/lib/webdrone/logg.rb
CHANGED
@@ -7,6 +7,8 @@ module Webdrone
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def initialize(methods = nil)
|
10
|
+
super()
|
11
|
+
|
10
12
|
@methods = methods
|
11
13
|
end
|
12
14
|
|
@@ -16,25 +18,26 @@ module Webdrone
|
|
16
18
|
base.class_eval do
|
17
19
|
method_list.each do |method_name|
|
18
20
|
original_method = instance_method(method_name)
|
19
|
-
define_method method_name do |*args, &block|
|
21
|
+
define_method method_name do |*args, **kwargs, &block|
|
20
22
|
caller_location = Kernel.caller_locations[0]
|
21
23
|
cl_path = caller_location.path
|
22
24
|
cl_line = caller_location.lineno
|
23
25
|
if @a0.conf.logger && Gem.path.none? { |path| cl_path.include? path }
|
24
26
|
ini = ::Webdrone::MethodLogger.last_time ||= Time.new
|
25
27
|
::Webdrone::MethodLogger.screenshot = nil
|
28
|
+
args_log = [args, kwargs].compact.reject(&:empty?).map(&:to_s).join(' ')
|
26
29
|
begin
|
27
|
-
result = original_method.bind(self).call(*args, &block)
|
30
|
+
result = original_method.bind(self).call(*args, **kwargs, &block)
|
28
31
|
fin = ::Webdrone::MethodLogger.last_time = Time.new
|
29
|
-
@a0.logs.trace(ini, fin, cl_path, cl_line, base, method_name,
|
32
|
+
@a0.logs.trace(ini, fin, cl_path, cl_line, base, method_name, args_log, result, nil, ::Webdrone::MethodLogger.screenshot)
|
30
33
|
result
|
31
34
|
rescue StandardError => exception
|
32
35
|
fin = ::Webdrone::MethodLogger.last_time = Time.new
|
33
|
-
@a0.logs.trace(ini, fin, cl_path, cl_line, base, method_name,
|
36
|
+
@a0.logs.trace(ini, fin, cl_path, cl_line, base, method_name, args_log, nil, exception, ::Webdrone::MethodLogger.screenshot)
|
34
37
|
raise exception
|
35
38
|
end
|
36
39
|
else
|
37
|
-
original_method.bind(self).call(*args, &block)
|
40
|
+
original_method.bind(self).call(*args, **kwargs, &block)
|
38
41
|
end
|
39
42
|
end
|
40
43
|
end
|
@@ -60,7 +63,7 @@ module Webdrone
|
|
60
63
|
|
61
64
|
def trace(ini, fin, from, lineno, base, method_name, args, result, exception, screenshot)
|
62
65
|
exception = "#{exception.class}: #{exception}" if exception
|
63
|
-
printf @format, (fin - ini), base, method_name, args, (result || exception)
|
66
|
+
printf @format, (fin - ini), base, method_name, args, (result || exception) unless a0.conf.logger.to_s == 'quiet'
|
64
67
|
CSV.open(@path, "a+") do |csv|
|
65
68
|
csv << [ini.strftime('%Y-%m-%d %H:%M:%S.%L %z'), (fin - ini), from, lineno, base, method_name, args, result, exception, screenshot]
|
66
69
|
end
|
@@ -80,8 +83,8 @@ module Webdrone
|
|
80
83
|
rescue StandardError => e
|
81
84
|
exception = e
|
82
85
|
bindings = Kernel.binding.callers
|
83
|
-
bindings[0
|
84
|
-
location = { path: binding.
|
86
|
+
bindings[0..].each do |binding|
|
87
|
+
location = { path: binding.source_location[0], lineno: binding.source_location[1] }
|
85
88
|
next unless Gem.path.none? { |path| location[:path].include? path }
|
86
89
|
|
87
90
|
result[:exception] = {}
|
@@ -93,7 +96,7 @@ module Webdrone
|
|
93
96
|
end
|
94
97
|
result[:trace_count] = @group_trace_count.pop
|
95
98
|
fin = Time.new
|
96
|
-
trace(ini, fin, cl_path, cl_line, Logs, :with_group, [name, abort_error: abort_error], result, exception, nil)
|
99
|
+
trace(ini, fin, cl_path, cl_line, Logs, :with_group, [name, { abort_error: abort_error }], result, exception, nil)
|
97
100
|
puts "abort_error: #{abort_error} exception: #{exception}"
|
98
101
|
exit if abort_error == true && exception
|
99
102
|
end
|
data/lib/webdrone/mark.rb
CHANGED
@@ -18,7 +18,7 @@ module Webdrone
|
|
18
18
|
@clear = ENV['WEBDRONE_MARK_CLEAR'] == 'true' || false
|
19
19
|
end
|
20
20
|
|
21
|
-
def mark(text, n: 1, all: false, visible: true, scroll: false, parent:
|
21
|
+
def mark(text, n: 1, all: false, visible: true, scroll: false, parent: a0.conf.parent, color: '#af1616', times: nil, delay: nil, shot: nil)
|
22
22
|
item = @a0.find.send __callee__, text, n: n, all: all, visible: visible, scroll: scroll, parent: parent
|
23
23
|
mark_item item, color: color, times: times, delay: delay, shot: shot, text: text
|
24
24
|
rescue StandardError => error
|
data/lib/webdrone/text.rb
CHANGED
@@ -14,7 +14,7 @@ module Webdrone
|
|
14
14
|
@a0 = a0
|
15
15
|
end
|
16
16
|
|
17
|
-
def text(text, n: 1, all: false, visible: true, scroll: false, parent:
|
17
|
+
def text(text, n: 1, all: false, visible: true, scroll: false, parent: a0.conf.parent)
|
18
18
|
item = @a0.find.send __callee__, text, n: n, all: all, visible: visible, scroll: scroll, parent: parent
|
19
19
|
if item.is_a? Array
|
20
20
|
item.collect(&:text)
|
data/lib/webdrone/version.rb
CHANGED
data/lib/webdrone/vrfy.rb
CHANGED
@@ -14,7 +14,7 @@ module Webdrone
|
|
14
14
|
@a0 = a0
|
15
15
|
end
|
16
16
|
|
17
|
-
def vrfy(text, n: 1, all: false, visible: true, scroll: false, parent:
|
17
|
+
def vrfy(text, n: 1, all: false, visible: true, scroll: false, parent: a0.conf.parent, attr: nil, eq: nil, contains: nil, mark: false)
|
18
18
|
item = @a0.find.send __callee__, text, n: n, all: all, visible: visible, scroll: scroll, parent: parent
|
19
19
|
@a0.mark.mark_item item if mark
|
20
20
|
if item.is_a? Array
|
data/lib/webdrone/wait.rb
CHANGED
@@ -20,11 +20,9 @@ module Webdrone
|
|
20
20
|
@ignore << Selenium::WebDriver::Error::InvalidSelectorError
|
21
21
|
end
|
22
22
|
|
23
|
-
def for
|
23
|
+
def for(&block)
|
24
24
|
if @a0.conf.timeout
|
25
|
-
Selenium::WebDriver::Wait.new(timeout: @a0.conf.timeout, ignore: @ignore).until
|
26
|
-
yield
|
27
|
-
end
|
25
|
+
Selenium::WebDriver::Wait.new(timeout: @a0.conf.timeout, ignore: @ignore).until(&block)
|
28
26
|
else
|
29
27
|
yield
|
30
28
|
end
|
data/lib/webdrone/xpath.rb
CHANGED
@@ -58,8 +58,7 @@ module Webdrone
|
|
58
58
|
def field(locator)
|
59
59
|
locator = locator.to_s
|
60
60
|
xpath = descendant(:input, :textarea, :select)[~attr(:type).one_of('submit', 'image', 'hidden')]
|
61
|
-
|
62
|
-
xpath
|
61
|
+
locate_field(xpath, locator)
|
63
62
|
end
|
64
63
|
|
65
64
|
# Match any `input` or `textarea` element that can be filled with text.
|
@@ -72,8 +71,7 @@ module Webdrone
|
|
72
71
|
def fillable_field(locator)
|
73
72
|
locator = locator.to_s
|
74
73
|
xpath = descendant(:input, :textarea)[~attr(:type).one_of('submit', 'image', 'radio', 'checkbox', 'hidden', 'file')]
|
75
|
-
|
76
|
-
xpath
|
74
|
+
locate_field(xpath, locator)
|
77
75
|
end
|
78
76
|
|
79
77
|
# Match any `select` element.
|
data/webdrone.gemspec
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
-
require 'webdrone/version'
|
3
|
+
require_relative 'lib/webdrone/version'
|
6
4
|
|
7
5
|
Gem::Specification.new do |spec|
|
8
6
|
spec.name = 'webdrone'
|
@@ -14,12 +12,17 @@ Gem::Specification.new do |spec|
|
|
14
12
|
spec.description = 'See webpage for more info.'
|
15
13
|
spec.homepage = 'http://github.com/a0/a0-webdrone-ruby'
|
16
14
|
spec.license = 'MIT'
|
15
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.6.0')
|
17
16
|
|
18
17
|
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
19
18
|
# delete this section to allow pushing this gem to any host.
|
20
19
|
raise 'RubyGems 2.0 or newer is required to protect against public gem pushes.' unless spec.respond_to?(:metadata)
|
21
20
|
|
22
|
-
spec.metadata['allowed_push_host']
|
21
|
+
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
22
|
+
|
23
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
24
|
+
spec.metadata['source_code_uri'] = 'http://github.com/a0/a0-webdrone-ruby'
|
25
|
+
spec.metadata['changelog_uri'] = 'http://github.com/a0/a0-webdrone-ruby/CHANGELOG.md'
|
23
26
|
|
24
27
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
25
28
|
spec.bindir = 'exe'
|
@@ -32,7 +35,6 @@ Gem::Specification.new do |spec|
|
|
32
35
|
spec.add_development_dependency 'rake'
|
33
36
|
spec.add_development_dependency 'rspec'
|
34
37
|
spec.add_development_dependency 'rubocop'
|
35
|
-
spec.add_development_dependency 'solargraph'
|
36
38
|
|
37
39
|
spec.add_runtime_dependency 'binding_of_caller'
|
38
40
|
spec.add_runtime_dependency 'highline', '>= 2.0.0'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webdrone
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.18.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aldrin Martoq
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-04-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -94,20 +94,6 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: solargraph
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - ">="
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
111
97
|
- !ruby/object:Gem::Dependency
|
112
98
|
name: binding_of_caller
|
113
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -255,6 +241,9 @@ licenses:
|
|
255
241
|
- MIT
|
256
242
|
metadata:
|
257
243
|
allowed_push_host: https://rubygems.org
|
244
|
+
homepage_uri: http://github.com/a0/a0-webdrone-ruby
|
245
|
+
source_code_uri: http://github.com/a0/a0-webdrone-ruby
|
246
|
+
changelog_uri: http://github.com/a0/a0-webdrone-ruby/CHANGELOG.md
|
258
247
|
post_install_message:
|
259
248
|
rdoc_options: []
|
260
249
|
require_paths:
|
@@ -263,14 +252,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
263
252
|
requirements:
|
264
253
|
- - ">="
|
265
254
|
- !ruby/object:Gem::Version
|
266
|
-
version:
|
255
|
+
version: 2.6.0
|
267
256
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
268
257
|
requirements:
|
269
258
|
- - ">="
|
270
259
|
- !ruby/object:Gem::Version
|
271
260
|
version: '0'
|
272
261
|
requirements: []
|
273
|
-
rubygems_version: 3.
|
262
|
+
rubygems_version: 3.1.6
|
274
263
|
signing_key:
|
275
264
|
specification_version: 4
|
276
265
|
summary: A simple selenium webdriver wrapper, ruby version.
|