webdrone 1.16.2 → 1.18.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f487358146231428767a939df5a958331b4ca65e0051203096af15c8d652d218
4
- data.tar.gz: 2816b82fcf89b10ce8a19a9988c7d12fa7cad846d3ee9a2db66377047684bd8c
3
+ metadata.gz: 3280a123629a2b7fe840fe9bbecf008505491bd91ea26fca460d75bdcd1e0954
4
+ data.tar.gz: 28cc5a4b420bbc4ddf6366770a026520226a57c43bd9d77f5ee637e1ba226a95
5
5
  SHA512:
6
- metadata.gz: 4aa55ce3c9ec8c93c2509acaa812a1728172092b5ad5fc3b8b4f9fe10bc39c6692223743188e9c1190bcd880521fa933e1df1f07f9efc2d55fbd6de4c228191f
7
- data.tar.gz: 26d7e1388cbdc34f0e69ae66ef71c4203be31f67ae76770f3952f6a03068a6b5fafcc520d0900d404fa2ca4f1a87056ff1f2aa92a0160d3845c3f2b79a44f4eb
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.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,6 +4,13 @@ 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
+
7
14
  ## v.1.16.2 - 2021-03-19
8
15
  ### Fixed
9
16
  - Remove rspec from runtime_dependencies.
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
 
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
@@ -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
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,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, args, result, nil, ::Webdrone::MethodLogger.screenshot)
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, args, nil, exception, ::Webdrone::MethodLogger.screenshot)
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
@@ -80,8 +83,8 @@ module Webdrone
80
83
  rescue StandardError => e
81
84
  exception = e
82
85
  bindings = Kernel.binding.callers
83
- bindings[0..-1].each do |binding|
84
- location = { path: binding.eval('__FILE__'), lineno: binding.eval('__LINE__') }
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Webdrone
4
- VERSION = '1.16.2'
4
+ VERSION = '1.18.0'
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/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.16.2
4
+ version: 1.18.0
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-04-25 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: []