frank-cucumber 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -191,11 +191,11 @@
191
191
  fill: "#aaff00",
192
192
  opacity: 0.8,
193
193
  stroke: "black",
194
- transform: _this.backdropTransformer.push().translate(origin.x, origin.y).descAndPop(),
194
+ transform: _this.backdropTransformer.push().translate(origin.x * resolution.scale, origin.y * resolution.scale).descAndPop(),
195
195
  x: 0,
196
196
  y: 0,
197
- width: size.width,
198
- height: size.height
197
+ width: size.width *resolution.scale,
198
+ height: size.height * resolution.scale
199
199
  });
200
200
  });
201
201
  }
@@ -114,7 +114,7 @@
114
114
  fetchDevice: fetchDevice,
115
115
  requestSnapshotRefresh: requestSnapshotRefresh,
116
116
  baseScreenshotUrl: function() {
117
- return cacheBust(baseUrlFor('/screenshot'));
117
+ return cacheBust(baseUrlFor('/screenshot/allwindows/'));
118
118
  },
119
119
  snapshotUrlForViewWithUid: function(uid) {
120
120
  return cacheBust(baseUrlFor("/screenshot/view-snapshot/" + uid));
@@ -3,4 +3,4 @@ INSTALL_PATH = /./
3
3
  FRANK_CORE_LDFLAGS = -all_load -ObjC -framework CFNetwork -framework Security <%= @libs.map { |lib| "-l#{lib}" }.join(' ') %>
4
4
  FRANK_CORE_MAC_LDFLAGS = -all_load -ObjC -framework CFNetwork -framework Security <%= @libsMac.map { |lib| "-l#{lib}" }.join(' ') %>
5
5
 
6
- FRANK_CORE_GCC_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS = FRANKIFIED
6
+ GCC_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS = FRANKIFIED
Binary file
Binary file
Binary file
@@ -3,7 +3,6 @@ require 'frank-cucumber/color_helper'
3
3
  require 'frank-cucumber/frank_helper'
4
4
  require 'frank-cucumber/frank_mac_helper'
5
5
  require 'frank-cucumber/launcher'
6
- require 'frank-cucumber/mac_launcher'
7
6
 
8
7
  World(Frank::Cucumber::ColorHelper)
9
8
  World(Frank::Cucumber::FrankHelper)
@@ -7,12 +7,12 @@ require 'thor'
7
7
  require 'frank-cucumber/launcher'
8
8
  require 'frank-cucumber/console'
9
9
  require 'frank-cucumber/frankifier'
10
- require 'frank-cucumber/mac_launcher'
11
10
  require 'frank-cucumber/plugins/plugin'
12
11
 
13
12
  module Frank
14
13
  class CLI < Thor
15
14
  include Thor::Actions
15
+ include Frank::Cucumber::Launcher
16
16
 
17
17
  def self.source_root
18
18
  File.join( File.dirname(__FILE__), '..','..','frank-skeleton' )
@@ -131,7 +131,7 @@ module Frank
131
131
  else
132
132
  extra_opts += " -arch #{options['arch']}"
133
133
 
134
- run %Q|xcodebuild -xcconfig #{xcconfig_file} #{build_steps} #{extra_opts} #{separate_configuration_option} -sdk iphonesimulator DEPLOYMENT_LOCATION=YES DSTROOT="#{build_output_dir}" FRANK_LIBRARY_SEARCH_PATHS="#{frank_lib_search_paths}" #{xcodebuild_args}|
134
+ run %Q|xcodebuild -xcconfig #{xcconfig_file} #{build_steps} #{extra_opts} #{separate_configuration_option} -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO DEPLOYMENT_LOCATION=YES DSTROOT="#{build_output_dir}" FRANK_LIBRARY_SEARCH_PATHS="#{frank_lib_search_paths}" #{xcodebuild_args}|
135
135
  end
136
136
  exit $?.exitstatus if not $?.success?
137
137
 
@@ -169,11 +169,11 @@ module Frank
169
169
  method_option :idiom, :banner => 'iphone|ipad', :type => :string, :default => (ENV['FRANK_SIM_IDIOM'] || 'iphone')
170
170
  def launch
171
171
  $DEBUG = options[:debug]
172
- launcher = case options[:idiom].downcase
172
+ version = case options[:idiom].downcase
173
173
  when 'iphone'
174
- SimLauncher::DirectClient.for_iphone_app( frankified_app_dir )
174
+ 'iphone'
175
175
  when 'ipad'
176
- SimLauncher::DirectClient.for_ipad_app( frankified_app_dir )
176
+ 'ipad'
177
177
  else
178
178
  say "idiom must be either iphone or ipad. You supplied '#{options[:idiom]}'", :red
179
179
  exit 10
@@ -186,14 +186,9 @@ module Frank
186
186
  invoke :build
187
187
  end
188
188
 
189
- if built_product_is_mac_app( frankified_app_dir )
190
- launcher = Frank::MacLauncher.new( frankified_app_dir )
191
- say "LAUNCHING APP..."
192
- else
193
- say "LAUNCHING IN THE SIMULATOR..."
194
- end
189
+ say "LAUNCHING APP..."
195
190
 
196
- launcher.relaunch
191
+ launch_app(frankified_app_dir, nil, version, false)
197
192
  end
198
193
  end
199
194
 
@@ -205,6 +200,8 @@ module Frank
205
200
  end
206
201
 
207
202
  desc 'console', "launch a ruby console connected to your Frankified app"
203
+ method_option :bonjour, :type => :boolean, :default => false, :aliases => :b, :desc => "find Frank via Bonjour."
204
+ method_option :server, :type => :string, :default => false, :aliases => :s, :desc => "server URL for Frank."
208
205
  def console
209
206
  # TODO: check whether app is running (using ps or similar), and launch it if it's not
210
207
 
@@ -218,6 +215,8 @@ module Frank
218
215
 
219
216
  Frank::Cucumber::FrankHelper.use_shelley_from_now_on
220
217
  console = Frank::Console.new
218
+ Frank::Cucumber::FrankHelper.test_on_physical_device_via_bonjour if options[:bonjour]
219
+ Frank::Cucumber::FrankHelper.server_base_url = options[:server] if options[:server]
221
220
  if console.check_for_running_app
222
221
  console.pry
223
222
  end
@@ -258,10 +257,6 @@ module Frank
258
257
  File.expand_path 'Frank/plugins'
259
258
  end
260
259
 
261
- def built_product_is_mac_app ( app_dir )
262
- return File.exists? File.join( app_dir, "Contents", "MacOS" )
263
- end
264
-
265
260
  def fix_frankified_apps_bundle_identifier
266
261
  # as of iOS 6 the iOS Simulator locks up with a black screen if you try and launch an app which has the same
267
262
  # bundle identifier as a previously installed app but which is in fact a different app. This impacts us because our
@@ -442,6 +442,14 @@ module FrankHelper
442
442
  return frankly_device_name == "mac"
443
443
  end
444
444
 
445
+ # @return [String] the operating system version currently running the application
446
+ def frankly_os_version
447
+ res = frank_server.send_get( 'device' )
448
+ os_version = JSON.parse( res )['os_version']
449
+ puts "os_version reported as '#{os_version}'" if $DEBUG
450
+ os_version
451
+ end
452
+
445
453
  # Check whether Frank is able to communicate with the application under automation
446
454
  def frankly_ping
447
455
  frank_server.ping
@@ -25,12 +25,14 @@ class Frankifier
25
25
  check_target_build_configuration_is_valid!
26
26
 
27
27
  say ''
28
- add_linker_flag
28
+ project_changed |= add_linker_flag
29
29
 
30
30
  say ''
31
- add_library_search_path
31
+ project_changed |= add_library_search_path
32
32
 
33
- save_changes
33
+ if project_changed
34
+ save_changes
35
+ end
34
36
  end
35
37
 
36
38
  private
@@ -99,7 +101,7 @@ class Frankifier
99
101
 
100
102
  if setting_array.find{ |flag| flag.start_with? "$(FRANK_" }
101
103
  say "It appears that your '#{@target_build_configuration}' configuration's #{build_setting} build setting already include some FRANK setup. Namely: #{setting_array.inspect}. I won't change anything here."
102
- return
104
+ return false
103
105
  end
104
106
 
105
107
  say "Adding $(inherited) and $(#{entry_to_add}) to your '#{@target_build_configuration}' configuration's #{build_setting} build setting ..."
@@ -109,6 +111,7 @@ class Frankifier
109
111
  say "... #{build_setting} is now: #{setting_array.inspect}"
110
112
 
111
113
  build_settings_to_edit[build_setting] = setting_array
114
+ true
112
115
  end
113
116
 
114
117
  def check_target_build_configuration_is_valid!
@@ -3,7 +3,7 @@ require 'frank-cucumber/frank_localize'
3
3
  module Frank module Cucumber
4
4
 
5
5
  module HostScripting
6
-
6
+
7
7
  def start_recording
8
8
  %x{osascript<<APPLESCRIPT
9
9
  tell application "QuickTime Player"
@@ -11,7 +11,7 @@ module HostScripting
11
11
  tell sr to start
12
12
  end tell
13
13
  APPLESCRIPT}
14
-
14
+
15
15
  end
16
16
 
17
17
  def stop_recording
@@ -20,20 +20,22 @@ module HostScripting
20
20
  set sr to (document 1)
21
21
  tell sr to stop
22
22
  end tell
23
- APPLESCRIPT}
23
+ APPLESCRIPT}
24
24
  end
25
-
25
+
26
26
  def quit_simulator
27
27
  %x{osascript<<APPLESCRIPT-
28
- application "iPhone Simulator" quit
28
+ application id "com.apple.iphonesimulator" quit
29
29
  APPLESCRIPT}
30
30
  end
31
31
 
32
32
  def quit_double_simulator
33
33
  %x{osascript<<APPLESCRIPT
34
- activate application "iPhone Simulator"
34
+ activate application id "com.apple.iphonesimulator"
35
35
  tell application "System Events"
36
- tell process "#{Localize.t(:iphone_simulator)}"
36
+ set process_name_list to name of (application processes where bundle identifier is "com.apple.iphonesimulator")
37
+ set process_name to first item of process_name_list
38
+ tell process process_name
37
39
  if (value of static text 1 of window 1) is "#{Localize.t(:only_one_simulator)}" then
38
40
  click button 1 of window 1
39
41
  end if
@@ -44,30 +46,34 @@ module HostScripting
44
46
 
45
47
  def simulator_reset_data
46
48
  %x{osascript<<APPLESCRIPT
47
- activate application "iPhone Simulator"
49
+ activate application id "com.apple.iphonesimulator"
48
50
  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)}"
51
+ set process_name_list to name of (application processes where bundle identifier is "com.apple.iphonesimulator")
52
+ set process_name to first item of process_name_list
53
+ click menu item 5 of menu 1 of menu bar item 2 of menu bar 1 of process process_name
50
54
  delay 0.5
51
- click button 2 of window 1 of process "#{Localize.t(:iphone_simulator)}"
55
+ click button "#{Localize.t(:iphone_simulator_reset)}" of window 1 of process process_name
52
56
  end tell
53
- APPLESCRIPT}
57
+ APPLESCRIPT}
54
58
  end
55
59
 
56
60
  #Note this needs to have "Enable access for assistive devices"
57
61
  #chcked in the Universal Access system preferences
58
62
  def simulator_hardware_menu_press( menu_label )
59
- %x{osascript<<APPLESCRIPT
60
- activate application "iPhone Simulator"
63
+ %x{osascript -s o <<APPLESCRIPT
64
+ activate application id "com.apple.iphonesimulator"
61
65
  tell application "System Events"
62
- click menu item "#{menu_label}" of menu "#{Localize.t(:hardware)}" of menu bar of process "#{Localize.t(:iphone_simulator)}"
66
+ set process_name_list to name of (application processes where bundle identifier is "com.apple.iphonesimulator")
67
+ set process_name to first item of process_name_list
68
+ click menu item "#{menu_label}" of menu "#{Localize.t(:hardware)}" of menu bar of process process_name
63
69
  end tell
64
- APPLESCRIPT}
70
+ APPLESCRIPT}
65
71
  end
66
-
72
+
67
73
  def press_home_on_simulator
68
74
  simulator_hardware_menu_press Localize.t(:home)
69
75
  end
70
-
76
+
71
77
  def rotate_simulator_left
72
78
  simulator_hardware_menu_press Localize.t(:rotate_left)
73
79
  end
@@ -79,18 +85,18 @@ end tell
79
85
  def shake_simulator
80
86
  simulator_hardware_menu_press Localize.t(:shake_gesture)
81
87
  end
82
-
88
+
83
89
  def simulate_memory_warning
84
90
  simulator_hardware_menu_press Localize.t(:simulate_memory_warning)
85
91
  end
86
-
92
+
87
93
  def toggle_call_status_bar
88
94
  simulator_hardware_menu_press Localize.t(:toggle_call_status_bar)
89
95
  end
90
-
96
+
91
97
  def simulate_hardware_keyboard
92
98
  simulator_hardware_menu_press Localize.t(:simulate_hardware_keyboard)
93
99
  end
94
- end
100
+ end
95
101
 
96
102
  end end
@@ -1,9 +1,12 @@
1
1
  require 'sim_launcher'
2
2
  require 'frank-cucumber/app_bundle_locator'
3
+ require 'frank-cucumber/frank_helper'
3
4
 
4
5
  module Frank module Cucumber
5
6
 
6
- module Launcher
7
+ module Launcher
8
+ include Frank::Cucumber::FrankHelper
9
+
7
10
  attr_accessor :application_path, :sdk, :version
8
11
 
9
12
  def simulator_client
@@ -30,19 +33,26 @@ module Launcher
30
33
  end
31
34
  end
32
35
 
33
- def launch_app(app_path, sdk = nil, version = 'iphone')
36
+ def launch_app(app_path, sdk = nil, version = 'iphone', wait_for_launch = true)
34
37
  @application_path = app_path
35
38
  @sdk = sdk
36
39
  @version = version
37
40
 
38
- enforce(app_path)
41
+ if path_is_mac_app(@application_path)
42
+ launch_mac_app(wait_for_launch)
43
+ else
44
+ enforce(app_path)
45
+ launch_ios_app(wait_for_launch)
46
+ end
47
+ end
39
48
 
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
49
+ def launch_ios_app(wait_for_launch = true)
50
+ # kill the app if it's already running, just in case this helps
51
+ # reduce simulator flakiness when relaunching the app. Use a timeout of 5 seconds to
42
52
  # prevent us hanging around for ages waiting for the ping to fail if the app isn't running
43
53
  begin
44
54
  Timeout::timeout(5) { press_home_on_simulator if frankly_ping }
45
- rescue Timeout::Error
55
+ rescue Timeout::Error
46
56
  end
47
57
 
48
58
  if( ENV['USE_SIM_LAUNCHER_SERVER'] )
@@ -54,7 +64,10 @@ module Launcher
54
64
  num_timeouts = 0
55
65
  begin
56
66
  simulator.relaunch
57
- wait_for_frank_to_come_up
67
+
68
+ if wait_for_launch
69
+ wait_for_frank_to_come_up
70
+ end
58
71
  rescue Timeout::Error
59
72
  num_timeouts += 1
60
73
  puts "Encountered #{num_timeouts} timeouts while launching the app."
@@ -66,5 +79,40 @@ module Launcher
66
79
  end
67
80
 
68
81
  end
82
+
83
+ def path_is_mac_app (app_dir)
84
+ return File.exists? File.join( app_dir, "Contents", "MacOS" )
85
+ end
86
+
87
+
88
+ def launch_mac_app(wait_for_launch = true)
89
+ `open "#{@application_path}"`
90
+
91
+ if wait_for_launch
92
+ wait_for_frank_to_come_up
93
+ end
94
+ end
95
+
96
+ def quit_mac_app_if_running
97
+ pid = `ps -ax | grep "#{@app_path}" | grep -v grep`
98
+
99
+ if pid != ""
100
+ pid = pid.strip.split[0]
101
+ `kill #{pid}`
102
+ end
103
+
104
+ Timeout::timeout(60) {
105
+ while pid != ""
106
+ pid = `ps -ax | grep "#{@app_path}" | grep -v grep`
107
+ end
108
+ }
109
+
110
+ end
111
+
112
+ def relaunch_mac_app
113
+ self.quit_if_running
114
+ self.launch
115
+ end
116
+
69
117
  end
70
118
  end end
@@ -1,5 +1,6 @@
1
1
  en:
2
- iphone_simulator: iPhone Simulator
2
+ iphone_simulator: iOS Simulator
3
+ iphone_simulator_reset: Reset
3
4
  hardware: Hardware
4
5
  home: Home
5
6
  rotate_left: Rotate Left
@@ -12,6 +13,7 @@ en:
12
13
 
13
14
  fr:
14
15
  iphone_simulator: Simulateur iOS
16
+ iphone_simulator_reset: Réinitialiser
15
17
  hardware: Matériel
16
18
  home: Écran d’accueil
17
19
  rotate_left: Rotation à gauche
@@ -24,6 +26,7 @@ fr:
24
26
 
25
27
  de:
26
28
  iphone_simulator: iOS-Simulator
29
+ iphone_simulator_reset: Zurücksetzen
27
30
  hardware: Hardware
28
31
  home: Home
29
32
  rotate_left: Links drehen
@@ -36,6 +39,7 @@ de:
36
39
 
37
40
  ru:
38
41
  iphone_simulator: Симулятор iOS
42
+ iphone_simulator_reset: Сбросить
39
43
  hardware: Аппаратура
40
44
  home: Экран «Домой»
41
45
  rotate_left: Повернуть влево
@@ -48,6 +52,7 @@ ru:
48
52
 
49
53
  zh:
50
54
  iphone_simulator: iOS 模拟器
55
+ iphone_simulator_reset: 还原
51
56
  hardware: 硬件
52
57
  home: 首页
53
58
  rotate_left: 向左旋转
@@ -60,6 +65,7 @@ zh:
60
65
 
61
66
  ja:
62
67
  iphone_simulator: iOSシミュレータ
68
+ iphone_simulator_reset: リセット
63
69
  hardware: ハードウェア
64
70
  home: ホーム
65
71
  rotate_left: 反時計回りに回転
@@ -72,6 +78,7 @@ ja:
72
78
 
73
79
  es:
74
80
  iphone_simulator: Simulador iOS
81
+ iphone_simulator_reset: Restablecer
75
82
  hardware: Hardware
76
83
  home: Inicio
77
84
  rotate_left: Girar a la izquierda
@@ -84,6 +91,7 @@ es:
84
91
 
85
92
  it:
86
93
  iphone_simulator: Simulatore iOS
94
+ iphone_simulator_reset: Reimposta
87
95
  hardware: Hardware
88
96
  home: Home
89
97
  rotate_left: Ruota a sinistra
@@ -1,3 +1,5 @@
1
+ require "ostruct"
2
+
1
3
  module Frank module Cucumber
2
4
 
3
5
  class Rect
@@ -1,5 +1,5 @@
1
1
  module Frank
2
2
  module Cucumber
3
- VERSION = "1.2.0"
3
+ VERSION = "1.2.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: frank-cucumber
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-09-17 00:00:00.000000000 Z
13
+ date: 2013-11-20 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: cucumber
@@ -269,7 +269,6 @@ files:
269
269
  - lib/frank-cucumber/launcher.rb
270
270
  - lib/frank-cucumber/localize.yml
271
271
  - lib/frank-cucumber/location_helper.rb
272
- - lib/frank-cucumber/mac_launcher.rb
273
272
  - lib/frank-cucumber/plugins/plugin.rb
274
273
  - lib/frank-cucumber/rect.rb
275
274
  - lib/frank-cucumber/scroll_helper.rb
@@ -1,35 +0,0 @@
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