testautoi 0.9.146 → 0.9.147

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.
@@ -76,6 +76,8 @@ def print_usage
76
76
  Start recording
77
77
  record stop
78
78
  Stop recording
79
+ uia <Script>
80
+ Run a UIA script
79
81
  version
80
82
  prints the gem version
81
83
 
@@ -500,14 +502,16 @@ def simulator_path
500
502
  "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\\ Simulator.app/Contents/MacOS/iPhone\\ Simulator"
501
503
  end
502
504
 
503
- def launch_app(app_url)
505
+ def run_instruments(udid, app_path, script_path)
506
+ output = nil
504
507
  File.open("#{Dir.tmpdir}/testautoi.lock", 'w') { |f|
505
508
  f.flock(File::LOCK_EX)
506
- launch_app_unsafe(app_url)
509
+ output = `instruments -w #{udid} -t #{tracetemplate} #{app_path} -e UIASCRIPT #{script_path}`
507
510
  }
511
+ output
508
512
  end
509
513
 
510
- def launch_app_unsafe(app_url)
514
+ def launch_app(app_url)
511
515
  udid = @settings["device_udid"].to_s
512
516
  udids = Device.detect
513
517
  raise "No device is connected" if udids.length <= 0
@@ -521,17 +525,10 @@ def launch_app_unsafe(app_url)
521
525
  text = File.read(File.join(File.dirname(__FILE__), script))
522
526
  File.open(File.join(FileUtils.pwd, script), "w") {|file| file.puts text.gsub(/\[%app%\]/, app_url)}
523
527
  script = File.join(FileUtils.pwd, script)
524
- cmd = `instruments -w #{udid} -t #{tracetemplate} #{launcher_path} -e UIASCRIPT #{script}`
528
+ run_instruments(udid, launcher_path, script)
525
529
  end
526
530
 
527
531
  def get_device_ip
528
- File.open("#{Dir.tmpdir}/testautoi.lock", 'w') { |f|
529
- f.flock(File::LOCK_EX)
530
- get_device_ip_unsafe
531
- }
532
- end
533
-
534
- def get_device_ip_unsafe
535
532
  app_url = app_bundle_url_schemes(app_bundle_path)
536
533
  udid = @settings["device_udid"].to_s
537
534
  udids = Device.detect
@@ -547,7 +544,7 @@ def get_device_ip_unsafe
547
544
  File.open(File.join(FileUtils.pwd, script), "w") {|file| file.puts text}
548
545
  script = File.join(FileUtils.pwd, script)
549
546
  File.open(File.join(FileUtils.pwd, "Device.cfg"), "w") {|file| file.puts "IPAddress="}
550
- cmd = `instruments -w #{udid} -t #{tracetemplate} #{launcher_path} -e UIASCRIPT #{script}`
547
+ run_instruments(udid, launcher_path, script)
551
548
  puts File.read(File.join(FileUtils.pwd, "Device.cfg"))
552
549
  end
553
550
 
@@ -816,6 +813,11 @@ elsif cmd == 'gen'
816
813
  elsif cmd == 'go'
817
814
  go
818
815
 
816
+ elsif cmd == 'uia'
817
+ read_settings
818
+ script_path = ARGV.shift
819
+ puts run_instruments(@settings["device_udid"].to_s, @settings["app_bundle"], script_path)
820
+
819
821
  elsif cmd == 'record'
820
822
  read_settings
821
823
  option = ARGV.shift
@@ -1,6 +1,6 @@
1
1
  module Calabash
2
2
  module Cucumber
3
- VERSION = '0.9.146'
4
- FRAMEWORK_VERSION = '0.9.146'
3
+ VERSION = '0.9.147'
4
+ FRAMEWORK_VERSION = '0.9.147'
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.146
4
+ version: 0.9.147
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-08-22 00:00:00.000000000 Z
12
+ date: 2013-08-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cucumber