calios-uia-extension 0.0.2 → 0.0.3

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: d17f56356ce1ac86135ead194db42cdfed0d6dfc
4
- data.tar.gz: b76208114389cf1509579985032e308ed3f1cff4
3
+ metadata.gz: 4cd184d1ec6d5b5aeafe0ce2ac9397b06b91ff42
4
+ data.tar.gz: 4f08bc514766de7250e7c4a2ac0a5042313fcff8
5
5
  SHA512:
6
- metadata.gz: 5e8cf3a2aadd5572ecaa0fd4180f8ecfefbb03f031c30e615d179955c03e2c4915261405a167ee0a8171a311809c2474b68be0396e4a4e2560f995cc4359975f
7
- data.tar.gz: 0a3c8a0ed86b9b99380bbc2f743063e74d78fbf57fd0f412e401200b09f3ef420ca9786272edff969585022fedaf142c2984ba20232dc6b6c600809e193f28a8
6
+ metadata.gz: 6f8c1bae162ad9db045a955aadd0fbcece9a1ec6d94ce26f87c57fda94e7f5f3a86a818339d14adb28adf23aecc2944eb0abfe1f318408d5dff4d6e7a300ffc2
7
+ data.tar.gz: 4847ebbbec93e8a6eee79b5de03cbe692cf80357c81a3f24109ca48b5d7c7dc6148b044cf536578408ba08c6975c7d323cf87baf6f4f8788efe9203d7f330b1d
@@ -22,5 +22,40 @@ class UIATarget < UIABase
22
22
  res = execute('target.deviceOrientation()')
23
23
  response(res)
24
24
  end
25
+
26
+ def deactivate_app_for_duration(aDuration=5)
27
+ res = execute("target.deactivateAppForDuration(#{aDuration})")
28
+ response(res)
29
+ end
30
+
31
+ alias_method :send_application_to_background, :deactivate_app_for_duration
32
+
33
+ def drag_from_to_for_duration(aFromX, aFromY, aToX, aToY, aDuration=1)
34
+ res = execute("target.dragFromToForDuration({x:#{aFromX}, y:#{aFromY}}, {x:#{aToX}, y:#{aToY}}, #{aDuration})")
35
+ response(res)
36
+ end
37
+
38
+ alias_method :drag, :drag_from_to_for_duration
39
+
40
+ def pinch_close_from_to_for_duration(aFromX, aFromY, aToX, aToY, aDuration=1)
41
+ res = execute("target.pinchCloseFromToForDuration({x:#{aFromX}, y:#{aFromY}}, {x:#{aToX}, y:#{aToY}}, #{aDuration})")
42
+ response(res)
43
+ end
44
+
45
+ alias_method :pinch_close, :pinch_close_from_to_for_duration
46
+
47
+ def pinch_open_from_to_for_duration(aFromX, aFromY, aToX, aToY, aDuration=1)
48
+ res = execute("target.pinchOpenFromToForDuration({x:#{aFromX}, y:#{aFromY}}, {x:#{aToX}, y:#{aToY}}, #{aDuration})")
49
+ response(res)
50
+ end
51
+
52
+ alias_method :pinch_open, :pinch_open_from_to_for_duration
53
+
54
+ def flick_from_to(aFromX, aFromY, aToX, aToY)
55
+ res = execute("target.flickFromTo({x:#{aFromX}, y:#{aFromY}}, {x:#{aToX}, y:#{aToY}})")
56
+ response(res)
57
+ end
58
+
59
+ alias_method :flick, :flick_from_to
25
60
  end
26
61
  end
@@ -1,3 +1,3 @@
1
1
  module CaliosUIAExtension
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
@@ -11,7 +11,7 @@ class SpecUIABase < Minitest::Spec
11
11
  end
12
12
 
13
13
  describe 'UIABase' do
14
- classes = [UIAAlert, UIAPopover]
14
+ classes = [UIAAlert, UIAPopover, UIATarget]
15
15
  classes.each do |klass|
16
16
  describe "#{klass}.execute" do
17
17
  it 'should call Calabash uia method with correct parameters' do
@@ -67,6 +67,101 @@ class SpecUIATarget < Minitest::Spec
67
67
  $uia_command.must_equal('target.deviceOrientation()')
68
68
  res.must_equal(3)
69
69
  end
70
+
71
+ describe 'UIATarget.deactivate_app_for_duration and alias methods' do
72
+ it 'should call Calabash uia command with correct parameters and return correct response' do
73
+ $stub_uia_response =
74
+ {
75
+ 'status' => 'success',
76
+ 'value' => true,
77
+ 'index' => 0
78
+ }
79
+
80
+ res = UIATarget.deactivate_app_for_duration
81
+ $uia_command.must_equal('target.deactivateAppForDuration(5)')
82
+ res.must_equal(true)
83
+
84
+ res = UIATarget.deactivate_app_for_duration(10)
85
+ $uia_command.must_equal('target.deactivateAppForDuration(10)')
86
+ res.must_equal(true)
87
+
88
+ res = UIATarget.send_application_to_background
89
+ $uia_command.must_equal('target.deactivateAppForDuration(5)')
90
+ res.must_equal(true)
91
+
92
+ res = UIATarget.send_application_to_background(10)
93
+ $uia_command.must_equal('target.deactivateAppForDuration(10)')
94
+ res.must_equal(true)
95
+ end
96
+ end
97
+
98
+ describe 'UIATarget.drag_from_to_for_duration and alias methods' do
99
+ it 'should call Calabash uia command with correct parameters and return correct response' do
100
+ $stub_uia_response =
101
+ {
102
+ 'status' => 'success',
103
+ 'value' => ':nil',
104
+ 'index' => 0
105
+ }
106
+
107
+ UIATarget.drag_from_to_for_duration(100, 100, 200, 200, 3)
108
+ $uia_command.must_equal('target.dragFromToForDuration({x:100, y:100}, {x:200, y:200}, 3)')
109
+
110
+ UIATarget.drag(300, 300, 400, 400, 5)
111
+ $uia_command.must_equal('target.dragFromToForDuration({x:300, y:300}, {x:400, y:400}, 5)')
112
+ end
113
+ end
114
+
115
+ describe 'UIATarget.pinch_close_from_to_for_duration and alias methods' do
116
+ it 'should call Calabash uia command with correct parameters and return correct response' do
117
+ $stub_uia_response =
118
+ {
119
+ 'status' => 'success',
120
+ 'value' => ':nil',
121
+ 'index' => 0
122
+ }
123
+
124
+ UIATarget.pinch_close_from_to_for_duration(100, 100, 200, 200, 3)
125
+ $uia_command.must_equal('target.pinchCloseFromToForDuration({x:100, y:100}, {x:200, y:200}, 3)')
126
+
127
+ UIATarget.pinch_close(300, 300, 400, 400, 5)
128
+ $uia_command.must_equal('target.pinchCloseFromToForDuration({x:300, y:300}, {x:400, y:400}, 5)')
129
+ end
130
+ end
131
+
132
+ describe 'UIATarget.pinch_open_from_to_for_duration and alias methods' do
133
+ it 'should call Calabash uia command with correct parameters and return correct response' do
134
+ $stub_uia_response =
135
+ {
136
+ 'status' => 'success',
137
+ 'value' => ':nil',
138
+ 'index' => 0
139
+ }
140
+
141
+ UIATarget.pinch_open_from_to_for_duration(100, 100, 200, 200, 3)
142
+ $uia_command.must_equal('target.pinchOpenFromToForDuration({x:100, y:100}, {x:200, y:200}, 3)')
143
+
144
+ UIATarget.pinch_open(300, 300, 400, 400, 5)
145
+ $uia_command.must_equal('target.pinchOpenFromToForDuration({x:300, y:300}, {x:400, y:400}, 5)')
146
+ end
147
+ end
148
+
149
+ describe 'UIATarget.flick_from_to and alias methods' do
150
+ it 'should call Calabash uia command with correct parameters and return correct response' do
151
+ $stub_uia_response =
152
+ {
153
+ 'status' => 'success',
154
+ 'value' => ':nil',
155
+ 'index' => 0
156
+ }
157
+
158
+ UIATarget.flick_from_to(100, 100, 200, 200)
159
+ $uia_command.must_equal('target.flickFromTo({x:100, y:100}, {x:200, y:200})')
160
+
161
+ UIATarget.flick(300, 300, 400, 400)
162
+ $uia_command.must_equal('target.flickFromTo({x:300, y:300}, {x:400, y:400})')
163
+ end
164
+ end
70
165
  end
71
166
  end
72
167
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calios-uia-extension
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jani Jegoroff