frank-cucumber 1.1.13.pre1 → 1.2.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -7,6 +7,7 @@ require 'frank-cucumber/mac_launcher'
7
7
 
8
8
  World(Frank::Cucumber::ColorHelper)
9
9
  World(Frank::Cucumber::FrankHelper)
10
+ World(Frank::Cucumber::FrankMacHelper)
10
11
  World(Frank::Cucumber::Launcher)
11
12
 
12
13
  AfterConfiguration do
@@ -9,7 +9,6 @@ require 'frank-cucumber/console'
9
9
  require 'frank-cucumber/frankifier'
10
10
  require 'frank-cucumber/mac_launcher'
11
11
  require 'frank-cucumber/plugins/plugin'
12
- require 'xcodeproj'
13
12
 
14
13
  module Frank
15
14
  class CLI < Thor
@@ -56,6 +55,10 @@ module Frank
56
55
  copy_file f, File.join( 'Frank', f ), :force => true
57
56
  end
58
57
  directory( 'frank_static_resources.bundle', 'Frank/frank_static_resources.bundle', :force => true )
58
+
59
+ if yes? "\nOne or more static libraries may have been updated. For these changes to take effect the 'frankified_build' directory must be cleaned. Would you like me to do that now? Type 'y' or 'yes' to delete the contents of frankified_build."
60
+ remove_file('Frank/frankified_build')
61
+ end
59
62
  end
60
63
 
61
64
  XCODEBUILD_OPTIONS = %w{workspace project scheme target configuration}
@@ -67,6 +70,7 @@ module Frank
67
70
  WITHOUT_DEPS = 'without-dependencies'
68
71
  method_option 'no-plugins', :type => :boolean, :default => false, :aliases => '--np', :desc => 'Disable plugins'
69
72
  method_option 'arch', :type => :string, :default => 'i386'
73
+ method_option 'mac', :type => :string, :default => false
70
74
  method_option :noclean, :type => :boolean, :default => false, :aliases => '--nc', :desc => "Don't clean the build directory before building"
71
75
  method_option WITHOUT_DEPS, :type => :array, :desc => 'An array (space separated list) of plugin dependencies to exclude'
72
76
  def build(*args)
@@ -110,7 +114,7 @@ module Frank
110
114
  xcconfig_file = 'Frank/frank.xcconfig'
111
115
  File.open(xcconfig_file,'w') {|f| f.write(xcconfig_data) }
112
116
 
113
- extra_opts = XCODEBUILD_OPTIONS.map{ |o| "-#{o} \"#{options[o]}\"" if options[o] }.compact.join(' ')
117
+ extra_opts = XCODEBUILD_OPTIONS.map{ |o| "-#{o} \"#{options[o]}\"" if options[o] and (o != "target" or options['workspace'] == nil)}.compact.join(' ')
114
118
 
115
119
  # If there is a scheme specified we don't want to inject the default configuration
116
120
  # If there is a configuration specified, we also do not want to inject the default configuration
@@ -120,11 +124,9 @@ module Frank
120
124
  separate_configuration_option = "-configuration Debug"
121
125
  end
122
126
 
123
- build_mac = determine_build_patform(options) == :osx
124
-
125
127
  xcodebuild_args = args.join(" ")
126
128
 
127
- if build_mac
129
+ if options['mac']
128
130
  run %Q|xcodebuild -xcconfig #{xcconfig_file} #{build_steps} #{extra_opts} #{separate_configuration_option} DEPLOYMENT_LOCATION=YES DSTROOT="#{build_output_dir}" FRANK_LIBRARY_SEARCH_PATHS="#{frank_lib_search_paths}" #{xcodebuild_args}|
129
131
  else
130
132
  extra_opts += " -arch #{options['arch']}"
@@ -137,7 +139,7 @@ module Frank
137
139
  app = app.first
138
140
  FileUtils.cp_r("#{app}/.", frankified_app_dir)
139
141
 
140
- if build_mac
142
+ if options['mac']
141
143
  in_root do
142
144
  FileUtils.cp_r(
143
145
  File.join( 'Frank',static_bundle),
@@ -275,88 +277,6 @@ module Frank
275
277
  end
276
278
  end
277
279
 
278
- # The xcodeproj gem doesn't currently support schemes, and schemes have been difficult
279
- # to figure out. I plan to either implement schemes in xcodeproj at a later date, or
280
- # wait for them to be implemented, and then fix this function
281
- def determine_build_patform ( options )
282
- project_path = nil
283
-
284
- if options["workspace"] != nil
285
- if options["scheme"] != nil
286
- workspace = Xcodeproj::Workspace.new_from_xcworkspace(options["workspace"])
287
- projects = workspace.projpaths
288
-
289
- projects.each { | current_project |
290
- lines = `xcodebuild -project "#{current_project}" -list`
291
-
292
- found_schemes = false
293
-
294
- lines.split("\n").each { | line |
295
- if found_schemes
296
- line = line[8..-1]
297
-
298
- if line == ""
299
- found_schemes = false
300
- else
301
- if line == options["scheme"]
302
- project_path = current_project
303
- end
304
- end
305
-
306
- else
307
- line = line [4..-1]
308
-
309
- if line == "Schemes:"
310
- found_schemes = true
311
- end
312
-
313
- end
314
- }
315
- }
316
- else
317
- say "You must specify a scheme if you specify a workplace"
318
- exit 10
319
- end
320
- else
321
- project_path = options["project"]
322
- end
323
-
324
- if project_path == nil
325
- Dir.foreach(Dir.pwd) { | file |
326
- if file.end_with? ".xcodeproj"
327
- if project_path != nil
328
- say "You must specify a project if there are more than one .xcodeproj bundles in a directory"
329
- exit 10
330
- else
331
- project_path = file
332
- end
333
- end
334
- }
335
- end
336
-
337
- project = Xcodeproj::Project.new(project_path)
338
-
339
- target = nil
340
-
341
- if options["target"] != nil
342
- project.targets.each { | proj_target |
343
- if proj_target.name == options["target"]
344
- target = proj_target
345
- end
346
- }
347
- else
348
- target = project.targets[0]
349
- end
350
-
351
- if target == nil
352
- say "Unable to determine a target from the options provided. Assuming iOS"
353
- return :ios
354
- end
355
-
356
- return target.platform_name
357
-
358
- end
359
-
360
280
  def each_plugin_path(&block)
361
281
  plugin_glob = File.join("#{plugin_dir}",'*')
362
282
  Dir[plugin_glob].map do |plugin_path|
@@ -5,6 +5,7 @@ require 'frank-cucumber/launcher'
5
5
  module Frank
6
6
  class Console
7
7
  include Frank::Cucumber::FrankHelper
8
+ include Frank::Cucumber::FrankMacHelper
8
9
  include Frank::Cucumber::Launcher
9
10
 
10
11
  def check_for_running_app
@@ -6,6 +6,12 @@ INSTALL_PATH = /./
6
6
 
7
7
  <% plugin_names = plugins.map {|plugin| plugin.name } %>
8
8
 
9
- FRANK_LDFLAGS = $(FRANK_CORE_LDFLAGS) <%= plugin_names.map {|name| "$(#{name.upcase}_LDFLAGS)"}.join(' ') %>
9
+ FRANK_LDFLAGS_iphoneos = $(FRANK_CORE_LDFLAGS) <%= plugin_names.map {|name| "$(#{name.upcase}_LDFLAGS)"}.join(' ') %>
10
+
11
+ FRANK_LDFLAGS_macosx = $(FRANK_CORE_MAC_LDFLAGS) <%= plugin_names.map {|name| "$(#{name.upcase}_MAC_LDFLAGS)"}.join(' ') %>
12
+
13
+ FRANK_LDFLAGS_iphonesimulator = $(FRANK_LDFLAGS_iphoneos)
14
+
15
+ FRANK_LDFLAGS = $(FRANK_LDFLAGS_$(PLATFORM_NAME))
10
16
 
11
17
  FRANK_GCC_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS = $(FRANK_CORE_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS) <%= plugin_names.map {|name| "$(#{name.upcase}_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS)"}.join(' ') %>
@@ -2,50 +2,117 @@ require 'frank-cucumber/frank_helper'
2
2
 
3
3
  module Frank module Cucumber
4
4
 
5
- module FrankHelper
5
+ module FrankMacHelper
6
6
 
7
+ # Performs a click at the center of the selected object.
8
+ #
9
+ # This method creates CGEvents to move and click the mouse. Before calling this method,
10
+ # you should make sure that the element that you want to click is frontmost by calling
11
+ # bring_to_front.
12
+ #
13
+ # This method is designed to act on a single object, so do not pass a selector that will
14
+ # return multiple objects.
15
+ def click ( selector )
16
+ frame = accessibility_frame(selector)
17
+ frankly_map( selector, 'FEX_mouseDownX:y:', frame.center.x, frame.center.y )
18
+ frankly_map( selector, 'FEX_mouseUpX:y:', frame.center.x, frame.center.y )
19
+ end
20
+
21
+ # Performs a double-click at the center of the selected object.
22
+ #
23
+ # This method creates CGEvents to move and click the mouse. Before calling this method,
24
+ # you should make sure that the element that you want to click is frontmost by calling
25
+ # bring_to_front.
26
+ #
27
+ # This method is designed to act on a single object, so do not pass a selector that will
28
+ # return multiple objects.
29
+ def double_click ( selector )
30
+ click(selector)
31
+ click(selector)
32
+ end
33
+
34
+ #@api private
7
35
  def perform_action_on_selector( action, selector )
8
36
  touch_successes = frankly_map( selector, action )
9
37
  raise "could not find anything matching [#{selector}] which supports that action" if touch_successes == nil or touch_successes.empty?
10
38
  raise "some objects do not support that action" if touch_successes.include?(false)
11
39
  end
12
40
 
41
+ # Simulates the effect of clicking on the selected objects without actually moving the
42
+ # mouse or clicking.
43
+ #
44
+ # If the object supports the NSAccessibilityPressAction, that action is performed.
45
+ # Otherwise, if the object is a table cell or row, that row is selected,
46
+ # Otherwise, if the object is an NSView, it is made the first responder, if possible
47
+ # Otherwise, if the object is a menu item, it opens its submenu if it has one, or
48
+ # performs it's action if not.
13
49
  def simulate_click( selector )
14
50
  perform_action_on_selector( 'FEX_simulateClick', selector )
15
51
  end
16
52
 
53
+ # Brings the selected application or window to the front.
17
54
  def bring_to_front( selector )
18
55
  perform_action_on_selector( 'FEX_raise', selector )
19
56
  end
20
57
 
58
+ # Cancels the current action, such as editing a text field.
21
59
  def cancel( selector )
22
60
  perform_action_on_selector( 'FEX_cancel', selector )
23
61
  end
24
62
 
63
+ # Finishes the current action, such as editing a text field.
25
64
  def confirm( selector )
26
65
  perform_action_on_selector( 'FEX_confirm', selector )
27
66
  end
28
67
 
68
+ # Decrements the value of NSSliders, NSSteppers, and similar controls
29
69
  def decrement_value( selector )
30
70
  perform_action_on_selector( 'FEX_decrement', selector )
31
71
  end
32
72
 
73
+ # Deletes the user-inputted value
33
74
  def delete_value( selector )
34
75
  perform_action_on_selector( 'FEX_delete', selector )
35
76
  end
36
77
 
78
+ # Increments the value of NSSliders, NSSteppers, and similar controls
37
79
  def increment_value( selector )
38
80
  perform_action_on_selector( 'FEX_increment', selector )
39
81
  end
40
82
 
83
+ # Selects a menu item. This action is considered "outdated" by the Accessibility API, so
84
+ # don't use it without a good reason.
41
85
  def pick( selector )
42
86
  perform_action_on_selector( 'FEX_pick', selector )
43
87
  end
44
88
 
89
+ # Shows the contextual menu associated with the selector. This is the menu that would
90
+ # appear if the user right-clicked the selector, or, in some cases, held down the left
91
+ # mouse button on the selector.
45
92
  def show_menu( selector )
46
93
  perform_action_on_selector( 'FEX_showMenu', selector )
47
94
  end
48
95
 
96
+ # Expands the row the selector belongs to in an NSOutlineView. Do not expand more than
97
+ # one row at a time.
98
+ def expand_row( selector )
99
+ perform_action_on_selector( 'FEX_expand', selector )
100
+ end
101
+
102
+ # Collapses the row the selector belongs to in an NSOutlineView. Do not expand more than
103
+ # one row at a time.
104
+ def collapse_row( selector )
105
+ perform_action_on_selector( 'FEX_collapse', selector )
106
+ end
107
+
108
+ # @return [Boolean] whether the rows the selectors belong to in an NSOutlineView are all
109
+ # expanded
110
+ def row_is_expanded( selector )
111
+ successes = frankly_map( selector, "FEX_isExpanded" )
112
+ return false if successes == nil or successes.empty?
113
+ return !successes.include?(false)
114
+ end
115
+
49
116
  end
50
117
 
51
118
  end
@@ -39,12 +39,12 @@ class Frankifier
39
39
  unless File.exists?(xcodeproj)
40
40
  raise "Project file '#{xcodeproj}' does not exist. Please specify the relative path."
41
41
  end
42
-
42
+
43
43
  @xcodeproj_path = Pathname.new(xcodeproj)
44
44
  @project = Xcodeproj::Project.new(@xcodeproj_path)
45
45
  end
46
46
  end
47
-
47
+
48
48
  def decide_on_project
49
49
  projects = Pathname.glob( @root+'*.xcodeproj' )
50
50
  xcodeproj = case projects.size
@@ -86,19 +86,8 @@ class Frankifier
86
86
  puts "Frankifying target [#{@target.name}] in project #{@xcodeproj_path.basename}"
87
87
  end
88
88
 
89
- def target_is_mac
90
- settings = @target.build_configurations.first.build_settings['SDKROOT'] \
91
- || @project.build_configurations.first.build_settings['SDKROOT']
92
-
93
- return settings.include? 'macosx'
94
- end
95
-
96
89
  def add_linker_flag
97
- if target_is_mac
98
- add_frank_entry_to_build_setting( 'OTHER_LDFLAGS', 'FRANK_MAC_LDFLAGS' )
99
- else
100
- add_frank_entry_to_build_setting( 'OTHER_LDFLAGS', 'FRANK_LDFLAGS' )
101
- end
90
+ add_frank_entry_to_build_setting( 'OTHER_LDFLAGS', 'FRANK_LDFLAGS' )
102
91
  end
103
92
 
104
93
  def add_library_search_path
@@ -41,6 +41,15 @@ module KeyboardHelper
41
41
  Frank::Cucumber::Gateway.evaluate_frankly_response( res, "typing the following into the keyboard '#{text_to_type}'" )
42
42
  end
43
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"
44
53
  def type_shortcut(*args)
45
54
  if args[0].kind_of?(Array)
46
55
  return type_shortcut(*args)
@@ -1,5 +1,5 @@
1
1
  module Frank
2
2
  module Cucumber
3
- VERSION = "1.1.13.pre1"
3
+ VERSION = "1.2.0.pre1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: frank-cucumber
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.13.pre1
5
- prerelease: 7
4
+ version: 1.2.0.pre1
5
+ prerelease: 6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Pete Hodgson
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-06-27 00:00:00.000000000 Z
13
+ date: 2013-07-31 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: cucumber