sc-frank-cucumber 1.2.1.00af28c
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/Rakefile +38 -0
- data/bin/frank +6 -0
- data/bin/frank-skeleton +33 -0
- data/frank-skeleton/features/my_first.feature +12 -0
- data/frank-skeleton/features/step_definitions/launch_steps.rb +20 -0
- data/frank-skeleton/features/support/env.rb +8 -0
- data/frank-skeleton/frank_static_resources.bundle/ViewAttributeMapping.plist +63 -0
- data/frank-skeleton/frank_static_resources.bundle/ViewAttributeMappingMac.plist +99 -0
- data/frank-skeleton/frank_static_resources.bundle/images/ajax-loader.gif +0 -0
- data/frank-skeleton/frank_static_resources.bundle/images/file.gif +0 -0
- data/frank-skeleton/frank_static_resources.bundle/images/folder-closed.gif +0 -0
- data/frank-skeleton/frank_static_resources.bundle/images/folder.gif +0 -0
- data/frank-skeleton/frank_static_resources.bundle/images/loader.gif +0 -0
- data/frank-skeleton/frank_static_resources.bundle/images/loader.png +0 -0
- data/frank-skeleton/frank_static_resources.bundle/images/minus.gif +0 -0
- data/frank-skeleton/frank_static_resources.bundle/images/plus.gif +0 -0
- data/frank-skeleton/frank_static_resources.bundle/images/treeview-black-line.gif +0 -0
- data/frank-skeleton/frank_static_resources.bundle/images/treeview-black.gif +0 -0
- data/frank-skeleton/frank_static_resources.bundle/images/treeview-default-line.gif +0 -0
- data/frank-skeleton/frank_static_resources.bundle/images/treeview-default.gif +0 -0
- data/frank-skeleton/frank_static_resources.bundle/images/treeview-famfamfam-line.gif +0 -0
- data/frank-skeleton/frank_static_resources.bundle/images/treeview-famfamfam.gif +0 -0
- data/frank-skeleton/frank_static_resources.bundle/images/treeview-gray-line.gif +0 -0
- data/frank-skeleton/frank_static_resources.bundle/images/treeview-gray.gif +0 -0
- data/frank-skeleton/frank_static_resources.bundle/images/treeview-red-line.gif +0 -0
- data/frank-skeleton/frank_static_resources.bundle/images/treeview-red.gif +0 -0
- data/frank-skeleton/frank_static_resources.bundle/index.html +86 -0
- data/frank-skeleton/frank_static_resources.bundle/index.html.haml +76 -0
- data/frank-skeleton/frank_static_resources.bundle/js/accessible_views_view.coffee +41 -0
- data/frank-skeleton/frank_static_resources.bundle/js/accessible_views_view.js +46 -0
- data/frank-skeleton/frank_static_resources.bundle/js/controller.coffee +134 -0
- data/frank-skeleton/frank_static_resources.bundle/js/controller.js +139 -0
- data/frank-skeleton/frank_static_resources.bundle/js/details_view.coffee +42 -0
- data/frank-skeleton/frank_static_resources.bundle/js/details_view.js +51 -0
- data/frank-skeleton/frank_static_resources.bundle/js/dropdown_control.coffee +64 -0
- data/frank-skeleton/frank_static_resources.bundle/js/dropdown_control.js +73 -0
- data/frank-skeleton/frank_static_resources.bundle/js/ersatz_model.coffee +46 -0
- data/frank-skeleton/frank_static_resources.bundle/js/ersatz_model.js +60 -0
- data/frank-skeleton/frank_static_resources.bundle/js/ersatz_view.coffee +167 -0
- data/frank-skeleton/frank_static_resources.bundle/js/ersatz_view.js +205 -0
- data/frank-skeleton/frank_static_resources.bundle/js/experiment_bar_model.coffee +10 -0
- data/frank-skeleton/frank_static_resources.bundle/js/experiment_bar_model.js +17 -0
- data/frank-skeleton/frank_static_resources.bundle/js/experiment_bar_view.coffee +44 -0
- data/frank-skeleton/frank_static_resources.bundle/js/experiment_bar_view.js +63 -0
- data/frank-skeleton/frank_static_resources.bundle/js/frank.coffee +96 -0
- data/frank-skeleton/frank_static_resources.bundle/js/frank.js +146 -0
- data/frank-skeleton/frank_static_resources.bundle/js/lib/backbone.js +1431 -0
- data/frank-skeleton/frank_static_resources.bundle/js/lib/coffee-script.js +8 -0
- data/frank-skeleton/frank_static_resources.bundle/js/lib/jquery-ui.min.js +405 -0
- data/frank-skeleton/frank_static_resources.bundle/js/lib/jquery.min.js +4 -0
- data/frank-skeleton/frank_static_resources.bundle/js/lib/jquery.treeview.js +251 -0
- data/frank-skeleton/frank_static_resources.bundle/js/lib/json2.js +481 -0
- data/frank-skeleton/frank_static_resources.bundle/js/lib/raphael.js +5815 -0
- data/frank-skeleton/frank_static_resources.bundle/js/lib/require.js +2053 -0
- data/frank-skeleton/frank_static_resources.bundle/js/lib/underscore.js +1059 -0
- data/frank-skeleton/frank_static_resources.bundle/js/main.coffee +27 -0
- data/frank-skeleton/frank_static_resources.bundle/js/main.js +29 -0
- data/frank-skeleton/frank_static_resources.bundle/js/tabs_controller.coffee +13 -0
- data/frank-skeleton/frank_static_resources.bundle/js/tabs_controller.js +22 -0
- data/frank-skeleton/frank_static_resources.bundle/js/toast_controller.coffee +15 -0
- data/frank-skeleton/frank_static_resources.bundle/js/toast_controller.js +28 -0
- data/frank-skeleton/frank_static_resources.bundle/js/transform_stack.coffee +59 -0
- data/frank-skeleton/frank_static_resources.bundle/js/transform_stack.js +78 -0
- data/frank-skeleton/frank_static_resources.bundle/js/tree_view.coffee +53 -0
- data/frank-skeleton/frank_static_resources.bundle/js/tree_view.js +64 -0
- data/frank-skeleton/frank_static_resources.bundle/js/view_hier_model.coffee +37 -0
- data/frank-skeleton/frank_static_resources.bundle/js/view_hier_model.js +48 -0
- data/frank-skeleton/frank_static_resources.bundle/js/view_model.coffee +39 -0
- data/frank-skeleton/frank_static_resources.bundle/js/view_model.js +62 -0
- data/frank-skeleton/frank_static_resources.bundle/pictos/index.html +329 -0
- data/frank-skeleton/frank_static_resources.bundle/pictos/pictos-web.eot +0 -0
- data/frank-skeleton/frank_static_resources.bundle/pictos/pictos-web.svg +114 -0
- data/frank-skeleton/frank_static_resources.bundle/pictos/pictos-web.ttf +0 -0
- data/frank-skeleton/frank_static_resources.bundle/pictos/pictos-web.woff +0 -0
- data/frank-skeleton/frank_static_resources.bundle/pictos/pictos.css +20 -0
- data/frank-skeleton/frank_static_resources.bundle/pictos/pictos_base64.css +18 -0
- data/frank-skeleton/frank_static_resources.bundle/stylesheets/css/symbiote.css +1 -0
- data/frank-skeleton/frank_static_resources.bundle/stylesheets/sass/_elements.scss +28 -0
- data/frank-skeleton/frank_static_resources.bundle/stylesheets/sass/_header.scss +61 -0
- data/frank-skeleton/frank_static_resources.bundle/stylesheets/sass/_inspect_tabs_list_tabs.scss +194 -0
- data/frank-skeleton/frank_static_resources.bundle/stylesheets/sass/_jquery.treeview.scss +68 -0
- data/frank-skeleton/frank_static_resources.bundle/stylesheets/sass/_jqui.scss +2 -0
- data/frank-skeleton/frank_static_resources.bundle/stylesheets/sass/_layout.scss +13 -0
- data/frank-skeleton/frank_static_resources.bundle/stylesheets/sass/_mixins.sass +137 -0
- data/frank-skeleton/frank_static_resources.bundle/stylesheets/sass/_reset.scss +32 -0
- data/frank-skeleton/frank_static_resources.bundle/stylesheets/sass/_selector_test_toolbar.scss +81 -0
- data/frank-skeleton/frank_static_resources.bundle/stylesheets/sass/_solarized.scss +16 -0
- data/frank-skeleton/frank_static_resources.bundle/stylesheets/sass/_typography.scss +11 -0
- data/frank-skeleton/frank_static_resources.bundle/stylesheets/sass/_unicode.scss +3 -0
- data/frank-skeleton/frank_static_resources.bundle/stylesheets/sass/_z_index.scss +2 -0
- data/frank-skeleton/frank_static_resources.bundle/stylesheets/sass/symbiote.scss +26 -0
- data/frank-skeleton/frankify.xcconfig.tt +6 -0
- data/frank-skeleton/libCocoaAsyncSocket.a +0 -0
- data/frank-skeleton/libCocoaAsyncSocketMac.a +0 -0
- data/frank-skeleton/libCocoaHTTPServer.a +0 -0
- data/frank-skeleton/libCocoaHTTPServerMac.a +0 -0
- data/frank-skeleton/libCocoaLumberjack.a +0 -0
- data/frank-skeleton/libCocoaLumberjackMac.a +0 -0
- data/frank-skeleton/libFrank.a +0 -0
- data/frank-skeleton/libFrankMac.a +0 -0
- data/frank-skeleton/libShelley.a +0 -0
- data/frank-skeleton/libShelleyMac.a +0 -0
- data/frank-skeleton/plugins/.empty_directory +0 -0
- data/lib/frank-cucumber.rb +15 -0
- data/lib/frank-cucumber/app_bundle_locator.rb +58 -0
- data/lib/frank-cucumber/bonjour.rb +73 -0
- data/lib/frank-cucumber/cli.rb +299 -0
- data/lib/frank-cucumber/color_helper.rb +13 -0
- data/lib/frank-cucumber/console.rb +28 -0
- data/lib/frank-cucumber/core_frank_steps.rb +260 -0
- data/lib/frank-cucumber/frank.xcconfig.erb +17 -0
- data/lib/frank-cucumber/frank_helper.rb +459 -0
- data/lib/frank-cucumber/frank_localize.rb +43 -0
- data/lib/frank-cucumber/frank_mac_helper.rb +120 -0
- data/lib/frank-cucumber/frankifier.rb +150 -0
- data/lib/frank-cucumber/gateway.rb +135 -0
- data/lib/frank-cucumber/gesture_helper.rb +99 -0
- data/lib/frank-cucumber/host_scripting.rb +96 -0
- data/lib/frank-cucumber/keyboard_helper.rb +69 -0
- data/lib/frank-cucumber/launcher.rb +70 -0
- data/lib/frank-cucumber/localize.yml +104 -0
- data/lib/frank-cucumber/location_helper.rb +20 -0
- data/lib/frank-cucumber/mac_launcher.rb +35 -0
- data/lib/frank-cucumber/plugins/plugin.rb +57 -0
- data/lib/frank-cucumber/rect.rb +26 -0
- data/lib/frank-cucumber/scroll_helper.rb +24 -0
- data/lib/frank-cucumber/version.rb +5 -0
- data/lib/frank-cucumber/wait_helper.rb +57 -0
- data/sc-frank-cucumber.gemspec +37 -0
- data/test/keyboard_helper_test.rb +84 -0
- data/test/launcher_test.rb +57 -0
- data/test/rect_test.rb +25 -0
- data/test/test_helper.rb +16 -0
- metadata +395 -0
@@ -0,0 +1,99 @@
|
|
1
|
+
module Frank
|
2
|
+
module Cucumber
|
3
|
+
module GestureHelper
|
4
|
+
|
5
|
+
# Touch and hold the selector for a given duration
|
6
|
+
#
|
7
|
+
# @param [String] selector a view selector.
|
8
|
+
# @param [Number] duration the duration of the touch, the default is 1.
|
9
|
+
#
|
10
|
+
# @return [Array<Boolean>] an array indicating for each view which matched the selector whether it was touched or not.
|
11
|
+
#
|
12
|
+
# @raise an expection if no views matched the selector
|
13
|
+
# @raise an expection if no views which matched the selector could be touched
|
14
|
+
def tap_and_hold( selector, duration = 1 )
|
15
|
+
touch_successes = frankly_map( selector, "touchAndHold:", duration )
|
16
|
+
raise "Could not find anything matching [#{selector}] to long touch" if touch_successes.empty?
|
17
|
+
raise "Some views could not be long touched (probably because they are not within the current viewport)" if touch_successes.include?(false)
|
18
|
+
end
|
19
|
+
|
20
|
+
# Touch and hold the selector at a specific point for a given duration
|
21
|
+
#
|
22
|
+
# @param [String] selector a view selector.
|
23
|
+
# @param [Number] duration the duration of the touch, the default is 1.
|
24
|
+
# @param [Number] x the x-coordinate to touch
|
25
|
+
# @param [Number] y the y-coordinate to touch
|
26
|
+
#
|
27
|
+
# @return [Array<Boolean>] an array indicating for each view which matched the selector whether it was touched or not.
|
28
|
+
#
|
29
|
+
# @raise an expection if no views matched the selector
|
30
|
+
# @raise an expection if no views which matched the selector could be touched
|
31
|
+
def tap_and_hold_point( selector, x, y, duration = 1 )
|
32
|
+
touch_successes = frankly_map( selector, "touchAndHold:x:y:", duration, x, y )
|
33
|
+
raise "Could not find anything matching [#{selector}] to long touch" if touch_successes.empty?
|
34
|
+
raise "Some views could not be long touched (probably because they are not within the current viewport)" if touch_successes.include?(false)
|
35
|
+
end
|
36
|
+
|
37
|
+
# Double tap the selector
|
38
|
+
#
|
39
|
+
# @param [String] selector a view selector.
|
40
|
+
#
|
41
|
+
# @return [Array<Boolean>] an array indicating for each view which matched the selector whether it was touched or not.
|
42
|
+
#
|
43
|
+
# @raise an expection if no views matched the selector
|
44
|
+
# @raise an expection if no views which matched the selector could be touched
|
45
|
+
def double_tap( selector )
|
46
|
+
touch_successes = frankly_map( selector, "doubleTap" )
|
47
|
+
raise "Could not find anything matching [#{selector}] to double tap" if touch_successes.empty?
|
48
|
+
raise "Some views could not be double tap (probably because they are not within the current viewport)" if touch_successes.include?(false)
|
49
|
+
end
|
50
|
+
|
51
|
+
# Double tap the selector at a specific point
|
52
|
+
#
|
53
|
+
# @param [String] selector a view selector.
|
54
|
+
# @param [Number] x the x-coordinate to touch
|
55
|
+
# @param [Number] y the y-coordinate to touch
|
56
|
+
#
|
57
|
+
# @return [Array<Boolean>] an array indicating for each view which matched the selector whether it was touched or not.
|
58
|
+
#
|
59
|
+
# @raise an expection if no views matched the selector
|
60
|
+
# @raise an expection if no views which matched the selector could be touched
|
61
|
+
def double_tap_point( selector, x, y )
|
62
|
+
touch_successes = frankly_map( selector, "doubleTapx:y:", x, y )
|
63
|
+
raise "Could not find anything matching [#{selector}] to double tap" if touch_successes.empty?
|
64
|
+
raise "Some views could not be double tap (probably because they are not within the current viewport)" if touch_successes.include?(false)
|
65
|
+
end
|
66
|
+
|
67
|
+
# Drag the slider thumb to required value, taking the specified time
|
68
|
+
#
|
69
|
+
# @param [String] selector A view selector
|
70
|
+
# @param [Number] value The value up to which the slider should be dragged
|
71
|
+
# @param [Number] duration The time interval that the drag should take
|
72
|
+
#
|
73
|
+
# @return [Array<Boolean>] an array indicating for each view which matched the selector if the value was acceptable or not
|
74
|
+
#
|
75
|
+
# @raise an expection if no views matched the selector
|
76
|
+
# @raise an expection if no views which matched the selector could have their thumbs dragged
|
77
|
+
def drag_thumb_in_slider( selector, value, duration )
|
78
|
+
touch_successes = frankly_map( selector, "FEX_dragThumbToValue:withDuration:", value, duration)
|
79
|
+
raise "Could not find anything matching [#{selector}] to have its thumb dragged" if touch_successes.empty?
|
80
|
+
raise "Some views could not had their thumbs dragged (are they even UISLiders?)" if touch_successes.include?(false)
|
81
|
+
end
|
82
|
+
|
83
|
+
# Drag the slider thumb to required value
|
84
|
+
#
|
85
|
+
# @param [String] selector A view selector
|
86
|
+
# @param [Number] value The value up to which the slider should be dragged
|
87
|
+
#
|
88
|
+
# @return [Array<Boolean>] an array indicating for each view which matched the selector if the value was acceptable or not
|
89
|
+
#
|
90
|
+
# @raise an expection if no views matched the selector
|
91
|
+
# @raise an expection if no views which matched the selector could have their thumbs dragged
|
92
|
+
def drag_thumb_in_slider_with_default_duration( selector, value )
|
93
|
+
touch_successes = frankly_map( selector, "FEX_dragThumbToValue:", value )
|
94
|
+
raise "Could not find anything matching [#{selector}] to have its thumb dragged" if touch_successes.empty?
|
95
|
+
raise "Some views could not had their thumbs dragged (are they even UISLiders?)" if touch_successes.include?(false)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
@@ -0,0 +1,96 @@
|
|
1
|
+
require 'frank-cucumber/frank_localize'
|
2
|
+
|
3
|
+
module Frank module Cucumber
|
4
|
+
|
5
|
+
module HostScripting
|
6
|
+
|
7
|
+
def start_recording
|
8
|
+
%x{osascript<<APPLESCRIPT
|
9
|
+
tell application "QuickTime Player"
|
10
|
+
set sr to new screen recording
|
11
|
+
tell sr to start
|
12
|
+
end tell
|
13
|
+
APPLESCRIPT}
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
def stop_recording
|
18
|
+
%x{osascript<<APPLESCRIPT
|
19
|
+
tell application "QuickTime Player"
|
20
|
+
set sr to (document 1)
|
21
|
+
tell sr to stop
|
22
|
+
end tell
|
23
|
+
APPLESCRIPT}
|
24
|
+
end
|
25
|
+
|
26
|
+
def quit_simulator
|
27
|
+
%x{osascript<<APPLESCRIPT-
|
28
|
+
application id "com.apple.iphonesimulator" quit
|
29
|
+
APPLESCRIPT}
|
30
|
+
end
|
31
|
+
|
32
|
+
def quit_double_simulator
|
33
|
+
%x{osascript<<APPLESCRIPT
|
34
|
+
activate application id "com.apple.iphonesimulator"
|
35
|
+
tell application "System Events"
|
36
|
+
tell process "#{Localize.t(:iphone_simulator)}"
|
37
|
+
if (value of static text 1 of window 1) is "#{Localize.t(:only_one_simulator)}" then
|
38
|
+
click button 1 of window 1
|
39
|
+
end if
|
40
|
+
end tell
|
41
|
+
end tell
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
def simulator_reset_data
|
46
|
+
%x{osascript<<APPLESCRIPT
|
47
|
+
activate application id "com.apple.iphonesimulator"
|
48
|
+
tell application "System Events"
|
49
|
+
click menu item 5 of menu 1 of menu bar item 2 of menu bar 1 of process "#{Localize.t(:iphone_simulator)}"
|
50
|
+
delay 0.5
|
51
|
+
click button "#{Localize.t(:iphone_simulator_reset)}" of window 1 of process "#{Localize.t(:iphone_simulator)}"
|
52
|
+
end tell
|
53
|
+
APPLESCRIPT}
|
54
|
+
end
|
55
|
+
|
56
|
+
#Note this needs to have "Enable access for assistive devices"
|
57
|
+
#chcked in the Universal Access system preferences
|
58
|
+
def simulator_hardware_menu_press( menu_label )
|
59
|
+
%x{osascript<<APPLESCRIPT
|
60
|
+
activate application id "com.apple.iphonesimulator"
|
61
|
+
tell application "System Events"
|
62
|
+
click menu item "#{menu_label}" of menu "#{Localize.t(:hardware)}" of menu bar of process "#{Localize.t(:iphone_simulator)}"
|
63
|
+
end tell
|
64
|
+
APPLESCRIPT}
|
65
|
+
end
|
66
|
+
|
67
|
+
def press_home_on_simulator
|
68
|
+
simulator_hardware_menu_press Localize.t(:home)
|
69
|
+
end
|
70
|
+
|
71
|
+
def rotate_simulator_left
|
72
|
+
simulator_hardware_menu_press Localize.t(:rotate_left)
|
73
|
+
end
|
74
|
+
|
75
|
+
def rotate_simulator_right
|
76
|
+
simulator_hardware_menu_press Localize.t(:rotate_right)
|
77
|
+
end
|
78
|
+
|
79
|
+
def shake_simulator
|
80
|
+
simulator_hardware_menu_press Localize.t(:shake_gesture)
|
81
|
+
end
|
82
|
+
|
83
|
+
def simulate_memory_warning
|
84
|
+
simulator_hardware_menu_press Localize.t(:simulate_memory_warning)
|
85
|
+
end
|
86
|
+
|
87
|
+
def toggle_call_status_bar
|
88
|
+
simulator_hardware_menu_press Localize.t(:toggle_call_status_bar)
|
89
|
+
end
|
90
|
+
|
91
|
+
def simulate_hardware_keyboard
|
92
|
+
simulator_hardware_menu_press Localize.t(:simulate_hardware_keyboard)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
end end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
module Frank
|
2
|
+
module Cucumber
|
3
|
+
|
4
|
+
module KeyboardHelper
|
5
|
+
# Ask Frank to press a sequence of keys on the iOS keyboard.
|
6
|
+
#
|
7
|
+
# @note The keyboard must be fully visible on the device before calling this method.
|
8
|
+
#
|
9
|
+
# The "/b" control character is interpreted as a request to press the 'Delete' key.
|
10
|
+
#
|
11
|
+
# An implicit return is appended to the key sequence, unless you explicitly specify otherwise by setting the :append_return option to false.
|
12
|
+
#
|
13
|
+
# @example
|
14
|
+
# # press the X, -, Y, and z keys on the
|
15
|
+
# # iOS keyboard, then press return
|
16
|
+
# type_into_keyboard("X-Yz")
|
17
|
+
#
|
18
|
+
# # press the 1, 2, and 3 keys on the
|
19
|
+
# # iOS keyboard, but don't press return afterwards
|
20
|
+
# type_into_keyboard("123", :append_return => false)
|
21
|
+
#
|
22
|
+
# # press the 1, 2, and 3 keys on the
|
23
|
+
# # iOS keyboard, but don't press return afterwards
|
24
|
+
# type_into_keyboard("123", :append_return => false)
|
25
|
+
#
|
26
|
+
# # press Delete twice, then type "foo"
|
27
|
+
# type_into_keyboard("\b\bfoo")
|
28
|
+
#
|
29
|
+
def type_into_keyboard(text_to_type, options = {})
|
30
|
+
options = {
|
31
|
+
:append_return => true
|
32
|
+
}.merge(options)
|
33
|
+
|
34
|
+
if( options[:append_return] )
|
35
|
+
text_to_type = text_to_type+"\n" unless text_to_type.end_with?("\n")
|
36
|
+
end
|
37
|
+
res = frank_server.send_post(
|
38
|
+
'type_into_keyboard',
|
39
|
+
:text_to_type => text_to_type
|
40
|
+
)
|
41
|
+
Frank::Cucumber::Gateway.evaluate_frankly_response( res, "typing the following into the keyboard '#{text_to_type}'" )
|
42
|
+
end
|
43
|
+
|
44
|
+
# Type a keyboard shortcut (Mac only)
|
45
|
+
#
|
46
|
+
# This function takes as arguments either a single string, or an array of strings, with
|
47
|
+
# each string representing a different key to press. Modifier keys are represented by
|
48
|
+
# the strings "command", "shift", "option", and "control".
|
49
|
+
#
|
50
|
+
# For example, to sent a keyboard shortcut to quit the app, you would call
|
51
|
+
#
|
52
|
+
# type shortcut "command", "q"
|
53
|
+
def type_shortcut(*args)
|
54
|
+
if args[0].kind_of?(Array)
|
55
|
+
return type_shortcut(*args)
|
56
|
+
else
|
57
|
+
key = args.pop
|
58
|
+
|
59
|
+
res = frank_server.send_post(
|
60
|
+
'type_into_keyboard',
|
61
|
+
:text_to_type => key,
|
62
|
+
:modifiers => args
|
63
|
+
)
|
64
|
+
|
65
|
+
Frank::Cucumber::Gateway.evaluate_frankly_response(res, "typing the following shortcut into the keyboard '#{key}' with modifiers #{args}")
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require 'sim_launcher'
|
2
|
+
require 'frank-cucumber/app_bundle_locator'
|
3
|
+
|
4
|
+
module Frank module Cucumber
|
5
|
+
|
6
|
+
module Launcher
|
7
|
+
attr_accessor :application_path, :sdk, :version
|
8
|
+
|
9
|
+
def simulator_client
|
10
|
+
@simulator_client ||= SimLauncher::Client.new(@application_path, @sdk, @version)
|
11
|
+
end
|
12
|
+
|
13
|
+
def simulator_direct_client
|
14
|
+
@simulator_direct_client ||= SimLauncher::DirectClient.new(@application_path, @sdk, @version)
|
15
|
+
end
|
16
|
+
|
17
|
+
def enforce(app_path, locator = Frank::Cucumber::AppBundleLocator.new)
|
18
|
+
if app_path.nil?
|
19
|
+
message = "APP_BUNDLE_PATH is not set. \n\nPlease set APP_BUNDLE_PATH (either an environment variable, or the ruby constant in support/env.rb) to the path of your Frankified target's iOS app bundle."
|
20
|
+
possible_app_bundles = locator.guess_possible_app_bundles_for_dir( Dir.pwd )
|
21
|
+
if possible_app_bundles && !possible_app_bundles.empty?
|
22
|
+
message << "\n\nBased on your current directory, you probably want to use one of the following paths for your APP_BUNDLE_PATH:\n"
|
23
|
+
message << possible_app_bundles.join("\n")
|
24
|
+
end
|
25
|
+
raise "\n\n"+("="*80)+"\n"+message+"\n"+("="*80)+"\n\n"
|
26
|
+
end
|
27
|
+
|
28
|
+
if app_path_problem = SimLauncher.check_app_path(app_path)
|
29
|
+
raise "\n\n"+("="*80)+"\n"+app_path_problem+"\n"+("="*80)+"\n\n"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def launch_app(app_path, sdk = nil, version = 'iphone')
|
34
|
+
@application_path = app_path
|
35
|
+
@sdk = sdk
|
36
|
+
@version = version
|
37
|
+
|
38
|
+
enforce(app_path)
|
39
|
+
|
40
|
+
# kill the app if it's already running, just in case this helps
|
41
|
+
# reduce simulator flakiness when relaunching the app. Use a timeout of 5 seconds to
|
42
|
+
# prevent us hanging around for ages waiting for the ping to fail if the app isn't running
|
43
|
+
begin
|
44
|
+
Timeout::timeout(5) { press_home_on_simulator if frankly_ping }
|
45
|
+
rescue Timeout::Error
|
46
|
+
end
|
47
|
+
|
48
|
+
if( ENV['USE_SIM_LAUNCHER_SERVER'] )
|
49
|
+
simulator = simulator_client
|
50
|
+
else
|
51
|
+
simulator = simulator_direct_client
|
52
|
+
end
|
53
|
+
|
54
|
+
num_timeouts = 0
|
55
|
+
begin
|
56
|
+
simulator.relaunch
|
57
|
+
wait_for_frank_to_come_up
|
58
|
+
rescue Timeout::Error
|
59
|
+
num_timeouts += 1
|
60
|
+
puts "Encountered #{num_timeouts} timeouts while launching the app."
|
61
|
+
if num_timeouts > 3
|
62
|
+
raise "Encountered #{num_timeouts} timeouts in a row while trying to launch the app."
|
63
|
+
end
|
64
|
+
quit_double_simulator
|
65
|
+
retry
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end end
|
@@ -0,0 +1,104 @@
|
|
1
|
+
en:
|
2
|
+
iphone_simulator: iPhone Simulator
|
3
|
+
iphone_simulator_reset: Reset
|
4
|
+
hardware: Hardware
|
5
|
+
home: Home
|
6
|
+
rotate_left: Rotate Left
|
7
|
+
rotate_right: Rotate Right
|
8
|
+
shake_gesture: Shake Gesture
|
9
|
+
simulate_memory_warning: Simulate Memory Warning
|
10
|
+
toggle_in_call_status_bar: Toggle In-Call Status Bar
|
11
|
+
simulate_hardware_keyboard: Simulate Hardware Keyboard
|
12
|
+
only_one_simulator: Only one iOS Simulator can run at a time.
|
13
|
+
|
14
|
+
fr:
|
15
|
+
iphone_simulator: Simulateur iOS
|
16
|
+
iphone_simulator_reset: Réinitialiser
|
17
|
+
hardware: Matériel
|
18
|
+
home: Écran d’accueil
|
19
|
+
rotate_left: Rotation à gauche
|
20
|
+
rotate_right: Rotation à droite
|
21
|
+
shake_gesture: Secousse
|
22
|
+
simulate_memory_warning: Simuler un avertissement de mémoire
|
23
|
+
toggle_in_call_status_bar: Afficher/Masquer la barre d'état d'appel en cour
|
24
|
+
simulate_hardware_keyboard: Simuler un clavier matériel
|
25
|
+
only_one_simulator: Un seul Simulateur iOS peut être exécuté à la fois.
|
26
|
+
|
27
|
+
de:
|
28
|
+
iphone_simulator: iOS-Simulator
|
29
|
+
iphone_simulator_reset: Zurücksetzen
|
30
|
+
hardware: Hardware
|
31
|
+
home: Home
|
32
|
+
rotate_left: Links drehen
|
33
|
+
rotate_right: Rechts drehen
|
34
|
+
shake_gesture: Schüttelgeste
|
35
|
+
simulate_memory_warning: Speicherwarnhinweis simulieren
|
36
|
+
toggle_in_call_status_bar: Status für eingeh. Anrufe ein/aus
|
37
|
+
simulate_hardware_keyboard: Hardware-Tastatur simulieren
|
38
|
+
only_one_simulator: Es kann jeweils nur eine iOS-Simulator-Instanz aktiv sein.
|
39
|
+
|
40
|
+
ru:
|
41
|
+
iphone_simulator: Симулятор iOS
|
42
|
+
iphone_simulator_reset: Сбросить
|
43
|
+
hardware: Аппаратура
|
44
|
+
home: Экран «Домой»
|
45
|
+
rotate_left: Повернуть влево
|
46
|
+
rotate_right: Повернуть вправо
|
47
|
+
shake_gesture: Выполнить жест встряхивания
|
48
|
+
simulate_memory_warning: Симулировать предупреждение о нехватке памяти
|
49
|
+
toggle_in_call_status_bar: Переключить на строку состояния поступающего вызова
|
50
|
+
simulate_hardware_keyboard: Симулировать физическую клавиатуру
|
51
|
+
only_one_simulator: Два и более Симуляторов iOS не могут быть запущены одновременно.
|
52
|
+
|
53
|
+
zh:
|
54
|
+
iphone_simulator: iOS 模拟器
|
55
|
+
iphone_simulator_reset: 还原
|
56
|
+
hardware: 硬件
|
57
|
+
home: 首页
|
58
|
+
rotate_left: 向左旋转
|
59
|
+
rotate_right: 向右旋转
|
60
|
+
shake_gesture: 摇动手势
|
61
|
+
simulate_memory_warning: 模拟内存警告
|
62
|
+
toggle_in_call_status_bar: 切换呼叫状态栏
|
63
|
+
simulate_hardware_keyboard: 模拟硬件键盘
|
64
|
+
only_one_simulator: 一次只能运行一个“iOS 模拟器”。
|
65
|
+
|
66
|
+
ja:
|
67
|
+
iphone_simulator: iOSシミュレータ
|
68
|
+
iphone_simulator_reset: リセット
|
69
|
+
hardware: ハードウェア
|
70
|
+
home: ホーム
|
71
|
+
rotate_left: 反時計回りに回転
|
72
|
+
rotate_right: 時計回りに回転
|
73
|
+
shake_gesture: シェイクジェスチャー
|
74
|
+
simulate_memory_warning: メモリ警告をシミュレート
|
75
|
+
toggle_in_call_status_bar: 着信ステータスバーを切り替える
|
76
|
+
simulate_hardware_keyboard: ハードウェアキーボードをシミュレート
|
77
|
+
only_one_simulator: 実行できるiOSシミュレータは1度に1つのみです。
|
78
|
+
|
79
|
+
es:
|
80
|
+
iphone_simulator: Simulador iOS
|
81
|
+
iphone_simulator_reset: Restablecer
|
82
|
+
hardware: Hardware
|
83
|
+
home: Inicio
|
84
|
+
rotate_left: Girar a la izquierda
|
85
|
+
rotate_right: Girar a la derecha
|
86
|
+
shake_gesture: Agitar
|
87
|
+
simulate_memory_warning: Simular aviso de memoria
|
88
|
+
toggle_in_call_status_bar: Activar/Desactivar barra de estado durante llamada
|
89
|
+
simulate_hardware_keyboard: Simular teclado físico
|
90
|
+
only_one_simulator: Sólo se puede ejecutar un Simulador iOS a la vez.
|
91
|
+
|
92
|
+
it:
|
93
|
+
iphone_simulator: Simulatore iOS
|
94
|
+
iphone_simulator_reset: Reimposta
|
95
|
+
hardware: Hardware
|
96
|
+
home: Home
|
97
|
+
rotate_left: Ruota a sinistra
|
98
|
+
rotate_right: Ruota a destra
|
99
|
+
shake_gesture: Gesto Agita
|
100
|
+
simulate_memory_warning: Simula avviso memoria
|
101
|
+
toggle_in_call_status_bar: Attiva/disattiva barra di state chiamata
|
102
|
+
simulate_hardware_keyboard: Simula la tastiera hardware
|
103
|
+
only_one_simulator: Solo un Simulatore iOS può essere eseguito in un momento.
|
104
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Frank
|
2
|
+
module Cucumber
|
3
|
+
module LocationHelper
|
4
|
+
# Ask Frank to set the location.
|
5
|
+
#
|
6
|
+
# @example
|
7
|
+
# # Set the location to Stockholm
|
8
|
+
# set_location(:latitude => 59.338887, :longitude => 18.058425)
|
9
|
+
#
|
10
|
+
def set_location(options = {})
|
11
|
+
res = frank_server.send_post(
|
12
|
+
'location',
|
13
|
+
:latitude => options[:latitude],
|
14
|
+
:longitude => options[:longitude]
|
15
|
+
)
|
16
|
+
Frank::Cucumber::Gateway.evaluate_frankly_response( res, "setting the location to #{options[:latitude]}, #{options[:longitude]}" )
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|