appom 1.1.0 → 1.1.1

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: e2853e5118fd75268ff6297448f91e01994b2f4a06a22e00cd92963dc08215b0
4
- data.tar.gz: d911296d61b4568e3e9f73453bd931aba4647a86e81b4fc3bf20c92c7c26ae0b
3
+ metadata.gz: d908dabf19833e634dfca5346479af0ddaec674d3789fb2c5ed8e3b6f683c8b2
4
+ data.tar.gz: 71f4bd5d5993a315bca716ef04df92a600b4e599e832d868d702d7592510648d
5
5
  SHA512:
6
- metadata.gz: a822cac2b1155cd1aa21eeb6263f361e669f0c90911ffd444b041d37ed2fb6ec03a054d5d2bd87a2a21f6f097ebb80dfd98c661aac5c1a44fa135e0ba9e2d597
7
- data.tar.gz: 3cfaea41cb2cdb4ec8c337f53d8342d0153c2e8483412d0c43cfdbbd0a74f4b1f1a18afc9ba64030885f72ad228c7c183a5ac32ec7c783fe0221587e574b1c22
6
+ metadata.gz: 343714b2b78f8a1d4a3201c0eb123981d14d8a666821849a89f77da9137f9654c1aaed61659c85f90af5e1255539bdb4f432766e58cc6e0cef136e5133b46f93
7
+ data.tar.gz: cf82ada29b646b08e20c5a42d3ffaf228294f65e7a7deb96cee6fd4057bdc0729209908d42b9d33a7250a293d95ef1941c1a102a4db20f4569302e757c3be739
@@ -14,38 +14,6 @@ module Appom
14
14
  raise Appom::UnsupportedBlockError
15
15
  end
16
16
 
17
- # # Check container has element
18
- # def not_contain_element(element_name)
19
- # element_params = send("#{element_name}_params")
20
- # wait_until('no element exists', *element_params)
21
- # end
22
- #
23
- # # Check container has elements
24
- # def contain_elements(element_names)
25
- # element_names.each do |element|
26
- # contain_element(element)
27
- # end
28
- # end
29
- #
30
- # Check container has element
31
- # def contain_element(element_name)
32
- # element_params = send("#{element_name}_params")
33
- # puts "Elemenet params = #{element_params}"
34
- # wait_until('at least one element exists', *element_params)
35
- # end
36
- #
37
- # # Check container has element and element is disabled
38
- # def contain_disabled_element(element_name)
39
- # element_params = send("#{element_name}_params")
40
- # wait_until('element disable', *element_params)
41
- # end
42
- #
43
- # # Check container has element and element is enabled
44
- # def contain_enableb_element(element_name)
45
- # element_params = send("#{element_name}_params")
46
- # wait_until('element enable', *element_params)
47
- # end
48
-
49
17
  ##
50
18
  # Options re-combiner. This takes the original inputs and combines
51
19
  # them such that there is only one hash passed as a final argument
@@ -85,9 +53,8 @@ module Appom
85
53
  end
86
54
  end
87
55
 
88
- create_verify_element_text(name, text, args)
89
-
90
- create_get_element_params(name, find_args)
56
+ create_get_element_params(name, args)
57
+ define_get_element_text(name, text)
91
58
  end
92
59
  end
93
60
 
@@ -210,21 +177,6 @@ module Appom
210
177
  end
211
178
  end
212
179
 
213
- ##
214
- # Check element exist
215
- # We will try to find all elements with *find_args
216
- # Condition is pass when response is not empty
217
- #
218
- def create_existence_checker(element_name, *find_args)
219
- method_name = "wait_until_has_#{element_name}"
220
- create_helper_method(method_name, *find_args) do
221
- define_method(method_name) do |*runtime_args|
222
- args = merge_args(find_args, runtime_args)
223
- wait_check_until_not_empty(*args)
224
- end
225
- end
226
- end
227
-
228
180
  ##
229
181
  # Try to get all elements until not get empty array
230
182
  #
@@ -253,6 +205,20 @@ module Appom
253
205
  end
254
206
  end
255
207
 
208
+ ##
209
+ # Check element exist
210
+ # We will try to find all elements with *find_args
211
+ # Condition is pass when response is not empty
212
+ #
213
+ def create_existence_checker(element_name, *find_args)
214
+ method_name = "wait_until_has_#{element_name}"
215
+ create_helper_method(method_name, *find_args) do
216
+ define_method(method_name) do |*runtime_args|
217
+ args = merge_args(find_args, runtime_args)
218
+ wait_until('at least one element exists', *args)
219
+ end
220
+ end
221
+ end
256
222
 
257
223
  ##
258
224
  # Check element non-existent
@@ -264,7 +230,7 @@ module Appom
264
230
  create_helper_method(method_name, *find_args) do
265
231
  define_method(method_name) do |*runtime_args|
266
232
  args = merge_args(find_args, runtime_args)
267
- wait_check_until_empty(*args)
233
+ wait_until('no element exists', *args)
268
234
  end
269
235
  end
270
236
  end
@@ -295,29 +261,6 @@ module Appom
295
261
  end
296
262
  end
297
263
 
298
- ##
299
- # Verify text for an element
300
- #
301
- def create_verify_element_text(element_name, text, *find_args)
302
- method_name = "#{element_name}_verify_text"
303
-
304
- create_helper_method(method_name, *find_args) do
305
- define_method(method_name) do |*runtime_args|
306
- # Raise if element have no text value
307
- if text.nil?
308
- raise(ElementsDefineNoTextError, "#{name} element is define with no text value")
309
- end
310
-
311
- args = merge_args(find_args, runtime_args)
312
- element = _find(*args)
313
- element_text = element.text
314
- if !element_text.eql?(text)
315
- raise(ElementsTextVerifyError, "expected: value == #{text} got: #{element_text}")
316
- end
317
- end
318
- end
319
- end
320
-
321
264
  ##
322
265
  # Get parameter is passed when declared element
323
266
  #
@@ -330,6 +273,16 @@ module Appom
330
273
  end
331
274
  end
332
275
 
276
+ ##
277
+ # Get text is passed when declared element
278
+ #
279
+ def define_get_element_text(element_name, text)
280
+ method_name = "#{element_name}_text"
281
+ define_method(method_name) do
282
+ text
283
+ end
284
+ end
285
+
333
286
  ##
334
287
  # Deduce text value
335
288
  # @return expected text for element and the remaining parameters
@@ -11,51 +11,6 @@ module Appom
11
11
  page.find_elements(*find_args)
12
12
  end
13
13
 
14
- ##
15
- # Use wait to check element non-exist
16
- # Before timeout we will try to find elements and check response is empty
17
- #
18
- def wait_check_until_empty(*find_args)
19
- wait = Wait.new(timeout: Appom.max_wait_time)
20
- wait.until do
21
- page.find_elements(*find_args).empty?
22
- end
23
- end
24
-
25
- ##
26
- # Use wait to check element exist
27
- # Before timeout we will try to find elements and check response is not empty
28
- #
29
- def wait_check_until_not_empty(*find_args)
30
- wait = Wait.new(timeout: Appom.max_wait_time)
31
- wait.until do
32
- !page.find_elements(*find_args).empty?
33
- end
34
- end
35
-
36
-
37
-
38
- ##
39
- # Wait until an element will be enable
40
- #
41
- def wait_until_element_enabled(*find_args)
42
- wait = Wait.new(timeout: Appom.max_wait_time)
43
- wait.until { page.find_element(*find_args).enabled? }
44
- end
45
-
46
- ##
47
- # Wait until an element will be disable
48
- #
49
- def wait_until_element_disabled(*find_args)
50
- wait = Wait.new(timeout: Appom.max_wait_time)
51
- wait.until do !page.
52
- find_element(*find_args).enabled?
53
- end
54
- end
55
-
56
-
57
-
58
-
59
14
  ##
60
15
  # Use wait to get elements
61
16
  # Before timeout we will try to find elements until response return array is not empty
data/lib/appom/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Appom
2
- VERSION = '1.1.0'.freeze
2
+ VERSION = '1.1.1'.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.0
4
+ version: 1.1.1
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-03-25 00:00:00.000000000 Z
11
+ date: 2019-03-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: appium_lib