calabash-cucumber 0.9.161 → 0.9.162

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: d5a530cbf65efa54db1984a3f8afe227d5de54f9
4
- data.tar.gz: 4e9b073d215cc110aaf8d207b6ce2d9fdeef29eb
3
+ metadata.gz: 5b8134e2f83edca8edd8edddca519b5189a427a2
4
+ data.tar.gz: 4a105d3ae28b247712a531a1d78df6205a976395
5
5
  SHA512:
6
- metadata.gz: 26835b71dfd637fcaa0003b6ac3f051a61cb0db81742a188fda6e8bfec820f5f86e502a8135608c15d5330f81a9caf1e7825f181e92f7228dd27299c1f897880
7
- data.tar.gz: e4d5478835361305f871412e9a1808d44a415b7743baa2adcd3a54c6662344a2f7cb1e976b0ebffb556cd7f47dcc5a20d51d303335c241f08736b0a1e94bde48
6
+ metadata.gz: 1b40fbdca41785f04e10c94326ceb946c14083c90faab97ebd40583a29c6d4bc14e3ed1c820451e08496a9b5571df8dd9db5b2aeea1bc53c168596cc668df069
7
+ data.tar.gz: 07002708b43689e9a1a5b7f4ec20a59b88f8c226e3aa39b60070e4f44d0d8ada75cede0244872c219c4510b3ae2b6beb9454c5c929159429e0916994f3cf745a
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
26
26
  s.add_dependency( "location-one", "~>0.0.10")
27
27
  s.add_dependency( "httpclient","~> 2.3.3")
28
28
  s.add_dependency( "bundler", "~> 1.1")
29
- s.add_dependency( "run_loop", "~> 0.0.21" )
29
+ s.add_dependency( "run_loop", "~> 0.0.22" )
30
30
  s.add_dependency( "awesome_print")
31
31
  s.add_dependency( "xamarin-test-cloud", "~> 0.9.25")
32
32
 
@@ -18,44 +18,19 @@ module Calabash
18
18
  if ui_query.nil?
19
19
  uia_tap_offset(offset)
20
20
  else
21
- el_to_touch = find_or_raise(ui_query)
22
- rect = el_to_touch['rect']
23
- normalize_rect_for_orientation(rect)
21
+ el_to_touch = find_and_normalize_or_raise(ui_query)
24
22
  touch(el_to_touch, options)
25
23
  [el_to_touch]
26
24
  end
27
25
  end
28
26
 
29
- def normalize_rect_for_orientation(rect)
30
- orientation = status_bar_orientation().to_sym
31
- launcher = Calabash::Cucumber::Launcher.launcher
32
- screen_size = launcher.device.screen_size
33
- case orientation
34
- when :right
35
- cx = rect['center_x']
36
- rect['center_x'] = rect['center_y']
37
- rect['center_y'] = screen_size[:width] - cx
38
- when :left
39
- cx = rect['center_x']
40
- rect['center_x'] = screen_size[:height] - rect['center_y']
41
- rect['center_y'] = cx
42
- when :up
43
- cy = rect['center_y']
44
- cx = rect['center_x']
45
- rect['center_y'] = screen_size[:height] - cy
46
- rect['center_x'] = screen_size[:width] - cx
47
- else
48
- # no-op by design.
49
- end
50
- end
51
-
52
27
  def swipe_ios7(options)
53
28
  ui_query = options[:query]
54
29
  offset = options[:offset]
55
30
  if ui_query.nil?
56
31
  uia_swipe_offset(offset, options)
57
32
  else
58
- el_to_swipe = find_or_raise(ui_query)
33
+ el_to_swipe = find_and_normalize_or_raise(ui_query)
59
34
  offset = point_from(el_to_swipe, options)
60
35
  uia_swipe_offset(offset, options)
61
36
  [el_to_swipe]
@@ -69,7 +44,7 @@ module Calabash
69
44
  if ui_query.nil?
70
45
  uia_pinch_offset(in_or_out, offset, {:duration => options[:duration]})
71
46
  else
72
- el_to_pinch = find_or_raise(ui_query)
47
+ el_to_pinch = find_and_normalize_or_raise(ui_query)
73
48
  offset = point_from(el_to_pinch, options)
74
49
  uia_pinch_offset(in_or_out, offset, duration)
75
50
  [el_to_pinch]
@@ -77,12 +52,21 @@ module Calabash
77
52
  end
78
53
 
79
54
  def pan_ios7(from, to, options={})
80
- from_result = find_or_raise from
81
- to_result = find_or_raise to
82
- uia_pan_offset(point_from(from_result, options), point_from(to_result, options), options)
55
+ from_result = find_and_normalize_or_raise from
56
+ to_result = find_and_normalize_or_raise to
57
+ uia_pan_offset(point_from(from_result, options),
58
+ point_from(to_result, options),
59
+ options)
83
60
  [to_result]
84
61
  end
85
62
 
63
+ private
64
+ def find_and_normalize_or_raise(ui_query)
65
+ res = find_or_raise(ui_query)
66
+ normalize_rect_for_orientation!(res['rect']) if res['rect']
67
+ res
68
+ end
69
+
86
70
  def find_or_raise(ui_query)
87
71
  results = query(ui_query)
88
72
  if results.empty?
@@ -92,6 +76,31 @@ module Calabash
92
76
  end
93
77
  end
94
78
 
79
+ def normalize_rect_for_orientation!(rect)
80
+ orientation = status_bar_orientation().to_sym
81
+ launcher = Calabash::Cucumber::Launcher.launcher
82
+ screen_size = launcher.device.screen_size
83
+ case orientation
84
+ when :right
85
+ cx = rect['center_x']
86
+ rect['center_x'] = rect['center_y']
87
+ rect['center_y'] = screen_size[:width] - cx
88
+ when :left
89
+ cx = rect['center_x']
90
+ rect['center_x'] = screen_size[:height] - rect['center_y']
91
+ rect['center_y'] = cx
92
+ when :up
93
+ cy = rect['center_y']
94
+ cx = rect['center_x']
95
+ rect['center_y'] = screen_size[:height] - cy
96
+ rect['center_x'] = screen_size[:width] - cx
97
+ else
98
+ # no-op by design.
99
+ end
100
+ end
101
+
102
+
103
+
95
104
  end
96
105
  end
97
106
  end
@@ -73,7 +73,7 @@ module Calabash
73
73
  end
74
74
 
75
75
  def uia_screenshot(name)
76
- uia_handle_command(:elementDoesNotExist, name)
76
+ uia_handle_command(:screenshot, name)
77
77
  end
78
78
 
79
79
  def uia_type_string(string)
@@ -1,6 +1,6 @@
1
1
  module Calabash
2
2
  module Cucumber
3
- VERSION = '0.9.161'
4
- FRAMEWORK_VERSION = '0.9.160'
3
+ VERSION = '0.9.162'
4
+ FRAMEWORK_VERSION = '0.9.162'
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calabash-cucumber
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.161
4
+ version: 0.9.162
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karl Krukow
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-24 00:00:00.000000000 Z
11
+ date: 2013-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber
@@ -156,14 +156,14 @@ dependencies:
156
156
  requirements:
157
157
  - - ~>
158
158
  - !ruby/object:Gem::Version
159
- version: 0.0.21
159
+ version: 0.0.22
160
160
  type: :runtime
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - ~>
165
165
  - !ruby/object:Gem::Version
166
- version: 0.0.21
166
+ version: 0.0.22
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: awesome_print
169
169
  requirement: !ruby/object:Gem::Requirement