run_loop 2.2.1 → 2.2.2

This diff has not been reviewed by any users.
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: 7f70f23c16823815e9b01ca4e967dcd8f065d4ff
4
- data.tar.gz: 2d2b303201f7d2961dbb4a9f8947a2ab0638de3b
3
+ metadata.gz: c125e357c95d69d1ef1e4b74ce1bfbf4faddb920
4
+ data.tar.gz: f27d253bba7d6f3faeb4ee37d9f4d0e209d1393b
5
5
  SHA512:
6
- metadata.gz: 2343195435e906556bfe720b75f66637a42b29e4f8aea669584793ad4a668002151210c75ac96d2856afd1b1aee3800afa255d1ec2a5cd0e79ce3e5709683adc
7
- data.tar.gz: eea4a57f853d15eedfad0c710f889e5896dfa046ac45e7d4114df1c889f98a6d78cfc32948ebda371e48a26a726f756fbae4275812a13f48aa6b93a1815e2b16
6
+ metadata.gz: 009bddf011cdb692c5ee738b0b9a2e4a3c033e4b01fb29e0db6b548cadea44be2d068b3190af2a34db4b7c38cf7ed880b03c23943a7769f974da0d106ad98742
7
+ data.tar.gz: e26d021e69d642bdc9c115e47a235c993b837ac5b88ceaab43570bd86a3f0756de7d37ffea55418cf6818628eeb2cf8af6579decc4ca69924c450dba3a8db6fd
@@ -110,8 +110,8 @@ removed (1.5.0). It has been replaced by an options hash with two keys:
110
110
 
111
111
  instruments = merged_options[:instruments]
112
112
  simctl = merged_options[:simctl]
113
+ xcode = merged_options[:xcode]
113
114
 
114
- xcode = RunLoop::Xcode.new
115
115
  simulator = simctl.simulators.detect do |sim|
116
116
  sim.instruments_identifier(xcode) == udid_or_name ||
117
117
  sim.udid == udid_or_name
@@ -376,7 +376,10 @@ version: #{version}
376
376
  # iOS 9 simulators have an additional boot screen.
377
377
  is_gte_ios9 = version >= RunLoop::Version.new('9.0')
378
378
 
379
- # iOS 9 iPad simulators need additional time to stabilize, especially
379
+ # Xcode 8 simulators do not need to wait for log file
380
+ is_xcode8 = RunLoop::Xcode.new.version_gte_8?
381
+
382
+ # iOS > 9 iPad simulators need additional time to stabilize, especially
380
383
  # to ensure that `simctl install` notifies SpringBoard that a new app
381
384
  # has been installed.
382
385
  is_ipad = simulator_is_ipad?
@@ -388,7 +391,12 @@ version: #{version}
388
391
  RunLoop.log_debug("Waiting for simulator to stabilize with timeout: #{timeout} seconds")
389
392
 
390
393
  current_dir_sha = simulator_data_directory_sha
391
- current_log_sha = simulator_log_file_sha
394
+ if is_xcode8
395
+ current_log_sha = true
396
+ else
397
+ current_log_sha = simulator_log_file_sha
398
+ end
399
+
392
400
  is_stable = false
393
401
  waited_for_boot = false
394
402
  waited_for_ipad = false
@@ -396,7 +404,11 @@ version: #{version}
396
404
 
397
405
  while Time.now < poll_until do
398
406
  latest_dir_sha = simulator_data_directory_sha
399
- latest_log_sha = simulator_log_file_sha
407
+ if is_xcode8
408
+ latest_log_sha = true
409
+ else
410
+ latest_log_sha = simulator_log_file_sha
411
+ end
400
412
 
401
413
  is_stable = [current_dir_sha == latest_dir_sha,
402
414
  current_log_sha == latest_log_sha].all?
@@ -18,7 +18,7 @@
18
18
  "optionName" : "session_id",
19
19
  "info" : "Session ID for the XCUITest",
20
20
  "required" : false,
21
- "default" : "BEEFBABE-FEED-BABE-BEEF-CAFEBEEFFACE"
21
+ "default" : "AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE"
22
22
  },
23
23
  "-k" : {
24
24
  "longFlag" : "--keep-alive",
@@ -84,8 +84,13 @@ module RunLoop
84
84
  options,
85
85
  app_details)
86
86
 
87
+ default_options = {
88
+ :xcode => xcode
89
+ }
90
+ merged_options = default_options.merge(options)
91
+
87
92
  if device.simulator? && app
88
- core_sim = RunLoop::CoreSimulator.new(device, app, :xcode => xcode)
93
+ core_sim = RunLoop::CoreSimulator.new(device, app, merged_options)
89
94
  if reset_options
90
95
  core_sim.reset_app_sandbox
91
96
  end
@@ -317,7 +322,7 @@ INSTANCE METHODS
317
322
 
318
323
  # @!visibility private
319
324
  def tree
320
- options = http_options
325
+ options = tree_http_options
321
326
  request = request("tree")
322
327
  client = http_client(options)
323
328
  response = client.get(request)
@@ -336,12 +341,44 @@ INSTANCE METHODS
336
341
  result.count != 0
337
342
  end
338
343
 
344
+ # @!visibility private
345
+ def clear_text
346
+ options = enter_text_http_options
347
+ parameters = {
348
+ :gesture => "clear_text"
349
+ }
350
+ request = request("gesture", parameters)
351
+ client = http_client(options)
352
+ response = client.post(request)
353
+ expect_300_response(response)
354
+ end
355
+
339
356
  # @!visibility private
340
357
  def enter_text(string)
341
358
  if !keyboard_visible?
342
359
  raise RuntimeError, "Keyboard must be visible"
343
360
  end
344
- options = http_options
361
+ options = enter_text_http_options
362
+ parameters = {
363
+ :gesture => "enter_text",
364
+ :options => {
365
+ :string => string
366
+ }
367
+ }
368
+ request = request("gesture", parameters)
369
+ client = http_client(options)
370
+ response = client.post(request)
371
+ expect_300_response(response)
372
+ end
373
+
374
+ # @!visibility private
375
+ #
376
+ # Some clients are performing keyboard checks _before_ calling #enter_text.
377
+ #
378
+ # 1. Removes duplicate check.
379
+ # 2. It turns out DeviceAgent query can be very slow.
380
+ def enter_text_without_keyboard_check(string)
381
+ options = enter_text_http_options
345
382
  parameters = {
346
383
  :gesture => "enter_text",
347
384
  :options => {
@@ -377,6 +414,12 @@ INSTANCE METHODS
377
414
  # query({text: "\"To know is not enough.\""})
378
415
  # query({text: %Q["To know is not enough."]})
379
416
  #
417
+ # # Equivalent to Calabash query("*")
418
+ # query({})
419
+ #
420
+ # # Equivalent to Calabash query("all *")
421
+ # query({all: true})
422
+ #
380
423
  # Querying for text with newlines is not supported yet.
381
424
  #
382
425
  # The query language supports the following keys:
@@ -449,45 +492,40 @@ INSTANCE METHODS
449
492
  raise ArgumentError, %Q[
450
493
  Unsupported key or keys found: '#{unknown_keys}'.
451
494
 
452
- Allowed keys for a query are: #{keys}
453
-
454
- ]
455
- end
456
-
457
- has_any_key = (allowed_keys & uiquery.keys).any?
458
- if !has_any_key
459
- keys = allowed_keys.map { |key| ":#{key}" }.join(", ")
460
- raise ArgumentError, %Q[
461
- Query does not contain any keysUnsupported key or keys found: '#{unknown_keys}'.
495
+ Allowed keys for a query are:
462
496
 
463
- Allowed keys for a query are: #{keys}
497
+ #{keys}
464
498
 
465
499
  ]
466
500
  end
467
501
 
468
- parameters = merged_options.dup.tap { |hs| hs.delete(:all) }
469
- if parameters.empty?
470
- keys = allowed_keys.map { |key| ":#{key}" }.join(", ")
471
- raise ArgumentError, %Q[
502
+ if _wildcard_query?(uiquery)
503
+ elements = _flatten_tree
504
+ else
505
+ parameters = merged_options.dup.tap { |hs| hs.delete(:all) }
506
+ if parameters.empty?
507
+ keys = allowed_keys.map { |key| ":#{key}" }.join(", ")
508
+ raise ArgumentError, %Q[
472
509
  Query must contain at least one of these keys:
473
510
 
474
511
  #{keys}
475
512
 
476
513
  ]
477
- end
514
+ end
478
515
 
479
- request = request("query", parameters)
480
- client = http_client(http_options)
516
+ request = request("query", parameters)
517
+ client = http_client(http_options)
481
518
 
482
- RunLoop.log_debug %Q[Sending query with parameters:
519
+ RunLoop.log_debug %Q[Sending query with parameters:
483
520
 
484
521
  #{JSON.pretty_generate(parameters)}
485
522
 
486
523
  ]
487
524
 
488
- response = client.post(request)
489
- hash = expect_300_response(response)
490
- elements = hash["result"]
525
+ response = client.post(request)
526
+ hash = expect_300_response(response)
527
+ elements = hash["result"]
528
+ end
491
529
 
492
530
  if merged_options[:all]
493
531
  elements
@@ -1030,6 +1068,30 @@ PRIVATE
1030
1068
  end
1031
1069
  end
1032
1070
 
1071
+ # @!visibility private
1072
+ #
1073
+ # Tree can take a very long time.
1074
+ def tree_http_options
1075
+ timeout = DEFAULTS[:http_timeout] * 6
1076
+ {
1077
+ :timeout => timeout,
1078
+ :interval => 0.1,
1079
+ :retries => (timeout/0.1).to_i
1080
+ }
1081
+ end
1082
+
1083
+ # @!visibility private
1084
+ #
1085
+ # A patch while we are trying to figure out what is wrong with text entry.
1086
+ def enter_text_http_options
1087
+ timeout = DEFAULTS[:http_timeout] * 6
1088
+ {
1089
+ :timeout => timeout,
1090
+ :interval => 0.1,
1091
+ :retries => (timeout/0.1).to_i
1092
+ }
1093
+ end
1094
+
1033
1095
  # @!visibility private
1034
1096
  def server_pid
1035
1097
  options = http_options
@@ -1394,6 +1456,16 @@ Valid values are: :down, :up, :right, :left, :bottom, :top
1394
1456
  response = client.post(request)
1395
1457
  expect_300_response(response)
1396
1458
  end
1459
+
1460
+ # @!visibility private
1461
+ # Private method. Do not call.
1462
+ def _wildcard_query?(uiquery)
1463
+ return true if uiquery.empty?
1464
+ return false if uiquery.count != 1
1465
+
1466
+ uiquery.has_key?(:all)
1467
+ end
1468
+
1397
1469
  end
1398
1470
  end
1399
1471
  end
@@ -1,5 +1,5 @@
1
1
  module RunLoop
2
- VERSION = "2.2.1"
2
+ VERSION = "2.2.2"
3
3
 
4
4
  # A model of a software release version that can be used to compare two versions.
5
5
  #
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: run_loop
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ version: 2.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karl Krukow
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-09-30 00:00:00.000000000 Z
12
+ date: 2016-10-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
@@ -301,6 +301,20 @@ dependencies:
301
301
  - - ">="
302
302
  - !ruby/object:Gem::Version
303
303
  version: '0'
304
+ - !ruby/object:Gem::Dependency
305
+ name: rb-readline
306
+ requirement: !ruby/object:Gem::Requirement
307
+ requirements:
308
+ - - ">="
309
+ - !ruby/object:Gem::Version
310
+ version: '0'
311
+ type: :development
312
+ prerelease: false
313
+ version_requirements: !ruby/object:Gem::Requirement
314
+ requirements:
315
+ - - ">="
316
+ - !ruby/object:Gem::Version
317
+ version: '0'
304
318
  description:
305
319
  email:
306
320
  - karl.krukow@xamarin.com
@@ -412,7 +426,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
412
426
  version: '0'
413
427
  requirements: []
414
428
  rubyforge_project:
415
- rubygems_version: 2.6.6
429
+ rubygems_version: 2.5.1
416
430
  signing_key:
417
431
  specification_version: 4
418
432
  summary: The bridge between Calabash iOS and Xcode command-line tools like instruments