SurfCustomCalabash 0.1.7 → 0.1.8

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: bc36d47dbb465e8902af53b0d6519f9caf644ef1
4
- data.tar.gz: b6fab405830127ae15c75932c68ec40114b4cd74
3
+ metadata.gz: 9e4de4a6c1d6a35f5de695fa6b77244fef2274f8
4
+ data.tar.gz: 46d22f0d943ea780e1473260c9c417ac25ced891
5
5
  SHA512:
6
- metadata.gz: 41d1423cf682108dbde016efebcfa9a36b7ab6ac77d409aafc01bede5a1dd5209d93440f9225fe64ed04a7724380925b7d01ea43b1c19815db8eeafc2051a307
7
- data.tar.gz: 739e4e246b6c0f2b40691b7f8d75b61cc4059748a316d156906faf1b2b62533d772b0efc3e80134f83352e7b3ff760c6ce1e02fec1d199f4b35618a665eb156e
6
+ metadata.gz: 63b95cd838c704068f02b7cb151e7a6bc2f7fb720edd861bc6f0e3f71d299acf16564105a28e096ed2b763c53d9d6966e9c546e1f905b8a3cad75365231cf549
7
+ data.tar.gz: 80f508a5a6e11806174305f88206a0f6ad76a5056b20dcf27bcab795c2833cb50c485a8baaf7a4857d140b068a94168628ccaf189a793c221b248a70003b7323
@@ -7,9 +7,9 @@ require 'rspec/expectations'
7
7
 
8
8
  # ----------------------------------------------Custom Taps-----------------------------------------------------------
9
9
  # wait element and tap
10
- def tap_on(element)
11
- wait_for_elements_exist(element, :timeout=>15, :retry_frequency=>5)
12
- sleep(0.5)
10
+ def tap_on(element, timeout_duration: 15, sleep_duration: 0.5)
11
+ wait_for_elements_exist(element, :timeout=>timeout_duration, :retry_frequency=>5)
12
+ sleep(sleep_duration)
13
13
  touch(element)
14
14
  end
15
15
 
@@ -18,90 +18,92 @@ require 'rspec/expectations'
18
18
  end
19
19
 
20
20
  # if element exists - tap, if not - swipe until element exists and tap
21
- def tap_or_swipe(element)
21
+ def tap_or_swipe(element, timeout_duration: 30)
22
22
  if element_exists(element)
23
- sleep(1)
23
+ sleep(2)
24
24
  touch(element)
25
25
  else
26
- until_element_exists(element,:action => lambda{light_swipe('down')}, :timeout => 30)
26
+ until_element_exists(element,:action => lambda{light_swipe('down')}, :timeout => timeout_duration)
27
27
  light_swipe('down')
28
- sleep(1)
28
+ sleep(2)
29
29
  touch(element)
30
30
  end
31
31
  end
32
32
 
33
33
  # ----------------------------------------------------Custom Waits----------------------------------------------------
34
- def wait_element(element)
35
- wait_for_element_exists(element, :timeout=>15)
34
+ def wait_element(element, timeout_duration: 15)
35
+ wait_for_element_exists(element, :timeout=>timeout_duration)
36
36
  end
37
37
 
38
- def wait_no_element(element)
39
- wait_for_element_does_not_exist(element, :timeout=>15)
38
+ def wait_no_element(element, timeout_duration: 15)
39
+ wait_for_element_does_not_exist(element, :timeout=>timeout_duration)
40
40
  end
41
41
 
42
42
  # wait trait-element on screen
43
- def wait_for_screen
44
- wait_for_elements_exist(trait, :timeout=>25)
43
+ def wait_for_screen(timeout_duration: 25)
44
+ wait_for_elements_exist(trait, :timeout=>timeout_duration)
45
45
  end
46
46
 
47
47
  # ----------------------------------------------------Custom Swipe----------------------------------------------------
48
- def strong_swipe_until_not_exist(dir, element_destination)
48
+ def strong_swipe_until_not_exist(dir, element_destination, timeout_duration: 40)
49
49
  until_element_does_not_exist(element_destination,
50
- :action => lambda{strong_swipe(dir)})
50
+ :action => lambda{strong_swipe(dir)}, :timeout => timeout_duration)
51
51
  end
52
52
 
53
- def normal_swipe_until_not_exist(dir, element_destination)
53
+ def normal_swipe_until_not_exist(dir, element_destination, timeout_duration: 40)
54
54
  until_element_does_not_exist(element_destination,
55
- :action => lambda{normal_swipe(dir)})
55
+ :action => lambda{normal_swipe(dir)}, :timeout => timeout_duration)
56
56
  end
57
57
 
58
- def light_swipe_until_not_exist(dir, element_destination)
58
+ def light_swipe_until_not_exist(dir, element_destination, timeout_duration: 40)
59
59
  until_element_does_not_exist(element_destination,
60
- :action => lambda{light_swipe( dir)})
60
+ :action => lambda{light_swipe( dir)}, :timeout => timeout_duration)
61
61
  end
62
62
 
63
- def strong_swipe_until_exists(dir, element_destination)
63
+ def strong_swipe_until_exists(dir, element_destination, timeout_duration: 40)
64
64
  until_element_exists(element_destination,
65
- :action => lambda{strong_swipe( dir)})
65
+ :action => lambda{strong_swipe( dir)}, :timeout => timeout_duration)
66
66
  end
67
67
 
68
- def normal_swipe_until_exists(dir, element_destination)
68
+ def normal_swipe_until_exists(dir, element_destination, sleep_duration: 2, timeout_duration: 40)
69
69
  until_element_exists(element_destination,
70
- :action => lambda{normal_swipe( dir); sleep(2)}, :timeout=>40)
70
+ :action => lambda{normal_swipe( dir); sleep(sleep_duration)}, :timeout=>timeout_duration)
71
71
  end
72
72
 
73
- def light_swipe_until_exists(dir, element_destination)
73
+ def light_swipe_until_exists(dir, element_destination, sleep_duration: 2, timeout_duration: 40)
74
74
  until_element_exists(element_destination,
75
- :action => lambda{light_swipe( dir); sleep(2)}, :timeout=>60)
75
+ :action => lambda{light_swipe( dir); sleep(sleep_duration)}, :timeout=>timeout_duration)
76
76
 
77
77
  end
78
78
 
79
- def strong_swipe_element_until_exists(dir, element, element_destination)
79
+ def strong_swipe_element_until_exists(dir, element, element_destination, timeout_duration: 40)
80
80
  until_element_exists(element_destination,
81
- :action => lambda{strong_swipe_element(element, dir)})
81
+ :action => lambda{strong_swipe_element(element, dir)}, :timeout=>timeout_duration)
82
82
  end
83
83
 
84
- def light_swipe_element_until_exists(dir, element, element_destination)
84
+ def light_swipe_element_until_exists(dir, element, element_destination, timeout_duration: 40)
85
85
  until_element_exists(element_destination,
86
- :action => lambda{light_swipe_element(element, dir)}, :timeout=>70)
86
+ :action => lambda{light_swipe_element(element, dir)}, :timeout=>timeout_duration)
87
87
  end
88
88
 
89
- def strong_swipe_element_until_not_exists(dir, element, element_destination)
89
+ def strong_swipe_element_until_not_exists(dir, element, element_destination, timeout_duration: 40)
90
90
  until_element_does_not_exist(element_destination,
91
- :action => lambda{pan(element, dir)})
91
+ :action => lambda{pan(element, dir)}, :timeout=>timeout_duration)
92
92
  end
93
93
 
94
- def light_swipe_element_until_not_exists(dir, element, element_destination)
94
+ def light_swipe_element_until_not_exists(dir, element, element_destination, timeout_duration: 40)
95
95
  until_element_does_not_exist(element_destination,
96
- :action => lambda{light_swipe_element(element, dir)}, :timeout=>70)
96
+ :action => lambda{light_swipe_element(element, dir)}, :timeout=>timeout_duration)
97
97
  end
98
98
 
99
- def swipe_to_text(dir, text)
99
+ def swipe_to_text(dir, text, timeout_duration: 60)
100
100
  sleep(1)
101
- if dir == 'вверх'
102
- until_element_exists("* {text CONTAINS'#{text}'}", :action => lambda{light_swipe('up'); sleep(1)}, :timeout => 60)
103
- elsif dir == 'вниз'
104
- until_element_exists("* {text CONTAINS'#{text}'}", :action => lambda{light_swipe('down'); sleep(1.5)}, :timeout => 60)
101
+ if dir == 'up'
102
+ until_element_exists("* {text CONTAINS'#{text}'}", :action => lambda{light_swipe('up');
103
+ sleep(1)}, :timeout => timeout_duration)
104
+ elsif dir == 'down'
105
+ until_element_exists("* {text CONTAINS'#{text}'}", :action => lambda{light_swipe('down');
106
+ sleep(1.5)}, :timeout => timeout_duration)
105
107
  end
106
108
  end
107
109
 
@@ -110,7 +112,7 @@ require 'rspec/expectations'
110
112
  begin
111
113
  expect(element1).to eq(element2)
112
114
  true
113
- rescue Exception => e
115
+ rescue RSpec::Expectations::ExpectationNotMetError
114
116
  false
115
117
  end
116
118
  end
@@ -169,8 +171,8 @@ require 'rspec/expectations'
169
171
  end
170
172
 
171
173
  # get text from first element
172
- def remember(element)
173
- wait_for_element_exists(element, :timeout => 5)
174
+ def remember(element, timeout_duration: 5)
175
+ wait_for_element_exists(element, :timeout => timeout_duration)
174
176
  sleep(1.5)
175
177
  name = query(element)
176
178
  save_name = name.first['text']
@@ -179,8 +181,8 @@ require 'rspec/expectations'
179
181
  end
180
182
 
181
183
  # get text from last element
182
- def remember_last_text(element)
183
- wait_for_element_exists(element, :timeout => 5)
184
+ def remember_last_text(element, timeout_duration: 5)
185
+ wait_for_element_exists(element, :timeout => timeout_duration)
184
186
  sleep(1.5)
185
187
  name = query(element)
186
188
  save_name = name.last['text']
@@ -189,12 +191,12 @@ require 'rspec/expectations'
189
191
  end
190
192
 
191
193
  # wait text
192
- def check_text(text)
193
- wait_for_element_exists("* {text CONTAINS'#{text}'}", :timeout => 5, :retry_frequency => 2)
194
+ def check_text(text, timeout_duration: 5)
195
+ wait_for_element_exists("* {text CONTAINS'#{text}'}", :timeout => timeout_duration, :retry_frequency => 2)
194
196
  end
195
197
 
196
- def no_check_text(text)
197
- wait_for_element_does_not_exist("* {text CONTAINS'#{text}'}", :timeout => 5, :retry_frequency => 5)
198
+ def no_check_text(text, timeout_duration: 5)
199
+ wait_for_element_does_not_exist("* {text CONTAINS'#{text}'}", :timeout => timeout_duration, :retry_frequency => 5)
198
200
  end
199
201
 
200
202
  # get element's coordinates
@@ -77,9 +77,9 @@ require 'SurfCustomCalabash/CommonMethods'
77
77
  end
78
78
 
79
79
  # swipe trait-element from element_destination
80
- def light_swipe_trait_until_exists(dir, element_destination)
80
+ def light_swipe_trait_until_exists(dir, element_destination, timeout_duration: 50)
81
81
  until_element_exists(element_destination,
82
- :action => lambda{light_swipe_element(trait, dir)}, :timeout=>50)
82
+ :action => lambda{light_swipe_element(trait, dir)}, :timeout=>timeout_duration)
83
83
  end
84
84
 
85
85
  # pull-to-refresh screen
@@ -1,3 +1,3 @@
1
1
  module SurfCustomCalabash
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.8"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: SurfCustomCalabash
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexey Hripunov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-05-27 00:00:00.000000000 Z
11
+ date: 2019-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler