frank-pivotal 1.2.3.pre.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (136) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +4 -0
  3. data/Gemfile +4 -0
  4. data/Rakefile +38 -0
  5. data/bin/frank +6 -0
  6. data/bin/frank-skeleton +33 -0
  7. data/frank-pivotal.gemspec +37 -0
  8. data/frank-skeleton/features/my_first.feature +12 -0
  9. data/frank-skeleton/features/step_definitions/launch_steps.rb +20 -0
  10. data/frank-skeleton/features/support/env.rb +8 -0
  11. data/frank-skeleton/frank_static_resources.bundle/ViewAttributeMapping.plist +63 -0
  12. data/frank-skeleton/frank_static_resources.bundle/ViewAttributeMappingMac.plist +99 -0
  13. data/frank-skeleton/frank_static_resources.bundle/images/ajax-loader.gif +0 -0
  14. data/frank-skeleton/frank_static_resources.bundle/images/file.gif +0 -0
  15. data/frank-skeleton/frank_static_resources.bundle/images/folder-closed.gif +0 -0
  16. data/frank-skeleton/frank_static_resources.bundle/images/folder.gif +0 -0
  17. data/frank-skeleton/frank_static_resources.bundle/images/loader.gif +0 -0
  18. data/frank-skeleton/frank_static_resources.bundle/images/loader.png +0 -0
  19. data/frank-skeleton/frank_static_resources.bundle/images/minus.gif +0 -0
  20. data/frank-skeleton/frank_static_resources.bundle/images/plus.gif +0 -0
  21. data/frank-skeleton/frank_static_resources.bundle/images/treeview-black-line.gif +0 -0
  22. data/frank-skeleton/frank_static_resources.bundle/images/treeview-black.gif +0 -0
  23. data/frank-skeleton/frank_static_resources.bundle/images/treeview-default-line.gif +0 -0
  24. data/frank-skeleton/frank_static_resources.bundle/images/treeview-default.gif +0 -0
  25. data/frank-skeleton/frank_static_resources.bundle/images/treeview-famfamfam-line.gif +0 -0
  26. data/frank-skeleton/frank_static_resources.bundle/images/treeview-famfamfam.gif +0 -0
  27. data/frank-skeleton/frank_static_resources.bundle/images/treeview-gray-line.gif +0 -0
  28. data/frank-skeleton/frank_static_resources.bundle/images/treeview-gray.gif +0 -0
  29. data/frank-skeleton/frank_static_resources.bundle/images/treeview-red-line.gif +0 -0
  30. data/frank-skeleton/frank_static_resources.bundle/images/treeview-red.gif +0 -0
  31. data/frank-skeleton/frank_static_resources.bundle/index.html +86 -0
  32. data/frank-skeleton/frank_static_resources.bundle/index.html.haml +76 -0
  33. data/frank-skeleton/frank_static_resources.bundle/js/accessible_views_view.coffee +41 -0
  34. data/frank-skeleton/frank_static_resources.bundle/js/accessible_views_view.js +46 -0
  35. data/frank-skeleton/frank_static_resources.bundle/js/controller.coffee +134 -0
  36. data/frank-skeleton/frank_static_resources.bundle/js/controller.js +139 -0
  37. data/frank-skeleton/frank_static_resources.bundle/js/details_view.coffee +42 -0
  38. data/frank-skeleton/frank_static_resources.bundle/js/details_view.js +51 -0
  39. data/frank-skeleton/frank_static_resources.bundle/js/dropdown_control.coffee +64 -0
  40. data/frank-skeleton/frank_static_resources.bundle/js/dropdown_control.js +73 -0
  41. data/frank-skeleton/frank_static_resources.bundle/js/ersatz_model.coffee +46 -0
  42. data/frank-skeleton/frank_static_resources.bundle/js/ersatz_model.js +60 -0
  43. data/frank-skeleton/frank_static_resources.bundle/js/ersatz_view.coffee +167 -0
  44. data/frank-skeleton/frank_static_resources.bundle/js/ersatz_view.js +205 -0
  45. data/frank-skeleton/frank_static_resources.bundle/js/experiment_bar_model.coffee +10 -0
  46. data/frank-skeleton/frank_static_resources.bundle/js/experiment_bar_model.js +17 -0
  47. data/frank-skeleton/frank_static_resources.bundle/js/experiment_bar_view.coffee +44 -0
  48. data/frank-skeleton/frank_static_resources.bundle/js/experiment_bar_view.js +63 -0
  49. data/frank-skeleton/frank_static_resources.bundle/js/frank.coffee +96 -0
  50. data/frank-skeleton/frank_static_resources.bundle/js/frank.js +146 -0
  51. data/frank-skeleton/frank_static_resources.bundle/js/lib/backbone.js +1431 -0
  52. data/frank-skeleton/frank_static_resources.bundle/js/lib/coffee-script.js +8 -0
  53. data/frank-skeleton/frank_static_resources.bundle/js/lib/jquery-ui.min.js +405 -0
  54. data/frank-skeleton/frank_static_resources.bundle/js/lib/jquery.min.js +4 -0
  55. data/frank-skeleton/frank_static_resources.bundle/js/lib/jquery.treeview.js +251 -0
  56. data/frank-skeleton/frank_static_resources.bundle/js/lib/json2.js +481 -0
  57. data/frank-skeleton/frank_static_resources.bundle/js/lib/raphael.js +5815 -0
  58. data/frank-skeleton/frank_static_resources.bundle/js/lib/require.js +2053 -0
  59. data/frank-skeleton/frank_static_resources.bundle/js/lib/underscore.js +1059 -0
  60. data/frank-skeleton/frank_static_resources.bundle/js/main.coffee +27 -0
  61. data/frank-skeleton/frank_static_resources.bundle/js/main.js +29 -0
  62. data/frank-skeleton/frank_static_resources.bundle/js/tabs_controller.coffee +13 -0
  63. data/frank-skeleton/frank_static_resources.bundle/js/tabs_controller.js +22 -0
  64. data/frank-skeleton/frank_static_resources.bundle/js/toast_controller.coffee +15 -0
  65. data/frank-skeleton/frank_static_resources.bundle/js/toast_controller.js +28 -0
  66. data/frank-skeleton/frank_static_resources.bundle/js/transform_stack.coffee +59 -0
  67. data/frank-skeleton/frank_static_resources.bundle/js/transform_stack.js +78 -0
  68. data/frank-skeleton/frank_static_resources.bundle/js/tree_view.coffee +53 -0
  69. data/frank-skeleton/frank_static_resources.bundle/js/tree_view.js +64 -0
  70. data/frank-skeleton/frank_static_resources.bundle/js/view_hier_model.coffee +37 -0
  71. data/frank-skeleton/frank_static_resources.bundle/js/view_hier_model.js +48 -0
  72. data/frank-skeleton/frank_static_resources.bundle/js/view_model.coffee +39 -0
  73. data/frank-skeleton/frank_static_resources.bundle/js/view_model.js +62 -0
  74. data/frank-skeleton/frank_static_resources.bundle/pictos/index.html +329 -0
  75. data/frank-skeleton/frank_static_resources.bundle/pictos/pictos-web.eot +0 -0
  76. data/frank-skeleton/frank_static_resources.bundle/pictos/pictos-web.svg +114 -0
  77. data/frank-skeleton/frank_static_resources.bundle/pictos/pictos-web.ttf +0 -0
  78. data/frank-skeleton/frank_static_resources.bundle/pictos/pictos-web.woff +0 -0
  79. data/frank-skeleton/frank_static_resources.bundle/pictos/pictos.css +20 -0
  80. data/frank-skeleton/frank_static_resources.bundle/pictos/pictos_base64.css +18 -0
  81. data/frank-skeleton/frank_static_resources.bundle/stylesheets/css/symbiote.css +1 -0
  82. data/frank-skeleton/frank_static_resources.bundle/stylesheets/sass/_elements.scss +28 -0
  83. data/frank-skeleton/frank_static_resources.bundle/stylesheets/sass/_header.scss +61 -0
  84. data/frank-skeleton/frank_static_resources.bundle/stylesheets/sass/_inspect_tabs_list_tabs.scss +194 -0
  85. data/frank-skeleton/frank_static_resources.bundle/stylesheets/sass/_jquery.treeview.scss +68 -0
  86. data/frank-skeleton/frank_static_resources.bundle/stylesheets/sass/_jqui.scss +2 -0
  87. data/frank-skeleton/frank_static_resources.bundle/stylesheets/sass/_layout.scss +13 -0
  88. data/frank-skeleton/frank_static_resources.bundle/stylesheets/sass/_mixins.sass +137 -0
  89. data/frank-skeleton/frank_static_resources.bundle/stylesheets/sass/_reset.scss +32 -0
  90. data/frank-skeleton/frank_static_resources.bundle/stylesheets/sass/_selector_test_toolbar.scss +81 -0
  91. data/frank-skeleton/frank_static_resources.bundle/stylesheets/sass/_solarized.scss +16 -0
  92. data/frank-skeleton/frank_static_resources.bundle/stylesheets/sass/_typography.scss +11 -0
  93. data/frank-skeleton/frank_static_resources.bundle/stylesheets/sass/_unicode.scss +3 -0
  94. data/frank-skeleton/frank_static_resources.bundle/stylesheets/sass/_z_index.scss +2 -0
  95. data/frank-skeleton/frank_static_resources.bundle/stylesheets/sass/symbiote.scss +26 -0
  96. data/frank-skeleton/frankify.xcconfig.tt +6 -0
  97. data/frank-skeleton/libCocoaAsyncSocket.a +0 -0
  98. data/frank-skeleton/libCocoaAsyncSocketMac.a +0 -0
  99. data/frank-skeleton/libCocoaHTTPServer.a +0 -0
  100. data/frank-skeleton/libCocoaHTTPServerMac.a +0 -0
  101. data/frank-skeleton/libCocoaLumberjack.a +0 -0
  102. data/frank-skeleton/libCocoaLumberjackMac.a +0 -0
  103. data/frank-skeleton/libFrank.a +0 -0
  104. data/frank-skeleton/libFrankMac.a +0 -0
  105. data/frank-skeleton/libShelley.a +0 -0
  106. data/frank-skeleton/libShelleyMac.a +0 -0
  107. data/frank-skeleton/plugins/.empty_directory +0 -0
  108. data/lib/frank-pivotal/app_bundle_locator.rb +58 -0
  109. data/lib/frank-pivotal/bonjour.rb +78 -0
  110. data/lib/frank-pivotal/cli.rb +307 -0
  111. data/lib/frank-pivotal/color_helper.rb +13 -0
  112. data/lib/frank-pivotal/console.rb +28 -0
  113. data/lib/frank-pivotal/core_frank_steps.rb +264 -0
  114. data/lib/frank-pivotal/frank.xcconfig.erb +17 -0
  115. data/lib/frank-pivotal/frank_helper.rb +467 -0
  116. data/lib/frank-pivotal/frank_localize.rb +43 -0
  117. data/lib/frank-pivotal/frank_mac_helper.rb +120 -0
  118. data/lib/frank-pivotal/frankifier.rb +153 -0
  119. data/lib/frank-pivotal/gateway.rb +135 -0
  120. data/lib/frank-pivotal/gesture_helper.rb +99 -0
  121. data/lib/frank-pivotal/host_scripting.rb +102 -0
  122. data/lib/frank-pivotal/keyboard_helper.rb +69 -0
  123. data/lib/frank-pivotal/launcher.rb +118 -0
  124. data/lib/frank-pivotal/localize.yml +104 -0
  125. data/lib/frank-pivotal/location_helper.rb +20 -0
  126. data/lib/frank-pivotal/plugins/plugin.rb +57 -0
  127. data/lib/frank-pivotal/rect.rb +26 -0
  128. data/lib/frank-pivotal/scroll_helper.rb +24 -0
  129. data/lib/frank-pivotal/version.rb +5 -0
  130. data/lib/frank-pivotal/wait_helper.rb +57 -0
  131. data/lib/frank-pivotal.rb +14 -0
  132. data/test/keyboard_helper_test.rb +84 -0
  133. data/test/launcher_test.rb +57 -0
  134. data/test/rect_test.rb +25 -0
  135. data/test/test_helper.rb +16 -0
  136. metadata +367 -0
@@ -0,0 +1,104 @@
1
+ en:
2
+ iphone_simulator: iOS 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
@@ -0,0 +1,57 @@
1
+ require 'erb'
2
+
3
+ module Frank
4
+ module Plugins
5
+ class Plugin
6
+
7
+ attr_accessor :plugin_dir, :name, :exclude_dependencies
8
+
9
+ def initialize(plugin_dir, name)
10
+ self.plugin_dir= plugin_dir
11
+ self.name = name
12
+ end
13
+
14
+ def dependency(lib,linker_flag="-l#{lib}")
15
+ return linker_flag unless exclude_dependencies.include?(lib)
16
+ ''
17
+ end
18
+
19
+ def write_xcconfig(exclude_dependencies)
20
+ self.exclude_dependencies= exclude_dependencies
21
+
22
+ _xcconfig_erb = File.join(plugin_dir,"#{xcconfig}.erb")
23
+
24
+ unless File.exist?(_xcconfig_erb)
25
+ raise "Invalid plugin #{name} at #{File.join(plugin_dir)}.\nDoesn't have an erb file: #{_xcconfig_erb}"
26
+ end
27
+
28
+
29
+ _template = ERB.new(File.read(_xcconfig_erb))
30
+ result = _template.result(binding)
31
+ output_path = File.join(plugin_dir, xcconfig)
32
+ File.open(output_path,'w') {|f| f.write(result)}
33
+ output_path
34
+ end
35
+
36
+ def xcconfig
37
+ "#{name}.xcconfig"
38
+ end
39
+
40
+ def self.from_plugin_directory(path)
41
+ plugin_name = File.basename(path)
42
+ Plugin.new(path, plugin_name)
43
+ end
44
+
45
+ def self.generate_core_xcconfig(plugins)
46
+ _template = ERB.new(File.read(core_xcconfig_path))
47
+
48
+ _template.result(binding)
49
+ end
50
+
51
+ def self.core_xcconfig_path
52
+ File.expand_path(File.join(File.dirname(__FILE__), '..', 'frank.xcconfig.erb'))
53
+ end
54
+
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,26 @@
1
+ require "ostruct"
2
+
3
+ module Frank module Cucumber
4
+
5
+ class Rect
6
+ attr_reader :x, :y, :width, :height
7
+
8
+ def self.from_api_repr( hash )
9
+ x,y = hash["origin"]["x"], hash["origin"]["y"]
10
+ width,height = hash["size"]["width"],hash["size"]["height"]
11
+ self.new( x, y, width, height )
12
+ end
13
+
14
+ def initialize(x,y,width,height)
15
+ @x,@y,@width,@height = x,y,width,height
16
+ end
17
+
18
+ def center
19
+ OpenStruct.new(
20
+ :x => @x.to_f + (@width.to_f/2),
21
+ :y => @y.to_f + (@height.to_f/2)
22
+ )
23
+ end
24
+ end
25
+
26
+ end end
@@ -0,0 +1,24 @@
1
+ module Frank
2
+ module Cucumber
3
+
4
+ module ScrollHelper
5
+
6
+ def scroll_view_to_top( selector )
7
+ frankly_map( selector, "FEX_scrollToTop" )
8
+ end
9
+
10
+ def scroll_view_to_bottom( selector )
11
+ frankly_map( selector, "FEX_scrollToBottom" )
12
+ end
13
+
14
+ def scroll_view_to_position( selector, x, y )
15
+ frankly_map( selector, "FEX_setContentOffsetX:y:", x.to_i, y.to_i)
16
+ end
17
+
18
+ def scroll_table_view( selector, row, section = 0)
19
+ frankly_map(selector, "FEX_scrollToRow:inSection:", row.to_i, section.to_i)
20
+ end
21
+
22
+ end
23
+
24
+ end end
@@ -0,0 +1,5 @@
1
+ module Frank
2
+ module Cucumber
3
+ VERSION = "1.2.3-1"
4
+ end
5
+ end
@@ -0,0 +1,57 @@
1
+ require 'timeout'
2
+
3
+ module Frank
4
+ module Cucumber
5
+
6
+ # This module contains a single method called wait_until which implements the {http://sauceio.com/index.php/2011/04/how-to-lose-races-and-win-at-selenium/ Spin Assert} pattern.
7
+ #
8
+ # When we mix this module into another class or module (such as {FrankHelper}) then that wait_until method will be available inside
9
+ # that class or module. Because we call module_function at the end of the module this method is also available as a static method on the module.
10
+ # That means you can also call {Frank::Cucumber::WaitHelper.wait_until} from anywhere in your code.
11
+ #
12
+ module WaitHelper
13
+ # Default option for how long (in seconds) to keep checking before timing out the entire wait
14
+ TIMEOUT = (ENV['WAIT_TIMEOUT'] || 240).to_i
15
+ # How long to pause (in seconds) inbetween each spin through the assertion block
16
+ POLL_SLEEP = 0.1
17
+
18
+ # Repeatedly evaluate the passed in block until either it returns true or a timeout expires. Between
19
+ # evaluations there is a pause of {POLL_SLEEP} seconds.
20
+ #
21
+ # wait_until takes the following options:
22
+ # :timeout - How long in seconds to keep spinning before timing out of the entire operation. Defaults to TIMEOUT
23
+ # :message - What to raise in the event of a timeout. Defaults to an empty StandardError
24
+ #
25
+ # @yield the assertion to wait for
26
+ # @yieldreturn whether the assertion was met
27
+ #
28
+ #
29
+ # Here's an example where we will keep calling the reticulate_splines method until either it returns a result
30
+ # greater than 0 or 20 seconds elapses. In the timeout case an exception will be raised
31
+ # saying "timed out waiting for splines to reticulate":
32
+ #
33
+ # wait_until( :timeout => 20, :message => 'timed out waiting for splines to reticulate' ) do
34
+ # num_splines_reticulated = reticulate_splines(1,2,3)
35
+ # num_splines_reticulated > 0
36
+ # end
37
+ def wait_until(opts = {})
38
+ timeout = opts[:timeout] || TIMEOUT
39
+ message = opts[:message]
40
+
41
+ begin
42
+ Timeout::timeout(timeout) do
43
+ until yield
44
+ sleep POLL_SLEEP
45
+ end
46
+ end
47
+ rescue Timeout::Error => e
48
+ raise message if message
49
+ raise
50
+ end
51
+ end
52
+
53
+ module_function :wait_until
54
+ end
55
+
56
+ end
57
+ end
@@ -0,0 +1,14 @@
1
+ require 'frank-cucumber/rect'
2
+ require 'frank-cucumber/color_helper'
3
+ require 'frank-cucumber/frank_helper'
4
+ require 'frank-cucumber/frank_mac_helper'
5
+ require 'frank-cucumber/launcher'
6
+
7
+ World(Frank::Cucumber::ColorHelper)
8
+ World(Frank::Cucumber::FrankHelper)
9
+ World(Frank::Cucumber::FrankMacHelper)
10
+ World(Frank::Cucumber::Launcher)
11
+
12
+ AfterConfiguration do
13
+ require 'frank-cucumber/core_frank_steps'
14
+ end
@@ -0,0 +1,84 @@
1
+ require_relative 'test_helper.rb'
2
+
3
+ class HelperForTesting
4
+ include Frank::Cucumber::KeyboardHelper
5
+
6
+
7
+ def mock_frank_server
8
+ RR.mock(@mock_frank_server = Object.new)
9
+ end
10
+
11
+ private
12
+ def frank_server
13
+ @mock_frank_server
14
+ end
15
+ end
16
+
17
+ describe "frank keyboard helper" do
18
+
19
+ the_helper = nil
20
+ before do
21
+ the_helper = HelperForTesting.new
22
+ end
23
+
24
+ def successful_response
25
+ %Q{ { "outcome": "SUCCESS" } }
26
+ end
27
+
28
+ it 'posts to the right endpoint' do
29
+ the_helper.mock_frank_server.send_post('type_into_keyboard', anything ){ successful_response }
30
+
31
+ the_helper.type_into_keyboard('blah')
32
+ end
33
+
34
+ it 'sends the right payload, adding a trailing new-line if needed' do
35
+ the_helper.mock_frank_server.send_post.with_any_args do |endpoint,payload|
36
+ payload.must_equal( {:text_to_type => "the text I want to type\n"} )
37
+
38
+ successful_response
39
+ end
40
+
41
+ the_helper.type_into_keyboard('the text I want to type')
42
+ end
43
+
44
+ it "doesn't add a trailing newline if already there" do
45
+ the_helper.mock_frank_server.send_post.with_any_args do |endpoint,payload|
46
+ payload.must_equal( {:text_to_type => "existing newline\n"} )
47
+
48
+ successful_response
49
+ end
50
+
51
+ the_helper.type_into_keyboard("existing newline\n")
52
+ end
53
+
54
+ it "doesn't add a trailing newline if asked explicitly not to" do
55
+ the_helper.mock_frank_server.send_post.with_any_args do |endpoint,payload|
56
+ payload.must_equal( {:text_to_type => "text without newline"} )
57
+
58
+ successful_response
59
+ end
60
+
61
+ the_helper.type_into_keyboard("text without newline", :append_return => false)
62
+ end
63
+
64
+ it 'raises an exception if the server responds negatively' do
65
+ failure_message = <<-EOS
66
+ {
67
+ "outcome": "NOT SUCCESS AT ALL",
68
+ "reason": "reason for failure",
69
+ "details": "details about failure"
70
+ }
71
+ EOS
72
+
73
+ the_helper.mock_frank_server.send_post.with_any_args{ failure_message }
74
+
75
+ exception = lambda{
76
+ the_helper.type_into_keyboard('text we attempted to type')
77
+ }.must_raise RuntimeError
78
+
79
+ exception.message.must_match /text we attempted to type/
80
+ exception.message.must_match /reason for failure/
81
+ exception.message.must_match /details about failure/
82
+ end
83
+
84
+ end
@@ -0,0 +1,57 @@
1
+ require_relative 'test_helper.rb'
2
+
3
+ include Frank::Cucumber::Launcher
4
+ include Frank::Cucumber::FrankHelper
5
+
6
+ def wait_for_frank_to_come_up
7
+ # orig FrankHelper::wait_for_frank_to_come_up
8
+ # doing nothing
9
+ end
10
+
11
+ describe "frank cucumber launcher" do
12
+ DUMMY_APP_PATH = '/tmp/dummy_app_path'
13
+
14
+ before do
15
+ `mkdir -p #{DUMMY_APP_PATH}`
16
+ end
17
+
18
+ describe "when the path is wrong" do
19
+
20
+ it 'throws exception when no app path is given' do
21
+ assert_raises(RuntimeError) do
22
+ enforce(nil)
23
+ end
24
+ end
25
+
26
+ it 'prints suggestions if available' do
27
+ mock_locator = Mock.new
28
+ mock_locator.expect :guess_possible_app_bundles_for_dir, ['suggestion_1'], ['']
29
+ begin
30
+ enforce(nil, mock_locator)
31
+ rescue RuntimeError => e
32
+ e.message.must_match "suggestion_1"
33
+ end
34
+ end
35
+
36
+ it "throws exception when app path doesn't exist" do
37
+ assert_raises(RuntimeError) do
38
+ enforce('/foo/bar/baz/not/a/real/path')
39
+ end
40
+ end
41
+ end
42
+
43
+ describe "when starting the simulator with the specified params" do
44
+
45
+ before do
46
+ @simulator_direct_client = Mock.new
47
+ @simulator_direct_client.expect :relaunch, nil, []
48
+ end
49
+
50
+ it 'selects iphone mode by default' do
51
+ launch_app(DUMMY_APP_PATH, 'X.Y')
52
+ @version.must_equal 'iphone'
53
+ end
54
+
55
+ end
56
+
57
+ end
data/test/rect_test.rb ADDED
@@ -0,0 +1,25 @@
1
+ require_relative 'test_helper.rb'
2
+
3
+ require_relative '../lib/frank-cucumber/rect'
4
+
5
+ module Frank module Cucumber
6
+
7
+ describe Rect do
8
+ it 'parsing from the api hash representation correctly' do
9
+ api_repr = { "origin" => {"x" => 1.1, "y" => 2.2}, "size" => { "height" => 11.1, "width" => 22.2 } }
10
+ rect = Rect.from_api_repr( api_repr )
11
+
12
+ rect.x.must_equal 1.1
13
+ rect.y.must_equal 2.2
14
+ rect.width.must_equal 22.2
15
+ rect.height.must_equal 11.1
16
+ end
17
+
18
+ it 'calculates the center correctly' do
19
+ rect = Rect.new( 100, 200, 11, 21 )
20
+ rect.center.x.must_equal 105.5
21
+ rect.center.y.must_equal 210.5
22
+ end
23
+ end
24
+
25
+ end end
@@ -0,0 +1,16 @@
1
+ require 'ostruct'
2
+ require 'stringio'
3
+ require 'minitest/autorun'
4
+ require 'minitest/mock'
5
+ require 'minitest/spec'
6
+ include MiniTest
7
+
8
+ require 'rr'
9
+ class MiniTest::Unit::TestCase
10
+ include RR::Adapters::MiniTest
11
+ end
12
+
13
+ require_relative '../lib/frank-cucumber/color_helper'
14
+ require_relative '../lib/frank-cucumber/frank_helper'
15
+ require_relative '../lib/frank-cucumber/launcher'
16
+