webdrone 1.8.12 → 1.10.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: 7bd524cfbe7c2f32c7fa572044fc14c6c554098ca5ad770bebb8231d8cff9194
4
- data.tar.gz: ddc1e729d7daa429d85eaa5f6652a00ea8f739e34ed0e060226a1816951fcc3b
3
+ metadata.gz: 54033552a41d39468377a85f94dab87190f0e390488835a37b13647503950189
4
+ data.tar.gz: 874c198bc2ae7167600be37ad096c744b82b5cd3fc88ad53a854020e1c8062d7
5
5
  SHA512:
6
- metadata.gz: 04c477dc7ab916f8ddd131100192e882ee300e917b5f77dd1e298e4fa33932166b9c114ac45ecdb7e7faa807298f955636bd1a730ef7887d6cda206c89c96bba
7
- data.tar.gz: 16a6ee6f371d350624cafcf296341799b8dcccdde108ee745c92bb87ed1c371649d288f324cb6bf43a3a738a1c4963a3c8b4d002c4e9c76617e29d75036889c5
6
+ metadata.gz: 529391d94128a9d0e7bd0ab5ff68de96e8991e8d4400e9e5446e74572fe651505ae57caa9e48ca880bea72ac0b020d212b39bfe368309476a9ed79526b1c5062
7
+ data.tar.gz: 40f4855afbfe706c0821936cd302364edd0d16fd24b65c227eea1a7f139614d08678b69ce7b8915af5a642259b1a476ff37cc5145b4f2a2ba4d73d017fa4a53b
@@ -1,5 +1,5 @@
1
1
  # Relaxed.Ruby.Style
2
- ## Version 2.2
2
+ ## Version 2.4
3
3
 
4
4
  Style/Alias:
5
5
  Enabled: false
@@ -65,6 +65,10 @@ Style/NegatedWhile:
65
65
  Enabled: false
66
66
  StyleGuide: https://relaxed.ruby.style/#stylenegatedwhile
67
67
 
68
+ Style/NumericPredicate:
69
+ Enabled: false
70
+ StyleGuide: https://relaxed.ruby.style/#stylenumericpredicate
71
+
68
72
  Style/ParallelAssignment:
69
73
  Enabled: false
70
74
  StyleGuide: https://relaxed.ruby.style/#styleparallelassignment
@@ -121,6 +125,10 @@ Style/TrailingCommaInHashLiteral:
121
125
  Enabled: false
122
126
  StyleGuide: https://relaxed.ruby.style/#styletrailingcommainhashliteral
123
127
 
128
+ Style/SymbolArray:
129
+ Enabled: false
130
+ StyleGuide: http://relaxed.ruby.style/#stylesymbolarray
131
+
124
132
  Style/WhileUntilModifier:
125
133
  Enabled: false
126
134
  StyleGuide: https://relaxed.ruby.style/#stylewhileuntilmodifier
@@ -6,3 +6,13 @@ Naming/UncommunicativeMethodParamName:
6
6
  Enabled: false
7
7
  Style/AccessModifierDeclarations:
8
8
  Enabled: false
9
+ Naming/RescuedExceptionsVariableName:
10
+ Enabled: false
11
+ Metrics/BlockLength:
12
+ Max: 50
13
+ Style/Attr:
14
+ Exclude:
15
+ - lib/webdrone/xpath.rb
16
+ Lint/DuplicateMethods:
17
+ Exclude:
18
+ - lib/webdrone/xpath.rb
@@ -1 +1 @@
1
- ruby-2.5.3
1
+ ruby-2.6.4
@@ -0,0 +1 @@
1
+ ruby 2.6.4
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
 
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require 'bundler/setup'
4
5
  require 'webdrone'
@@ -0,0 +1,56 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ path = File.realpath File.join(__dir__, '../lib/webdrone/version.rb')
5
+ load path
6
+
7
+ current = Webdrone::VERSION
8
+ numbers = current.split('.').map(&:to_i)
9
+ length = numbers.count
10
+
11
+ versions = length.times.map do |index|
12
+ version = numbers.dup
13
+ version[index] += index.zero? ? 1 : 2
14
+ index += 1
15
+ (index...length).each do |i|
16
+ version[i] = 0
17
+ end
18
+ version.join '.'
19
+ end.reverse
20
+
21
+ text = versions.each_with_index.map do |version, index|
22
+ "#{index + 1}. #{version}"
23
+ end.join("\n")
24
+
25
+ puts <<~FIN
26
+
27
+ Version file: #{path}
28
+
29
+ Current version: #{current}. Choose next version:
30
+ #{text}
31
+
32
+ FIN
33
+
34
+ print 'Choose? [1]'
35
+ option = gets.strip
36
+
37
+ index = option == '' ? 0 : option.to_i - 1
38
+ version = versions[index]
39
+ raise "Invalid option #{option}" unless version
40
+
41
+ `ruby -p -i -e 'gsub /#{current}/,"#{version}"' #{path}`
42
+ puts `bundle; git add #{path} Gemfile.lock; git commit -m "Version #{version}."; git tag v#{version}`
43
+
44
+ puts <<~FIN
45
+
46
+ Press enter to git push or CTRL+C to cancel
47
+
48
+ FIN
49
+
50
+ print 'git push origin master --tags'
51
+ gets
52
+ puts `git push origin master --tags`
53
+
54
+ puts 'rake release'
55
+ gets
56
+ puts `rake release`
@@ -53,8 +53,9 @@ module Webdrone
53
53
  end
54
54
 
55
55
  def self.irb_console(binding = nil)
56
- puts "Webdrone: Webdrone.irb_console IS DEPRECATED, please use a0.console instead."
56
+ puts 'Webdrone: Webdrone.irb_console IS DEPRECATED, please use a0.console instead.'
57
57
  return if IRB.CurrentContext && !binding
58
+
58
59
  binding ||= Kernel.binding.of_caller(1)
59
60
  IRB.start_session(binding)
60
61
  end
@@ -62,7 +63,7 @@ module Webdrone
62
63
  Webdrone.running_pry = false
63
64
  def self.pry_console(binding = nil)
64
65
  if Webdrone.running_pry
65
- puts "Webdrone: pry console already running."
66
+ puts 'Webdrone: pry console already running.'
66
67
  else
67
68
  Webdrone.running_pry = true
68
69
  binding ||= Kernel.binding.of_caller(1)
@@ -91,7 +92,7 @@ module IRB
91
92
  @CONF[:IRB_RC]&.call(irb.context)
92
93
  @CONF[:MAIN_CONTEXT] = irb.context
93
94
 
94
- trap("SIGINT") do
95
+ trap('SIGINT') do
95
96
  irb.signal_handle
96
97
  end
97
98
 
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'English'
4
+
3
5
  module Webdrone
4
6
  class Browser
5
7
  attr_reader :driver
@@ -14,7 +16,7 @@ module Webdrone
14
16
  @firefox_profile['startup.homepage_welcome_url.additional'] = 'about:blank'
15
17
  @firefox_profile['browser.download.folderList'] = 2
16
18
  @firefox_profile['browser.download.manager.showWhenStarting'] = false
17
- @firefox_profile['browser.helperApps.neverAsk.saveToDisk'] = "images/jpeg, application/pdf, application/octet-stream, application/download"
19
+ @firefox_profile['browser.helperApps.neverAsk.saveToDisk'] = 'images/jpeg, application/pdf, application/octet-stream, application/download'
18
20
 
19
21
  @firefox_profile
20
22
  end
@@ -42,7 +44,7 @@ module Webdrone
42
44
  env_update(Kernel.binding) if use_env
43
45
 
44
46
  if create_outdir || outdir
45
- outdir ||= File.join("webdrone_output", Time.new.strftime('%Y%m%d_%H%M%S'))
47
+ outdir ||= File.join('webdrone_output', Time.new.strftime('%Y%m%d_%H%M%S'))
46
48
  conf.outdir = outdir
47
49
  end
48
50
  outdir = File.join(Dir.pwd, outdir) if !outdir.nil? && !Pathname.new(outdir).absolute?
@@ -57,15 +59,17 @@ module Webdrone
57
59
  chrome_options.add_argument '--start-maximized' if maximize
58
60
  maximize = false
59
61
 
60
- @driver = Selenium::WebDriver.for browser.to_sym, options: chrome_options, driver_opts: { log_path: "/tmp/chromedriver.#{$$}.log", verbose: true }
62
+ service = Selenium::WebDriver::Service.chrome(args: { log_path: "/tmp/chromedriver.#{$PID}.log", verbose: true })
63
+ @driver = Selenium::WebDriver.for browser.to_sym, options: chrome_options, service: service
61
64
  elsif !outdir.nil? && browser.to_sym == :firefox
62
65
  firefox_options ||= Browser.firefox_options
63
66
  firefox_profile ||= Browser.firefox_profile
64
67
 
65
68
  firefox_options.add_argument '-headless' if headless
66
- downdir = OS.windows? ? outdir.tr("/", "\\") : outdir
69
+ downdir = OS.windows? ? outdir.tr('/', '\\') : outdir
67
70
  firefox_profile['browser.download.dir'] = downdir
68
- @driver = Selenium::WebDriver.for browser.to_sym, profile: firefox_profile, options: firefox_options
71
+ firefox_options.profile = firefox_profile
72
+ @driver = Selenium::WebDriver.for browser.to_sym, options: firefox_options
69
73
  else
70
74
  @driver = Selenium::WebDriver.for browser.to_sym
71
75
  end
@@ -124,6 +128,7 @@ module Webdrone
124
128
 
125
129
  def console(binding = nil)
126
130
  return unless conf.developer
131
+
127
132
  binding ||= Kernel.binding.of_caller(1)
128
133
  old_error = conf.error
129
134
  old_developer = conf.developer
@@ -140,9 +145,9 @@ module Webdrone
140
145
  protected
141
146
 
142
147
  def env_update_bool(binding, var, val_old, val_new)
143
- if val_new == "true"
148
+ if val_new == 'true'
144
149
  val_new = true
145
- elsif val_new == "false"
150
+ elsif val_new == 'false'
146
151
  val_new = false
147
152
  else
148
153
  puts "Webdrone: ignoring value '#{val_new}' for boolean parameter #{var}."
@@ -32,7 +32,8 @@ module Webdrone
32
32
  end
33
33
 
34
34
  def error=(val)
35
- raise "Invalid value '#{val}' for error" if !%i[raise_report raise ignore].include? val
35
+ raise "Invalid value '#{val}' for error" unless %i[raise_report raise ignore].include? val
36
+
36
37
  @error = val
37
38
  rescue StandardError => error
38
39
  Webdrone.report_error(@a0, error)
@@ -133,6 +133,7 @@ module Webdrone
133
133
 
134
134
  def self.report_error(a0, exception)
135
135
  return if a0.conf.error == :ignore
136
+
136
137
  if exception.class != WebdroneError
137
138
  exception = WebdroneError.new(exception.message, exception, a0, Kernel.binding.callers)
138
139
  if a0.conf.developer && exception.binding
@@ -101,7 +101,8 @@ module Webdrone
101
101
  def setup_format
102
102
  begin
103
103
  cols, _line = HighLine.default_instance.terminal.terminal_size
104
- rescue StandardError
104
+ rescue StandardError => error
105
+ puts "ignoring error: #{error}"
105
106
  end
106
107
  cols ||= 120
107
108
  total = 6 + 15 + 11 + 5
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Webdrone
4
- VERSION = '1.8.12'
4
+ VERSION = '1.10.0'
5
5
  end
@@ -42,6 +42,7 @@ module Webdrone
42
42
  targ = "contains: [#{contains}]" if contains
43
43
 
44
44
  raise "VRFY: #{callee} [#{text}] text value [#{item.text}] does not comply #{targ}" if attr.nil?
45
+
45
46
  raise "VRFY: #{callee} [#{text}] attr [#{attr}] value [#{item.attribute(attr)}] does not comply #{targ}"
46
47
  end
47
48
 
@@ -27,7 +27,7 @@ module Webdrone
27
27
  locator = locator.to_s
28
28
  button = descendant(:input)[attr(:type).one_of('submit', 'reset', 'image', 'button')][attr(:id).equals(locator) | attr(:value).is(locator) | attr(:title).is(locator)]
29
29
  button += descendant(:button)[attr(:id).equals(locator) | attr(:value).is(locator) | string.n.is(locator) | attr(:title).is(locator)]
30
- button += descendant(:input)[attr(:type).equals('image')][attr(:alt).is(locator)]
30
+ button + descendant(:input)[attr(:type).equals('image')][attr(:alt).is(locator)]
31
31
  end
32
32
 
33
33
  # Match anything returned by either {#link} or {#button}.
@@ -154,7 +154,7 @@ module Webdrone
154
154
  # Id of the 'dd' element or text from preciding 'dt' element content
155
155
  def definition_description(locator)
156
156
  locator = locator.to_s
157
- descendant(:dd)[attr(:id).equals(locator) | previous_sibling(:dt)[string.n.equals(locator)] ]
157
+ descendant(:dd)[attr(:id).equals(locator) | previous_sibling(:dt)[string.n.equals(locator)]]
158
158
  end
159
159
 
160
160
  protected
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  lib = File.expand_path('lib', __dir__)
2
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
5
  require 'webdrone/version'
@@ -15,7 +17,8 @@ Gem::Specification.new do |spec|
15
17
 
16
18
  # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
17
19
  # delete this section to allow pushing this gem to any host.
18
- raise "RubyGems 2.0 or newer is required to protect against public gem pushes." unless spec.respond_to?(:metadata)
20
+ raise 'RubyGems 2.0 or newer is required to protect against public gem pushes.' unless spec.respond_to?(:metadata)
21
+
19
22
  spec.metadata['allowed_push_host'] = 'https://rubygems.org'
20
23
 
21
24
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
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.8.12
4
+ version: 1.10.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: 2019-02-22 00:00:00.000000000 Z
11
+ date: 2019-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -219,6 +219,7 @@ files:
219
219
  - ".rubocop.yml"
220
220
  - ".ruby-gemset"
221
221
  - ".ruby-version"
222
+ - ".tool-versions"
222
223
  - ".travis.yml"
223
224
  - CHANGELOG.md
224
225
  - Gemfile
@@ -226,6 +227,7 @@ files:
226
227
  - README.md
227
228
  - Rakefile
228
229
  - bin/console
230
+ - bin/release-version
229
231
  - bin/setup
230
232
  - lib/webdrone.rb
231
233
  - lib/webdrone/browser.rb
@@ -268,8 +270,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
268
270
  - !ruby/object:Gem::Version
269
271
  version: '0'
270
272
  requirements: []
271
- rubyforge_project:
272
- rubygems_version: 2.7.8
273
+ rubygems_version: 3.0.3
273
274
  signing_key:
274
275
  specification_version: 4
275
276
  summary: A simple selenium webdriver wrapper, ruby version.