calabash-cucumber 0.9.161 → 0.9.162
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/calabash-cucumber.gemspec +1 -1
- data/lib/calabash-cucumber/ios7_operations.rb +40 -31
- data/lib/calabash-cucumber/uia.rb +1 -1
- data/lib/calabash-cucumber/version.rb +2 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b8134e2f83edca8edd8edddca519b5189a427a2
|
4
|
+
data.tar.gz: 4a105d3ae28b247712a531a1d78df6205a976395
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b40fbdca41785f04e10c94326ceb946c14083c90faab97ebd40583a29c6d4bc14e3ed1c820451e08496a9b5571df8dd9db5b2aeea1bc53c168596cc668df069
|
7
|
+
data.tar.gz: 07002708b43689e9a1a5b7f4ec20a59b88f8c226e3aa39b60070e4f44d0d8ada75cede0244872c219c4510b3ae2b6beb9454c5c929159429e0916994f3cf745a
|
data/calabash-cucumber.gemspec
CHANGED
@@ -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.
|
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 =
|
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 =
|
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 =
|
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 =
|
81
|
-
to_result =
|
82
|
-
uia_pan_offset(point_from(from_result, 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
|
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.
|
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-
|
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.
|
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.
|
166
|
+
version: 0.0.22
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: awesome_print
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|