Module: Frank::Cucumber::HostScripting
- Included in:
- FrankHelper
- Defined in:
- lib/frank-cucumber/host_scripting.rb
Instance Method Summary collapse
- #press_home_on_simulator ⇒ Object
- #quit_double_simulator ⇒ Object
- #quit_simulator ⇒ Object
- #rotate_simulator_left ⇒ Object
- #rotate_simulator_right ⇒ Object
- #shake_simulator ⇒ Object
- #simulate_hardware_keyboard ⇒ Object
- #simulate_memory_warning ⇒ Object
-
#simulator_hardware_menu_press(menu_label) ⇒ Object
Note this needs to have “Enable access for assistive devices” chcked in the Universal Access system preferences.
- #simulator_reset_data ⇒ Object
- #start_recording ⇒ Object
- #stop_recording ⇒ Object
- #toggle_call_status_bar ⇒ Object
Instance Method Details
#press_home_on_simulator ⇒ Object
67 68 69 |
# File 'lib/frank-cucumber/host_scripting.rb', line 67 def press_home_on_simulator Localize.t(:home) end |
#quit_double_simulator ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/frank-cucumber/host_scripting.rb', line 32 def quit_double_simulator %x{osascript<<APPLESCRIPT activate application id "com.apple.iphonesimulator" tell application "System Events" tell process "#{Localize.t(:iphone_simulator)}" if (value of static text 1 of window 1) is "#{Localize.t(:only_one_simulator)}" then click button 1 of window 1 end if end tell end tell } end |
#quit_simulator ⇒ Object
26 27 28 29 30 |
# File 'lib/frank-cucumber/host_scripting.rb', line 26 def quit_simulator %x{osascript<<APPLESCRIPT- application id "com.apple.iphonesimulator" quit APPLESCRIPT} end |
#rotate_simulator_left ⇒ Object
71 72 73 |
# File 'lib/frank-cucumber/host_scripting.rb', line 71 def rotate_simulator_left Localize.t(:rotate_left) end |
#rotate_simulator_right ⇒ Object
75 76 77 |
# File 'lib/frank-cucumber/host_scripting.rb', line 75 def rotate_simulator_right Localize.t(:rotate_right) end |
#shake_simulator ⇒ Object
79 80 81 |
# File 'lib/frank-cucumber/host_scripting.rb', line 79 def shake_simulator Localize.t(:shake_gesture) end |
#simulate_hardware_keyboard ⇒ Object
91 92 93 |
# File 'lib/frank-cucumber/host_scripting.rb', line 91 def simulate_hardware_keyboard Localize.t(:simulate_hardware_keyboard) end |
#simulate_memory_warning ⇒ Object
83 84 85 |
# File 'lib/frank-cucumber/host_scripting.rb', line 83 def simulate_memory_warning Localize.t(:simulate_memory_warning) end |
#simulator_hardware_menu_press(menu_label) ⇒ Object
Note this needs to have “Enable access for assistive devices” chcked in the Universal Access system preferences
58 59 60 61 62 63 64 65 |
# File 'lib/frank-cucumber/host_scripting.rb', line 58 def ( ) %x{osascript<<APPLESCRIPT activate application id "com.apple.iphonesimulator" tell application "System Events" click menu item "#{}" of menu "#{Localize.t(:hardware)}" of menu bar of process "#{Localize.t(:iphone_simulator)}" end tell APPLESCRIPT} end |
#simulator_reset_data ⇒ Object
45 46 47 48 49 50 51 52 53 54 |
# File 'lib/frank-cucumber/host_scripting.rb', line 45 def simulator_reset_data %x{osascript<<APPLESCRIPT activate application id "com.apple.iphonesimulator" tell application "System Events" click menu item 5 of menu 1 of menu bar item 2 of menu bar 1 of process "#{Localize.t(:iphone_simulator)}" delay 0.5 click button "#{Localize.t(:iphone_simulator_reset)}" of window 1 of process "#{Localize.t(:iphone_simulator)}" end tell APPLESCRIPT} end |
#start_recording ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/frank-cucumber/host_scripting.rb', line 7 def start_recording %x{osascript<<APPLESCRIPT tell application "QuickTime Player" set sr to new screen recording tell sr to start end tell APPLESCRIPT} end |
#stop_recording ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/frank-cucumber/host_scripting.rb', line 17 def stop_recording %x{osascript<<APPLESCRIPT tell application "QuickTime Player" set sr to (document 1) tell sr to stop end tell APPLESCRIPT} end |