smart_monkey 0.4.2 → 0.5.0

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: 847d8e2008d02e4d0dea00c85c4bf3c7bb106792
4
- data.tar.gz: 4646d1a3da95b94cc90ae2601f9706a93ed83732
3
+ metadata.gz: f5ddbe7279314292b43fa557cc7b04b52bb00cce
4
+ data.tar.gz: 0c43f1a91725bcc6775017c65f76100aa374c1f1
5
5
  SHA512:
6
- metadata.gz: 0bda662b08477fee72e67f081d16404a01651e02424e6b99931ba3f41172bb8d2e5210b79955f654a40569fb60eb274a419939795841a0d21ff05224f4c7c97e
7
- data.tar.gz: 241f3eeec81ba69252e271b0e8e79d1e842239b61ad21ef78767b9e0e64f98eb3e73326c3eaadd125a60901632953d5fe7d0849723646c097a3853ae752ad9c7
6
+ metadata.gz: 7bc77e9fa56e837a4a257f05d7d5b9bdae04f3b809176795330ac5e71b93ecf84d673f15165f38e71b0ae6a42d497593ab71917571adee9c31266b3c88a8e4e3
7
+ data.tar.gz: c3d6be6f49773bc7b6717e144c73ac5e71bb26a996ede8d19fd4ef964ac91bfa67e917454cb906b6af5a6e0c668e8cf4f3e44d484a27ea4bb0dc905c450f0690
data/README.md CHANGED
@@ -32,6 +32,7 @@ iOS Monkey Test Tool.
32
32
  ###### 安装Release版
33
33
  `gem install smart_monkey`, 执行入口: 终端下直接使用`smart_monkey`
34
34
  ###### 安装开发版
35
+ 安装Ruby模块`gem install erubis`(如安装release版,此模块会自动配置加载。)
35
36
  直接clone本项目, 执行入口: `/CrashMonkey4IOS/bin/smart_monkey`
36
37
 
37
38
  ###### 执行命令
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.2
1
+ 0.5.0
@@ -4,6 +4,19 @@ module UIAutoMonkey
4
4
  module CommandHelper
5
5
  require 'open3'
6
6
 
7
+ def instruments_deviceinfo(device)
8
+ `"instruments" -s devices | grep "#{device}"`.strip
9
+ end
10
+
11
+ def is_simulator
12
+ deviceinfo = instruments_deviceinfo(device)
13
+ if deviceinfo.include? "-"
14
+ true
15
+ else
16
+ false
17
+ end
18
+ end
19
+
7
20
  def shell(cmds)
8
21
  puts "Shell: #{cmds.inspect}"
9
22
  Open3.popen3(*cmds) do |stdin, stdout, stderr|
@@ -18,7 +31,11 @@ module UIAutoMonkey
18
31
  # end
19
32
 
20
33
  def relaunch_app(device,app)
21
- `idevicedebug -u #{device} run #{app} >/dev/null 2>&1 &`
34
+ if is_simulator
35
+ `xcrun simctl launch #{device} #{app} >/dev/null 2>&1 &`
36
+ else
37
+ `idevicedebug -u #{device} run #{app} >/dev/null 2>&1 &`
38
+ end
22
39
  end
23
40
 
24
41
  def run_process(cmds)
@@ -8,7 +8,6 @@ module UIAutoMonkey
8
8
  require 'json'
9
9
 
10
10
  class MonkeyRunner
11
- TRACE_TEMPLATE='/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate'
12
11
  RESULT_BASE_PATH = File.expand_path('smart_monkey_result')
13
12
  INSTRUMENTS_TRACE_PATH = File.expand_path('*.trace')
14
13
  TIME_STAP = Time.new.strftime("%Y%m%d%H%M%S")
@@ -82,9 +81,9 @@ module UIAutoMonkey
82
81
  watch_syslog do
83
82
  begin
84
83
  unless time_limit_sec.nil?
85
- run_process(%W(instruments -w #{device} -l #{time_limit} -t #{TRACE_TEMPLATE} #{app_path} -e UIASCRIPT #{ui_custom_path} -e UIARESULTSPATH #{result_base_dir}))
84
+ run_process(%W(instruments -w #{device} -l #{time_limit} -t #{automation_template_path} #{app_path} -e UIASCRIPT #{ui_custom_path} -e UIARESULTSPATH #{result_base_dir}))
86
85
  else
87
- run_process(%W(instruments -w #{device} -t #{TRACE_TEMPLATE} #{app_path} -e UIASCRIPT #{ui_custom_path} -e UIARESULTSPATH #{result_base_dir}))
86
+ run_process(%W(instruments -w #{device} -t #{automation_template_path} #{app_path} -e UIASCRIPT #{ui_custom_path} -e UIARESULTSPATH #{result_base_dir}))
88
87
  end
89
88
  rescue Timeout::Error
90
89
  kill_all('instruments', '9')
@@ -413,6 +412,10 @@ module UIAutoMonkey
413
412
  def xcode_path
414
413
  `dirname #{xcode_developer_path}`.strip
415
414
  end
415
+
416
+ def automation_template_path
417
+ `find #{xcode_path} -name Automation.tracetemplate`.strip
418
+ end
416
419
 
417
420
  def symbolicatecrash_base_path()
418
421
  `find #{xcode_path} -name symbolicatecrash`.strip
@@ -193,7 +193,7 @@ UIAutoMonkey.prototype.allEvents = {
193
193
  },
194
194
 
195
195
  clickVolumeDown: function() {
196
- this.target().clickVolumeUp();
196
+ this.target().clickVolumeDown();
197
197
  },
198
198
 
199
199
  lock: function() {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smart_monkey
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - vigossjjj