webdrone 1.14.0 → 1.18.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7e526be196c417ab71f06e9d08c199b86295ca3327b0b73c6aff13f8e7bf12f2
4
- data.tar.gz: 4d128b76393382af9908f48ad8967a3dc8d41f4c619ee70673053b1bf1b2dbc2
3
+ metadata.gz: 835b95e7d4d0fc1c897e509b8453275e6592995316e9d98a93731d1db66f6700
4
+ data.tar.gz: 5cf48bef62eb1c88a8b0d01f24353c96a4e49a77239bbdbd219ecbec72257dff
5
5
  SHA512:
6
- metadata.gz: 1306f0537f417e66c279512c5952dd8be5487aee66fa33cf40c42e6e0a69bf36af62a96a41c834ec191fe2b8be0544f5c279f2e24d19f07e0f9b77d1365b351b
7
- data.tar.gz: d9366338f341cffbdbc4059a9e2c3676e65af01078cfa838d1e00ca8862cddda2e7274335e5b55ef8c95917f93102aa6018b92d40d96ef9d6dc24f6e3cfb2189
6
+ metadata.gz: b45bf5023816225a22bdbf5f91edb5577d2c321af36db254004b3434bf848604088584da733212e7732ef6082df4a29a495cccc73de41580a2ea559b9f4a4ebe
7
+ data.tar.gz: 2e9fecee89b66cafd117c515edce83216dc20e6d64e83da11408371aaf97bf5d96353dbc5ae255081268c72c718d71e63afa109af595f784a9bfd9f8c98db9df
data/.rubocop.relaxed.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  # Relaxed.Ruby.Style
2
- ## Version 2.4
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
- Metrics/AbcSize:
148
+ Layout/LineLength:
149
149
  Enabled: false
150
150
 
151
- Metrics/BlockNesting:
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
@@ -1,5 +1,6 @@
1
1
  AllCops:
2
2
  TargetRubyVersion: 2.6
3
+ NewCops: enable
3
4
  inherit_from:
4
5
  - .rubocop.relaxed.yml
5
6
  Naming/MethodParameterName:
data/.tool-versions CHANGED
@@ -1 +1 @@
1
- ruby 2.7.2
1
+ ruby 2.7.3
data/CHANGELOG.md CHANGED
@@ -4,7 +4,32 @@ New features are summarized here.
4
4
 
5
5
 
6
6
 
7
- ## v.1.12.2 - 2021-03-19
7
+ ## v.1.18.2 - 2021-08-26
8
+ ### Fixed
9
+ - Getting back support for ruby 2.6
10
+
11
+
12
+
13
+ ## v.1.18.0 - 2021-04-24
14
+ ### Changed
15
+ - Minimum Ruby version supported is now >= 2.6
16
+ - Added support to Ruby version 3.0
17
+
18
+
19
+
20
+ ## v.1.16.2 - 2021-03-19
21
+ ### Fixed
22
+ - Remove rspec from runtime_dependencies.
23
+
24
+
25
+
26
+ ## v.1.16.0 - 2021-03-19
27
+ ### Changed
28
+ - 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
29
+
30
+
31
+
32
+ ## v.1.14.0 - 2021-03-19
8
33
  ### Changed
9
34
  - New option for logger: :quiet that supress the normal stdout log, but not the log sent to webdrone_output dir.
10
35
  ```ruby
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in webdrone.gemspec
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/gem_tasks'
2
4
  require 'rspec/core/rake_task'
3
5
 
@@ -145,9 +145,10 @@ module Webdrone
145
145
  protected
146
146
 
147
147
  def env_update_bool(binding, var, val_old, val_new)
148
- if val_new == 'true'
148
+ case val_new
149
+ when 'true'
149
150
  val_new = true
150
- elsif val_new == 'false'
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..-1].downcase.to_sym
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]
@@ -14,8 +14,8 @@ module Webdrone
14
14
 
15
15
  begin
16
16
  # find location of user error
17
- bindings[0..-1].each do |binding|
18
- location = { path: binding.eval('__FILE__'), lineno: binding.eval('__LINE__') }
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
@@ -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
@@ -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
- if visible == true
72
+ case visible
73
+ when true
73
74
  x.displayed?
74
- elsif visible == false
75
+ when false
75
76
  !x.displayed?
76
77
  else
77
78
  true
data/lib/webdrone/logg.rb CHANGED
@@ -7,34 +7,71 @@ 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
 
13
- def included(base)
14
- @methods ||= base.instance_methods(false)
15
- method_list = @methods
16
- base.class_eval do
17
- method_list.each do |method_name|
18
- original_method = instance_method(method_name)
19
- define_method method_name do |*args, &block|
20
- caller_location = Kernel.caller_locations[0]
21
- cl_path = caller_location.path
22
- cl_line = caller_location.lineno
23
- if @a0.conf.logger && Gem.path.none? { |path| cl_path.include? path }
24
- ini = ::Webdrone::MethodLogger.last_time ||= Time.new
25
- ::Webdrone::MethodLogger.screenshot = nil
26
- begin
27
- result = original_method.bind(self).call(*args, &block)
28
- fin = ::Webdrone::MethodLogger.last_time = Time.new
29
- @a0.logs.trace(ini, fin, cl_path, cl_line, base, method_name, args, result, nil, ::Webdrone::MethodLogger.screenshot)
30
- result
31
- rescue StandardError => exception
32
- fin = ::Webdrone::MethodLogger.last_time = Time.new
33
- @a0.logs.trace(ini, fin, cl_path, cl_line, base, method_name, args, nil, exception, ::Webdrone::MethodLogger.screenshot)
34
- raise exception
15
+ if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.7')
16
+ def included(base)
17
+ @methods ||= base.instance_methods(false)
18
+ method_list = @methods
19
+ base.class_eval do
20
+ method_list.each do |method_name|
21
+ original_method = instance_method(method_name)
22
+ define_method method_name do |*args, &block|
23
+ caller_location = Kernel.caller_locations[0]
24
+ cl_path = caller_location.path
25
+ cl_line = caller_location.lineno
26
+ if @a0.conf.logger && Gem.path.none? { |path| cl_path.include? path }
27
+ ini = ::Webdrone::MethodLogger.last_time ||= Time.new
28
+ ::Webdrone::MethodLogger.screenshot = nil
29
+ args_log = [args].compact.reject(&:empty?).map(&:to_s).join(' ')
30
+ begin
31
+ result = original_method.bind(self).call(*args, &block)
32
+ fin = ::Webdrone::MethodLogger.last_time = Time.new
33
+ @a0.logs.trace(ini, fin, cl_path, cl_line, base, method_name, args_log, result, nil, ::Webdrone::MethodLogger.screenshot)
34
+ result
35
+ rescue StandardError => exception
36
+ fin = ::Webdrone::MethodLogger.last_time = Time.new
37
+ @a0.logs.trace(ini, fin, cl_path, cl_line, base, method_name, args_log, nil, exception, ::Webdrone::MethodLogger.screenshot)
38
+ raise exception
39
+ end
40
+ else
41
+ original_method.bind(self).call(*args, &block)
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ else
48
+ def included(base)
49
+ @methods ||= base.instance_methods(false)
50
+ method_list = @methods
51
+ base.class_eval do
52
+ method_list.each do |method_name|
53
+ original_method = instance_method(method_name)
54
+ define_method method_name do |*args, **kwargs, &block|
55
+ caller_location = Kernel.caller_locations[0]
56
+ cl_path = caller_location.path
57
+ cl_line = caller_location.lineno
58
+ if @a0.conf.logger && Gem.path.none? { |path| cl_path.include? path }
59
+ ini = ::Webdrone::MethodLogger.last_time ||= Time.new
60
+ ::Webdrone::MethodLogger.screenshot = nil
61
+ args_log = [args, kwargs].compact.reject(&:empty?).map(&:to_s).join(' ')
62
+ begin
63
+ result = original_method.bind(self).call(*args, **kwargs, &block)
64
+ fin = ::Webdrone::MethodLogger.last_time = Time.new
65
+ @a0.logs.trace(ini, fin, cl_path, cl_line, base, method_name, args_log, result, nil, ::Webdrone::MethodLogger.screenshot)
66
+ result
67
+ rescue StandardError => exception
68
+ fin = ::Webdrone::MethodLogger.last_time = Time.new
69
+ @a0.logs.trace(ini, fin, cl_path, cl_line, base, method_name, args_log, nil, exception, ::Webdrone::MethodLogger.screenshot)
70
+ raise exception
71
+ end
72
+ else
73
+ original_method.bind(self).call(*args, **kwargs, &block)
35
74
  end
36
- else
37
- original_method.bind(self).call(*args, &block)
38
75
  end
39
76
  end
40
77
  end
@@ -80,8 +117,8 @@ module Webdrone
80
117
  rescue StandardError => e
81
118
  exception = e
82
119
  bindings = Kernel.binding.callers
83
- bindings[0..-1].each do |binding|
84
- location = { path: binding.eval('__FILE__'), lineno: binding.eval('__LINE__') }
120
+ bindings[0..].each do |binding|
121
+ location = { path: binding.source_location[0], lineno: binding.source_location[1] }
85
122
  next unless Gem.path.none? { |path| location[:path].include? path }
86
123
 
87
124
  result[:exception] = {}
@@ -93,7 +130,7 @@ module Webdrone
93
130
  end
94
131
  result[:trace_count] = @group_trace_count.pop
95
132
  fin = Time.new
96
- trace(ini, fin, cl_path, cl_line, Logs, :with_group, [name, abort_error: abort_error], result, exception, nil)
133
+ trace(ini, fin, cl_path, cl_line, Logs, :with_group, [name, { abort_error: abort_error }], result, exception, nil)
97
134
  puts "abort_error: #{abort_error} exception: #{exception}"
98
135
  exit if abort_error == true && exception
99
136
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Webdrone
4
- VERSION = '1.14.0'
4
+ VERSION = '1.18.2'
5
5
  end
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 do
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
@@ -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
- xpath = locate_field(xpath, locator)
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
- xpath = locate_field(xpath, locator)
76
- xpath
74
+ locate_field(xpath, locator)
77
75
  end
78
76
 
79
77
  # Match any `select` element.
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/webdrone.gemspec CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'lib/webdrone/version'
2
4
 
3
5
  Gem::Specification.new do |spec|
@@ -10,7 +12,7 @@ Gem::Specification.new do |spec|
10
12
  spec.description = 'See webpage for more info.'
11
13
  spec.homepage = 'http://github.com/a0/a0-webdrone-ruby'
12
14
  spec.license = 'MIT'
13
- spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
15
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.6.0')
14
16
 
15
17
  # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
16
18
  # delete this section to allow pushing this gem to any host.
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.14.0
4
+ version: 1.18.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aldrin Martoq
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-03-20 00:00:00.000000000 Z
11
+ date: 2021-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -244,7 +244,7 @@ metadata:
244
244
  homepage_uri: http://github.com/a0/a0-webdrone-ruby
245
245
  source_code_uri: http://github.com/a0/a0-webdrone-ruby
246
246
  changelog_uri: http://github.com/a0/a0-webdrone-ruby/CHANGELOG.md
247
- post_install_message:
247
+ post_install_message:
248
248
  rdoc_options: []
249
249
  require_paths:
250
250
  - lib
@@ -252,15 +252,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
252
252
  requirements:
253
253
  - - ">="
254
254
  - !ruby/object:Gem::Version
255
- version: 2.3.0
255
+ version: 2.6.0
256
256
  required_rubygems_version: !ruby/object:Gem::Requirement
257
257
  requirements:
258
258
  - - ">="
259
259
  - !ruby/object:Gem::Version
260
260
  version: '0'
261
261
  requirements: []
262
- rubygems_version: 3.1.4
263
- signing_key:
262
+ rubygems_version: 3.1.6
263
+ signing_key:
264
264
  specification_version: 4
265
265
  summary: A simple selenium webdriver wrapper, ruby version.
266
266
  test_files: []