locatine 0.01215 → 0.01300

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: 654fcf96ac8cb5d60890e8f763c11f48d7a8a44b
4
- data.tar.gz: 4124878952ca9a27a869a347d2d56959e72e470b
3
+ metadata.gz: dcac98a7110904e47f05c216b6b78032013f626f
4
+ data.tar.gz: d2560254389abffb699a635a40dd211bebcb0abc
5
5
  SHA512:
6
- metadata.gz: e009b71ac4bf3c74912a0c7f03b7faf5de050dbbc996fd1cf95a8435dea7bb6a6708949f39c9ca42fae5769ebc40af7e79513d64b6e5424e8e359eafce865f79
7
- data.tar.gz: 6eb4a9ca18de051c96e915b0b6d7130d7ec0c2529577443b17b59bcf675dcbf4b082b7c38ea41426f600b78f092d85352e614c52d46aea34e64cdfd0bace1b1f
6
+ metadata.gz: 58a755f90fa8442934185daf90f33d0655e215c7487d21fb44dbd760ad3004bc222bca599ca77c221342a86dde2e665a0f9fdefc365456f06c5389cb60612a54
7
+ data.tar.gz: 8f0cf282edc1cc4652c8badf6d266814bdd22ab47efb88e708ac381eb75100d895e9e1ccc5306628fb1282eaf3927d8273a03006a96bfd66af638700558ee18c
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "Locatine app",
3
- "version": "0.01215",
3
+ "version": "0.01300",
4
4
  "description": "Messaging from browser to main app",
5
5
  "devtools_page": "devtools.html",
6
6
  "permissions": ["activeTab", "storage", "contextMenus", "tabs"],
@@ -30,7 +30,7 @@ module Locatine
30
30
  end
31
31
 
32
32
  def fix_iframe
33
- @iframe = @browser.iframe(@iframe.selector) if @iframe
33
+ @iframe = @browser.iframe(@iframe.selector) if @iframe && @iframe.stale?
34
34
  end
35
35
 
36
36
  def push_title(text)
@@ -40,7 +40,8 @@ module Locatine
40
40
 
41
41
  ##
42
42
  # Sending request to locatine app
43
- def start_listening(_scope, _name)
43
+ def start_listening(scope, name)
44
+ push_title "You are selecting #{name} in #{scope}"
44
45
  send_to_app('locatinestyle', 'blocked', @browser) if @iframe
45
46
  send_to_app('locatinehint', 'Toggle single//collection mode button if '\
46
47
  'you need. If you want to do some actions on the page toggle Locatine'\
@@ -59,13 +60,12 @@ module Locatine
59
60
 
60
61
  def response_action(element)
61
62
  send_to_app('locatineconfirmed', 'ok')
62
- send_to_app('locatinetitle', 'Right now you are defining nothing. '\
63
- 'So no button will work')
63
+ push_title 'Right now you are defining nothing. So no button will work'
64
64
  send_to_app('locatinehint', 'Place for a smart hint here')
65
65
  mass_highlight_turn(element, false)
66
66
  send_to_app('locatinestyle', 'set_false')
67
67
  send_to_app('locatinestyle', 'ok', @browser) if @iframe
68
- sleep 0.5
68
+ sleep 1
69
69
  end
70
70
  end
71
71
  end
@@ -43,19 +43,35 @@ module Locatine
43
43
 
44
44
  warn "Maybe #{tag} can't be found as a #{@type}?" if @type && !element
45
45
 
46
- return find_by_data(attributes, vars).to_a, attributes.to_h unless element
46
+ return_selected(element, attributes, new_attributes, vars)
47
+ end
48
+
49
+ def return_old_selection(attrs, vars)
50
+ return find_by_data(attrs, vars).to_a, attrss.to_h if attrs.to_h != {}
51
+
52
+ return nil, {}
53
+ end
54
+
55
+ def return_selected(element, attributes, new_attributes, vars)
56
+ if !element && new_attributes.to_h != {}
57
+ push_title 'Selected element was lost before locatine locate it. '\
58
+ 'Consider choosing it from devtools or write your own locator'
59
+ return return_old_selection(attributes, vars)
47
60
 
61
+ end
48
62
  return element, new_attributes
49
63
  end
50
64
 
51
65
  def what_was_selected(element, attributes, vars, name, scope)
52
- send_to_app('locatineconfirmed', 'ok')
53
66
  tag, index = tag_index
67
+ send_to_app('locatineconfirmed', 'ok')
54
68
  mass_highlight_turn(element, false) if element
55
69
  element, attributes = working_on_selected(tag, index, vars, attributes)
56
- mass_highlight_turn(element) if element
57
- push_title "#{element.length} elements were selected as #{name} in "\
70
+ if element
71
+ mass_highlight_turn(element)
72
+ push_title "#{element.length} elements were selected as #{name} in "\
58
73
  "#{scope}. If it is correct - confirm the selection."
74
+ end
59
75
  return element, attributes
60
76
  end
61
77
 
@@ -15,7 +15,7 @@ module Locatine
15
15
  hash.merge(JSON.parse(File.read(@json))['data'])
16
16
  end
17
17
 
18
- def set_file(json)
18
+ def import_file(json)
19
19
  @json = json
20
20
  @folder = File.dirname(@json)
21
21
  @name = File.basename(@json)
@@ -30,7 +30,7 @@ module Locatine
30
30
  tolerance: 15)
31
31
  browser ||= right_browser
32
32
  @browser = browser
33
- set_file(json)
33
+ import_file(json)
34
34
  @depth = depth
35
35
  @learn = learn
36
36
  @stability_limit = stability_limit
@@ -102,7 +102,7 @@ module Locatine
102
102
  end
103
103
 
104
104
  def json=(value)
105
- set_file(value)
105
+ import_file(value)
106
106
  end
107
107
  end
108
108
  end
@@ -1,6 +1,6 @@
1
1
  module Locatine
2
2
  # constants here...
3
- VERSION = '0.01215'.freeze
3
+ VERSION = '0.01300'.freeze
4
4
  NAME = 'locatine'.freeze
5
5
  HOME = if File.readable?("#{Dir.pwd}/lib/#{Locatine::NAME}")
6
6
  "#{Dir.pwd}/lib/#{Locatine::NAME}"
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.01215'
4
+ version: '0.01300'
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-10 00:00:00.000000000 Z
11
+ date: 2019-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler