sc-frank-cucumber 1.2.1.00af28c

Sign up to get free protection for your applications and to get access to all the features.
Files changed (136) hide show
  1. data/.gitignore +4 -0
  2. data/Gemfile +4 -0
  3. data/Rakefile +38 -0
  4. data/bin/frank +6 -0
  5. data/bin/frank-skeleton +33 -0
  6. data/frank-skeleton/features/my_first.feature +12 -0
  7. data/frank-skeleton/features/step_definitions/launch_steps.rb +20 -0
  8. data/frank-skeleton/features/support/env.rb +8 -0
  9. data/frank-skeleton/frank_static_resources.bundle/ViewAttributeMapping.plist +63 -0
  10. data/frank-skeleton/frank_static_resources.bundle/ViewAttributeMappingMac.plist +99 -0
  11. data/frank-skeleton/frank_static_resources.bundle/images/ajax-loader.gif +0 -0
  12. data/frank-skeleton/frank_static_resources.bundle/images/file.gif +0 -0
  13. data/frank-skeleton/frank_static_resources.bundle/images/folder-closed.gif +0 -0
  14. data/frank-skeleton/frank_static_resources.bundle/images/folder.gif +0 -0
  15. data/frank-skeleton/frank_static_resources.bundle/images/loader.gif +0 -0
  16. data/frank-skeleton/frank_static_resources.bundle/images/loader.png +0 -0
  17. data/frank-skeleton/frank_static_resources.bundle/images/minus.gif +0 -0
  18. data/frank-skeleton/frank_static_resources.bundle/images/plus.gif +0 -0
  19. data/frank-skeleton/frank_static_resources.bundle/images/treeview-black-line.gif +0 -0
  20. data/frank-skeleton/frank_static_resources.bundle/images/treeview-black.gif +0 -0
  21. data/frank-skeleton/frank_static_resources.bundle/images/treeview-default-line.gif +0 -0
  22. data/frank-skeleton/frank_static_resources.bundle/images/treeview-default.gif +0 -0
  23. data/frank-skeleton/frank_static_resources.bundle/images/treeview-famfamfam-line.gif +0 -0
  24. data/frank-skeleton/frank_static_resources.bundle/images/treeview-famfamfam.gif +0 -0
  25. data/frank-skeleton/frank_static_resources.bundle/images/treeview-gray-line.gif +0 -0
  26. data/frank-skeleton/frank_static_resources.bundle/images/treeview-gray.gif +0 -0
  27. data/frank-skeleton/frank_static_resources.bundle/images/treeview-red-line.gif +0 -0
  28. data/frank-skeleton/frank_static_resources.bundle/images/treeview-red.gif +0 -0
  29. data/frank-skeleton/frank_static_resources.bundle/index.html +86 -0
  30. data/frank-skeleton/frank_static_resources.bundle/index.html.haml +76 -0
  31. data/frank-skeleton/frank_static_resources.bundle/js/accessible_views_view.coffee +41 -0
  32. data/frank-skeleton/frank_static_resources.bundle/js/accessible_views_view.js +46 -0
  33. data/frank-skeleton/frank_static_resources.bundle/js/controller.coffee +134 -0
  34. data/frank-skeleton/frank_static_resources.bundle/js/controller.js +139 -0
  35. data/frank-skeleton/frank_static_resources.bundle/js/details_view.coffee +42 -0
  36. data/frank-skeleton/frank_static_resources.bundle/js/details_view.js +51 -0
  37. data/frank-skeleton/frank_static_resources.bundle/js/dropdown_control.coffee +64 -0
  38. data/frank-skeleton/frank_static_resources.bundle/js/dropdown_control.js +73 -0
  39. data/frank-skeleton/frank_static_resources.bundle/js/ersatz_model.coffee +46 -0
  40. data/frank-skeleton/frank_static_resources.bundle/js/ersatz_model.js +60 -0
  41. data/frank-skeleton/frank_static_resources.bundle/js/ersatz_view.coffee +167 -0
  42. data/frank-skeleton/frank_static_resources.bundle/js/ersatz_view.js +205 -0
  43. data/frank-skeleton/frank_static_resources.bundle/js/experiment_bar_model.coffee +10 -0
  44. data/frank-skeleton/frank_static_resources.bundle/js/experiment_bar_model.js +17 -0
  45. data/frank-skeleton/frank_static_resources.bundle/js/experiment_bar_view.coffee +44 -0
  46. data/frank-skeleton/frank_static_resources.bundle/js/experiment_bar_view.js +63 -0
  47. data/frank-skeleton/frank_static_resources.bundle/js/frank.coffee +96 -0
  48. data/frank-skeleton/frank_static_resources.bundle/js/frank.js +146 -0
  49. data/frank-skeleton/frank_static_resources.bundle/js/lib/backbone.js +1431 -0
  50. data/frank-skeleton/frank_static_resources.bundle/js/lib/coffee-script.js +8 -0
  51. data/frank-skeleton/frank_static_resources.bundle/js/lib/jquery-ui.min.js +405 -0
  52. data/frank-skeleton/frank_static_resources.bundle/js/lib/jquery.min.js +4 -0
  53. data/frank-skeleton/frank_static_resources.bundle/js/lib/jquery.treeview.js +251 -0
  54. data/frank-skeleton/frank_static_resources.bundle/js/lib/json2.js +481 -0
  55. data/frank-skeleton/frank_static_resources.bundle/js/lib/raphael.js +5815 -0
  56. data/frank-skeleton/frank_static_resources.bundle/js/lib/require.js +2053 -0
  57. data/frank-skeleton/frank_static_resources.bundle/js/lib/underscore.js +1059 -0
  58. data/frank-skeleton/frank_static_resources.bundle/js/main.coffee +27 -0
  59. data/frank-skeleton/frank_static_resources.bundle/js/main.js +29 -0
  60. data/frank-skeleton/frank_static_resources.bundle/js/tabs_controller.coffee +13 -0
  61. data/frank-skeleton/frank_static_resources.bundle/js/tabs_controller.js +22 -0
  62. data/frank-skeleton/frank_static_resources.bundle/js/toast_controller.coffee +15 -0
  63. data/frank-skeleton/frank_static_resources.bundle/js/toast_controller.js +28 -0
  64. data/frank-skeleton/frank_static_resources.bundle/js/transform_stack.coffee +59 -0
  65. data/frank-skeleton/frank_static_resources.bundle/js/transform_stack.js +78 -0
  66. data/frank-skeleton/frank_static_resources.bundle/js/tree_view.coffee +53 -0
  67. data/frank-skeleton/frank_static_resources.bundle/js/tree_view.js +64 -0
  68. data/frank-skeleton/frank_static_resources.bundle/js/view_hier_model.coffee +37 -0
  69. data/frank-skeleton/frank_static_resources.bundle/js/view_hier_model.js +48 -0
  70. data/frank-skeleton/frank_static_resources.bundle/js/view_model.coffee +39 -0
  71. data/frank-skeleton/frank_static_resources.bundle/js/view_model.js +62 -0
  72. data/frank-skeleton/frank_static_resources.bundle/pictos/index.html +329 -0
  73. data/frank-skeleton/frank_static_resources.bundle/pictos/pictos-web.eot +0 -0
  74. data/frank-skeleton/frank_static_resources.bundle/pictos/pictos-web.svg +114 -0
  75. data/frank-skeleton/frank_static_resources.bundle/pictos/pictos-web.ttf +0 -0
  76. data/frank-skeleton/frank_static_resources.bundle/pictos/pictos-web.woff +0 -0
  77. data/frank-skeleton/frank_static_resources.bundle/pictos/pictos.css +20 -0
  78. data/frank-skeleton/frank_static_resources.bundle/pictos/pictos_base64.css +18 -0
  79. data/frank-skeleton/frank_static_resources.bundle/stylesheets/css/symbiote.css +1 -0
  80. data/frank-skeleton/frank_static_resources.bundle/stylesheets/sass/_elements.scss +28 -0
  81. data/frank-skeleton/frank_static_resources.bundle/stylesheets/sass/_header.scss +61 -0
  82. data/frank-skeleton/frank_static_resources.bundle/stylesheets/sass/_inspect_tabs_list_tabs.scss +194 -0
  83. data/frank-skeleton/frank_static_resources.bundle/stylesheets/sass/_jquery.treeview.scss +68 -0
  84. data/frank-skeleton/frank_static_resources.bundle/stylesheets/sass/_jqui.scss +2 -0
  85. data/frank-skeleton/frank_static_resources.bundle/stylesheets/sass/_layout.scss +13 -0
  86. data/frank-skeleton/frank_static_resources.bundle/stylesheets/sass/_mixins.sass +137 -0
  87. data/frank-skeleton/frank_static_resources.bundle/stylesheets/sass/_reset.scss +32 -0
  88. data/frank-skeleton/frank_static_resources.bundle/stylesheets/sass/_selector_test_toolbar.scss +81 -0
  89. data/frank-skeleton/frank_static_resources.bundle/stylesheets/sass/_solarized.scss +16 -0
  90. data/frank-skeleton/frank_static_resources.bundle/stylesheets/sass/_typography.scss +11 -0
  91. data/frank-skeleton/frank_static_resources.bundle/stylesheets/sass/_unicode.scss +3 -0
  92. data/frank-skeleton/frank_static_resources.bundle/stylesheets/sass/_z_index.scss +2 -0
  93. data/frank-skeleton/frank_static_resources.bundle/stylesheets/sass/symbiote.scss +26 -0
  94. data/frank-skeleton/frankify.xcconfig.tt +6 -0
  95. data/frank-skeleton/libCocoaAsyncSocket.a +0 -0
  96. data/frank-skeleton/libCocoaAsyncSocketMac.a +0 -0
  97. data/frank-skeleton/libCocoaHTTPServer.a +0 -0
  98. data/frank-skeleton/libCocoaHTTPServerMac.a +0 -0
  99. data/frank-skeleton/libCocoaLumberjack.a +0 -0
  100. data/frank-skeleton/libCocoaLumberjackMac.a +0 -0
  101. data/frank-skeleton/libFrank.a +0 -0
  102. data/frank-skeleton/libFrankMac.a +0 -0
  103. data/frank-skeleton/libShelley.a +0 -0
  104. data/frank-skeleton/libShelleyMac.a +0 -0
  105. data/frank-skeleton/plugins/.empty_directory +0 -0
  106. data/lib/frank-cucumber.rb +15 -0
  107. data/lib/frank-cucumber/app_bundle_locator.rb +58 -0
  108. data/lib/frank-cucumber/bonjour.rb +73 -0
  109. data/lib/frank-cucumber/cli.rb +299 -0
  110. data/lib/frank-cucumber/color_helper.rb +13 -0
  111. data/lib/frank-cucumber/console.rb +28 -0
  112. data/lib/frank-cucumber/core_frank_steps.rb +260 -0
  113. data/lib/frank-cucumber/frank.xcconfig.erb +17 -0
  114. data/lib/frank-cucumber/frank_helper.rb +459 -0
  115. data/lib/frank-cucumber/frank_localize.rb +43 -0
  116. data/lib/frank-cucumber/frank_mac_helper.rb +120 -0
  117. data/lib/frank-cucumber/frankifier.rb +150 -0
  118. data/lib/frank-cucumber/gateway.rb +135 -0
  119. data/lib/frank-cucumber/gesture_helper.rb +99 -0
  120. data/lib/frank-cucumber/host_scripting.rb +96 -0
  121. data/lib/frank-cucumber/keyboard_helper.rb +69 -0
  122. data/lib/frank-cucumber/launcher.rb +70 -0
  123. data/lib/frank-cucumber/localize.yml +104 -0
  124. data/lib/frank-cucumber/location_helper.rb +20 -0
  125. data/lib/frank-cucumber/mac_launcher.rb +35 -0
  126. data/lib/frank-cucumber/plugins/plugin.rb +57 -0
  127. data/lib/frank-cucumber/rect.rb +26 -0
  128. data/lib/frank-cucumber/scroll_helper.rb +24 -0
  129. data/lib/frank-cucumber/version.rb +5 -0
  130. data/lib/frank-cucumber/wait_helper.rb +57 -0
  131. data/sc-frank-cucumber.gemspec +37 -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 +395 -0
@@ -0,0 +1,35 @@
1
+ require "timeout"
2
+
3
+ module Frank
4
+ class MacLauncher
5
+
6
+ def initialize(app_path)
7
+ @app_path = app_path
8
+ end
9
+
10
+ def launch
11
+ `open "#{@app_path}"`
12
+ end
13
+
14
+ def quit_if_running
15
+ pid = `ps -ax | grep "#{@app_path}" | grep -v grep`
16
+
17
+ if pid != ""
18
+ pid = pid.strip.split[0]
19
+ `kill #{pid}`
20
+ end
21
+
22
+ Timeout::timeout(60) {
23
+ while pid != ""
24
+ pid = `ps -ax | grep "#{@app_path}" | grep -v grep`
25
+ end
26
+ }
27
+
28
+ end
29
+
30
+ def relaunch
31
+ self.quit_if_running
32
+ self.launch
33
+ end
34
+ end
35
+ 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.1.00af28c"
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,37 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "frank-cucumber/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "sc-frank-cucumber"
7
+ s.version = Frank::Cucumber::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Pete Hodgson","Derek Longmuir"]
10
+ s.email = ["gems@thepete.net"]
11
+ s.homepage = "http://rubygems.org/gems/frank-cucumber"
12
+ s.summary = %q{Use cucumber to test native iOS apps via Frank}
13
+ s.description = %q{Use cucumber to test native iOS apps via Frank}
14
+
15
+ git_files = `git ls-files`.split("\n")
16
+ symbiote_files = Dir[File.join('frank-skeleton','frank_static_resources.bundle','**','*')]
17
+ s.files = git_files+symbiote_files
18
+ #puts s.files.join("\n")
19
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
20
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
21
+ s.require_paths = ["lib"]
22
+
23
+ s.add_dependency( "cucumber" )
24
+ s.add_dependency( "rspec", [">=2.0"] )
25
+ s.add_dependency( "sim_launcher", [">=0.4.6"] )
26
+ s.add_dependency( "i18n" )
27
+ s.add_dependency( "plist" )
28
+ s.add_dependency( "json" ) # TODO: figure out how to be more permissive as to which JSON gems we allow
29
+ s.add_dependency( "dnssd" )
30
+ s.add_dependency( "thor" )
31
+ s.add_dependency( "xcodeproj", [">=0.5.3"] )
32
+
33
+ s.add_development_dependency( "rr" )
34
+ s.add_development_dependency( "yard" )
35
+ s.add_development_dependency( "pry" )
36
+ s.add_development_dependency( "pry-debugger" )
37
+ 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
+
metadata ADDED
@@ -0,0 +1,395 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sc-frank-cucumber
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.2.1.00af28c
5
+ prerelease: 8
6
+ platform: ruby
7
+ authors:
8
+ - Pete Hodgson
9
+ - Derek Longmuir
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2013-10-30 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: cucumber
17
+ requirement: !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: '0'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ! '>='
29
+ - !ruby/object:Gem::Version
30
+ version: '0'
31
+ - !ruby/object:Gem::Dependency
32
+ name: rspec
33
+ requirement: !ruby/object:Gem::Requirement
34
+ none: false
35
+ requirements:
36
+ - - ! '>='
37
+ - !ruby/object:Gem::Version
38
+ version: '2.0'
39
+ type: :runtime
40
+ prerelease: false
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '2.0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: sim_launcher
49
+ requirement: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: 0.4.6
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: 0.4.6
63
+ - !ruby/object:Gem::Dependency
64
+ name: i18n
65
+ requirement: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ! '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ type: :runtime
72
+ prerelease: false
73
+ version_requirements: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ! '>='
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ - !ruby/object:Gem::Dependency
80
+ name: plist
81
+ requirement: !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
84
+ - - ! '>='
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ type: :runtime
88
+ prerelease: false
89
+ version_requirements: !ruby/object:Gem::Requirement
90
+ none: false
91
+ requirements:
92
+ - - ! '>='
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ - !ruby/object:Gem::Dependency
96
+ name: json
97
+ requirement: !ruby/object:Gem::Requirement
98
+ none: false
99
+ requirements:
100
+ - - ! '>='
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ type: :runtime
104
+ prerelease: false
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ none: false
107
+ requirements:
108
+ - - ! '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: dnssd
113
+ requirement: !ruby/object:Gem::Requirement
114
+ none: false
115
+ requirements:
116
+ - - ! '>='
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ type: :runtime
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ none: false
123
+ requirements:
124
+ - - ! '>='
125
+ - !ruby/object:Gem::Version
126
+ version: '0'
127
+ - !ruby/object:Gem::Dependency
128
+ name: thor
129
+ requirement: !ruby/object:Gem::Requirement
130
+ none: false
131
+ requirements:
132
+ - - ! '>='
133
+ - !ruby/object:Gem::Version
134
+ version: '0'
135
+ type: :runtime
136
+ prerelease: false
137
+ version_requirements: !ruby/object:Gem::Requirement
138
+ none: false
139
+ requirements:
140
+ - - ! '>='
141
+ - !ruby/object:Gem::Version
142
+ version: '0'
143
+ - !ruby/object:Gem::Dependency
144
+ name: xcodeproj
145
+ requirement: !ruby/object:Gem::Requirement
146
+ none: false
147
+ requirements:
148
+ - - ! '>='
149
+ - !ruby/object:Gem::Version
150
+ version: 0.5.3
151
+ type: :runtime
152
+ prerelease: false
153
+ version_requirements: !ruby/object:Gem::Requirement
154
+ none: false
155
+ requirements:
156
+ - - ! '>='
157
+ - !ruby/object:Gem::Version
158
+ version: 0.5.3
159
+ - !ruby/object:Gem::Dependency
160
+ name: rr
161
+ requirement: !ruby/object:Gem::Requirement
162
+ none: false
163
+ requirements:
164
+ - - ! '>='
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ type: :development
168
+ prerelease: false
169
+ version_requirements: !ruby/object:Gem::Requirement
170
+ none: false
171
+ requirements:
172
+ - - ! '>='
173
+ - !ruby/object:Gem::Version
174
+ version: '0'
175
+ - !ruby/object:Gem::Dependency
176
+ name: yard
177
+ requirement: !ruby/object:Gem::Requirement
178
+ none: false
179
+ requirements:
180
+ - - ! '>='
181
+ - !ruby/object:Gem::Version
182
+ version: '0'
183
+ type: :development
184
+ prerelease: false
185
+ version_requirements: !ruby/object:Gem::Requirement
186
+ none: false
187
+ requirements:
188
+ - - ! '>='
189
+ - !ruby/object:Gem::Version
190
+ version: '0'
191
+ - !ruby/object:Gem::Dependency
192
+ name: pry
193
+ requirement: !ruby/object:Gem::Requirement
194
+ none: false
195
+ requirements:
196
+ - - ! '>='
197
+ - !ruby/object:Gem::Version
198
+ version: '0'
199
+ type: :development
200
+ prerelease: false
201
+ version_requirements: !ruby/object:Gem::Requirement
202
+ none: false
203
+ requirements:
204
+ - - ! '>='
205
+ - !ruby/object:Gem::Version
206
+ version: '0'
207
+ - !ruby/object:Gem::Dependency
208
+ name: pry-debugger
209
+ requirement: !ruby/object:Gem::Requirement
210
+ none: false
211
+ requirements:
212
+ - - ! '>='
213
+ - !ruby/object:Gem::Version
214
+ version: '0'
215
+ type: :development
216
+ prerelease: false
217
+ version_requirements: !ruby/object:Gem::Requirement
218
+ none: false
219
+ requirements:
220
+ - - ! '>='
221
+ - !ruby/object:Gem::Version
222
+ version: '0'
223
+ description: Use cucumber to test native iOS apps via Frank
224
+ email:
225
+ - gems@thepete.net
226
+ executables:
227
+ - frank
228
+ - frank-skeleton
229
+ extensions: []
230
+ extra_rdoc_files: []
231
+ files:
232
+ - .gitignore
233
+ - Gemfile
234
+ - Rakefile
235
+ - bin/frank
236
+ - bin/frank-skeleton
237
+ - frank-skeleton/features/my_first.feature
238
+ - frank-skeleton/features/step_definitions/launch_steps.rb
239
+ - frank-skeleton/features/support/env.rb
240
+ - frank-skeleton/frankify.xcconfig.tt
241
+ - frank-skeleton/libCocoaAsyncSocket.a
242
+ - frank-skeleton/libCocoaAsyncSocketMac.a
243
+ - frank-skeleton/libCocoaHTTPServer.a
244
+ - frank-skeleton/libCocoaHTTPServerMac.a
245
+ - frank-skeleton/libCocoaLumberjack.a
246
+ - frank-skeleton/libCocoaLumberjackMac.a
247
+ - frank-skeleton/libFrank.a
248
+ - frank-skeleton/libFrankMac.a
249
+ - frank-skeleton/libShelley.a
250
+ - frank-skeleton/libShelleyMac.a
251
+ - frank-skeleton/plugins/.empty_directory
252
+ - lib/frank-cucumber.rb
253
+ - lib/frank-cucumber/app_bundle_locator.rb
254
+ - lib/frank-cucumber/bonjour.rb
255
+ - lib/frank-cucumber/cli.rb
256
+ - lib/frank-cucumber/color_helper.rb
257
+ - lib/frank-cucumber/console.rb
258
+ - lib/frank-cucumber/core_frank_steps.rb
259
+ - lib/frank-cucumber/frank.xcconfig.erb
260
+ - lib/frank-cucumber/frank_helper.rb
261
+ - lib/frank-cucumber/frank_localize.rb
262
+ - lib/frank-cucumber/frank_mac_helper.rb
263
+ - lib/frank-cucumber/frankifier.rb
264
+ - lib/frank-cucumber/gateway.rb
265
+ - lib/frank-cucumber/gesture_helper.rb
266
+ - lib/frank-cucumber/host_scripting.rb
267
+ - lib/frank-cucumber/keyboard_helper.rb
268
+ - lib/frank-cucumber/launcher.rb
269
+ - lib/frank-cucumber/localize.yml
270
+ - lib/frank-cucumber/location_helper.rb
271
+ - lib/frank-cucumber/mac_launcher.rb
272
+ - lib/frank-cucumber/plugins/plugin.rb
273
+ - lib/frank-cucumber/rect.rb
274
+ - lib/frank-cucumber/scroll_helper.rb
275
+ - lib/frank-cucumber/version.rb
276
+ - lib/frank-cucumber/wait_helper.rb
277
+ - sc-frank-cucumber.gemspec
278
+ - test/keyboard_helper_test.rb
279
+ - test/launcher_test.rb
280
+ - test/rect_test.rb
281
+ - test/test_helper.rb
282
+ - frank-skeleton/frank_static_resources.bundle/images/ajax-loader.gif
283
+ - frank-skeleton/frank_static_resources.bundle/images/file.gif
284
+ - frank-skeleton/frank_static_resources.bundle/images/folder-closed.gif
285
+ - frank-skeleton/frank_static_resources.bundle/images/folder.gif
286
+ - frank-skeleton/frank_static_resources.bundle/images/loader.gif
287
+ - frank-skeleton/frank_static_resources.bundle/images/loader.png
288
+ - frank-skeleton/frank_static_resources.bundle/images/minus.gif
289
+ - frank-skeleton/frank_static_resources.bundle/images/plus.gif
290
+ - frank-skeleton/frank_static_resources.bundle/images/treeview-black-line.gif
291
+ - frank-skeleton/frank_static_resources.bundle/images/treeview-black.gif
292
+ - frank-skeleton/frank_static_resources.bundle/images/treeview-default-line.gif
293
+ - frank-skeleton/frank_static_resources.bundle/images/treeview-default.gif
294
+ - frank-skeleton/frank_static_resources.bundle/images/treeview-famfamfam-line.gif
295
+ - frank-skeleton/frank_static_resources.bundle/images/treeview-famfamfam.gif
296
+ - frank-skeleton/frank_static_resources.bundle/images/treeview-gray-line.gif
297
+ - frank-skeleton/frank_static_resources.bundle/images/treeview-gray.gif
298
+ - frank-skeleton/frank_static_resources.bundle/images/treeview-red-line.gif
299
+ - frank-skeleton/frank_static_resources.bundle/images/treeview-red.gif
300
+ - frank-skeleton/frank_static_resources.bundle/index.html
301
+ - frank-skeleton/frank_static_resources.bundle/index.html.haml
302
+ - frank-skeleton/frank_static_resources.bundle/js/accessible_views_view.coffee
303
+ - frank-skeleton/frank_static_resources.bundle/js/accessible_views_view.js
304
+ - frank-skeleton/frank_static_resources.bundle/js/controller.coffee
305
+ - frank-skeleton/frank_static_resources.bundle/js/controller.js
306
+ - frank-skeleton/frank_static_resources.bundle/js/details_view.coffee
307
+ - frank-skeleton/frank_static_resources.bundle/js/details_view.js
308
+ - frank-skeleton/frank_static_resources.bundle/js/dropdown_control.coffee
309
+ - frank-skeleton/frank_static_resources.bundle/js/dropdown_control.js
310
+ - frank-skeleton/frank_static_resources.bundle/js/ersatz_model.coffee
311
+ - frank-skeleton/frank_static_resources.bundle/js/ersatz_model.js
312
+ - frank-skeleton/frank_static_resources.bundle/js/ersatz_view.coffee
313
+ - frank-skeleton/frank_static_resources.bundle/js/ersatz_view.js
314
+ - frank-skeleton/frank_static_resources.bundle/js/experiment_bar_model.coffee
315
+ - frank-skeleton/frank_static_resources.bundle/js/experiment_bar_model.js
316
+ - frank-skeleton/frank_static_resources.bundle/js/experiment_bar_view.coffee
317
+ - frank-skeleton/frank_static_resources.bundle/js/experiment_bar_view.js
318
+ - frank-skeleton/frank_static_resources.bundle/js/frank.coffee
319
+ - frank-skeleton/frank_static_resources.bundle/js/frank.js
320
+ - frank-skeleton/frank_static_resources.bundle/js/lib/backbone.js
321
+ - frank-skeleton/frank_static_resources.bundle/js/lib/coffee-script.js
322
+ - frank-skeleton/frank_static_resources.bundle/js/lib/jquery-ui.min.js
323
+ - frank-skeleton/frank_static_resources.bundle/js/lib/jquery.min.js
324
+ - frank-skeleton/frank_static_resources.bundle/js/lib/jquery.treeview.js
325
+ - frank-skeleton/frank_static_resources.bundle/js/lib/json2.js
326
+ - frank-skeleton/frank_static_resources.bundle/js/lib/raphael.js
327
+ - frank-skeleton/frank_static_resources.bundle/js/lib/require.js
328
+ - frank-skeleton/frank_static_resources.bundle/js/lib/underscore.js
329
+ - frank-skeleton/frank_static_resources.bundle/js/main.coffee
330
+ - frank-skeleton/frank_static_resources.bundle/js/main.js
331
+ - frank-skeleton/frank_static_resources.bundle/js/tabs_controller.coffee
332
+ - frank-skeleton/frank_static_resources.bundle/js/tabs_controller.js
333
+ - frank-skeleton/frank_static_resources.bundle/js/toast_controller.coffee
334
+ - frank-skeleton/frank_static_resources.bundle/js/toast_controller.js
335
+ - frank-skeleton/frank_static_resources.bundle/js/transform_stack.coffee
336
+ - frank-skeleton/frank_static_resources.bundle/js/transform_stack.js
337
+ - frank-skeleton/frank_static_resources.bundle/js/tree_view.coffee
338
+ - frank-skeleton/frank_static_resources.bundle/js/tree_view.js
339
+ - frank-skeleton/frank_static_resources.bundle/js/view_hier_model.coffee
340
+ - frank-skeleton/frank_static_resources.bundle/js/view_hier_model.js
341
+ - frank-skeleton/frank_static_resources.bundle/js/view_model.coffee
342
+ - frank-skeleton/frank_static_resources.bundle/js/view_model.js
343
+ - frank-skeleton/frank_static_resources.bundle/pictos/index.html
344
+ - frank-skeleton/frank_static_resources.bundle/pictos/pictos-web.eot
345
+ - frank-skeleton/frank_static_resources.bundle/pictos/pictos-web.svg
346
+ - frank-skeleton/frank_static_resources.bundle/pictos/pictos-web.ttf
347
+ - frank-skeleton/frank_static_resources.bundle/pictos/pictos-web.woff
348
+ - frank-skeleton/frank_static_resources.bundle/pictos/pictos.css
349
+ - frank-skeleton/frank_static_resources.bundle/pictos/pictos_base64.css
350
+ - frank-skeleton/frank_static_resources.bundle/stylesheets/css/symbiote.css
351
+ - frank-skeleton/frank_static_resources.bundle/stylesheets/sass/_elements.scss
352
+ - frank-skeleton/frank_static_resources.bundle/stylesheets/sass/_header.scss
353
+ - frank-skeleton/frank_static_resources.bundle/stylesheets/sass/_inspect_tabs_list_tabs.scss
354
+ - frank-skeleton/frank_static_resources.bundle/stylesheets/sass/_jquery.treeview.scss
355
+ - frank-skeleton/frank_static_resources.bundle/stylesheets/sass/_jqui.scss
356
+ - frank-skeleton/frank_static_resources.bundle/stylesheets/sass/_layout.scss
357
+ - frank-skeleton/frank_static_resources.bundle/stylesheets/sass/_mixins.sass
358
+ - frank-skeleton/frank_static_resources.bundle/stylesheets/sass/_reset.scss
359
+ - frank-skeleton/frank_static_resources.bundle/stylesheets/sass/_selector_test_toolbar.scss
360
+ - frank-skeleton/frank_static_resources.bundle/stylesheets/sass/_solarized.scss
361
+ - frank-skeleton/frank_static_resources.bundle/stylesheets/sass/_typography.scss
362
+ - frank-skeleton/frank_static_resources.bundle/stylesheets/sass/_unicode.scss
363
+ - frank-skeleton/frank_static_resources.bundle/stylesheets/sass/_z_index.scss
364
+ - frank-skeleton/frank_static_resources.bundle/stylesheets/sass/symbiote.scss
365
+ - frank-skeleton/frank_static_resources.bundle/ViewAttributeMapping.plist
366
+ - frank-skeleton/frank_static_resources.bundle/ViewAttributeMappingMac.plist
367
+ homepage: http://rubygems.org/gems/frank-cucumber
368
+ licenses: []
369
+ post_install_message:
370
+ rdoc_options: []
371
+ require_paths:
372
+ - lib
373
+ required_ruby_version: !ruby/object:Gem::Requirement
374
+ none: false
375
+ requirements:
376
+ - - ! '>='
377
+ - !ruby/object:Gem::Version
378
+ version: '0'
379
+ required_rubygems_version: !ruby/object:Gem::Requirement
380
+ none: false
381
+ requirements:
382
+ - - ! '>'
383
+ - !ruby/object:Gem::Version
384
+ version: 1.3.1
385
+ requirements: []
386
+ rubyforge_project:
387
+ rubygems_version: 1.8.25
388
+ signing_key:
389
+ specification_version: 3
390
+ summary: Use cucumber to test native iOS apps via Frank
391
+ test_files:
392
+ - test/keyboard_helper_test.rb
393
+ - test/launcher_test.rb
394
+ - test/rect_test.rb
395
+ - test/test_helper.rb