Class: Xcmonkey::Xcmonkey
- Inherits:
-
Object
- Object
- Xcmonkey::Xcmonkey
- Defined in:
- lib/xcmonkey.rb
Instance Attribute Summary collapse
-
#bundle_id ⇒ Object
Returns the value of attribute bundle_id.
-
#driver ⇒ Object
Returns the value of attribute driver.
-
#duration ⇒ Object
Returns the value of attribute duration.
-
#udid ⇒ Object
Returns the value of attribute udid.
Instance Method Summary collapse
- #ensure_required_params(params) ⇒ Object
- #gestures ⇒ Object
-
#initialize(params) ⇒ Xcmonkey
constructor
A new instance of Xcmonkey.
- #run ⇒ Object
Constructor Details
#initialize(params) ⇒ Xcmonkey
Returns a new instance of Xcmonkey.
12 13 14 15 16 17 18 |
# File 'lib/xcmonkey.rb', line 12 def initialize(params) ensure_required_params(params) self.udid = params[:udid] self.bundle_id = params[:bundle_id] self.duration = params[:duration] self.driver = Driver.new(params) end |
Instance Attribute Details
#bundle_id ⇒ Object
Returns the value of attribute bundle_id.
10 11 12 |
# File 'lib/xcmonkey.rb', line 10 def bundle_id @bundle_id end |
#driver ⇒ Object
Returns the value of attribute driver.
10 11 12 |
# File 'lib/xcmonkey.rb', line 10 def driver @driver end |
#duration ⇒ Object
Returns the value of attribute duration.
10 11 12 |
# File 'lib/xcmonkey.rb', line 10 def duration @duration end |
#udid ⇒ Object
Returns the value of attribute udid.
10 11 12 |
# File 'lib/xcmonkey.rb', line 10 def udid @udid end |
Instance Method Details
#ensure_required_params(params) ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/xcmonkey.rb', line 33 def ensure_required_params(params) Logger.error('UDID should be provided') if params[:udid].nil? Logger.error('Bundle identifier should be provided') if params[:bundle_id].nil? if params[:duration].nil? || !params[:duration].kind_of?(Integer) || !params[:duration].positive? Logger.error('Duration must be Integer and not less than 1 second') end end |
#gestures ⇒ Object
29 30 31 |
# File 'lib/xcmonkey.rb', line 29 def gestures [:precise_tap, :blind_tap, :swipe] end |
#run ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/xcmonkey.rb', line 20 def run driver.ensure_device_exists driver.ensure_app_installed driver.terminate_app driver.open_home_screen(return_tracker: true) driver.launch_app driver.monkey_test(gestures) end |