lebowski 0.2.1 → 0.3.0

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.
Files changed (31) hide show
  1. data/Gemfile +12 -0
  2. data/History.md +12 -1
  3. data/README.md +5 -5
  4. data/Rakefile +37 -19
  5. data/bin/lebowski +0 -1
  6. data/bin/lebowski-spec +5 -6
  7. data/lib/lebowski/foundation/core.rb +19 -0
  8. data/lib/lebowski/foundation/mixins/list_item_view_support.rb +10 -2
  9. data/lib/lebowski/foundation/mixins/user_actions.rb +101 -69
  10. data/lib/lebowski/foundation/proxy_object.rb +1 -20
  11. data/lib/lebowski/foundation/views/view.rb +10 -0
  12. data/lib/lebowski/{spec → rspec}/core.rb +1 -1
  13. data/lib/lebowski/{spec → rspec}/matchers/be.rb +2 -2
  14. data/lib/lebowski/{spec → rspec}/matchers/has.rb +2 -2
  15. data/lib/lebowski/{spec → rspec}/matchers/match_supporters/has_object_function.rb +3 -3
  16. data/lib/lebowski/{spec → rspec}/matchers/match_supporters/has_predicate_with_no_prefix.rb +1 -1
  17. data/lib/lebowski/{spec → rspec}/matchers/match_supporters/has_predicate_with_prefix_has.rb +1 -1
  18. data/lib/lebowski/{spec → rspec}/matchers/match_supporters/match_supporter.rb +1 -1
  19. data/lib/lebowski/{spec → rspec}/matchers/method_missing.rb +4 -4
  20. data/lib/lebowski/{spec → rspec}/operators/operator.rb +1 -1
  21. data/lib/lebowski/{spec → rspec}/operators/that.rb +10 -4
  22. data/lib/lebowski/{spec → rspec}/util.rb +1 -1
  23. data/lib/lebowski/rspec.rb +17 -0
  24. data/lib/lebowski/runtime/sprout_core_extensions.rb +58 -23
  25. data/lib/lebowski/version.rb +7 -7
  26. data/resources/README +1 -0
  27. data/resources/user-extensions.js +254 -20
  28. data/spec/spec_helper.rb +1 -0
  29. metadata +200 -106
  30. data/Manifest.txt +0 -93
  31. data/lib/lebowski/spec.rb +0 -17
@@ -4,7 +4,7 @@
4
4
  # ==========================================================================
5
5
 
6
6
  module Lebowski
7
- module Spec
7
+ module RSpec
8
8
  module Operators
9
9
 
10
10
  class That < Operator
@@ -96,13 +96,19 @@ module Lebowski
96
96
 
97
97
  def contains?(value)
98
98
  return false if value.nil?
99
- @args.all? do |x|
100
- value.member? x
99
+ if value.kind_of? String
100
+ return false if @args.length > 1
101
+ return value == @args[0]
102
+ elsif value.kind_of? Array
103
+ return @args.all? do |x|
104
+ value.member? x
105
+ end
101
106
  end
107
+ return false
102
108
  end
103
109
 
104
110
  def matches?(value)
105
- return Lebowski::Spec::Util.match?(@args[0], value)
111
+ return Lebowski::RSpec::Util.match?(@args[0], value)
106
112
  end
107
113
 
108
114
  def equals?(value)
@@ -4,7 +4,7 @@
4
4
  # ==========================================================================
5
5
 
6
6
  module Lebowski
7
- module Spec
7
+ module RSpec
8
8
  module Util
9
9
 
10
10
  #
@@ -0,0 +1,17 @@
1
+ # ==========================================================================
2
+ # Project: Lebowski Framework - The SproutCore Test Automation Framework
3
+ # License: Licensed under MIT license (see License.txt)
4
+ # ==========================================================================
5
+
6
+ require File.expand_path(File.dirname(__FILE__) + '/../lebowski')
7
+ require File.expand_path(File.dirname(__FILE__) + '/rspec/core')
8
+ require File.expand_path(File.dirname(__FILE__) + '/rspec/util')
9
+ require File.expand_path(File.dirname(__FILE__) + '/rspec/operators/operator')
10
+ require File.expand_path(File.dirname(__FILE__) + '/rspec/operators/that')
11
+ require File.expand_path(File.dirname(__FILE__) + '/rspec/matchers/match_supporters/match_supporter')
12
+ require File.expand_path(File.dirname(__FILE__) + '/rspec/matchers/match_supporters/has_object_function')
13
+ require File.expand_path(File.dirname(__FILE__) + '/rspec/matchers/match_supporters/has_predicate_with_no_prefix')
14
+ require File.expand_path(File.dirname(__FILE__) + '/rspec/matchers/match_supporters/has_predicate_with_prefix_has')
15
+ require File.expand_path(File.dirname(__FILE__) + '/rspec/matchers/be')
16
+ require File.expand_path(File.dirname(__FILE__) + '/rspec/matchers/has')
17
+ require File.expand_path(File.dirname(__FILE__) + '/rspec/matchers/method_missing')
@@ -171,45 +171,45 @@ module Lebowski
171
171
  alias_method :sc_mouse_enter, :sc_mouse_move
172
172
  alias_method :sc_mouse_exit, :sc_mouse_move
173
173
 
174
- def sc_mouse_move_at(type, x, y, *params)
175
- coords = "#{x},#{y}"
176
- __remote_control_command("mouseMoveAt", [__locator(type, *params), coords])
177
- end
178
-
179
174
  def sc_mouse_down(type, *params)
180
- __remote_control_command("scMouseDown", [__locator(type, *params),])
175
+ __remote_control_command("scMouseDown", [__locator(type, *params)])
181
176
  end
182
177
 
183
178
  def sc_mouse_up(type, *params)
184
- __remote_control_command("scMouseUp", [__locator(type, *params), ])
179
+ __remote_control_command("scMouseUp", [__locator(type, *params)])
185
180
  end
186
181
 
187
- def sc_mouse_down_at(type, x, y, *params)
188
- coords = "#{x},#{y}"
189
- __remote_control_command("mouseDownAt", [__locator(type, *params), coords])
190
- end
191
-
192
- def sc_mouse_up_at(type, x, y, *params)
193
- coords = "#{x},#{y}"
194
- __remote_control_command("mouseUpAt", [__locator(type, *params), coords])
195
- end
196
-
197
182
  def sc_right_mouse_down(type, *params)
198
- __remote_control_command("scMouseDownRight", [__locator(type, *params), ])
183
+ __remote_control_command("scMouseDownRight", [__locator(type, *params)])
199
184
  end
200
185
 
201
186
  def sc_right_mouse_up(type, *params)
202
- __remote_control_command("scMouseUpRight", [__locator(type, *params), ])
187
+ __remote_control_command("scMouseUpRight", [__locator(type, *params)])
188
+ end
189
+
190
+ def sc_mouse_move_at(type, x, y, *params)
191
+ encoded_params = ObjectEncoder.encode_hash({ :x => x, :y => y })
192
+ __remote_control_command("scMouseMoveAt", [__locator(type, *params), encoded_params])
193
+ end
194
+
195
+ def sc_mouse_down_at(type, x, y, *params)
196
+ encoded_params = ObjectEncoder.encode_hash({ :x => x, :y => y })
197
+ __remote_control_command("scMouseDownAt", [__locator(type, *params), encoded_params])
198
+ end
199
+
200
+ def sc_mouse_up_at(type, x, y, *params)
201
+ encoded_params = ObjectEncoder.encode_hash({ :x => x, :y => y })
202
+ __remote_control_command("scMouseUpAt", [__locator(type, *params), encoded_params])
203
203
  end
204
204
 
205
205
  def sc_right_mouse_down_at(type, x, y, *params)
206
- coords = "#{x},#{y}"
207
- __remote_control_command("mouseDownRightAt", [__locator(type, *params), coords])
206
+ encoded_params = ObjectEncoder.encode_hash({ :x => x, :y => y })
207
+ __remote_control_command("scMouseDownRightAt", [__locator(type, *params), encoded_params])
208
208
  end
209
209
 
210
210
  def sc_right_mouse_up_at(type, x, y, *params)
211
- coords = "#{x},#{y}"
212
- __remote_control_command("mouseUpRightAt", [__locator(type, *params), coords])
211
+ encoded_params = ObjectEncoder.encode_hash({ :x => x, :y => y })
212
+ __remote_control_command("scMouseUpRightAt", [__locator(type, *params), encoded_params])
213
213
  end
214
214
 
215
215
  def sc_basic_click(type, *params)
@@ -228,6 +228,18 @@ module Lebowski
228
228
  __remote_control_command("scDoubleClick", [__locator(type, *params), ])
229
229
  end
230
230
 
231
+ def sc_mouse_wheel_delta_x(type, delta, *params)
232
+ __remote_control_command("scMouseWheelDeltaX", [__locator(type, *params), delta])
233
+ end
234
+
235
+ def sc_mouse_wheel_delta_y(type, delta, *params)
236
+ __remote_control_command("scMouseWheelDeltaY", [__locator(type, *params), delta])
237
+ end
238
+
239
+ def sc_enable_mouse_move_event()
240
+ __remote_control_command("scEnableMouseMoveEvent", [])
241
+ end
242
+
231
243
  def sc_focus(type, *params)
232
244
  __remote_control_command("focus", [__locator(type, *params), ])
233
245
  end
@@ -365,6 +377,25 @@ module Lebowski
365
377
 
366
378
  # Selenium User Extension Utility Function Selenium Calls
367
379
 
380
+ # Disables all autoscrolling when performing a drag and drop
381
+ # operation within a SproutCore Application. Call this
382
+ # when you don't want autoscrolling to interfere with some
383
+ # user action.
384
+ #
385
+ # @see sc_disable_all_autoscrolling
386
+ def sc_disable_all_autoscrolling
387
+ __remote_control_command("scDisableAllAutoscrolling")
388
+ end
389
+
390
+ # Used to enable all autoscrolling. Call this after you have
391
+ # completed a user action that you did not want autoscrolling
392
+ # to intefere with.
393
+ #
394
+ # @see sc_disable_all_autoscrolling
395
+ def sc_enable_all_autoscrolling
396
+ __remote_control_command("scEnableAllAutoscrolling")
397
+ end
398
+
368
399
  def is_sc_bundle_loaded(bundle)
369
400
  return __boolean_command("isScBundleLoaded", [bundle])
370
401
  end
@@ -501,6 +532,10 @@ module Lebowski
501
532
  return __number_command("getElementChildNodesCount", [selector, index])
502
533
  end
503
534
 
535
+ def get_sc_scrollable_parent_view_layer_id(path)
536
+ return __string_command("getScScrollableParentViewLayerId", [path])
537
+ end
538
+
504
539
  # Selenium User Extensions Testing/Debugging Calls
505
540
 
506
541
  def __sc_test_computing_property_path(key, path)
@@ -3,14 +3,14 @@
3
3
  # License: Licensed under MIT license (see License.txt)
4
4
  # ==========================================================================
5
5
 
6
- module Lebowski # :nodoc:
7
- module VERSION # :nodoc:
8
- MAJOR = 0
9
- MINOR = 2
10
- TINY = 1
11
- PRE = nil
6
+ module Lebowski
7
+ module Version
8
+ MAJOR = 0
9
+ MINOR = 3
10
+ PATCH = 0
11
+ BUILD = nil
12
12
 
13
- STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
13
+ STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
14
14
 
15
15
  SUMMARY = "lebowski #{STRING}"
16
16
  end
data/resources/README ADDED
@@ -0,0 +1 @@
1
+ The selenium-server.jar is part of the Selenium Framework (http://seleniumhq.org)
@@ -96,6 +96,16 @@ ScExt.viewScrollToVisible = function(view) {
96
96
  $SC.RunLoop.end();
97
97
  };
98
98
 
99
+ /**
100
+ Will return a scrollable parent view of a given view. If no scrollable
101
+ parent view can be found then null is returned.
102
+ */
103
+ ScExt.getScrollableParentView = function(view) {
104
+ var pv = view.get('parentView');
105
+ while (pv && !pv.get('isScrollable')) pv = pv.get('parentView');
106
+ return (pv && pv.get('isScrollable')) ? pv : null;
107
+ };
108
+
99
109
  /**
100
110
  Gets all the class names that the given object inherits from. For instance, if
101
111
  an object is of type SC.ButtonView, then the following will be returned
@@ -338,26 +348,65 @@ var $ScPath = ScExt.PathParser;
338
348
  ScExt.MouseEventSimulation = {
339
349
 
340
350
  simulateEvent: function(mouseEvent, locator, x, y, button) {
341
- var element = selenium.browserbot.findElement(locator);
351
+ var element = selenium.browserbot.findElement(locator),
352
+ coord = element ? $SC.viewportOffset(element) : { x: 0, y: 0 },
353
+ width = element ? element.clientWidth : 0,
354
+ height = element ? element.clientHeight : 0;
355
+
356
+ x = x ? (x === 'center' ? width / 2 : x) : 0;
357
+ y = y ? (y === 'center' ? height / 2 : y) : 0;
358
+
359
+ var coords = element ? $SC.viewportOffset(element) : { x: 0, y: 0 },
360
+ clientX = coords.x + x,
361
+ clientY = coords.y + y;
362
+
342
363
  event = $SC.Event.simulateEvent(element, mouseEvent, {
343
- screenX: 0,
344
- screenY: 0,
345
- clientX: $SC.none(x) ? 0 : x,
346
- clientY: $SC.none(x) ? 0 : y,
347
- pageX: 0,
348
- pageY: 0,
364
+ screenX: 0, // assume 0 is fine
365
+ screenY: 0, // assume 0 is fine
366
+ clientX: clientX,
367
+ clientY: clientY,
368
+ pageX: clientX,
369
+ pageY: clientY,
349
370
  bubbles: true,
350
- button: $SC.none(button) ? 0 : button,
371
+ button: button ? button : 0,
351
372
  altKey: selenium.browserbot.altKeyDown,
352
373
  metaKey: selenium.browserbot.metaKeyDown,
353
374
  ctrlKey: selenium.browserbot.controlKeyDown,
354
375
  shiftKey: selenium.browserbot.shiftKeyDown
355
376
  });
377
+
356
378
  $SC.Event.trigger(element, mouseEvent, event);
357
379
  },
380
+
381
+ /**
382
+ Will simulate a mouse move event
383
+
384
+ Simulating a mouse move event works a bit differently from the other
385
+ mouse events. This is due to the way certain browsers behave when you
386
+ perform a mouse move.
387
+
388
+ In Safari, when you invoke a mouse move event and your mouse is placed
389
+ over the browser, it causes another mouse move event to occur having
390
+ clientX and clientY coordinates where the mouse is positioned. This causes
391
+ unexpected behavior and prevents not only mouse move to not behave correctly,
392
+ but also any drag and drop operation.
393
+
394
+ In order to prevent this unexpected behavior, the mousemove event is temporarily
395
+ enabled and then immediately disabled so that no other mouse move events
396
+ raised by the browser itself will intefere.
397
+
398
+ Because the mouse move event is immediate disabled after triggering a simulated
399
+ mouse move event, you may want to enable it later. To do so, you will need
400
+ to invoke the doScEnableMouseMoveEvent method.
401
+ */
402
+ mouseMove: function(locator, x, y) {
403
+ this.enableMouseMoveEvent();
404
+ this.simulateEvent('mousemove', locator, x, y, 0);
405
+ this.disableMouseMoveEvent();
406
+ },
358
407
 
359
408
  /**
360
- Will simulate a mouse down on a function key
409
+ Will simulate a mouse down event
361
410
  */
362
411
  mouseDown: function(locator, x, y) {
363
412
  this.simulateEvent('mousedown', locator, x, y, 0);
@@ -382,6 +431,64 @@ ScExt.MouseEventSimulation = {
382
431
  */
383
432
  mouseUpRight: function(locator, x, y) {
384
433
  this.simulateEvent('mouseup', locator, x, y, Selenium.RIGHT_MOUSE_CLICK);
434
+ },
435
+
436
+ disableMouseMoveEvent: function() {
437
+ var responder = this._getRootResponder();
438
+ var doc = this._getDocument();
439
+
440
+ $SC.Event.remove(doc, "mousemove", responder, responder["mousemove"]);
441
+ },
442
+
443
+ enableMouseMoveEvent: function() {
444
+ var responder = this._getRootResponder();
445
+ var doc = this._getDocument();
446
+
447
+ $SC.Event.add(doc, "mousemove", responder, responder["mousemove"]);
448
+ },
449
+
450
+ _getRootResponder: function() {
451
+ return $SC.RootResponder.responder;
452
+ },
453
+
454
+ _getDocument: function() {
455
+ return selenium.browserbot.currentWindow.document;
456
+ }
457
+
458
+ };
459
+
460
+ /**
461
+ Used to simulate a mouse wheel events using SproutCore's SC.Event object
462
+ */
463
+ ScExt.MouseWheelSimulation = {
464
+
465
+ simulateEvent: function(locator, deltaX, deltaY, delta) {
466
+ var element = selenium.browserbot.findElement(locator);
467
+ event = $SC.Event.simulateEvent(element, 'mousewheel', {
468
+ wheelDelta: !!delta ? delta : 0,
469
+ wheelDeltaX: !!deltaX ? deltaX : 0,
470
+ wheelDeltaY: !!deltaY ? deltaY : 0,
471
+ bubbles: true,
472
+ altKey: selenium.browserbot.altKeyDown,
473
+ metaKey: selenium.browserbot.metaKeyDown,
474
+ ctrlKey: selenium.browserbot.controlKeyDown,
475
+ shiftKey: selenium.browserbot.shiftKeyDown
476
+ });
477
+ $SC.Event.trigger(element, 'mousewheel', event);
478
+ },
479
+
480
+ /**
481
+ Will simulate a mouse wheel on the x-axis
482
+ */
483
+ wheelDeltaX: function(locator, delta) {
484
+ this.simulateEvent(locator, delta, 0, delta);
485
+ },
486
+
487
+ /**
488
+ Will simulate a mouse wheel on the y-axis
489
+ */
490
+ wheelDeltaY: function(locator, delta) {
491
+ this.simulateEvent(locator, 0, delta, delta);
385
492
  }
386
493
 
387
494
  };
@@ -1116,8 +1223,8 @@ Selenium.prototype.doScViewScrollToVisible = function(path) {
1116
1223
  */
1117
1224
  Selenium.prototype.doScMouseDown = function(locator) {
1118
1225
  try {
1119
- this.doMouseDown(locator);
1120
- } catch (ex) {}
1226
+ ScExt.MouseEventSimulation.mouseDown(locator);
1227
+ } catch (e) {}
1121
1228
  };
1122
1229
 
1123
1230
  /**
@@ -1125,8 +1232,8 @@ Selenium.prototype.doScMouseDown = function(locator) {
1125
1232
  */
1126
1233
  Selenium.prototype.doScMouseUp = function(locator) {
1127
1234
  try {
1128
- this.doMouseUp(locator);
1129
- } catch (ex) {}
1235
+ ScExt.MouseEventSimulation.mouseUp(locator);
1236
+ } catch (e) {}
1130
1237
  };
1131
1238
 
1132
1239
  /**
@@ -1134,8 +1241,8 @@ Selenium.prototype.doScMouseUp = function(locator) {
1134
1241
  */
1135
1242
  Selenium.prototype.doScMouseDownRight = function(locator) {
1136
1243
  try {
1137
- this.doMouseDownRight(locator);
1138
- } catch (ex) {}
1244
+ ScExt.MouseEventSimulation.mouseDownRight(locator);
1245
+ } catch (e) {}
1139
1246
  };
1140
1247
 
1141
1248
  /**
@@ -1143,8 +1250,73 @@ Selenium.prototype.doScMouseDownRight = function(locator) {
1143
1250
  */
1144
1251
  Selenium.prototype.doScMouseUpRight = function(locator) {
1145
1252
  try {
1146
- this.doMouseUpRight(locator);
1147
- } catch (ex) {}
1253
+ ScExt.MouseEventSimulation.mouseUpRight(locator);
1254
+ } catch (e) {}
1255
+ };
1256
+
1257
+ /**
1258
+ Action to raise a mouse move at event
1259
+ */
1260
+ Selenium.prototype.doScMouseMoveAt = function(locator, params) {
1261
+ var decodedParams = ScExt.ObjectDecoder.decodeHash(params),
1262
+ x = decodedParams ? decodedParams.x : 0,
1263
+ y = decodedParams ? decodedParams.y : 0;
1264
+
1265
+ try {
1266
+ ScExt.MouseEventSimulation.mouseMove(locator, x, y);
1267
+ } catch (e) {}
1268
+ };
1269
+
1270
+ /**
1271
+ Action to raise a mouse up at event
1272
+ */
1273
+ Selenium.prototype.doScMouseUpAt = function(locator, params) {
1274
+ var decodedParams = ScExt.ObjectDecoder.decodeHash(params),
1275
+ x = decodedParams ? decodedParams.x : 0,
1276
+ y = decodedParams ? decodedParams.y : 0;
1277
+
1278
+ try {
1279
+ ScExt.MouseEventSimulation.mouseUp(locator, x, y);
1280
+ } catch (e) {}
1281
+ };
1282
+
1283
+ /**
1284
+ Action to raise a mouse down at event
1285
+ */
1286
+ Selenium.prototype.doScMouseDownAt = function(locator, params) {
1287
+ var decodedParams = ScExt.ObjectDecoder.decodeHash(params),
1288
+ x = decodedParams ? decodedParams.x : 0,
1289
+ y = decodedParams ? decodedParams.y : 0;
1290
+
1291
+ try {
1292
+ ScExt.MouseEventSimulation.mouseDown(locator, x, y);
1293
+ } catch (e) {}
1294
+ };
1295
+
1296
+ /**
1297
+ Action to raise a right mouse up at event
1298
+ */
1299
+ Selenium.prototype.doScMouseUpRightAt = function(locator, params) {
1300
+ var decodedParams = ScExt.ObjectDecoder.decodeHash(params),
1301
+ x = decodedParams ? decodedParams.x : 0,
1302
+ y = decodedParams ? decodedParams.y : 0;
1303
+
1304
+ try {
1305
+ ScExt.MouseEventSimulation.mouseUpRight(locator, x, y);
1306
+ } catch (e) {}
1307
+ };
1308
+
1309
+ /**
1310
+ Action to raise a right mouse down at event
1311
+ */
1312
+ Selenium.prototype.doScMouseDownRightAt = function(locator, params) {
1313
+ var decodedParams = ScExt.ObjectDecoder.decodeHash(params),
1314
+ x = decodedParams ? decodedParams.x : 0,
1315
+ y = decodedParams ? decodedParams.y : 0;
1316
+
1317
+ try {
1318
+ ScExt.MouseEventSimulation.mouseDownRight(locator, x, y);
1319
+ } catch (e) {}
1148
1320
  };
1149
1321
 
1150
1322
  /**
@@ -1171,6 +1343,22 @@ Selenium.prototype.doScDoubleClick = function(locator) {
1171
1343
  this.doScClick(locator);
1172
1344
  };
1173
1345
 
1346
+ /**
1347
+ Action performs a mouse wheel event on the x-axis that is recognized
1348
+ by the SproutCore framework.
1349
+ */
1350
+ Selenium.prototype.doScMouseWheelDeltaX = function(locator, delta) {
1351
+ ScExt.MouseWheelSimulation.wheelDeltaX(locator, delta*1);
1352
+ };
1353
+
1354
+ /**
1355
+ Action performs a mouse wheel event on the y-axis that is recognized
1356
+ by the SproutCore framework.
1357
+ */
1358
+ Selenium.prototype.doScMouseWheelDeltaY = function(locator, delta) {
1359
+ ScExt.MouseWheelSimulation.wheelDeltaY(locator, delta*1);
1360
+ };
1361
+
1174
1362
  /** @private
1175
1363
  Check that the element is a valid text entry field
1176
1364
  */
@@ -1315,6 +1503,44 @@ Selenium.prototype.doRangeInsertContent = function(params) {
1315
1503
  }
1316
1504
  };
1317
1505
 
1506
+ /**
1507
+ Will disable all autoscrolling within the SproutCore application. Useful
1508
+ when you do not want scrollable views to automatically scroll since they
1509
+ can interfere with certain automated user actions like drag and drop. When
1510
+ the action is complete be use to enable all autoscrolling.
1511
+
1512
+ @see doScEnableAllAutoscrolling
1513
+ */
1514
+ Selenium.prototype.doScDisableAllAutoscrolling = function() {
1515
+ var sv = $SC.Drag._scrollableViews;
1516
+ this._scrollableViews = sv;
1517
+ $SC.Drag._scrollableViews = {};
1518
+ };
1519
+
1520
+ /**
1521
+ Will enable all autoscrolling within the SproutCore application. Call
1522
+ this after a user action is complete that you did not want autoscrolling
1523
+ to interfere with.
1524
+
1525
+ @see doScDisableAllAutoscrolling
1526
+ */
1527
+ Selenium.prototype.doScEnableAllAutoscrolling = function() {
1528
+ var sv = this._scrollableViews ? this._scrollableViews : {};
1529
+ $SC.Drag._scrollableViews = sv;
1530
+ };
1531
+
1532
+ /**
1533
+ Will enabled the mouse move event so that SproutCore will respond to it.
1534
+ The mouse move event gets disabled whenever the need to invoke a mouse
1535
+ mouse event is simulated by the ScExt.MouseEventSimulation's mouseMove
1536
+ method.
1537
+
1538
+ @see ScExt.MouseEventSimulation#mouseMove
1539
+ */
1540
+ Selenium.prototype.doScEnableMouseMoveEvent = function() {
1541
+ ScExt.MouseEventSimulation.enableMouseMoveEvent();
1542
+ };
1543
+
1318
1544
  ///////////////////// Selenium Core API Extensions - Accessors ////////////////////////////////////
1319
1545
 
1320
1546
  /**
@@ -1423,9 +1649,11 @@ Selenium.prototype.getScViewFrame = function(path) {
1423
1649
  Gets a DOM element's current window position
1424
1650
  */
1425
1651
  Selenium.prototype.getScElementWindowPosition = function(path) {
1426
- var x = this.getElementPositionLeft(path);
1427
- var y = this.getElementPositionTop(path);
1428
- return [x, y];
1652
+ var element = this.browserbot.findElement(path);
1653
+ if (!element) return null;
1654
+ var coords = $SC.viewportOffset(element);
1655
+ if (!coords) return null;
1656
+ return [coords.x, coords.y];
1429
1657
  };
1430
1658
 
1431
1659
  /**
@@ -1450,6 +1678,12 @@ Selenium.prototype.isScBundleLoaded = function(bundle) {
1450
1678
  return $SC.bundleIsLoaded(bundle);
1451
1679
  };
1452
1680
 
1681
+ Selenium.prototype.getScScrollableParentViewLayerId = function(path) {
1682
+ var view = $ScPath.getPath(path, 'SC.View');
1683
+ var parent = view ? ScExt.getScrollableParentView(view) : null;
1684
+ return parent ? parent.get('layerId') : null;
1685
+ };
1686
+
1453
1687
  /////// SC Core Query Specific Selenium Calls /////////////////
1454
1688
 
1455
1689
  /**
@@ -0,0 +1 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../lib/lebowski')