testautoi 0.9.134 → 0.9.135

Sign up to get free protection for your applications and to get access to all the features.
data/bin/devicedetect CHANGED
Binary file
data/bin/fruitstrap CHANGED
Binary file
data/bin/testautoi CHANGED
@@ -12,7 +12,7 @@ require File.join(File.dirname(__FILE__),"calabash-ios-sim")
12
12
 
13
13
  def print_usage
14
14
  puts <<EOF
15
- Usage: testautoi <command-name> [parameters] [options]
15
+ Usage: testautoi <command-name>
16
16
  <command-name> can be one of
17
17
  setup
18
18
  Set up test automation configurations
@@ -21,10 +21,12 @@ def print_usage
21
21
  build <Source Dir>
22
22
  Build the instrumented app.
23
23
  Use getsource command first to download source to <Source Dir>
24
+ Use 'sim build <Source Dir>' for Simulator
24
25
  install
25
26
  Install the app
26
27
  install tools
27
28
  Download and install tools from Subversion.
29
+ Tools for real iOS devices, not for Simulator.
28
30
  uninstall
29
31
  Uninstall the app
30
32
  launch
@@ -37,6 +39,17 @@ def print_usage
37
39
  Start an iOS Simulator
38
40
  sim quit
39
41
  Quit the iOS Simulator
42
+ sim version [option]
43
+ One of version options: 5.0, 5.1, 6.0, and 6.1
44
+ sim device [option]
45
+ One of device options: iPad, iPad_Retina, iPhone, iPhone_Retina, iPhone_Retina_4inch
46
+ sim pref [key] [value]
47
+ Keys:
48
+ KeyboardAutocorrection
49
+ KeyboardAutocapitalization
50
+ Values:
51
+ true
52
+ false
40
53
  devices
41
54
  List connected iOS Devices
42
55
  getsource list
@@ -49,8 +62,10 @@ def print_usage
49
62
  List available builds in the build drop
50
63
  getbuild <Version>
51
64
  Download the build with <Version>.
65
+ Use 'sim getbuild <Version>' for Simulator
52
66
  getbuild trunk
53
67
  Download the trunk build
68
+ Use 'sim getbuild trunk' for Simulator
54
69
  getscript list
55
70
  List available scripts
56
71
  getscript <Script>
@@ -61,10 +76,7 @@ def print_usage
61
76
  Stop recording
62
77
  version
63
78
  prints the gem version
64
-
65
- <options> can be
66
- -v, --verbose
67
- Turns on verbose logging
79
+
68
80
  EOF
69
81
  end
70
82
 
@@ -100,7 +112,13 @@ def run(option)
100
112
  env = {}
101
113
  env["APP_BUNDLE_PATH"] = File.join(FileUtils.pwd, app_bundle)
102
114
  if device_udid == ''
103
- # Use Simulator
115
+ # Use a Simulator
116
+ if option == 'console'
117
+ Calabash::Cucumber::SimulatorHelper.relaunch(env["APP_BUNDLE_PATH"], @settings["sim_version"], @settings["sim_device"])
118
+ else
119
+ ENV["SDK_VERSION"] = @settings["sim_version"]
120
+ ENV["DEVICE"] = @settings["sim_device"]
121
+ end
104
122
  else
105
123
  env["NO_LAUNCH"] = "1"
106
124
  get_device_ip
@@ -137,6 +155,9 @@ def setup
137
155
  ask_for_setting("app_bundle", "Please enter the name of app bundle", @settings["app_bundle"])
138
156
  ask_for_setting("device_udid", "Please enter the unique device ID of the device", @settings["device_udid"])
139
157
 
158
+ ask_for_setting("sim_version", "Please enter the version of the Simulator [5.0, 5.1, 6.0, 6.1]", @settings["sim_version"])
159
+ ask_for_setting("sim_device", "Please enter the device of the Simulator [iphone, ipad]", @settings["sim_device"])
160
+
140
161
  @settings["build_drop_branch_dir"] = "Mobile/iPhone/branch"
141
162
  @settings["build_drop_trunk_dir"] = "Mobile/iPhone/trunk"
142
163
 
@@ -255,7 +276,7 @@ def unzip_file (file, destination)
255
276
  filenames
256
277
  end
257
278
 
258
- def get_build
279
+ def get_build(version, sim)
259
280
  raise "Please configure build drop location, username, and password first by running setup" if @settings["build_drop_location"].to_s.empty? or @settings["build_drop_username"].to_s.empty? or @settings["build_drop_password"].to_s.empty?
260
281
 
261
282
  mount_node = smb_connect(@settings["build_drop_location"],
@@ -272,8 +293,7 @@ def get_build
272
293
  end
273
294
  else
274
295
  app_bundle = @settings["app_bundle"]
275
- version = ARGV.shift
276
- sim = (ARGV.shift == 'sim')?"Emulator":"Device"
296
+ sim = (sim == 'sim')?"Emulator":"Device"
277
297
  if version == 'trunk'
278
298
  # copy the trunk build
279
299
  release_path = File.join(mount_node, @settings["build_drop_trunk_dir"], "ConcurMobile", sim)
@@ -454,6 +474,45 @@ def reset_sim
454
474
  calabash_sim_reset
455
475
  end
456
476
 
477
+ def sim_set_version(args)
478
+ quit_sim
479
+ options = ["5.0","5.1", "6.0", "6.1"]
480
+ if args.length != 1 or not options.find { |x| x == args[0] }
481
+ print_usage
482
+ puts "Unrecognized args: #{args}"
483
+ puts "should be one of #{options.inspect}"
484
+ exit(0)
485
+ end
486
+ path =File.join(File.expand_path("~/Library"), "Preferences", "com.apple.iphonesimulator.plist")
487
+ plist = CFPropertyList::List.new(:file => path)
488
+ hash = CFPropertyList.native_types(plist.value)
489
+
490
+ version = args.first
491
+
492
+ if version
493
+ hash['currentSDKRoot'] = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator#{version}.sdk"
494
+ plist.value = CFPropertyList.guess(hash)
495
+ plist.save(path, CFPropertyList::List::FORMAT_BINARY)
496
+ end
497
+ end
498
+
499
+ def sim_set_device(device)
500
+ calabash_sim_device([device])
501
+ end
502
+
503
+ def sim_set_pref(key, value)
504
+ value_map = { "true" => true, "false" => false, "on" => true, "off" => false }
505
+ value = value_map[value]
506
+ pref_files = Dir.glob(File.join(File.expand_path("~/Library"), "Application Support", "iPhone Simulator", "*.*", "Library", "Preferences", "com.apple.Preferences.plist"))
507
+ pref_files.each do |pref_file|
508
+ plist = CFPropertyList::List.new(:file => pref_file)
509
+ hash = CFPropertyList.native_types(plist.value)
510
+ hash['KeyboardAutocorrection'] = value
511
+ plist.value = CFPropertyList.guess(hash)
512
+ plist.save(pref_file, CFPropertyList::List::FORMAT_BINARY)
513
+ end
514
+ end
515
+
457
516
  class Device
458
517
  def self.call_device_detect(udid = nil)
459
518
  udid_arg = (udid == nil) ? "" : "-i #{udid}"
@@ -566,7 +625,9 @@ elsif cmd == 'getbuild'
566
625
  read_settings
567
626
  File.open("#{Dir.tmpdir}/testauto.lock", 'w') { |f|
568
627
  f.flock(File::LOCK_EX)
569
- get_build
628
+ version = ARGV.shift
629
+ sim = ARGV.shift
630
+ get_build(version, sim)
570
631
  }
571
632
  exit 0
572
633
 
@@ -615,9 +676,20 @@ elsif cmd == 'sim'
615
676
  start_sim
616
677
  elsif option == 'quit'
617
678
  quit_sim
679
+ elsif option == 'device'
680
+ sim_set_device(ARGV.shift)
681
+ elsif option == 'version'
682
+ sim_set_version([ARGV.shift])
683
+ elsif option == 'pref'
684
+ key = ARGV.shift
685
+ value = ARGV.shift
686
+ sim_set_pref(key, value)
618
687
  elsif option == 'build'
619
688
  branch_dir = ARGV.shift
620
689
  build_app(branch_dir, 'sim')
690
+ elsif option == 'getbuild'
691
+ version = ARGV.shift
692
+ get_build(version, 'sim')
621
693
  end
622
694
  exit 0
623
695
 
@@ -1,6 +1,6 @@
1
1
  module Calabash
2
2
  module Cucumber
3
- VERSION = "0.9.134"
3
+ VERSION = "0.9.135"
4
4
  FRAMEWORK_VERSION = "0.9.126"
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: testautoi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.134
4
+ version: 0.9.135
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-20 00:00:00.000000000 Z
12
+ date: 2013-04-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cucumber
@@ -144,7 +144,7 @@ dependencies:
144
144
  requirement: !ruby/object:Gem::Requirement
145
145
  none: false
146
146
  requirements:
147
- - - ~>
147
+ - - '='
148
148
  - !ruby/object:Gem::Version
149
149
  version: 0.0.5
150
150
  type: :runtime
@@ -152,7 +152,7 @@ dependencies:
152
152
  version_requirements: !ruby/object:Gem::Requirement
153
153
  none: false
154
154
  requirements:
155
- - - ~>
155
+ - - '='
156
156
  - !ruby/object:Gem::Version
157
157
  version: 0.0.5
158
158
  - !ruby/object:Gem::Dependency