calabash-cucumber 0.19.2 → 0.20.0
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/dylibs/libCalabashDyn.dylib +0 -0
- data/dylibs/libCalabashDynSim.dylib +0 -0
- data/lib/calabash-cucumber.rb +9 -2
- data/lib/calabash-cucumber/abstract.rb +23 -0
- data/lib/calabash-cucumber/automator/automator.rb +158 -0
- data/lib/calabash-cucumber/automator/coordinates.rb +401 -0
- data/lib/calabash-cucumber/automator/device_agent.rb +424 -0
- data/lib/calabash-cucumber/automator/instruments.rb +441 -0
- data/lib/calabash-cucumber/connection_helpers.rb +1 -0
- data/lib/calabash-cucumber/core.rb +632 -138
- data/lib/calabash-cucumber/device_agent.rb +346 -0
- data/lib/calabash-cucumber/dot_dir.rb +1 -0
- data/lib/calabash-cucumber/environment.rb +1 -0
- data/lib/calabash-cucumber/environment_helpers.rb +4 -3
- data/lib/calabash-cucumber/http/http.rb +6 -4
- data/lib/calabash-cucumber/keyboard_helpers.rb +97 -679
- data/lib/calabash-cucumber/launcher.rb +107 -31
- data/lib/calabash-cucumber/log_tailer.rb +46 -0
- data/lib/calabash-cucumber/map.rb +7 -1
- data/lib/calabash-cucumber/rotation_helpers.rb +47 -139
- data/lib/calabash-cucumber/status_bar_helpers.rb +51 -20
- data/lib/calabash-cucumber/store/preferences.rb +3 -0
- data/lib/calabash-cucumber/uia.rb +333 -2
- data/lib/calabash-cucumber/usage_tracker.rb +2 -0
- data/lib/calabash-cucumber/version.rb +2 -2
- data/lib/calabash-cucumber/wait_helpers.rb +2 -0
- data/lib/calabash/formatters/html.rb +6 -1
- data/lib/frank-calabash.rb +10 -4
- data/scripts/.irbrc +3 -0
- data/staticlib/calabash.framework.zip +0 -0
- data/staticlib/libFrankCalabash.a +0 -0
- metadata +11 -6
- data/lib/calabash-cucumber/actions/instruments_actions.rb +0 -155
@@ -3,10 +3,10 @@ module Calabash
|
|
3
3
|
|
4
4
|
# @!visibility public
|
5
5
|
# The Calabash iOS gem version.
|
6
|
-
VERSION = "0.
|
6
|
+
VERSION = "0.20.0"
|
7
7
|
|
8
8
|
# @!visibility public
|
9
9
|
# The minimum required version of the Calabash embedded server.
|
10
|
-
MIN_SERVER_VERSION = "0.
|
10
|
+
MIN_SERVER_VERSION = "0.20.0"
|
11
11
|
end
|
12
12
|
end
|
@@ -2,9 +2,13 @@ require "cucumber/formatter/html"
|
|
2
2
|
require "uri"
|
3
3
|
require "pathname"
|
4
4
|
|
5
|
+
# @!visibility private
|
5
6
|
module Calabash
|
7
|
+
# @!visibility private
|
6
8
|
module Formatters
|
9
|
+
# @!visibility private
|
7
10
|
class Html < ::Cucumber::Formatter::Html
|
11
|
+
# @!visibility private
|
8
12
|
def embed_image(src, label)
|
9
13
|
if _output_relative? && _relative_uri?(src)
|
10
14
|
output_dir = Pathname.new(File.dirname(@io.path))
|
@@ -16,13 +20,14 @@ module Calabash
|
|
16
20
|
end
|
17
21
|
end
|
18
22
|
|
23
|
+
# @!visibility private
|
19
24
|
def _relative_uri?(src)
|
20
25
|
uri = URI.parse(src)
|
21
26
|
return false if uri.scheme
|
22
27
|
not Pathname.new(src).absolute?
|
23
28
|
end
|
24
29
|
|
25
|
-
|
30
|
+
# @!visibility private
|
26
31
|
def _output_relative?
|
27
32
|
if @io.is_a?(File)
|
28
33
|
path = @io.path
|
data/lib/frank-calabash.rb
CHANGED
@@ -3,14 +3,15 @@ require 'calabash-cucumber/core'
|
|
3
3
|
require 'calabash-cucumber/operations'
|
4
4
|
require 'calabash-cucumber/launcher'
|
5
5
|
|
6
|
-
#
|
6
|
+
# @!visibility private
|
7
7
|
module Calabash
|
8
8
|
module Cucumber
|
9
9
|
module Map
|
10
|
+
# @!visibility private
|
10
11
|
def raw_map(query, method_name, *method_args)
|
11
12
|
operation_map = {
|
12
|
-
|
13
|
-
|
13
|
+
:method_name => method_name,
|
14
|
+
:arguments => method_args
|
14
15
|
}
|
15
16
|
res = http({:method => :post, :path => 'cal_map'},
|
16
17
|
{:query => query, :operation => operation_map})
|
@@ -26,8 +27,11 @@ module Calabash
|
|
26
27
|
end
|
27
28
|
end
|
28
29
|
|
30
|
+
# @!visibility private
|
29
31
|
module Frank
|
32
|
+
# @!visibility private
|
30
33
|
module Calabash
|
34
|
+
# @!visibility private
|
31
35
|
def launch(options={})
|
32
36
|
launcher = ::Calabash::Cucumber::Launcher.launcher
|
33
37
|
#noinspection RubyResolve
|
@@ -37,17 +41,19 @@ module Frank
|
|
37
41
|
launcher.relaunch(options)
|
38
42
|
end
|
39
43
|
|
44
|
+
# @!visibility private
|
40
45
|
def calabash_client
|
41
46
|
Client.new
|
42
47
|
end
|
43
48
|
|
49
|
+
# @!visibility private
|
44
50
|
module Operations
|
45
51
|
include ::Calabash::Cucumber::Operations
|
46
52
|
end
|
47
53
|
|
54
|
+
# @!visibility private
|
48
55
|
class Client
|
49
56
|
include Operations
|
50
57
|
end
|
51
|
-
|
52
58
|
end
|
53
59
|
end
|
data/scripts/.irbrc
CHANGED
Binary file
|
Binary file
|
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.
|
4
|
+
version: 0.20.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Karl Krukow
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cucumber
|
@@ -132,7 +132,7 @@ dependencies:
|
|
132
132
|
requirements:
|
133
133
|
- - ">="
|
134
134
|
- !ruby/object:Gem::Version
|
135
|
-
version: 2.
|
135
|
+
version: 2.2.0
|
136
136
|
- - "<"
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '3.0'
|
@@ -142,7 +142,7 @@ dependencies:
|
|
142
142
|
requirements:
|
143
143
|
- - ">="
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: 2.
|
145
|
+
version: 2.2.0
|
146
146
|
- - "<"
|
147
147
|
- !ruby/object:Gem::Version
|
148
148
|
version: '3.0'
|
@@ -401,7 +401,11 @@ files:
|
|
401
401
|
- features-skeleton/support/patches/cucumber.rb
|
402
402
|
- features/step_definitions/calabash_steps.rb
|
403
403
|
- lib/calabash-cucumber.rb
|
404
|
-
- lib/calabash-cucumber/
|
404
|
+
- lib/calabash-cucumber/abstract.rb
|
405
|
+
- lib/calabash-cucumber/automator/automator.rb
|
406
|
+
- lib/calabash-cucumber/automator/coordinates.rb
|
407
|
+
- lib/calabash-cucumber/automator/device_agent.rb
|
408
|
+
- lib/calabash-cucumber/automator/instruments.rb
|
405
409
|
- lib/calabash-cucumber/calabash_steps.rb
|
406
410
|
- lib/calabash-cucumber/connection.rb
|
407
411
|
- lib/calabash-cucumber/connection_helpers.rb
|
@@ -410,6 +414,7 @@ files:
|
|
410
414
|
- lib/calabash-cucumber/cucumber.rb
|
411
415
|
- lib/calabash-cucumber/date_picker.rb
|
412
416
|
- lib/calabash-cucumber/device.rb
|
417
|
+
- lib/calabash-cucumber/device_agent.rb
|
413
418
|
- lib/calabash-cucumber/dot_dir.rb
|
414
419
|
- lib/calabash-cucumber/dylibs.rb
|
415
420
|
- lib/calabash-cucumber/environment.rb
|
@@ -422,6 +427,7 @@ files:
|
|
422
427
|
- lib/calabash-cucumber/keyboard_helpers.rb
|
423
428
|
- lib/calabash-cucumber/keychain_helpers.rb
|
424
429
|
- lib/calabash-cucumber/launcher.rb
|
430
|
+
- lib/calabash-cucumber/log_tailer.rb
|
425
431
|
- lib/calabash-cucumber/logging.rb
|
426
432
|
- lib/calabash-cucumber/map.rb
|
427
433
|
- lib/calabash-cucumber/operations.rb
|
@@ -468,4 +474,3 @@ signing_key:
|
|
468
474
|
specification_version: 4
|
469
475
|
summary: Client for calabash-ios-server for automated functional testing on iOS
|
470
476
|
test_files: []
|
471
|
-
has_rdoc:
|
@@ -1,155 +0,0 @@
|
|
1
|
-
require 'calabash-cucumber/uia'
|
2
|
-
require 'calabash-cucumber/connection_helpers'
|
3
|
-
require 'calabash-cucumber/query_helpers'
|
4
|
-
|
5
|
-
# @!visibility private
|
6
|
-
class Calabash::Cucumber::InstrumentsActions
|
7
|
-
include Calabash::Cucumber::UIA
|
8
|
-
include Calabash::Cucumber::ConnectionHelpers
|
9
|
-
include Calabash::Cucumber::QueryHelpers
|
10
|
-
|
11
|
-
require "calabash-cucumber/map"
|
12
|
-
|
13
|
-
# @!visibility private
|
14
|
-
def touch(options)
|
15
|
-
query_action(options, :uia_tap_offset)
|
16
|
-
end
|
17
|
-
|
18
|
-
# @!visibility private
|
19
|
-
def double_tap(options)
|
20
|
-
query_action(options, :uia_double_tap_offset)
|
21
|
-
end
|
22
|
-
|
23
|
-
# @!visibility private
|
24
|
-
def two_finger_tap(options)
|
25
|
-
query_action(options, :uia_two_finger_tap_offset)
|
26
|
-
end
|
27
|
-
|
28
|
-
# @!visibility private
|
29
|
-
def flick(options)
|
30
|
-
query_action(options) do |offset|
|
31
|
-
delta = {:offset => options[:delta] || {}}
|
32
|
-
uia_flick_offset(offset, point_from(offset, delta))
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
# @!visibility private
|
37
|
-
def touch_hold(options)
|
38
|
-
query_action(options) do |offset|
|
39
|
-
duration = options[:duration] || 3
|
40
|
-
uia_touch_hold_offset(duration, offset)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
# @!visibility private
|
45
|
-
def swipe(dir, options={})
|
46
|
-
options = options.merge(:direction => dir)
|
47
|
-
query_action(options, :uia_swipe_offset, options)
|
48
|
-
end
|
49
|
-
|
50
|
-
# @!visibility private
|
51
|
-
def pan(from, to, options={})
|
52
|
-
query_action(:query => from) do |from_offset|
|
53
|
-
query_action(:query => to) do |to_offset|
|
54
|
-
uia_pan_offset(from_offset, to_offset, options)
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
# @!visibility private
|
60
|
-
def pinch(in_out, options)
|
61
|
-
query_action(options) do |offset|
|
62
|
-
options[:duration] = options[:duration] || 0.5
|
63
|
-
uia_pinch_offset(in_out, offset, options)
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
# @!visibility private
|
68
|
-
def send_app_to_background(secs)
|
69
|
-
uia_send_app_to_background(secs)
|
70
|
-
end
|
71
|
-
|
72
|
-
private
|
73
|
-
|
74
|
-
# @!visibility private
|
75
|
-
# Data interface
|
76
|
-
# options[:query] or options[:offset]
|
77
|
-
def query_action(options, action=nil, *args, &block)
|
78
|
-
ui_query = options[:query]
|
79
|
-
offset = options[:offset]
|
80
|
-
if ui_query
|
81
|
-
res = find_and_normalize(ui_query)
|
82
|
-
return res if res.empty?
|
83
|
-
el = res.first
|
84
|
-
final_offset = point_from(el, options)
|
85
|
-
if block_given?
|
86
|
-
yield final_offset
|
87
|
-
else
|
88
|
-
self.send(action, final_offset, *args)
|
89
|
-
end
|
90
|
-
[el]
|
91
|
-
else
|
92
|
-
##implies offset
|
93
|
-
if block_given?
|
94
|
-
yield offset
|
95
|
-
else
|
96
|
-
self.send(action, offset, *args)
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
# @!visibility private
|
102
|
-
def find_and_normalize(ui_query)
|
103
|
-
raw_result = Calabash::Cucumber::Map.raw_map(ui_query, :query)
|
104
|
-
orientation = raw_result['status_bar_orientation']
|
105
|
-
res = raw_result['results']
|
106
|
-
|
107
|
-
return res if res.empty?
|
108
|
-
|
109
|
-
first_res = res.first
|
110
|
-
normalize_rect_for_orientation!(orientation, first_res['rect']) if first_res['rect']
|
111
|
-
|
112
|
-
res
|
113
|
-
end
|
114
|
-
|
115
|
-
# @!visibility private
|
116
|
-
def normalize_rect_for_orientation!(orientation, rect)
|
117
|
-
orientation = orientation.to_sym
|
118
|
-
launcher = Calabash::Cucumber::Launcher.launcher
|
119
|
-
device = launcher.device
|
120
|
-
|
121
|
-
# Coordinate translations for orientation is handled in the server for iOS 8+
|
122
|
-
if device.ios_major_version.to_i >= 8
|
123
|
-
return
|
124
|
-
end
|
125
|
-
|
126
|
-
# We cannot use Device#screen_dimensions here because on iPads the height
|
127
|
-
# and width are the opposite of what we expect.
|
128
|
-
# @todo Move all coordinate/orientation translation into the server.
|
129
|
-
if device.ipad?
|
130
|
-
screen_size = { :width => 768, :height => 1024 }
|
131
|
-
elsif device.iphone_4in?
|
132
|
-
screen_size = { :width => 320, :height => 568 }
|
133
|
-
else
|
134
|
-
screen_size = { :width => 320, :height => 480 }
|
135
|
-
end
|
136
|
-
|
137
|
-
case orientation
|
138
|
-
when :right
|
139
|
-
cx = rect['center_x']
|
140
|
-
rect['center_x'] = rect['center_y']
|
141
|
-
rect['center_y'] = screen_size[:width] - cx
|
142
|
-
when :left
|
143
|
-
cx = rect['center_x']
|
144
|
-
rect['center_x'] = screen_size[:height] - rect['center_y']
|
145
|
-
rect['center_y'] = cx
|
146
|
-
when :up
|
147
|
-
cy = rect['center_y']
|
148
|
-
cx = rect['center_x']
|
149
|
-
rect['center_y'] = screen_size[:height] - cy
|
150
|
-
rect['center_x'] = screen_size[:width] - cx
|
151
|
-
else
|
152
|
-
# no-op by design.
|
153
|
-
end
|
154
|
-
end
|
155
|
-
end
|