calabash-cucumber 0.17.0 → 0.17.1
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 +2 -0
- data/lib/calabash-cucumber/device.rb +1 -1
- data/lib/calabash-cucumber/dylibs.rb +37 -0
- data/lib/calabash-cucumber/environment.rb +16 -0
- data/lib/calabash-cucumber/keyboard_helpers.rb +6 -1
- data/lib/calabash-cucumber/launcher.rb +47 -43
- data/lib/calabash-cucumber/logging.rb +47 -0
- data/lib/calabash-cucumber/store/preferences.rb +5 -17
- data/lib/calabash-cucumber/usage_tracker.rb +8 -5
- data/lib/calabash-cucumber/version.rb +2 -2
- data/staticlib/calabash.framework.zip +0 -0
- data/staticlib/libFrankCalabash.a +0 -0
- metadata +14 -7
- data/lib/calabash/dylibs.rb +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 634d208866c3c80558eea3cf6e002d436a38ca70
|
4
|
+
data.tar.gz: d2800a32dec27bbbbb2fef975ca0c0714cfe4dcb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c3d0e8203c996a79d956d3c1862a48a760a716f622ff070a053682816e0a06bd2e77daeaeb232a299592cef3a8bb060222a64d96bdc39250d484638becea859a
|
7
|
+
data.tar.gz: ecf56d4a6ed42028125511566d7b5a8078c43bdc2925619e7f3ee56b9ce5a715d63057355c91800480bc61b3fdc7427ff4677a515ae6e1d786175374aad9b7a8
|
data/dylibs/libCalabashDyn.dylib
CHANGED
Binary file
|
Binary file
|
data/lib/calabash-cucumber.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
+
require "calabash-cucumber/environment"
|
1
2
|
require "calabash-cucumber/logging"
|
2
3
|
require "calabash-cucumber/dot_dir"
|
3
4
|
require "calabash-cucumber/store/preferences"
|
4
5
|
require "calabash-cucumber/usage_tracker.rb"
|
6
|
+
require "calabash-cucumber/dylibs"
|
5
7
|
require 'calabash-cucumber/core'
|
6
8
|
require 'calabash-cucumber/tests_helpers'
|
7
9
|
require 'calabash-cucumber/keyboard_helpers'
|
@@ -193,7 +193,7 @@ module Calabash
|
|
193
193
|
# @return [Boolean] true if this device is a simulator
|
194
194
|
def simulator?
|
195
195
|
# Post 0.16.2 server
|
196
|
-
|
196
|
+
unless simulator_details.nil? || simulator_details.empty?
|
197
197
|
true
|
198
198
|
else
|
199
199
|
system == GESTALT_SIM_SYS
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Calabash
|
2
|
+
module Cucumber
|
3
|
+
|
4
|
+
# @!visibility private
|
5
|
+
module Dylibs
|
6
|
+
|
7
|
+
# @!visibility private
|
8
|
+
def self.sim_dylib_basename
|
9
|
+
"libCalabashDynSim.dylib"
|
10
|
+
end
|
11
|
+
|
12
|
+
# @!visibility private
|
13
|
+
def self.path_to_sim_dylib
|
14
|
+
File.join(self.dylib_dir, self.sim_dylib_basename)
|
15
|
+
end
|
16
|
+
|
17
|
+
# @!visibility private
|
18
|
+
def self.device_dylib_basename
|
19
|
+
"libCalabashDyn.dylib"
|
20
|
+
end
|
21
|
+
|
22
|
+
# @!visibility private
|
23
|
+
def self.path_to_device_dylib
|
24
|
+
File.join(self.dylib_dir, self.device_dylib_basename)
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
# @!visibility private
|
30
|
+
def self.dylib_dir
|
31
|
+
dirname = File.dirname(__FILE__)
|
32
|
+
File.expand_path(File.join(dirname, "..", "..", "dylibs"))
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
@@ -323,7 +323,12 @@ module Calabash
|
|
323
323
|
# on numeric keyboards, it is actually a button on the
|
324
324
|
# keyboard and not a key
|
325
325
|
if code.eql?(UIA_SUPPORTED_CHARS['Delete'])
|
326
|
-
|
326
|
+
js_tap_delete = "(function() {"\
|
327
|
+
"var deleteElement = uia.keyboard().elements().firstWithName('Delete');"\
|
328
|
+
"deleteElement = deleteElement.isValid() ? deleteElement : uia.keyboard().elements().firstWithName('delete');"\
|
329
|
+
"deleteElement.tap();"\
|
330
|
+
"})();"
|
331
|
+
uia(js_tap_delete)
|
327
332
|
else
|
328
333
|
uia_type_string_raw(code)
|
329
334
|
end
|
@@ -7,7 +7,6 @@ require 'calabash-cucumber/actions/playback_actions'
|
|
7
7
|
require 'run_loop'
|
8
8
|
require 'cfpropertylist'
|
9
9
|
require 'calabash-cucumber/utils/logging'
|
10
|
-
require 'calabash/dylibs'
|
11
10
|
require "calabash-cucumber/usage_tracker"
|
12
11
|
|
13
12
|
# Used to launch apps for testing in iOS Simulator or on iOS Devices. By default
|
@@ -31,6 +30,9 @@ require "calabash-cucumber/usage_tracker"
|
|
31
30
|
# not exit the simulator when a Scenario fails.
|
32
31
|
class Calabash::Cucumber::Launcher
|
33
32
|
|
33
|
+
require "calabash-cucumber/dylibs"
|
34
|
+
require "calabash-cucumber/environment"
|
35
|
+
|
34
36
|
include Calabash::Cucumber::Logging
|
35
37
|
include Calabash::Cucumber::SimulatorAccessibility
|
36
38
|
|
@@ -109,48 +111,25 @@ class Calabash::Cucumber::Launcher
|
|
109
111
|
# @see Calabash::Cucumber::Core#console_attach
|
110
112
|
def attach(options={})
|
111
113
|
default_options = {:max_retry => 1,
|
112
|
-
:timeout => 10
|
113
|
-
:uia_strategy => nil}
|
114
|
+
:timeout => 10}
|
114
115
|
merged_options = default_options.merge(options)
|
115
116
|
|
116
117
|
if calabash_no_launch?
|
117
|
-
self.actions= Calabash::Cucumber::PlaybackActions.new
|
118
|
+
self.actions = Calabash::Cucumber::PlaybackActions.new
|
118
119
|
return
|
119
120
|
end
|
120
121
|
|
121
|
-
|
122
|
-
strategy_from_options = merged_options[:uia_strategy]
|
123
|
-
if strategy_from_options == :host
|
124
|
-
self.run_loop = RunLoop::HostCache.default.read
|
125
|
-
return self
|
126
|
-
end
|
122
|
+
self.run_loop = RunLoop::HostCache.default.read
|
127
123
|
|
128
124
|
# Sets the device attribute.
|
129
125
|
ensure_connectivity(merged_options[:max_retry], merged_options[:timeout])
|
130
126
|
|
131
|
-
if
|
132
|
-
self.
|
133
|
-
return self
|
134
|
-
end
|
135
|
-
|
136
|
-
pids_str = `ps x -o pid,command | grep -v grep | grep "instruments" | awk '{printf "%s,", $1}'`
|
137
|
-
pids = pids_str.split(',').map { |pid| pid.to_i }
|
138
|
-
pid = pids.first
|
139
|
-
run_loop = {}
|
140
|
-
if pid
|
141
|
-
run_loop[:pid] = pid
|
142
|
-
self.actions= Calabash::Cucumber::InstrumentsActions.new
|
127
|
+
if self.run_loop[:pid]
|
128
|
+
self.actions = Calabash::Cucumber::InstrumentsActions.new
|
143
129
|
else
|
144
|
-
self.actions= Calabash::Cucumber::PlaybackActions.new
|
130
|
+
self.actions = Calabash::Cucumber::PlaybackActions.new
|
145
131
|
end
|
146
132
|
|
147
|
-
if strategy_from_options
|
148
|
-
run_loop[:uia_strategy] = merged_options[:uia_strategy]
|
149
|
-
else
|
150
|
-
run_loop[:uia_strategy] = :preferences
|
151
|
-
end
|
152
|
-
|
153
|
-
self.run_loop = run_loop
|
154
133
|
major = self.device.ios_major_version
|
155
134
|
if major.to_i >= 7 && self.actions.is_a?(Calabash::Cucumber::PlaybackActions)
|
156
135
|
puts %Q{
|
@@ -296,21 +275,46 @@ Remove direct calls to reset_app_sandbox.
|
|
296
275
|
})
|
297
276
|
end
|
298
277
|
|
299
|
-
# Erases
|
300
|
-
#
|
301
|
-
# For Xcode 6, this is equivalent to calling: `$ xcrun simctl erase` on
|
302
|
-
# every available simulator. For Xcode < 6, it is equivalent to touching
|
303
|
-
# the 'Reset Content & Settings' menu item.
|
278
|
+
# Erases a simulator. This is the same as touching the Simulator
|
279
|
+
# "Reset Content & Settings" menu item.
|
304
280
|
#
|
305
|
-
# @
|
306
|
-
#
|
281
|
+
# @param [RunLoop::Device, String] The simulator to erase. Can be a device
|
282
|
+
# instance, a simulator UUID, or a human readable simulator name.
|
307
283
|
#
|
308
|
-
# @raise
|
309
|
-
|
284
|
+
# @raise ArgumentError If the simulator is a physical device
|
285
|
+
# @raise RuntimeError If the simulator cannot be shutdown
|
286
|
+
# @raise RuntimeError If the simulator cannot be erased
|
287
|
+
def reset_simulator(device=nil)
|
310
288
|
if device_target?
|
311
|
-
raise "
|
289
|
+
raise ArgumentError, "Resetting physical devices is not supported."
|
312
290
|
end
|
313
|
-
|
291
|
+
|
292
|
+
simulator = nil
|
293
|
+
|
294
|
+
if device.nil? || device == ""
|
295
|
+
device_target = Calabash::Cucumber::Environment.device_target
|
296
|
+
if device_target.nil?
|
297
|
+
default_simulator = RunLoop::Core.default_simulator
|
298
|
+
simulator = RunLoop::Device.device_with_identifier(default_simulator)
|
299
|
+
else
|
300
|
+
simulator = RunLoop::Device.device_with_identifier(device_target)
|
301
|
+
end
|
302
|
+
elsif device.is_a?(RunLoop::Device)
|
303
|
+
if device.physical_device?
|
304
|
+
raise ArgumentError,
|
305
|
+
%Q{
|
306
|
+
Cannot reset: #{device}.
|
307
|
+
|
308
|
+
Resetting physical devices is not supported.
|
309
|
+
}
|
310
|
+
end
|
311
|
+
simulator = device
|
312
|
+
else
|
313
|
+
simulator = RunLoop::Device.device_with_identifier(device)
|
314
|
+
end
|
315
|
+
|
316
|
+
RunLoop::CoreSimulator.erase(simulator)
|
317
|
+
simulator
|
314
318
|
end
|
315
319
|
|
316
320
|
# @!visibility private
|
@@ -559,9 +563,9 @@ Remove direct calls to reset_app_sandbox.
|
|
559
563
|
# User passed a Boolean, not a file.
|
560
564
|
if use_dylib.is_a?(TrueClass)
|
561
565
|
if simulator_target?(args)
|
562
|
-
args[:inject_dylib] = Calabash::Dylibs.path_to_sim_dylib
|
566
|
+
args[:inject_dylib] = Calabash::Cucumber::Dylibs.path_to_sim_dylib
|
563
567
|
else
|
564
|
-
|
568
|
+
raise RuntimeError, "Injecting a dylib is not supported when targetting a device"
|
565
569
|
end
|
566
570
|
else
|
567
571
|
unless File.exist? use_dylib
|
@@ -1,6 +1,8 @@
|
|
1
1
|
module Calabash
|
2
2
|
module Cucumber
|
3
|
+
require "fileutils"
|
3
4
|
require "run_loop"
|
5
|
+
require "calabash-cucumber/dot_dir"
|
4
6
|
|
5
7
|
# These methods are not part of the API.
|
6
8
|
#
|
@@ -32,6 +34,30 @@ module Calabash
|
|
32
34
|
puts self.red("ERROR: #{msg}") if msg
|
33
35
|
end
|
34
36
|
|
37
|
+
# !@visibility private
|
38
|
+
def self.log_to_file(message)
|
39
|
+
timestamp = self.timestamp
|
40
|
+
|
41
|
+
begin
|
42
|
+
File.open(self.calabash_log_file, "a:UTF-8") do |file|
|
43
|
+
message.split($-0).each do |line|
|
44
|
+
file.write("#{timestamp} #{line}#{$-0}")
|
45
|
+
end
|
46
|
+
end
|
47
|
+
rescue => e
|
48
|
+
message =
|
49
|
+
%Q{Could not write:
|
50
|
+
|
51
|
+
#{message}
|
52
|
+
|
53
|
+
to calabash.log because:
|
54
|
+
|
55
|
+
#{e}
|
56
|
+
}
|
57
|
+
self.log_debug(message)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
35
61
|
private
|
36
62
|
|
37
63
|
# @!visibility private
|
@@ -74,6 +100,27 @@ module Calabash
|
|
74
100
|
def self.green(string)
|
75
101
|
colorize(string, 32)
|
76
102
|
end
|
103
|
+
|
104
|
+
# @!visibility private
|
105
|
+
def self.timestamp
|
106
|
+
Time.now.strftime("%Y-%m-%d_%H-%M-%S")
|
107
|
+
end
|
108
|
+
|
109
|
+
# @!visibility private
|
110
|
+
def self.logs_directory
|
111
|
+
path = File.join(Calabash::Cucumber::DotDir.directory, "logs")
|
112
|
+
FileUtils.mkdir_p(path)
|
113
|
+
path
|
114
|
+
end
|
115
|
+
|
116
|
+
# @!visibility private
|
117
|
+
def self.calabash_log_file
|
118
|
+
path = File.join(self.logs_directory, "calabash.log")
|
119
|
+
if !File.exist?(path)
|
120
|
+
FileUtils.touch(path)
|
121
|
+
end
|
122
|
+
path
|
123
|
+
end
|
77
124
|
end
|
78
125
|
end
|
79
126
|
|
@@ -8,6 +8,7 @@ module Calabash
|
|
8
8
|
#
|
9
9
|
# ~/.calabash/preferences/preferences.json
|
10
10
|
class Preferences
|
11
|
+
require "calabash-cucumber/dot_dir"
|
11
12
|
|
12
13
|
def initialize
|
13
14
|
dot_dir = Calabash::Cucumber::DotDir.directory
|
@@ -150,12 +151,8 @@ module Calabash
|
|
150
151
|
def generate_json(hash)
|
151
152
|
begin
|
152
153
|
JSON.pretty_generate(hash)
|
153
|
-
rescue TypeError, JSON::UnparserError =>
|
154
|
-
|
155
|
-
%Q{Error generating JSON from:
|
156
|
-
hash: #{hash}
|
157
|
-
error: #{e}
|
158
|
-
})
|
154
|
+
rescue TypeError, JSON::UnparserError => _
|
155
|
+
|
159
156
|
log_defaults_reset
|
160
157
|
|
161
158
|
# Will always generate valid JSON
|
@@ -181,12 +178,8 @@ error: #{e}
|
|
181
178
|
def parse_json(string)
|
182
179
|
begin
|
183
180
|
JSON.parse(string, {:symbolize_names => true})
|
184
|
-
rescue TypeError, JSON::ParserError =>
|
185
|
-
|
186
|
-
%Q{Error parsing JSON from:
|
187
|
-
string: #{string}
|
188
|
-
error: #{e}
|
189
|
-
})
|
181
|
+
rescue TypeError, JSON::ParserError => _
|
182
|
+
|
190
183
|
log_defaults_reset
|
191
184
|
|
192
185
|
hash = defaults
|
@@ -195,11 +188,6 @@ string: #{string}
|
|
195
188
|
end
|
196
189
|
end
|
197
190
|
|
198
|
-
# @!visibility private
|
199
|
-
def write_to_log(error_message)
|
200
|
-
# TODO write to a log file?
|
201
|
-
end
|
202
|
-
|
203
191
|
# @!visibility private
|
204
192
|
def log_defaults_reset
|
205
193
|
Calabash::Cucumber.log_warn(
|
@@ -1,6 +1,8 @@
|
|
1
1
|
module Calabash
|
2
2
|
module Cucumber
|
3
3
|
class UsageTracker
|
4
|
+
require "calabash-cucumber/store/preferences"
|
5
|
+
require "calabash-cucumber/logging"
|
4
6
|
|
5
7
|
require "httpclient"
|
6
8
|
require "run_loop"
|
@@ -24,9 +26,9 @@ module Calabash
|
|
24
26
|
info_we_are_allowed_to_track != "none"
|
25
27
|
begin
|
26
28
|
HTTPClient.post(ROUTE, info)
|
27
|
-
rescue =>
|
28
|
-
|
29
|
-
|
29
|
+
rescue => e
|
30
|
+
message = %Q{ERROR: Could not post usage tracking information:#{$-0}#{e}}
|
31
|
+
Calabash::Cucumber::log_to_file(message)
|
30
32
|
end
|
31
33
|
end
|
32
34
|
end
|
@@ -82,7 +84,7 @@ module Calabash
|
|
82
84
|
end
|
83
85
|
|
84
86
|
# @!visibility private
|
85
|
-
DATA_VERSION = "1.
|
87
|
+
DATA_VERSION = "1.1"
|
86
88
|
|
87
89
|
# @!visibility private
|
88
90
|
WINDOWS = "Windows"
|
@@ -179,7 +181,8 @@ module Calabash
|
|
179
181
|
:jenkins => RunLoop::Environment.jenkins?,
|
180
182
|
:travis => RunLoop::Environment.travis?,
|
181
183
|
:circle_ci => RunLoop::Environment.circle_ci?,
|
182
|
-
:teamcity => RunLoop::Environment.teamcity
|
184
|
+
:teamcity => RunLoop::Environment.teamcity?,
|
185
|
+
:gitlab => RunLoop::Environment.gitlab?
|
183
186
|
}
|
184
187
|
)
|
185
188
|
end
|
@@ -3,10 +3,10 @@ module Calabash
|
|
3
3
|
|
4
4
|
# @!visibility public
|
5
5
|
# The Calabash iOS gem version.
|
6
|
-
VERSION = "0.17.
|
6
|
+
VERSION = "0.17.1"
|
7
7
|
|
8
8
|
# @!visibility public
|
9
9
|
# The minimum required version of the Calabash embedded server.
|
10
|
-
MIN_SERVER_VERSION = "0.17.
|
10
|
+
MIN_SERVER_VERSION = "0.17.1"
|
11
11
|
end
|
12
12
|
end
|
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.17.
|
4
|
+
version: 0.17.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Karl Krukow
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cucumber
|
@@ -144,16 +144,22 @@ dependencies:
|
|
144
144
|
name: run_loop
|
145
145
|
requirement: !ruby/object:Gem::Requirement
|
146
146
|
requirements:
|
147
|
-
- - "
|
147
|
+
- - ">="
|
148
148
|
- !ruby/object:Gem::Version
|
149
|
-
version:
|
149
|
+
version: 2.0.3
|
150
|
+
- - "<"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '3.0'
|
150
153
|
type: :runtime
|
151
154
|
prerelease: false
|
152
155
|
version_requirements: !ruby/object:Gem::Requirement
|
153
156
|
requirements:
|
154
|
-
- - "
|
157
|
+
- - ">="
|
155
158
|
- !ruby/object:Gem::Version
|
156
|
-
version:
|
159
|
+
version: 2.0.3
|
160
|
+
- - "<"
|
161
|
+
- !ruby/object:Gem::Version
|
162
|
+
version: '3.0'
|
157
163
|
- !ruby/object:Gem::Dependency
|
158
164
|
name: json
|
159
165
|
requirement: !ruby/object:Gem::Requirement
|
@@ -406,6 +412,8 @@ files:
|
|
406
412
|
- lib/calabash-cucumber/deprecated.rb
|
407
413
|
- lib/calabash-cucumber/device.rb
|
408
414
|
- lib/calabash-cucumber/dot_dir.rb
|
415
|
+
- lib/calabash-cucumber/dylibs.rb
|
416
|
+
- lib/calabash-cucumber/environment.rb
|
409
417
|
- lib/calabash-cucumber/environment_helpers.rb
|
410
418
|
- lib/calabash-cucumber/failure_helpers.rb
|
411
419
|
- lib/calabash-cucumber/http_helpers.rb
|
@@ -533,7 +541,6 @@ files:
|
|
533
541
|
- lib/calabash-cucumber/utils/xctools.rb
|
534
542
|
- lib/calabash-cucumber/version.rb
|
535
543
|
- lib/calabash-cucumber/wait_helpers.rb
|
536
|
-
- lib/calabash/dylibs.rb
|
537
544
|
- lib/frank-calabash.rb
|
538
545
|
- scripts/.irbrc
|
539
546
|
- scripts/calabash.xcconfig.erb
|
data/lib/calabash/dylibs.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
module Calabash
|
2
|
-
module Dylibs
|
3
|
-
def sim_dylib_basename
|
4
|
-
'libCalabashDynSim.dylib'
|
5
|
-
end
|
6
|
-
|
7
|
-
def path_to_sim_dylib
|
8
|
-
File.expand_path File.join(__FILE__, '..', '..', '..', 'dylibs', sim_dylib_basename)
|
9
|
-
end
|
10
|
-
|
11
|
-
def device_dylib_basename
|
12
|
-
'libCalabashDyn.dylib'
|
13
|
-
end
|
14
|
-
|
15
|
-
def path_to_device_dylib
|
16
|
-
File.expand_path File.join(__FILE__, '..', '..', '..', 'dylibs', device_dylib_basename)
|
17
|
-
end
|
18
|
-
|
19
|
-
module_function :path_to_sim_dylib, :path_to_device_dylib, :device_dylib_basename, :sim_dylib_basename
|
20
|
-
end
|
21
|
-
end
|