calabash-cucumber 0.18.1 → 0.18.2

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: 858401fd6208b68bba5b454ead0fc6c0fb1cf096
4
- data.tar.gz: 615e20e056d41bf5bac1617fd29c311213244a0b
3
+ metadata.gz: 4fcd5b3694c5b5a674846f6afdc47d9b69bee38f
4
+ data.tar.gz: 8355da41535f75c286004c00917c5b70a6997b31
5
5
  SHA512:
6
- metadata.gz: 72c8518231bc1becf0ded6507d9f033d26639a8acdbb8f515c6c8626ba509cce2cd8987f2a4c5e8e4791f8a06d23a8d0d194bfeddcbb7f52b0421855dccc5055
7
- data.tar.gz: ae4c2405c6b4091c5280f67ee0710d69838d76e1dcd007376a7350fa8bb446873188d343188d48ded4626f1be59d3903a6ffe9aafdb21e8b3d9ebacbea7326d7
6
+ metadata.gz: 263e85bb0b112f15639b3242d2855c4f0002001048bf1b16b5b2c813ece268bcb837080935926250729c9dad7d79c50130098ec4e18ad3ac50935368db87df34
7
+ data.tar.gz: f1ec4ed7d7e002a190959c88f85c2f1b4e5c3256101be838cbe2538b60559259f0053ef47c3f1d92f9362f4451660feb09f07de9827a038cd9d3f8ce8b2cb206
Binary file
Binary file
@@ -469,6 +469,11 @@ module Calabash
469
469
  #
470
470
  # @raise [RuntimeError] if the text cannot be typed.
471
471
  def done
472
+ _deprecated("0.10.0",
473
+ %Q{Use tap_keyboard_action_key
474
+
475
+ The `done` method will be removed in 0.19.0
476
+ }, :warn)
472
477
  tap_keyboard_action_key
473
478
  end
474
479
 
@@ -36,9 +36,6 @@ class Calabash::Cucumber::Launcher
36
36
  include Calabash::Cucumber::Logging
37
37
  include Calabash::Cucumber::SimulatorAccessibility
38
38
 
39
- # A hash of known privacy settings that calabash can control.
40
- KNOWN_PRIVACY_SETTINGS = {:photos => 'kTCCServicePhotos', :calendar => 'kTCCServiceCalendar', :address_book => 'kTCCServiceAddressBook'}
41
-
42
39
  # noinspection RubyClassVariableUsageInspection
43
40
 
44
41
  # @!visibility private
@@ -317,78 +314,6 @@ Resetting physical devices is not supported.
317
314
  simulator
318
315
  end
319
316
 
320
- # @!visibility private
321
- def directories_for_sdk_prefix(sdk)
322
- if sdk == :all
323
- existing_simulator_support_sdk_dirs
324
- else
325
- Dir["#{simulator_app_support_dir}/#{sdk}*"]
326
- end
327
- end
328
-
329
- # Call as `update_privacy_settings('com.my.app', {:photos => {:allow => true}})`
330
- # @!visibility private
331
- def update_privacy_settings(bundle_id, opts={})
332
- if debug_logging?
333
- puts "Update privacy settings #{bundle_id}, #{opts}"
334
- end
335
- unless File.exist?(`which sqlite3`.strip)
336
- raise 'Error: Unable to find sqlite3. The binary sqlite3 must be installed and on path.'
337
- end
338
- opts.each do |setting_name, setting_options|
339
-
340
- setting_name = KNOWN_PRIVACY_SETTINGS[setting_name] || setting_name
341
- allow = setting_options[:allow] == false ? false : true
342
- sdk = setting_options[:sdk] || self.simulator_launcher.sdk_detector.latest_sdk_version
343
-
344
- dirs = directories_for_sdk_prefix(sdk)
345
- if debug_logging?
346
- puts "About to update privacy setting #{setting_name} for #{bundle_id}, allow: #{allow} in sdk #{sdk}, #{dirs}"
347
- end
348
-
349
- dirs.each do |dir|
350
- if debug_logging?
351
- puts "Setting access for #{bundle_id} for permission #{setting_name} to allow: #{allow}"
352
- end
353
- path_to_tcc_db = tcc_database_for_sdk_dir(dir)
354
- unless File.exist?(path_to_tcc_db)
355
- puts "Warning: No TCC.db in location #{path_to_tcc_db}"
356
- next
357
- end
358
- allowed_as_i = allow ? 1 : 0
359
- if privacy_setting(dir, bundle_id,setting_name).nil?
360
- sql = %Q['INSERT INTO access (service, client, client_type, allowed, prompt_count) VALUES ("#{setting_name}","#{bundle_id}",0,#{allowed_as_i},1);']
361
- else
362
- sql = %Q['UPDATE access SET allowed=#{allowed_as_i} where client="#{bundle_id}" AND service="#{setting_name}";']
363
- end
364
-
365
- if debug_logging?
366
- puts "Executing sql #{sql} on #{path_to_tcc_db}"
367
- end
368
-
369
- unless system(%Q[sqlite3 "#{path_to_tcc_db}" #{sql}]) && privacy_setting(dir,bundle_id,setting_name) == allowed_as_i
370
- puts "Warning: Error executing sql: #{sql} against #{path_to_tcc_db} (Setting is #{privacy_setting(dir,bundle_id,setting_name)}). Continuing..."
371
- next
372
- end
373
- end
374
- end
375
- end
376
-
377
- # @!visibility private
378
- def tcc_database_for_sdk_dir(dir)
379
- File.join(dir,'Library', 'TCC', 'TCC.db')
380
- end
381
-
382
- # @!visibility private
383
- def privacy_setting(sdk_dir, bundle_id, setting_name)
384
- setting_name = KNOWN_PRIVACY_SETTINGS[setting_name] || setting_name
385
- path_to_tcc_db = tcc_database_for_sdk_dir(sdk_dir)
386
- sql = %Q['SELECT allowed FROM access WHERE client="#{bundle_id}" and service="#{setting_name}";']
387
- output = `sqlite3 "#{path_to_tcc_db}" #{sql}`.strip
388
-
389
- (output == '0' || output == '1') ? output.to_i : nil
390
- end
391
-
392
317
  # @!visibility private
393
318
  def default_launch_args
394
319
  # APP_BUNDLE_PATH
@@ -405,7 +330,6 @@ Resetting physical devices is not supported.
405
330
  :launch_method => default_launch_method,
406
331
  :reset => reset_between_scenarios?,
407
332
  :bundle_id => ENV['BUNDLE_ID'],
408
- :device => device_env,
409
333
  :no_stop => calabash_no_stop?,
410
334
  :no_launch => calabash_no_launch?,
411
335
  :sdk_version => sdk_version,
@@ -522,40 +446,38 @@ Resetting physical devices is not supported.
522
446
  raise "Unable to find app bundle at #{args[:app]}. It should be an iOS Simulator build (typically a *.app directory)."
523
447
  end
524
448
  end
525
- args[:app] = args[:app] || args[:bundle_id] || app_path || detect_app_bundle_from_args(args)
526
449
 
450
+ # User passed {:app => "path/to/my.app"} _and_ it exists.
451
+ # User defined BUNDLE_ID or passed {:bundle_id => com.example.myapp}
452
+ # User defined APP or APP_BUNDLE_PATH env vars _or_ APP_BUNDLE_PATH constant.
453
+ args[:app] = args[:app] || args[:bundle_id] || app_path
527
454
 
528
455
  if args[:app]
529
456
  if File.directory?(args[:app])
530
457
  args[:app] = File.expand_path(args[:app])
531
458
  else
532
- # args[:app] is not a directory so must be a bundle id
533
- if simulator_target?(args) ## bundle id set, but simulator target
534
- args[:app] = app_path || detect_app_bundle_from_args(args)
459
+ # args[:app] is not a directory so must be a bundle id.
460
+ if simulator_target?(args)
461
+ args[:app] = app_path
535
462
  end
536
463
  end
537
464
  end
538
465
 
539
- unless args[:app]
540
- if simulator_target?(args)
541
- device_xamarin_build_dir = 'iPhoneSimulator'
542
- else
543
- device_xamarin_build_dir = 'iPhone'
544
- end
545
- args[:app] = self.simulator_launcher.app_bundle_or_raise(app_path, device_xamarin_build_dir)
546
- end
547
-
548
- args[:bundle_id] ||= detect_bundle_id_from_app_bundle(args)
549
-
550
- args[:device] ||= detect_device_from_args(args)
466
+ # At this point :app is either nil because we are targeting a simulator
467
+ # or it is a CFBundleIdentifier.
468
+ if args[:app]
469
+ # nothing to do because :bundle_id and :app are the same.
470
+ else
471
+ # User gave us no information about where the simulator app is located
472
+ # so we have to auto detect it. This RunLoop method raises an error
473
+ # with a meaningful message based on the environment. The message
474
+ # includes suggestions about what to do next.
475
+ run_loop_app = RunLoop::DetectAUT::Detect.new.app_for_simulator
551
476
 
552
- if args[:privacy_settings]
553
- if simulator_target?(args)
554
- update_privacy_settings(args[:bundle_id], args[:privacy_settings])
555
- else
556
- # Not supported on device
557
- puts 'Warning: :privacy_settings not supported on device'
558
- end
477
+ # This is not great - RunLoop is going to take this path and create a new
478
+ # RunLoop::App. This is the best we can do for now.
479
+ args[:app] = run_loop_app.path
480
+ args[:bundle_id] = run_loop_app.bundle_identifier
559
481
  end
560
482
 
561
483
  use_dylib = args[:inject_dylib]
@@ -655,57 +577,6 @@ Resetting physical devices is not supported.
655
577
  end
656
578
  end
657
579
 
658
- # @!visibility private
659
- def detect_device_from_args(args)
660
- if args[:app] && File.directory?(args[:app])
661
- # Derive bundle id from bundle_dir
662
- plist_as_hash = info_plist_from_bundle_path(args[:app])
663
- if plist_as_hash
664
- device_family = plist_as_hash['UIDeviceFamily']
665
- if device_family
666
- first_device = device_family.first
667
- if first_device == 2
668
- return 'ipad'
669
- else
670
- return 'iphone'
671
- end
672
- end
673
- end
674
- else
675
- args[:app]
676
- end
677
- end
678
-
679
- # @!visibility private
680
- def detect_app_bundle_from_args(args)
681
- if simulator_target?(args)
682
- device_xamarin_build_dir = 'iPhoneSimulator'
683
- else
684
- device_xamarin_build_dir = 'iPhone'
685
- end
686
- # is this really only applicable to the Xamarin IDE?
687
- self.simulator_launcher.detect_app_bundle(nil, device_xamarin_build_dir)
688
- end
689
-
690
- # @!visibility private
691
- def detect_bundle_id_from_app_bundle(args)
692
- if args[:app] && File.directory?(args[:app])
693
- # Derive bundle id from bundle_dir
694
- plist_as_hash = info_plist_from_bundle_path(args[:app])
695
- if plist_as_hash
696
- plist_as_hash['CFBundleIdentifier']
697
- end
698
- else
699
- args[:app]
700
- end
701
- end
702
-
703
- # @!visibility private
704
- def info_plist_from_bundle_path(bundle_path)
705
- plist_path = File.join(bundle_path, 'Info.plist')
706
- info_plist_as_hash(plist_path) if File.exist?(plist_path)
707
- end
708
-
709
580
  # @!visibility private
710
581
  def new_run_loop(args)
711
582
 
@@ -718,14 +589,14 @@ Resetting physical devices is not supported.
718
589
  return RunLoop.run(args)
719
590
  rescue RunLoop::TimeoutError => e
720
591
  last_err = e
721
- if full_console_logging?
722
- puts 'retrying run loop...'
723
- end
724
- self.simulator_launcher.stop
725
592
  end
726
593
  end
727
- self.simulator_launcher.stop
728
- puts "Unable to start. Make sure you've set APP_BUNDLE_PATH to a build supported by this simulator version"
594
+
595
+ if simulator_target?(args)
596
+ puts "Unable to launch app on Simulator."
597
+ else
598
+ puts "Unable to launch app on physical device"
599
+ end
729
600
  raise StartError.new(last_err)
730
601
  end
731
602
 
@@ -807,26 +678,6 @@ Resetting physical devices is not supported.
807
678
  end
808
679
  end
809
680
 
810
- # @!visibility private
811
- def info_plist_as_hash(plist_path)
812
- unless File.exist?(plist_path)
813
- raise "Unable to find Info.plist: #{plist_path}"
814
- end
815
- parsedplist = CFPropertyList::List.new(:file => plist_path)
816
- CFPropertyList.native_types(parsedplist.value)
817
- end
818
-
819
- # @!visibility private
820
- def detect_bundle_id
821
- begin
822
- bundle_path = self.simulator_launcher.app_bundle_or_raise(app_path)
823
- plist_path = File.join(bundle_path, 'Info.plist')
824
- info_plist_as_hash(plist_path)['CFBundleIdentifier']
825
- rescue => e
826
- raise "Unable to automatically find bundle id. Please set BUNDLE_ID environment variable. #{e}"
827
- end
828
- end
829
-
830
681
  # @!visibility private
831
682
  def calabash_no_stop?
832
683
  calabash_no_launch? or ENV['NO_STOP']=="1"
@@ -907,14 +758,9 @@ Resetting physical devices is not supported.
907
758
  ENV['RESET_BETWEEN_SCENARIOS']=="1"
908
759
  end
909
760
 
910
- # @!visibility private
911
- def device_env
912
- ENV['DEVICE']
913
- end
914
-
915
761
  # @!visibility private
916
762
  def app_path
917
- ENV['APP_BUNDLE_PATH'] || (defined?(APP_BUNDLE_PATH) && APP_BUNDLE_PATH) || ENV['APP']
763
+ RunLoop::Environment.path_to_app_bundle || (defined?(APP_BUNDLE_PATH) && APP_BUNDLE_PATH)
918
764
  end
919
765
 
920
766
  # @!visibility private
@@ -3,10 +3,10 @@ module Calabash
3
3
 
4
4
  # @!visibility public
5
5
  # The Calabash iOS gem version.
6
- VERSION = "0.18.1"
6
+ VERSION = "0.18.2"
7
7
 
8
8
  # @!visibility public
9
9
  # The minimum required version of the Calabash embedded server.
10
- MIN_SERVER_VERSION = "0.18.1"
10
+ MIN_SERVER_VERSION = "0.18.2"
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.18.1
4
+ version: 0.18.2
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-02-19 00:00:00.000000000 Z
11
+ date: 2016-03-11 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.0.6
135
+ version: 2.0.9
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.0.6
145
+ version: 2.0.9
146
146
  - - "<"
147
147
  - !ruby/object:Gem::Version
148
148
  version: '3.0'
@@ -248,16 +248,16 @@ dependencies:
248
248
  name: rake
249
249
  requirement: !ruby/object:Gem::Requirement
250
250
  requirements:
251
- - - ">="
251
+ - - "~>"
252
252
  - !ruby/object:Gem::Version
253
- version: '0'
253
+ version: '10.0'
254
254
  type: :development
255
255
  prerelease: false
256
256
  version_requirements: !ruby/object:Gem::Requirement
257
257
  requirements:
258
- - - ">="
258
+ - - "~>"
259
259
  - !ruby/object:Gem::Version
260
- version: '0'
260
+ version: '10.0'
261
261
  - !ruby/object:Gem::Dependency
262
262
  name: rspec
263
263
  requirement: !ruby/object:Gem::Requirement
@@ -557,7 +557,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
557
557
  version: '0'
558
558
  requirements: []
559
559
  rubyforge_project:
560
- rubygems_version: 2.5.1
560
+ rubygems_version: 2.5.2
561
561
  signing_key:
562
562
  specification_version: 4
563
563
  summary: Client for calabash-ios-server for automated functional testing on iOS