run_loop 2.1.7 → 2.1.8

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: 8451119a8e88cf2179b1b7a0bfc554a19459e9c5
4
- data.tar.gz: 0b75d4af7f258d99780c624750dc3e3f241e5581
3
+ metadata.gz: edeacc3eddade4e3a26023d8b011b2fcea314f38
4
+ data.tar.gz: f8ab2b05bb26507c5a1029d583faab39edf3a1ba
5
5
  SHA512:
6
- metadata.gz: ad70df268ab1bcd8001f71cb81499653ec67428be5e5fd78a7a6a89d83e527b7fe3e2da982be52bb0c1480eee57de119b40b2a1c3a4b290e6a5d5b5c9565afb2
7
- data.tar.gz: d75408caf251d7b4a4ebf532adfe361697dc7cf46e4aab6f15c6447818622604c13205a764202ff5796079e2e28ec0fed871fbe73309d63cdbf1f99e63eaeed5
6
+ metadata.gz: 05c864c7ea5163367eaa0efa4e961a80e78b5b721d5392cc32592b18b292451496088b367e52a2a7a61713d5dd2f82443c8014f4b4fdf15236ed46d900b84113
7
+ data.tar.gz: 45a1cec5422e444c8155b038a7650949a756d719dbe451f17b036c04335878dffb542d908b9c443ba25024ad19502bd9d001e143bd015c488a07b2cc2f81d345
@@ -100,7 +100,7 @@ class RunLoop::CoreSimulator
100
100
  # launchd_sim process.
101
101
  ['launchd_sim', false],
102
102
 
103
- # Required for XCUITest termination; the simulator hangs otherwise.
103
+ # Required for DeviceAgent termination; the simulator hangs otherwise.
104
104
  ["xpcproxy", false],
105
105
 
106
106
  # Causes crash reports on Xcode < 7.0
@@ -246,8 +246,7 @@ class RunLoop::CoreSimulator
246
246
  end
247
247
 
248
248
  if simulator.physical_device?
249
- raise ArgumentError,
250
- "The language cannot be set on physical devices"
249
+ raise ArgumentError, "The language cannot be set on physical devices"
251
250
  end
252
251
 
253
252
  self.quit_simulator
@@ -255,6 +254,40 @@ class RunLoop::CoreSimulator
255
254
  simulator.simulator_set_language(lang_code)
256
255
  end
257
256
 
257
+ # @!visibility private
258
+ #
259
+ # @param [RunLoop::Device, String] device a simulator UDID, instruments-ready
260
+ # name, or a RunLoop::Device
261
+ # @param [String] bundle_identifier the app to check for
262
+ #
263
+ # @raise [ArgumentError] if no device can be found matching the UDID or
264
+ # instruments-ready name
265
+ # @raise [ArgumentError] if device is not a simulator
266
+ # @raise [ArgumentError] if language_code is invalid
267
+ #
268
+ # @return [Boolean] true if the app with the identifier is installed
269
+ def self.app_installed?(device, bundle_identifier, options={})
270
+ merged_options = {:xcode => RunLoop::Xcode.new}.merge(options)
271
+
272
+ if device.is_a?(RunLoop::Device)
273
+ simulator = device
274
+ else
275
+ simulator = RunLoop::Device.device_with_identifier(device, merged_options)
276
+ end
277
+
278
+ if simulator.physical_device?
279
+ raise ArgumentError, "The device must be a simulator"
280
+ end
281
+
282
+ start = Time.now
283
+
284
+ installed = self.send(:user_app_installed?, device, bundle_identifier) ||
285
+ self.send(:system_app_installed?, bundle_identifier, merged_options[:xcode])
286
+
287
+ RunLoop.log_debug("Took #{Time.now - start} seconds to check if app was installed")
288
+ installed
289
+ end
290
+
258
291
  # @!visibility private
259
292
  def self.simulator_pid
260
293
  @@simulator_pid
@@ -890,6 +923,46 @@ Command had no output
890
923
  end
891
924
  end
892
925
 
926
+ # @!visibility private
927
+ def self.system_applications_dir(xcode=RunLoop::Xcode.new)
928
+ base_dir = xcode.developer_dir
929
+ sim_apps_dir = "Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/Applications"
930
+ File.expand_path(File.join(base_dir, sim_apps_dir))
931
+ end
932
+
933
+ # @!visibility private
934
+ def self.system_app_installed?(bundle_identifier, xcode)
935
+ apps_dir = self.send(:system_applications_dir, xcode)
936
+
937
+ return false if !File.exist?(apps_dir)
938
+
939
+ black_list = ["Fitness.app", "Photo Booth.app", "ScreenSharingViewService.app"]
940
+
941
+ Dir.glob("#{apps_dir}/*.app").detect do |app_dir|
942
+ basename = File.basename(app_dir)
943
+ if black_list.include?(basename)
944
+ false
945
+ else
946
+ begin
947
+ RunLoop::App.new(app_dir).bundle_identifier == bundle_identifier
948
+ rescue ArgumentError => _
949
+ bundle_name = File.basename(app_dir)
950
+ RunLoop.log_debug("Could not create an App from simulator system app: #{bundle_name}")
951
+ nil
952
+ end
953
+ end
954
+ end
955
+ end
956
+
957
+ # @!visibility private
958
+ def self.user_app_installed?(device, bundle_identifier)
959
+ core_sim = self.new(device, bundle_identifier, {:quit_sim_on_init => false})
960
+ sim_apps_dir = core_sim.send(:device_applications_dir)
961
+ Dir.glob("#{sim_apps_dir}/**/*.app").find do |path|
962
+ RunLoop::App.new(path).bundle_identifier == bundle_identifier
963
+ end
964
+ end
965
+
893
966
  # Not yet. Failing on Travis and this is not a feature yet.
894
967
  #
895
968
  # There is a spec that has been commented out.
@@ -0,0 +1,125 @@
1
+ {
2
+ "start_test" : {
3
+ "-d" : {
4
+ "longFlag" : "--device-id",
5
+ "optionName" : "device-identifier",
6
+ "info" : "iOS Simulator GUID or 40-digit physical device ID",
7
+ "required" : true
8
+ },
9
+ "-b" : {
10
+ "longFlag" : "--test-runner-bundle-id",
11
+ "optionName" : "test_runner_bundle_id",
12
+ "info" : "BundleID of the Test Runner application (DeviceAgent)",
13
+ "required" : false,
14
+ "default" : "com.apple.test.DeviceAgent-Runner"
15
+ },
16
+ "-s" : {
17
+ "longFlag" : "--session-id",
18
+ "optionName" : "session_id",
19
+ "info" : "Session ID for the XCUITest",
20
+ "required" : false,
21
+ "default" : "BEEFBABE-FEED-BABE-BEEF-CAFEBEEFFACE"
22
+ },
23
+ "-k" : {
24
+ "longFlag" : "--keep-alive",
25
+ "optionName" : "true-or-false",
26
+ "info" : "Only set to false for smoke testing/debugging this tool",
27
+ "required" : false,
28
+ "default" : true
29
+ }
30
+ },
31
+ "is_installed" : {
32
+ "-b" : {
33
+ "longFlag" : "--bundle-identifier",
34
+ "optionName" : "bundle-id",
35
+ "info" : "bundle identifier (e.g. com.my.app)",
36
+ "required" : true
37
+ },
38
+ "-d" : {
39
+ "longFlag" : "--device-id",
40
+ "optionName" : "device-identifier",
41
+ "info" : "iOS Simulator GUID or 40-digit physical device ID",
42
+ "required" : true
43
+ }
44
+ },
45
+ "install" : {
46
+ "-d" : {
47
+ "longFlag" : "--device-id",
48
+ "optionName" : "device-identifier",
49
+ "info" : "iOS Simulator GUID or 40-digit physical device ID",
50
+ "required" : true
51
+ },
52
+ "-a" : {
53
+ "longFlag" : "--app-bundle",
54
+ "optionName" : "path/to/app-bundle.app",
55
+ "info" : "Path .app bundle (for .ipas, unzip and look inside of 'Payload')",
56
+ "required" : true
57
+ },
58
+ "-c" : {
59
+ "longFlag" : "--codesign-identity",
60
+ "optionName" : "codesign-identity",
61
+ "info" : "Identity used to codesign app bundle [device only]",
62
+ "required" : false,
63
+ "default" : ""
64
+ },
65
+ "-u" : {
66
+ "longFlag" : "--update-app",
67
+ "optionName" : "true-or-false",
68
+ "info" : "When true, will reinstall the app if the device contains an older version than the bundle specified",
69
+ "required" : false,
70
+ "default" : true
71
+ }
72
+ },
73
+ "kill_simulator" : {
74
+ "-d" : {
75
+ "longFlag" : "--device-id",
76
+ "optionName" : "device-identifier",
77
+ "info" : "iOS Simulator GUID",
78
+ "required" : true
79
+ }
80
+ },
81
+ "launch_simulator" : {
82
+ "-d" : {
83
+ "longFlag" : "--device-id",
84
+ "optionName" : "device-identifier",
85
+ "info" : "iOS Simulator GUID",
86
+ "required" : true
87
+ }
88
+ },
89
+ "uninstall" : {
90
+ "-d" : {
91
+ "longFlag" : "--device-id",
92
+ "optionName" : "device-identifier",
93
+ "info" : "iOS Simulator GUID or 40-digit physical device ID",
94
+ "required" : true
95
+ },
96
+ "-b" : {
97
+ "longFlag" : "--bundle-identifier",
98
+ "optionName" : "bundle-id",
99
+ "info" : "bundle identifier (e.g. com.my.app)",
100
+ "required" : true
101
+ }
102
+ },
103
+ "set_location" : {
104
+ "-d" : {
105
+ "longFlag" : "--device-id",
106
+ "optionName" : "device-identifier",
107
+ "info" : "iOS Simulator GUID or 40-digit physical device ID",
108
+ "required" : true
109
+ },
110
+ "-l" : {
111
+ "longFlag" : "--location",
112
+ "optionName" : "lat,lng",
113
+ "info" : "latitude and longitude separated by a single comma",
114
+ "required" : true
115
+ }
116
+ },
117
+ "stop_simulating_location" : {
118
+ "-d" : {
119
+ "longFlag" : "--device-id",
120
+ "optionName" : "device-identifier",
121
+ "info" : "40-digit physical device ID",
122
+ "required" : true
123
+ }
124
+ }
125
+ }