appom 1.1.4 → 1.1.5

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: af44a4930d45306b62a8b2f383feed589ce9f6d7ce606f0425bda6f940eb3eb5
4
- data.tar.gz: cbe7893e9b5ebac45b2488f5aa01092a46fc56ed7875217f186a37e4b4ac3b3c
3
+ metadata.gz: 413f62216c8a9e8fde5b69001d39e7479b34a0625e747beeccde3334649719d8
4
+ data.tar.gz: 8739cc428c145008df6f59b923fe532b41434a099936ba0e7fc4a1b0532537a6
5
5
  SHA512:
6
- metadata.gz: 3f0121294b4234366135e9a148d2b87dedac876ccd8d3a555adfc0479e9803beb257b9f8c378d4eb228b73b9b00911a643c3d5c39f79ed15d37503d8d4a2f947
7
- data.tar.gz: f8a2a3a4aa46a3077fc532166268907f8dc165b34e5afb08d4c801d9e7da810d3255894ec02ed3573146049fbfa9a26c0956bf2c9cd1a402182f27ba0d61e951
6
+ metadata.gz: 8c747846946703a616271e19ae68d911b2eab95f76f6429adcefa90c1dd68b9b8330a98a257ace03665d675bde53a85d7f5ca9dddc46d78d962b4dd5e86effa9
7
+ data.tar.gz: 3998ed8432d928ec38c4cb5728ae0aef3766b7c4e0ba57549bf7ee0c6db59f595e0dcd40d09707ca47c440adb0e891d8161412e3786e99f46cabe811157fea93
@@ -42,7 +42,8 @@ module Appom
42
42
  # Element doesn't support block so that will raise if pass a block when declare
43
43
  #
44
44
  def element(name, *find_args)
45
- text, args = deduce_element_text(find_args)
45
+ args, text = deduce_element_args(find_args)
46
+
46
47
  build_element(name, *args) do
47
48
  define_method(name) do |*runtime_args, &block|
48
49
  raise_if_block(self, name, !block.nil?, :element)
@@ -284,10 +285,10 @@ module Appom
284
285
  end
285
286
 
286
287
  ##
287
- # Deduce text value
288
- # @return expected text for element and the remaining parameters
288
+ # Deduce args and other parameters
289
+ # @return args for appium and other parameters
289
290
  #
290
- def deduce_element_text(args)
291
+ def deduce_element_args(args)
291
292
  # Flatten argument array first if we are in case array inside array
292
293
  args = args.flatten
293
294
 
@@ -298,14 +299,17 @@ module Appom
298
299
  # Get last key and check if it contain 'text' key
299
300
  last_key = args.last
300
301
  text = nil
301
- if last_key.is_a?(Hash)
302
- if last_key.key?(:text)
303
- text = last_key[:text]
304
- args.pop
302
+
303
+ args.each do |arg|
304
+ if arg.is_a?(Hash)
305
+ # Extract text value
306
+ if arg.key?(:text)
307
+ text = arg[:text]
308
+ args.delete(arg)
309
+ end
305
310
  end
306
311
  end
307
-
308
- [text, args]
312
+ [args, text]
309
313
  end
310
314
 
311
315
  ##
@@ -41,7 +41,6 @@ module Appom
41
41
  wait = Wait.new(timeout: Appom.max_wait_time)
42
42
  wait.until do
43
43
  elements = page.find_elements(*find_args)
44
- is_found = false
45
44
  elements.each do |element|
46
45
  element_text = element.text
47
46
  if element_text == text
@@ -49,10 +48,7 @@ module Appom
49
48
  end
50
49
  end
51
50
 
52
- if !is_found
53
- raise Appom::ElementsEmptyError, "Not found element with text #{text}"
54
- end
55
- return result
51
+ raise Appom::ElementsEmptyError, "Not found element with text #{text}"
56
52
  end
57
53
  end
58
54
 
@@ -1,3 +1,3 @@
1
1
  module Appom
2
- VERSION = '1.1.4'.freeze
2
+ VERSION = '1.1.5'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appom
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4
4
+ version: 1.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Harry.Tran
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-04-19 00:00:00.000000000 Z
11
+ date: 2019-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: appium_lib