frank-cucumber 0.8.8 → 0.8.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -29,7 +29,7 @@
29
29
  %label(for="query") Selector
30
30
  %input#query(placeholder="label marked:'Search'")
31
31
  %button#flash_button Flash
32
- %button#shelley_flash_button Flash using Shelley
32
+ %input#selector_engine(placeholder="uiquery")
33
33
  %td
34
34
  #refresh
35
35
  %img#loading(src="images/ajax-loader.gif")
@@ -29,7 +29,7 @@
29
29
  <label for='query'>Selector</label>
30
30
  <input id='query' placeholder="label marked:'Search'" />
31
31
  <button id='flash_button'>Flash</button>
32
- <button id='shelley_flash_button'>Flash using Shelley</button>
32
+ <input id='selector_engine' placeholder='uiquery' />
33
33
  </div>
34
34
  </td>
35
35
  <td>
@@ -380,10 +380,10 @@ $(document).ready(function() {
380
380
 
381
381
 
382
382
 
383
- function sendFlashCommand( selector, use_shelley ) {
383
+ function sendFlashCommand( selector, engine ) {
384
384
  var command = {
385
- query: selector,
386
- selector_engine: use_shelley ? 'shelley_compat' : 'uiquery',
385
+ query: selector,
386
+ selector_engine: engine ? engine : 'uiquery' ,
387
387
  operation: {
388
388
  method_name: 'flash',
389
389
  arguments: []
@@ -482,13 +482,8 @@ $(document).ready(function() {
482
482
  });
483
483
 
484
484
  $('#flash_button').click( function(){
485
- sendFlashCommand( $("input#query").val(), false );
485
+ sendFlashCommand( $("input#query").val(), $("input#selector_engine").val() );
486
486
  });
487
-
488
- $('#shelley_flash_button').click( function(){
489
- sendFlashCommand( $("input#query").val(), true );
490
- });
491
-
492
487
 
493
488
  liveView = symbiote.LiveView( uiLocator.updateBackdrop, refreshViewHeirarchy );
494
489
 
Binary file
Binary file
@@ -130,6 +130,20 @@ When /^I fill in text fields as follows:$/ do |table|
130
130
  end
131
131
  end
132
132
 
133
+ # simulate entering text from keyboard
134
+ When /^I enter the text "([^\\"]*)" from keyboard to the textfield "([^\\"]*)"$/ do |text_to_type, text_field_mark| # !> ambiguous first argument; put parentheses or even spaces
135
+ selector = "view marked:'#{text_field_mark}' first"
136
+ if element_exists(selector)
137
+ touch( selector )
138
+ else
139
+ raise "Could not find [#{text_field_mark}], it does not exist."
140
+ end
141
+ text_field_selector = "textField placeholder:'#{text_field_mark}'"
142
+ frankly_map( text_field_selector, 'becomeFirstResponder' )
143
+ frankly_map( text_field_selector, 'setText:', text_to_type )
144
+ frankly_map( text_field_selector, 'endEditing:', true )
145
+ end
146
+
133
147
  # -- Rotate -- #
134
148
  Given /^the device is in (a )?landscape orientation$/ do |ignored|
135
149
  # for some reason the simulator sometimes starts of reporting its orientation as 'flat'. Workaround for this is to rotate the device then wait a bit
@@ -276,3 +290,7 @@ end
276
290
  When /^I quit the simulator/ do
277
291
  quit_simulator
278
292
  end
293
+
294
+ When /^I reset the simulator/ do
295
+ simulator_reset_data
296
+ end
@@ -5,6 +5,8 @@ require 'frank-cucumber/frank_localize'
5
5
  module Frank module Cucumber
6
6
 
7
7
  module FrankHelper
8
+ HOST = "localhost"
9
+ FRANK_PORT = 37265
8
10
 
9
11
  class << self
10
12
  # TODO: adding an ivar to the module itself is a big ugyl hack. We need a FrankDriver class, or similar
@@ -69,14 +71,12 @@ module FrankHelper
69
71
 
70
72
  res['results']
71
73
  end
72
-
73
-
74
- def frankly_map( query, method_name, *method_args )
74
+
75
+ def frankly_engine_map( selector_engine, query, method_name, *method_args )
75
76
  operation_map = {
76
77
  :method_name => method_name,
77
78
  :arguments => method_args,
78
79
  }
79
- selector_engine = Frank::Cucumber::FrankHelper.selector_engine || 'uiquery' # default to UIQuery for backwards compatibility
80
80
  res = post_to_uispec_server( 'map', :query => query, :operation => operation_map, :selector_engine => selector_engine )
81
81
  res = JSON.parse( res )
82
82
  if res['outcome'] != 'SUCCESS'
@@ -85,12 +85,29 @@ module FrankHelper
85
85
 
86
86
  res['results']
87
87
  end
88
+
89
+ def frankly_map( query, method_name, *method_args )
90
+ selector_engine = Frank::Cucumber::FrankHelper.selector_engine || 'uiquery' # default to UIQuery for backwards compatibility
91
+ frankly_engine_map( selector_engine, query, method_name, *method_args )
92
+ end
88
93
 
89
94
  def frankly_dump
90
95
  res = get_to_uispec_server( 'dump' )
91
96
  puts JSON.pretty_generate(JSON.parse(res)) rescue puts res #dumping a super-deep DOM causes errors
92
97
  end
93
98
 
99
+ def frankly_screenshot(filename, subframe=nil, allwindows=true)
100
+ path = 'screenshot'
101
+ path += '/allwindows' if allwindows
102
+ path += "/frame/" + URI.escape(subframe) if (subframe != nil)
103
+
104
+ data = get_to_uispec_server( path )
105
+
106
+ open(filename, "wb") do |file|
107
+ file.write(data)
108
+ end
109
+ end
110
+
94
111
  def frankly_oriented_portrait?
95
112
  'portrait' == frankly_current_orientation
96
113
  end
@@ -173,8 +190,10 @@ module FrankHelper
173
190
  make_http_request( url, req )
174
191
  end
175
192
 
176
- def frank_url_for( verb )
177
- url = URI.parse "http://localhost:37265/"
193
+ def frank_url_for( verb , port=nil )
194
+ port ||= FRANK_PORT
195
+
196
+ url = URI.parse "http://#{HOST}:#{port}/"
178
197
  url.path = '/'+verb
179
198
  url
180
199
  end
@@ -214,6 +233,17 @@ module FrankHelper
214
233
  APPLESCRIPT}
215
234
  end
216
235
 
236
+ def simulator_reset_data
237
+ %x{osascript<<APPLESCRIPT
238
+ activate application "iPhone Simulator"
239
+ tell application "System Events"
240
+ click menu item 5 of menu 1 of menu bar item 2 of menu bar 1 of process "#{Localize.t(:iphone_simulator)}"
241
+ delay 0.5
242
+ click button 2 of window 1 of process "#{Localize.t(:iphone_simulator)}"
243
+ end tell
244
+ APPLESCRIPT}
245
+ end
246
+
217
247
  #Note this needs to have "Enable access for assistive devices"
218
248
  #chcked in the Universal Access system preferences
219
249
  def simulator_hardware_menu_press( menu_label )
@@ -8,6 +8,14 @@ module Frank
8
8
  case ENV['LANG']
9
9
  when /^fr_/
10
10
  :fr
11
+ when /^de_/
12
+ :de
13
+ when /^ru_/
14
+ :ru
15
+ when /^zh_/
16
+ :zh
17
+ when /^ja_/
18
+ :ja
11
19
  else
12
20
  :en
13
21
  end
@@ -18,4 +18,48 @@ fr:
18
18
  shake_gesture: Secousse
19
19
  simulate_memory_warning: Simuler un avertissement de mémoire
20
20
  toggle_in_call_status_bar: Afficher/Masquer la barre d'état d'appel en cour
21
- simulate_hardware_keyboard: Simuler un clavier matériel
21
+ simulate_hardware_keyboard: Simuler un clavier matériel
22
+
23
+ de:
24
+ iphone_simulator: iOS-Simulator
25
+ hardware: Hardware
26
+ home: Home
27
+ rotate_left: Links drehen
28
+ rotate_right: Rechts drehen
29
+ shake_gesture: Schüttelgeste
30
+ simulate_memory_warning: Speicherwarnhinweis simulieren
31
+ toggle_in_call_status_bar: Status für eingeh. Anrufe ein/aus
32
+ simulate_hardware_keyboard: Hardware-Tastatur simulieren
33
+
34
+ ru:
35
+ iphone_simulator: Симулятор iOS
36
+ hardware: Аппаратура
37
+ home: Экран «Домой»
38
+ rotate_left: Повернуть влево
39
+ rotate_right: Повернуть вправо
40
+ shake_gesture: Выполнить жест встряхивания
41
+ simulate_memory_warning: Симулировать предупреждение о нехватке памяти
42
+ toggle_in_call_status_bar: Переключить на строку состояния поступающего вызова
43
+ simulate_hardware_keyboard: Симулировать физическую клавиатуру
44
+
45
+ zh:
46
+ iphone_simulator: iOS 模拟器
47
+ hardware: 硬件
48
+ home: 首页
49
+ rotate_left: 向左旋转
50
+ rotate_right: 向右旋转
51
+ shake_gesture: 摇动手势
52
+ simulate_memory_warning: 模拟内存警告
53
+ toggle_in_call_status_bar: 切换呼叫状态栏
54
+ simulate_hardware_keyboard: 模拟硬件键盘
55
+
56
+ ja:
57
+ iphone_simulator: iOSシミュレータ
58
+ hardware: ハードウェア
59
+ home: ホーム
60
+ rotate_left: 反時計回りに回転
61
+ rotate_right: 時計回りに回転
62
+ shake_gesture: シェイクジェスチャー
63
+ simulate_memory_warning: メモリ警告をシミュレート
64
+ toggle_in_call_status_bar: 着信ステータスバーを切り替える
65
+ simulate_hardware_keyboard: ハードウェアキーボードをシミュレート
@@ -1,5 +1,5 @@
1
1
  module Frank
2
2
  module Cucumber
3
- VERSION = "0.8.8"
3
+ VERSION = "0.8.10"
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: 0.8.8
4
+ version: 0.8.10
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-01-19 00:00:00.000000000Z
13
+ date: 2012-03-19 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: cucumber
17
- requirement: &70324880537740 !ruby/object:Gem::Requirement
17
+ requirement: &70296015296240 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: '0'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *70324880537740
25
+ version_requirements: *70296015296240
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: rspec
28
- requirement: &70324880536340 !ruby/object:Gem::Requirement
28
+ requirement: &70296015295720 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: '2.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *70324880536340
36
+ version_requirements: *70296015295720
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: sim_launcher
39
- requirement: &70324880535140 !ruby/object:Gem::Requirement
39
+ requirement: &70296015295240 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: '0'
45
45
  type: :runtime
46
46
  prerelease: false
47
- version_requirements: *70324880535140
47
+ version_requirements: *70296015295240
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: i18n
50
- requirement: &70324880534020 !ruby/object:Gem::Requirement
50
+ requirement: &70296015294760 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ! '>='
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: '0'
56
56
  type: :runtime
57
57
  prerelease: false
58
- version_requirements: *70324880534020
58
+ version_requirements: *70296015294760
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: plist
61
- requirement: &70324880532620 !ruby/object:Gem::Requirement
61
+ requirement: &70296015294160 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ! '>='
@@ -66,10 +66,10 @@ dependencies:
66
66
  version: '0'
67
67
  type: :runtime
68
68
  prerelease: false
69
- version_requirements: *70324880532620
69
+ version_requirements: *70296015294160
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: json
72
- requirement: &70324880531520 !ruby/object:Gem::Requirement
72
+ requirement: &70296015293620 !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
75
  - - ! '>='
@@ -77,7 +77,7 @@ dependencies:
77
77
  version: '0'
78
78
  type: :runtime
79
79
  prerelease: false
80
- version_requirements: *70324880531520
80
+ version_requirements: *70296015293620
81
81
  description: Use cucumber to test native iOS apps via Frank
82
82
  email:
83
83
  - gems@thepete.net