locatine 0.00506 → 0.00552

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
  SHA1:
3
- metadata.gz: 9a068a134bc0e30eb40d642214352c806cf81fed
4
- data.tar.gz: 4b666c9a61e5f2d0e48e559d3559a71493ae3a4e
3
+ metadata.gz: e57e23979fb3a69439e1bd692a22568d47654178
4
+ data.tar.gz: 02d220e1a0cd3ae905516c0e488cec37858e9484
5
5
  SHA512:
6
- metadata.gz: 648e56d5ce390bf5b08a1da6631d5b9dfaf51f356fea9b7ffd0759cd8108332cd513d4a0e90d6ae78cd6f4abf73e5d20375b0de3c3a87b82ebc909d723c4140a
7
- data.tar.gz: 4d92abdb0b900b2fb456bcd230564bd051b0ca8e15c08f198a7eb3ecb0409f0a76a122068ef272b3db642486977d79dccac5802a8f84e451998b9b81e790e4c5
6
+ metadata.gz: 8fdd5b8d9e841b3b08de8b2611c24d9402866b4b523f84b1741cfbf0f7618a987e538cf45b54c1a56bb8a8372598feaef8f25822157d2d56b0539f002a2fcc1f
7
+ data.tar.gz: 56cd9562f131ba2b52d9a7bcb2e6cf45d335c83acdbc50c2808f685aadbe2295d0d9b3704a9b8e923f1b3350a5e9699fee486b5897aa226b5993f5d87a99011c
@@ -2,7 +2,6 @@ require "watir"
2
2
  require "json"
3
3
  require "fileutils"
4
4
  require "chromedriver-helper"
5
- require "pry"
6
5
 
7
6
  module Locatine
8
7
 
@@ -172,8 +171,12 @@ module Locatine
172
171
  end
173
172
 
174
173
  def get_trusted(array)
175
- max_stability = (array.max_by {|i| i["stability"].to_i})["stability"].to_i
176
- return (array.select {|i| i["stability"].to_i == max_stability}).uniq
174
+ if array.length > 0
175
+ max_stability = (array.max_by {|i| i["stability"].to_i})["stability"].to_i
176
+ return (array.select {|i| i["stability"].to_i == max_stability}).uniq
177
+ else
178
+ return []
179
+ end
177
180
  end
178
181
 
179
182
  def generate_xpath(data, vars)
@@ -310,7 +313,8 @@ module Locatine
310
313
  max = all.count(all.max_by {|i| all.count(i)})
311
314
  guess = (all.select {|i| all.count(i) == max}).uniq
312
315
  guess_data = generate_data(guess, vars)
313
- if (engine.elements.length/find_by_data(guess_data, vars).length <=4)
316
+ by_data = find_by_data(guess_data, vars)
317
+ if by_data.nil? || (engine.elements.length/find_by_data(guess_data, vars).length <=4)
314
318
  puts "Locatine has no good guess for #{name} in #{scope}. Try to change the name. Or just define it."
315
319
  guess = nil
316
320
  guess_data = {}
@@ -350,13 +354,17 @@ module Locatine
350
354
  if old_element != element
351
355
  mass_highlight_turn(old_element, false) if old_element
352
356
  mass_highlight_turn(element) if element
353
- puts "#{element.length} elemens were selected as #{name} in #{scope}"
357
+ if element.nil?
358
+ puts "Nothing is selected as #{name} in #{scope}"
359
+ else
360
+ puts "#{element.length} elements were selected as #{name} in #{scope}"
361
+ end
354
362
  end
355
363
  old_element, old_tag, old_index = element, tag, index
356
364
  case get_from_app("locatineconfirmed")
357
365
  when "true"
358
366
  send_to_app("locatineconfirmed", "ok")
359
- send_to_app("locatinetitle", "You are defining nothing. So no button will work")
367
+ send_to_app("locatinetitle", "Right now you are defining nothing. So no button will work")
360
368
  send_to_app("locatinehint", "Place for a smart hint here")
361
369
  finished = true
362
370
  when "declined"
@@ -1,6 +1,6 @@
1
1
  module Locatine
2
2
  # constants here...
3
- VERSION = "0.00506"
3
+ VERSION = "0.00552"
4
4
  NAME = "locatine"
5
5
  HOME = File.readable?("#{Dir.pwd}/lib/#{Locatine::NAME}")? "#{Dir.pwd}/lib/#{Locatine::NAME}" : "#{Gem.dir}/gems/#{Locatine::NAME}-#{Locatine::VERSION}/lib/#{Locatine::NAME}"
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: locatine
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.00506'
4
+ version: '0.00552'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergei Seleznev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-03 00:00:00.000000000 Z
11
+ date: 2019-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler