-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
40b1a42
commit 38e0bfa
Showing
10 changed files
with
192 additions
and
218 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
class Describer | ||
attr_accessor :x, :y, :driver | ||
attr_accessor :x, :y, :driver | ||
|
||
def initialize(params) | ||
ensure_required_params(params) | ||
self.x = params[:x] | ||
self.y = params[:y] | ||
self.driver = Driver.new(params) | ||
end | ||
def initialize(params) | ||
ensure_required_params(params) | ||
self.x = params[:x] | ||
self.y = params[:y] | ||
self.driver = Driver.new(params) | ||
end | ||
|
||
def run | ||
driver.ensure_device_exists | ||
driver.describe_point(x, y) | ||
end | ||
def run | ||
driver.ensure_device_exists | ||
driver.describe_point(x, y) | ||
end | ||
|
||
def ensure_required_params(params) | ||
Logger.error('UDID should be provided') if params[:udid].nil? | ||
Logger.error('`x` point coordinate should be provided') if params[:x].nil? || params[:x].to_i.to_s != params[:x].to_s | ||
Logger.error('`y` point coordinate should be provided') if params[:y].nil? || params[:y].to_i.to_s != params[:y].to_s | ||
end | ||
def ensure_required_params(params) | ||
Logger.error('UDID should be provided') if params[:udid].nil? | ||
Logger.error('`x` point coordinate should be provided') if params[:x].nil? || params[:x].to_i.to_s != params[:x].to_s | ||
Logger.error('`y` point coordinate should be provided') if params[:y].nil? || params[:y].to_i.to_s != params[:y].to_s | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,39 @@ | ||
class Repeater | ||
attr_accessor :udid, :bundle_id, :enable_simulator_keyboard, :actions | ||
attr_accessor :udid, :bundle_id, :enable_simulator_keyboard, :actions | ||
|
||
def initialize(params) | ||
validate_session(params[:session_path]) | ||
end | ||
def initialize(params) | ||
validate_session(params[:session_path]) | ||
end | ||
|
||
def run | ||
params = { | ||
udid: udid, | ||
bundle_id: bundle_id, | ||
enable_simulator_keyboard: enable_simulator_keyboard, | ||
session_actions: actions | ||
} | ||
Driver.new(params).repeat_monkey_test | ||
end | ||
def run | ||
params = { | ||
udid: udid, | ||
bundle_id: bundle_id, | ||
enable_simulator_keyboard: enable_simulator_keyboard, | ||
session_actions: actions | ||
} | ||
Driver.new(params).repeat_monkey_test | ||
end | ||
|
||
def validate_session(session_path) | ||
Logger.error("Provided session can't be found: #{session_path}") unless File.exist?(session_path) | ||
def validate_session(session_path) | ||
Logger.error("Provided session can't be found: #{session_path}") unless File.exist?(session_path) | ||
|
||
session = JSON.parse(File.read(session_path)) | ||
session = JSON.parse(File.read(session_path)) | ||
|
||
if session['params'].nil? | ||
Logger.error('Provided session is not valid: `params` should not be `nil`') | ||
return | ||
end | ||
if session['params'].nil? | ||
Logger.error('Provided session is not valid: `params` should not be `nil`') | ||
return | ||
end | ||
|
||
self.actions = session['actions'] | ||
Logger.error('Provided session is not valid: `actions` should not be `nil` or `empty`') if actions.nil? || actions.empty? | ||
self.actions = session['actions'] | ||
Logger.error('Provided session is not valid: `actions` should not be `nil` or `empty`') if actions.nil? || actions.empty? | ||
|
||
self.udid = session['params']['udid'] | ||
Logger.error('Provided session is not valid: `udid` should not be `nil`') if udid.nil? | ||
self.udid = session['params']['udid'] | ||
Logger.error('Provided session is not valid: `udid` should not be `nil`') if udid.nil? | ||
|
||
self.bundle_id = session['params']['bundle_id'] | ||
Logger.error('Provided session is not valid: `bundle_id` should not be `nil`') if bundle_id.nil? | ||
self.bundle_id = session['params']['bundle_id'] | ||
Logger.error('Provided session is not valid: `bundle_id` should not be `nil`') if bundle_id.nil? | ||
|
||
self.enable_simulator_keyboard = session['params']['enable_simulator_keyboard'] | ||
end | ||
self.enable_simulator_keyboard = session['params']['enable_simulator_keyboard'] | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
module Xcmonkey | ||
VERSION = '1.0.0' | ||
GEM_NAME = 'xcmonkey' | ||
class Xcmonkey | ||
VERSION = '1.1.0' | ||
end |
Oops, something went wrong.