testautoi 0.9.144 → 0.9.145

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.
@@ -25,6 +25,8 @@ end
25
25
  def calabash_setup(args)
26
26
  puts "Checking if Xcode is running..."
27
27
  res = `ps x -o pid,command | grep -v grep | grep Contents/MacOS/Xcode`
28
+ puts "Skip checking"
29
+ res = ""
28
30
  if res==""
29
31
  puts "Xcode not running."
30
32
  project_name, project_path, xpath = find_project_files(args)
@@ -114,6 +114,8 @@ def run(option)
114
114
  env = {}
115
115
  env['CALABASH_NO_DEPRECATION'] = '1'
116
116
  env["APP_BUNDLE_PATH"] = File.join(FileUtils.pwd, app_bundle)
117
+ env["APP_NAME"] = app_bundle_name(env["APP_BUNDLE_PATH"])
118
+ env["APP_VERSION"] = app_bundle_version(env["APP_BUNDLE_PATH"])
117
119
  if device_udid == ''
118
120
  # Use a Simulator
119
121
  #Calabash::Cucumber::SimulatorHelper.relaunch(env["APP_BUNDLE_PATH"], @settings["sim_version"], @settings["sim_device"])
@@ -153,6 +155,9 @@ def run(option)
153
155
  if device_ipaddr != ''
154
156
  env["DEVICE_ENDPOINT"] = "http://#{device_ipaddr}:37265"
155
157
  end
158
+ if File.exists?(File.join(FileUtils.pwd, "build_drop_dir.txt"))
159
+ env["BUILD_DROP_DIR"] = IO.read(File.join(FileUtils.pwd, "build_drop_dir.txt"))
160
+ end
156
161
  result = system(env, cmd)
157
162
  sleep(1)
158
163
  result
@@ -312,27 +317,52 @@ def get_build(version, sim)
312
317
  end
313
318
  end
314
319
  else
320
+ home_path = ENV['HOME'] || ENV['HOMEPATH']
315
321
  app_bundle = @settings["app_bundle"]
316
322
  sim = (sim == 'sim')?"Emulator":"Device"
317
323
  if version == 'trunk'
318
324
  # copy the trunk build
319
325
  release_path = File.join(mount_node, @settings["build_drop_trunk_dir"], "Instrumented", "ConcurMobile-cal", sim)
326
+ cache_path = File.join(home_path, @settings["build_drop_trunk_dir"], "Instrumented", "ConcurMobile-cal", sim)
320
327
  else
321
328
  # copy the version build
322
329
  release_path = File.join(mount_node, @settings["build_drop_branch_dir"], "iPhone#{version}", "Instrumented", "ConcurMobile-cal", sim)
330
+ cache_path = File.join(home_path, @settings["build_drop_branch_dir"], "iPhone#{version}", "Instrumented", "ConcurMobile-cal", sim)
323
331
  if not File.directory?(release_path)
324
332
  release_path = File.join(mount_node, @settings["build_drop_branch_dir"], "iOSCorp#{version}", "Instrumented", "ConcurMobile-cal", sim)
333
+ cache_path = File.join(home_path, @settings["build_drop_branch_dir"], "iOSCorp#{version}", "Instrumented", "ConcurMobile-cal", sim)
325
334
  end
326
335
  end
327
336
  raise "No builds found in #{release_path}" unless File.directory?(release_path)
328
- build_dir = Dir.entries(release_path).reject{|d|d.start_with?('.')}.sort_by{|c| File.stat(File.join(release_path,c)).ctime}.last
337
+
338
+ build_dirs = Dir.entries(release_path).reject{|d|d.start_with?('.')}.sort_by{|c| File.stat(File.join(release_path,c)).ctime}
339
+
340
+ build_dir = nil
341
+ zip_file = nil
342
+ begin
343
+ raise "No builds found in #{release_path}" if build_dirs.size == 0
344
+ if File.exists?(File.join(release_path, build_dirs.last, build_dirs.last + ".zip"))
345
+ build_dir = build_dirs.last
346
+ zip_file = build_dir + ".zip"
347
+ else
348
+ build_dirs.pop
349
+ end
350
+ end while build_dir == nil
351
+
329
352
  raise "No builds found in #{release_path}" if build_dir == nil
330
- zip_file = build_dir + ".zip"
331
- source = File.join(release_path, build_dir, zip_file)
353
+
354
+ source = File.join(cache_path, build_dir, zip_file)
355
+ if not File.exists?(source)
356
+ release_source = File.join(release_path, build_dir, zip_file)
357
+ FileUtils.mkdir_p(File.dirname(source))
358
+ FileUtils.copy(release_source, source)
359
+ puts "Copy the build from #{release_source} to #{source}"
360
+ end
332
361
  raise "the file '#{source}' does not exist" if not File.exists?(source)
333
362
  dest = File.join(FileUtils.pwd, zip_file)
334
363
  FileUtils.copy(source, dest)
335
364
  puts "Copy the build from #{source}"
365
+ File.open(File.join(FileUtils.pwd, "build_drop_dir.txt"), 'w') {|f| f.write(build_dir) }
336
366
  filenames = unzip_file(dest, FileUtils.pwd)
337
367
  FileUtils.rm_rf(File.join(FileUtils.pwd, app_bundle))
338
368
  FileUtils.cp_r(filenames.find{|e| File.basename(e) == app_bundle}, FileUtils.pwd)
@@ -341,18 +371,18 @@ def get_build(version, sim)
341
371
  smb_disconnect(mount_node)
342
372
  end
343
373
 
344
- def get_script
374
+ def get_script(name)
345
375
  svn_location = @settings["svn_location"]
346
376
  svn_location += '/' unless svn_location.end_with?('/')
347
377
  username = @settings["svn_username"]
348
378
  password = @settings["svn_password"]
349
379
  uri = URI.join(svn_location, "Mobile/", "BVT/", "CTE/")
350
380
 
351
- if ARGV.first == 'list'
381
+ if name == 'list'
352
382
  puts `svn list #{uri} --username #{username} --password #{password}`
353
383
  else
354
- feature = ARGV.first
355
- feature += '/' unless ARGV.first.end_with?('/')
384
+ feature = name
385
+ feature += '/' unless name.end_with?('/')
356
386
  uri = URI.join(uri, feature)
357
387
  puts `svn export --force #{uri} features --username #{username} --password #{password}`
358
388
 
@@ -423,6 +453,19 @@ def app_bundle_path
423
453
  File.join(FileUtils.pwd, @settings["app_bundle"])
424
454
  end
425
455
 
456
+ def app_bundle_name(app_bundle)
457
+ plist = CFPropertyList::List.new(:file => File.join(app_bundle, "Info.plist"))
458
+ hash = CFPropertyList.native_types(plist.value)
459
+ hash["CFBundleName"]
460
+ end
461
+
462
+ def app_bundle_version(app_bundle)
463
+ plist = CFPropertyList::List.new(:file => File.join(app_bundle, "Info.plist"))
464
+ hash = CFPropertyList.native_types(plist.value)
465
+ hash["CFBundleVersion"]
466
+ #hash["CFBundleShortVersionString"]
467
+ end
468
+
426
469
  def app_bundle_id(app_bundle)
427
470
  plist = CFPropertyList::List.new(:file => File.join(app_bundle, "Info.plist"))
428
471
  hash = CFPropertyList.native_types(plist.value)
@@ -671,7 +714,7 @@ elsif cmd == 'getbuild'
671
714
 
672
715
  elsif cmd == 'getscript'
673
716
  read_settings
674
- get_script
717
+ get_script(ARGV.shift)
675
718
  exit 0
676
719
 
677
720
  elsif cmd == 'getsource'
@@ -742,7 +785,7 @@ elsif cmd == 'sim'
742
785
  sim_add_photo(file)
743
786
  end
744
787
  exit 0
745
-
788
+
746
789
  elsif cmd == 'run' or cmd == 'console'
747
790
  read_settings
748
791
  run(cmd)
@@ -120,18 +120,17 @@ end
120
120
 
121
121
  Then /^I type "([^\"]*)" into the "([^\"]*)" (?:text|input) field$/ do |text_to_type, field_name|
122
122
  tap(field_name)
123
- wait_for_elements_exist( ["keyboardAutomatic"] )
123
+ await_keyboard()
124
+ sleep(STEP_PAUSE)
124
125
  keyboard_enter_text(text_to_type)
125
126
  sleep(STEP_PAUSE)
126
127
  end
127
128
 
128
129
  Then /^I type "([^\"]*)" into (?:input|text) field number (\d+)$/ do |text_to_type, index|
129
- index = index.to_i
130
- screenshot_and_raise "Index should be positive (was: #{index})" if (index<=0)
131
- touch("textField index:#{index-1}")
132
- wait_for_elements_exist( ["keyboardAutomatic"] )
133
- keyboard_enter_text(text_to_type)
134
- sleep(STEP_PAUSE)
130
+ macro %Q|I touch text field number #{index}|
131
+ await_keyboard()
132
+ keyboard_enter_text(text_to_type)
133
+ sleep(STEP_PAUSE)
135
134
  end
136
135
 
137
136
  # alias
@@ -1,6 +1,6 @@
1
1
  module Calabash
2
2
  module Cucumber
3
- VERSION = '0.9.144'
4
- FRAMEWORK_VERSION = '0.9.144'
3
+ VERSION = '0.9.145'
4
+ FRAMEWORK_VERSION = '0.9.145'
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.144
4
+ version: 0.9.145
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-06-04 00:00:00.000000000 Z
12
+ date: 2013-06-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cucumber