bin/xcmonkey in xcmonkey-0.3.0 vs bin/xcmonkey in xcmonkey-1.0.0
- old
+ new
@@ -1,10 +1,11 @@
#!/usr/bin/env ruby
require 'commander/import'
require_relative '../lib/xcmonkey'
require_relative '../lib/xcmonkey/describer'
+require_relative '../lib/xcmonkey/repeater'
require_relative '../lib/xcmonkey/logger'
require_relative '../lib/xcmonkey/driver'
require_relative '../lib/xcmonkey/version'
module Xcmonkey
@@ -16,28 +17,44 @@
c.description = 'Runs monkey test'
c.option('-u', '--udid STRING', String, 'Set device UDID')
c.option('-b', '--bundle-id STRING', String, 'Set target bundle identifier')
c.option('-d', '--duration SECONDS', Integer, 'Test duration in seconds. Defaults to `60`')
c.option('-k', '--enable-simulator-keyboard', 'Should simulator keyboard be enabled? Defaults to `true`')
- c.action do |args, options|
- options.default(duration: 60, enable_simulator_keyboard: true)
+ c.option('-s', '--session-path STRING', String, 'Path where monkey testing session should be saved. Defaults to current directory')
+ c.action do |_, options|
+ options.default(
+ duration: 60,
+ session_path: Dir.pwd,
+ enable_simulator_keyboard: true
+ )
params = {
udid: options.udid,
bundle_id: options.bundle_id,
duration: options.duration,
- simulator_keyboard: options.enable_simulator_keyboard
+ session_path: options.session_path,
+ enable_simulator_keyboard: options.enable_simulator_keyboard
}
Xcmonkey.new(params).run
end
end
+ command :repeat do |c|
+ c.syntax = 'xcmonkey repeat [options]'
+ c.description = 'Repeats given session'
+ c.option('-s', '--session-path STRING', String, 'Path to monkey testing session')
+ c.action do |_, options|
+ params = { session_path: options.session_path }
+ Repeater.new(params).run
+ end
+ end
+
command :describe do |c|
c.syntax = 'xcmonkey describe [options]'
c.description = 'Describes given point'
c.option('-u', '--udid STRING', String, 'Set device UDID')
c.option('-x', '--x STRING', 'Point `x` coordinate')
c.option('-y', '--y STRING', 'Point `y` coordinate')
- c.action do |args, options|
+ c.action do |_, options|
params = {
udid: options.udid,
x: options.x,
y: options.y
}