lebowski 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.md +17 -1
- data/Manifest.txt +8 -0
- data/README.md +6 -0
- data/lib/lebowski/foundation/application.rb +340 -74
- data/lib/lebowski/foundation/core.rb +23 -0
- data/lib/lebowski/foundation/dom_element.rb +15 -0
- data/lib/lebowski/foundation/errors/timeout.rb +5 -0
- data/lib/lebowski/foundation/mixins/collection_item_view_support.rb +5 -0
- data/lib/lebowski/foundation/mixins/define_paths_support.rb +318 -0
- data/lib/lebowski/foundation/mixins/delegate_support.rb +5 -0
- data/lib/lebowski/foundation/mixins/frame_application_context_support.rb +37 -0
- data/lib/lebowski/foundation/mixins/inline_text_field_support.rb +5 -0
- data/lib/lebowski/foundation/mixins/key_check.rb +5 -0
- data/lib/lebowski/foundation/mixins/list_item_view_support.rb +5 -0
- data/lib/lebowski/foundation/mixins/positioned_element.rb +24 -0
- data/lib/lebowski/foundation/mixins/stall_support.rb +5 -0
- data/lib/lebowski/foundation/mixins/user_actions.rb +37 -8
- data/lib/lebowski/foundation/mixins/wait_actions.rb +5 -0
- data/lib/lebowski/foundation/object_array.rb +96 -1
- data/lib/lebowski/foundation/proxy_factory.rb +2 -0
- data/lib/lebowski/foundation/proxy_object.rb +128 -130
- data/lib/lebowski/foundation/views/select_button.rb +69 -0
- data/lib/lebowski/foundation/views/view.rb +10 -0
- data/lib/lebowski/foundation/views/web.rb +26 -0
- data/lib/lebowski/foundation.rb +10 -0
- data/lib/lebowski/runtime/errors/remote_control_command_execution_error.rb +5 -0
- data/lib/lebowski/runtime/errors/remote_control_command_timeout_error.rb +5 -0
- data/lib/lebowski/runtime/errors/remote_control_error.rb +5 -0
- data/lib/lebowski/runtime/errors/selenium_server_error.rb +5 -0
- data/lib/lebowski/runtime/object_encoder.rb +5 -0
- data/lib/lebowski/runtime/sprout_core_driver.rb +5 -0
- data/lib/lebowski/runtime/sprout_core_extensions.rb +114 -0
- data/lib/lebowski/runtime.rb +5 -0
- data/lib/lebowski/scui/mixins/link_support.rb +32 -0
- data/lib/lebowski/scui/mixins/node_item_view_support.rb +50 -13
- data/lib/lebowski/scui/mixins/terminal_view_support.rb +30 -0
- data/lib/lebowski/scui/views/color_well.rb +48 -0
- data/lib/lebowski/scui/views/combo_box.rb +90 -87
- data/lib/lebowski/scui/views/content_editable.rb +422 -0
- data/lib/lebowski/scui/views/date_picker.rb +70 -58
- data/lib/lebowski/scui/views/linkit.rb +8 -0
- data/lib/lebowski/scui/views/select_field_tab.rb +30 -0
- data/lib/lebowski/scui.rb +18 -0
- data/lib/lebowski/version.rb +2 -2
- data/resources/user-extensions.js +293 -11
- metadata +69 -25
data/History.md
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
-
# lebowski 0.
|
1
|
+
# lebowski 0.2.0 2010-08-20
|
2
|
+
|
3
|
+
* Changed Application to MainApplication which is now used to start a main SproutCore application
|
4
|
+
* Improved application support in order to communicate with SproutCore apps loaded in iframes and pop-up windows
|
5
|
+
* Changed how paths are defined. No longer use define. Now use define_path
|
6
|
+
* Changed how path proxies are defined. No longer use proxy. Now use define_proxy
|
7
|
+
* Added proxy for SC.SelectButtonView
|
8
|
+
* Added proxy for SC.WebView
|
9
|
+
* Added proxy for SCUI.SelectFieldTab
|
10
|
+
* Added proxy for SCUI.ColorWell
|
11
|
+
* Added proxy for SCUI.ContentEditableView
|
12
|
+
* Can now supply a string value to the main application browser parameter
|
13
|
+
* Added functionality to the PositionedElement mixin
|
14
|
+
* Updated the drag and drop user action so that you can specify mouse offsets
|
15
|
+
* Updated what value can be passed to the main application browser parameter. Can now supply string values and :chrome
|
16
|
+
|
17
|
+
# lebowski 0.1.1 2010-06-07
|
2
18
|
|
3
19
|
* Open source beta release
|
data/Manifest.txt
CHANGED
@@ -27,7 +27,9 @@ lib/lebowski/foundation/mixins/delegate_support.rb
|
|
27
27
|
lib/lebowski/foundation/mixins/collection_item_view_support.rb
|
28
28
|
lib/lebowski/foundation/mixins/list_item_view_support.rb
|
29
29
|
lib/lebowski/foundation/mixins/inline_text_field_support.rb
|
30
|
+
lib/lebowski/foundation/mixins/frame_application_context_support.rb
|
30
31
|
lib/lebowski/foundation/mixins/stall_support.rb
|
32
|
+
lib/lebowski/foundation/mixins/define_paths_support.rb
|
31
33
|
lib/lebowski/foundation/proxy_object.rb
|
32
34
|
lib/lebowski/foundation/sc_object.rb
|
33
35
|
lib/lebowski/foundation/object_array.rb
|
@@ -48,6 +50,8 @@ lib/lebowski/foundation/views/collection.rb
|
|
48
50
|
lib/lebowski/foundation/views/list.rb
|
49
51
|
lib/lebowski/foundation/views/list_item.rb
|
50
52
|
lib/lebowski/foundation/views/grid.rb
|
53
|
+
lib/lebowski/foundation/views/web.rb
|
54
|
+
lib/lebowski/foundation/views/select_button.rb
|
51
55
|
lib/lebowski/foundation/views/support/simple_item_array.rb
|
52
56
|
lib/lebowski/foundation/panes/pane.rb
|
53
57
|
lib/lebowski/foundation/panes/main.rb
|
@@ -64,8 +68,12 @@ lib/lebowski/scui.rb
|
|
64
68
|
lib/lebowski/scui/views/combo_box.rb
|
65
69
|
lib/lebowski/scui/views/date_picker.rb
|
66
70
|
lib/lebowski/scui/views/linkit.rb
|
71
|
+
lib/lebowski/scui/views/select_field_tab.rb
|
72
|
+
lib/lebowski/scui/views/color_well.rb
|
73
|
+
lib/lebowski/scui/views/content_editable.rb
|
67
74
|
lib/lebowski/scui/mixins/node_item_view_support.rb
|
68
75
|
lib/lebowski/scui/mixins/terminal_view_support.rb
|
76
|
+
lib/lebowski/scui/mixins/link_support.rb
|
69
77
|
lib/lebowski/spec.rb
|
70
78
|
lib/lebowski/spec/core.rb
|
71
79
|
lib/lebowski/spec/util.rb
|
data/README.md
CHANGED
@@ -144,3 +144,9 @@ be sure to check out the `sc_controls` example app.
|
|
144
144
|
> that. Quite possibly the laziest in Los Angeles County, which would place him high in the runnin'
|
145
145
|
> for laziest worldwide. But sometimes there's a man, sometimes, there's a man.
|
146
146
|
|
147
|
+
#Contributors
|
148
|
+
|
149
|
+
Special thanks to the following individuals:
|
150
|
+
|
151
|
+
* Dessy Daskalov, for contributing lots of code for the SCUI proxies
|
152
|
+
* Mike Ramsey, for providing a lot of solid usage, testing, and feedback of the framework
|
@@ -7,16 +7,227 @@ module Lebowski
|
|
7
7
|
module Foundation
|
8
8
|
|
9
9
|
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
# the application within the web browser.
|
10
|
+
# Represents a SproutCore Application. This is a base class that is derived
|
11
|
+
# by other classes. The class provides the common data and behavior that
|
12
|
+
# all other classes representing an application must have.
|
14
13
|
#
|
15
|
-
class Application < Lebowski::Foundation::
|
14
|
+
class Application < Lebowski::Foundation::ProxyObject
|
16
15
|
include Lebowski
|
17
16
|
include Lebowski::Foundation
|
18
17
|
include Lebowski::Foundation::Panes
|
18
|
+
include Lebowski::Foundation::Mixins
|
19
19
|
include Lebowski::Foundation::Mixins::KeyCheck
|
20
|
+
|
21
|
+
attr_reader :app_context_manager
|
22
|
+
attr_reader :parent_app
|
23
|
+
|
24
|
+
def initialize(params)
|
25
|
+
super()
|
26
|
+
|
27
|
+
if params.nil?
|
28
|
+
raise ArgumentError.new "must supply parameters to create application instance"
|
29
|
+
end
|
30
|
+
|
31
|
+
if not params.kind_of?(Hash)
|
32
|
+
raise ArgumentError.new "must supply a hash containing parameters"
|
33
|
+
end
|
34
|
+
|
35
|
+
if not params[:parent_app].nil?
|
36
|
+
@parent_app = params[:parent_app]
|
37
|
+
@app_context_manager = @parent_app.app_context_manager
|
38
|
+
@driver = @parent_app.driver
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def abs_path()
|
43
|
+
return nil
|
44
|
+
end
|
45
|
+
|
46
|
+
def root_object(name, expected_type=nil)
|
47
|
+
return self['$' + name, expected_type]
|
48
|
+
end
|
49
|
+
|
50
|
+
alias_method :framework, :root_object
|
51
|
+
|
52
|
+
def main_pane(expected_type=nil)
|
53
|
+
return self['$SC.RootResponder.responder.mainPane', expected_type]
|
54
|
+
end
|
55
|
+
|
56
|
+
def key_pane(expected_type=nil)
|
57
|
+
return self['$SC.RootResponder.responder.keyPane', expected_type]
|
58
|
+
end
|
59
|
+
|
60
|
+
def responding_panes()
|
61
|
+
if @responding_panes.nil?
|
62
|
+
@responding_panes = ObjectArray.new self, '$SC.RootResponder.responder.panes'
|
63
|
+
end
|
64
|
+
return @responding_panes
|
65
|
+
end
|
66
|
+
|
67
|
+
def define_root_object(key, name, expected_type=nil)
|
68
|
+
return define(key, '$' + name, expected_type)
|
69
|
+
end
|
70
|
+
|
71
|
+
alias_method :define_framework, :define_root_object
|
72
|
+
|
73
|
+
def acquire_application_context(app_name)
|
74
|
+
if app_name.nil?
|
75
|
+
raise ArugmentError.new "app_name can not be nil"
|
76
|
+
end
|
77
|
+
app_context_manager.switch_application_context_to self, app_name
|
78
|
+
end
|
79
|
+
|
80
|
+
def do_aquire_application_context()
|
81
|
+
# no-op
|
82
|
+
end
|
83
|
+
|
84
|
+
def has_current_application_context?()
|
85
|
+
return app_context_manager.has_current_application_context?(self)
|
86
|
+
end
|
87
|
+
|
88
|
+
def exec_in_context(app_name, &block)
|
89
|
+
if app_name.nil?
|
90
|
+
raise ArgumentError.new "app_name can not be nil"
|
91
|
+
end
|
92
|
+
app_context_manager.exec_in_context self, app_name, &block
|
93
|
+
end
|
94
|
+
|
95
|
+
def exec_driver_in_context(&block)
|
96
|
+
app_context_manager.exec_driver_in_context self, &block
|
97
|
+
end
|
98
|
+
|
99
|
+
end
|
100
|
+
|
101
|
+
#
|
102
|
+
# Used to represent a SproutCore application that is contained within
|
103
|
+
# a web brower window
|
104
|
+
#
|
105
|
+
class WindowApplication < Application
|
106
|
+
|
107
|
+
def initialize(params)
|
108
|
+
super(params)
|
109
|
+
end
|
110
|
+
|
111
|
+
#
|
112
|
+
# Moves the browser window
|
113
|
+
#
|
114
|
+
def move_to(x, y)
|
115
|
+
exec_driver_in_context do |driver|
|
116
|
+
@driver.sc_window_move_to(x,y)
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
#
|
121
|
+
# Resizes the browser window
|
122
|
+
#
|
123
|
+
def resize_to(width, height)
|
124
|
+
exec_driver_in_context do |driver|
|
125
|
+
driver.sc_window_resize_to(width, height)
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
#
|
130
|
+
# Maximizes the browser window
|
131
|
+
#
|
132
|
+
def maximize()
|
133
|
+
exec_driver_in_context do |driver|
|
134
|
+
driver.sc_window_maximize
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
end
|
139
|
+
|
140
|
+
#
|
141
|
+
# Used to represent a SproutCore application that is contained within
|
142
|
+
# a web browser window that was opened by another window
|
143
|
+
#
|
144
|
+
class OpenedWindowApplication < WindowApplication
|
145
|
+
|
146
|
+
attr_reader :locator_type, :locator_value
|
147
|
+
|
148
|
+
def initialize(params)
|
149
|
+
super(params)
|
150
|
+
|
151
|
+
if params[:parent_app].nil?
|
152
|
+
raise ArugmentError.new "parent_app can not be nil"
|
153
|
+
end
|
154
|
+
|
155
|
+
@locator_type = params[:locator_type]
|
156
|
+
@locator_value = params[:locator_value]
|
157
|
+
end
|
158
|
+
|
159
|
+
#
|
160
|
+
# Used to check if this window is open
|
161
|
+
#
|
162
|
+
def is_opened?()
|
163
|
+
return @driver.is_sc_opened_window?(locator_type, locator_value)
|
164
|
+
end
|
165
|
+
|
166
|
+
#
|
167
|
+
# Closes the opened window if it is currently open
|
168
|
+
#
|
169
|
+
def close()
|
170
|
+
return if (not is_opened?)
|
171
|
+
driver.sc_close_opened_window locator_type, locator_value
|
172
|
+
if has_current_application_context?
|
173
|
+
parent_app.reset_application_context
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
def do_acquire_application_context()
|
178
|
+
@driver.sc_select_window(locator_type, locator_value)
|
179
|
+
end
|
180
|
+
|
181
|
+
end
|
182
|
+
|
183
|
+
#
|
184
|
+
# Used to represent a SproutCore application that is contained within
|
185
|
+
# an IFrame.
|
186
|
+
#
|
187
|
+
class FrameApplication < Application
|
188
|
+
|
189
|
+
attr_reader :locator
|
190
|
+
|
191
|
+
def initialize(params)
|
192
|
+
super(params)
|
193
|
+
|
194
|
+
if params[:parent_app].nil?
|
195
|
+
raise ArugmentError.new "parent_app can not be nil"
|
196
|
+
end
|
197
|
+
|
198
|
+
@locator = params[:locator]
|
199
|
+
end
|
200
|
+
|
201
|
+
def do_acquire_application_context()
|
202
|
+
parents = []
|
203
|
+
current_parent = self.parent_app
|
204
|
+
while not current_parent.nil? do
|
205
|
+
parents << current_parent
|
206
|
+
current_parent = current_parent.parent_app
|
207
|
+
end
|
208
|
+
|
209
|
+
parents = parents.reverse
|
210
|
+
|
211
|
+
parents.each do |parent|
|
212
|
+
if parent.kind_of? FrameApplication
|
213
|
+
@driver.select_frame parent.locator
|
214
|
+
else
|
215
|
+
parent.do_acquire_application_context
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
@driver.select_frame(locator)
|
220
|
+
end
|
221
|
+
|
222
|
+
end
|
223
|
+
|
224
|
+
#
|
225
|
+
# This class represents a SproutCore-based main application. In order to interact with the
|
226
|
+
# actual application you must create an instance of this class and start it. Once
|
227
|
+
# started, you are then free to access any object or view that has been created by
|
228
|
+
# the application within the web browser.
|
229
|
+
#
|
230
|
+
class MainApplication < WindowApplication
|
20
231
|
|
21
232
|
SAFARI = '*safari'
|
22
233
|
FIREFOX = '*firefox'
|
@@ -35,8 +246,7 @@ module Lebowski
|
|
35
246
|
:port,
|
36
247
|
:base_url,
|
37
248
|
:session_id,
|
38
|
-
:browser
|
39
|
-
:app_is_loaded_flag
|
249
|
+
:browser
|
40
250
|
|
41
251
|
#
|
42
252
|
# Creates an Application instance that will allow you to interact with a
|
@@ -64,15 +274,7 @@ module Lebowski
|
|
64
274
|
# :app_name => "HelloWorldApp"
|
65
275
|
#
|
66
276
|
def initialize(params)
|
67
|
-
super()
|
68
|
-
|
69
|
-
if params.nil?
|
70
|
-
raise ArgumentError.new "must supply parameters to create application instance"
|
71
|
-
end
|
72
|
-
|
73
|
-
if not params.kind_of?(Hash)
|
74
|
-
raise ArgumentError.new "must supply a hash containing parameters"
|
75
|
-
end
|
277
|
+
super(params)
|
76
278
|
|
77
279
|
@host = get_selenium_server_host(params)
|
78
280
|
@port = get_selenium_server_port(params)
|
@@ -85,7 +287,6 @@ module Lebowski
|
|
85
287
|
raise ArgumentError.new "Application name is required - :app_name" if @app_name.nil?
|
86
288
|
|
87
289
|
@rel_path = @app_name
|
88
|
-
@app_is_loaded_flag = get_app_is_loaded_flag(params)
|
89
290
|
@timeout_in_seconds = get_timeout_in_second(params)
|
90
291
|
@base_url = get_application_base_url(params)
|
91
292
|
@session_id = get_session_id(params)
|
@@ -98,6 +299,9 @@ module Lebowski
|
|
98
299
|
:timeout_in_second => @timeout_in_seconds
|
99
300
|
|
100
301
|
@started = false
|
302
|
+
|
303
|
+
@app_context_manager = Support::ApplicationContextManager.new self
|
304
|
+
@parent_app = nil
|
101
305
|
end
|
102
306
|
|
103
307
|
#
|
@@ -147,7 +351,6 @@ module Lebowski
|
|
147
351
|
raise TimeoutError.new err_message
|
148
352
|
end
|
149
353
|
end
|
150
|
-
|
151
354
|
end
|
152
355
|
|
153
356
|
def end()
|
@@ -167,42 +370,23 @@ module Lebowski
|
|
167
370
|
return @started
|
168
371
|
end
|
169
372
|
|
170
|
-
def
|
171
|
-
|
172
|
-
return @window
|
373
|
+
def reset_application_context()
|
374
|
+
acquire_application_context app_name
|
173
375
|
end
|
174
376
|
|
175
|
-
def
|
176
|
-
|
377
|
+
def define_app_name(name)
|
378
|
+
define_path name
|
177
379
|
end
|
178
380
|
|
179
|
-
def
|
180
|
-
|
381
|
+
def opened_windows()
|
382
|
+
@opened_windows = Support::OpenedWindows.new(self) if @opened_windows.nil?
|
383
|
+
return @opened_windows
|
181
384
|
end
|
182
385
|
|
183
|
-
|
184
|
-
|
185
|
-
def main_pane(expected_type=nil)
|
186
|
-
return self['$SC.RootResponder.responder.mainPane', expected_type]
|
386
|
+
def do_acquire_application_context()
|
387
|
+
@driver.sc_select_main_window
|
187
388
|
end
|
188
389
|
|
189
|
-
def key_pane(expected_type=nil)
|
190
|
-
return self['$SC.RootResponder.responder.keyPane', expected_type]
|
191
|
-
end
|
192
|
-
|
193
|
-
def responding_panes()
|
194
|
-
if @responding_panes.nil?
|
195
|
-
@responding_panes = ObjectArray.new self, '$SC.RootResponder.responder.panes'
|
196
|
-
end
|
197
|
-
return @responding_panes
|
198
|
-
end
|
199
|
-
|
200
|
-
def define_root_object(key, name, expected_type=nil)
|
201
|
-
return define(key, '$' + name, expected_type)
|
202
|
-
end
|
203
|
-
|
204
|
-
alias_method :define_framework, :define_root_object
|
205
|
-
|
206
390
|
private
|
207
391
|
|
208
392
|
def get_selenium_client(params)
|
@@ -250,11 +434,16 @@ module Lebowski
|
|
250
434
|
return client.browser_string if (not client.nil?)
|
251
435
|
|
252
436
|
browser = params[:browser]
|
437
|
+
|
438
|
+
return browser if browser.kind_of?(String)
|
439
|
+
|
253
440
|
case (browser)
|
254
441
|
when :firefox
|
255
442
|
return FIREFOX
|
256
443
|
when :safari
|
257
444
|
return SAFARI
|
445
|
+
when :chrome
|
446
|
+
return CHROME
|
258
447
|
else
|
259
448
|
return DEFAULT_BROWSER
|
260
449
|
end
|
@@ -268,10 +457,6 @@ module Lebowski
|
|
268
457
|
return params[:app_name]
|
269
458
|
end
|
270
459
|
|
271
|
-
def get_app_is_loaded_flag(params)
|
272
|
-
return params[:app_is_loaded_flag]
|
273
|
-
end
|
274
|
-
|
275
460
|
def get_timeout_in_second(params)
|
276
461
|
return DEFAULT_TIMEOUT_IN_SECONDS if params[:timeout_in_seconds].nil?
|
277
462
|
return params[:timeout_in_seconds].to_i
|
@@ -279,34 +464,115 @@ module Lebowski
|
|
279
464
|
|
280
465
|
end
|
281
466
|
|
282
|
-
|
283
|
-
# Represents the browser window the application has been loaded into
|
284
|
-
#
|
285
|
-
class Window
|
286
|
-
|
287
|
-
def initialize(driver)
|
288
|
-
@driver = driver
|
289
|
-
end
|
467
|
+
module Support
|
290
468
|
|
291
469
|
#
|
292
|
-
#
|
470
|
+
# Application context manager is used to handle the switching between SproutCore
|
471
|
+
# applications and keeping track of what application currently posses the current
|
472
|
+
# context that all operations act upon
|
293
473
|
#
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
474
|
+
class ApplicationContextManager
|
475
|
+
include Lebowski::Foundation
|
476
|
+
|
477
|
+
attr_reader :main_app
|
478
|
+
|
479
|
+
def initialize(main_app)
|
480
|
+
@main_app = main_app
|
481
|
+
@driver = main_app.driver
|
482
|
+
@current_application_context = { :app => main_app, :app_name => main_app.app_name }
|
483
|
+
end
|
484
|
+
|
485
|
+
def switch_application_context_to(app, app_name=nil)
|
486
|
+
if not app.kind_of? Application
|
487
|
+
raise ArgumentInvalidTypeError.new "app", app, "class < Application"
|
488
|
+
end
|
489
|
+
|
490
|
+
if not app.__eql? main_app
|
491
|
+
if main_app.path_defined? app_name
|
492
|
+
root = main_app.defined_path app_name
|
493
|
+
app.root_defined_path_part = root
|
494
|
+
else
|
495
|
+
app.root_defined_path_part = main_app.root_defined_path_part
|
496
|
+
end
|
497
|
+
end
|
498
|
+
|
499
|
+
app.do_acquire_application_context
|
500
|
+
|
501
|
+
@driver.update_sc_application_context(app_name) if not app_name.nil?
|
502
|
+
@current_application_context = { :app => app, :app_name => app_name }
|
503
|
+
end
|
504
|
+
|
505
|
+
def has_current_application_context?(app)
|
506
|
+
return app.__eql?(@current_application_context[:app])
|
507
|
+
end
|
508
|
+
|
509
|
+
def exec_in_context(app, app_name=nil, &block)
|
510
|
+
previous_app_context = @current_application_context.clone
|
511
|
+
switch_application_context_to app, app_name
|
512
|
+
yield app
|
513
|
+
switch_application_context_to previous_app_context[:app], previous_app_context[:app_name]
|
514
|
+
end
|
515
|
+
|
516
|
+
def exec_driver_in_context(app, &block)
|
517
|
+
previous_app_context = nil
|
518
|
+
if not has_current_application_context?(app)
|
519
|
+
previous_app_context = @current_application_context.clone
|
520
|
+
switch_application_context_to app
|
521
|
+
end
|
522
|
+
|
523
|
+
yield @driver
|
524
|
+
|
525
|
+
if not previous_app_context.nil?
|
526
|
+
switch_application_context_to previous_app_context[:app], previous_app_context[:app_name]
|
527
|
+
end
|
528
|
+
end
|
529
|
+
|
303
530
|
end
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
531
|
+
|
532
|
+
class OpenedWindows
|
533
|
+
|
534
|
+
def initialize(parent_app)
|
535
|
+
@parent_app = parent_app
|
536
|
+
@driver = parent_app.driver
|
537
|
+
end
|
538
|
+
|
539
|
+
def window_with_location?(value)
|
540
|
+
return @driver.is_sc_opened_window?(:location, value)
|
541
|
+
end
|
542
|
+
|
543
|
+
def window_with_name?(value)
|
544
|
+
return @driver.is_sc_opened_window?(:name, value)
|
545
|
+
end
|
546
|
+
|
547
|
+
def window_with_title?(value)
|
548
|
+
return @driver.is_sc_opened_window?(:title, value)
|
549
|
+
end
|
550
|
+
|
551
|
+
def find_by_location(value)
|
552
|
+
return find_opened_window(:location, value)
|
553
|
+
end
|
554
|
+
|
555
|
+
def find_by_name(value)
|
556
|
+
return find_opened_window(:name, value)
|
557
|
+
end
|
558
|
+
|
559
|
+
def find_by_title(value)
|
560
|
+
return find_opened_window(:title, value)
|
561
|
+
end
|
562
|
+
|
563
|
+
private
|
564
|
+
|
565
|
+
def find_opened_window(locator_type, locator_value)
|
566
|
+
if @driver.is_sc_opened_window?(locator_type, locator_value)
|
567
|
+
return OpenedWindowApplication.new({
|
568
|
+
:locator_type => locator_type,
|
569
|
+
:locator_value => locator_value,
|
570
|
+
:parent_app => @parent_app
|
571
|
+
})
|
572
|
+
end
|
573
|
+
return nil
|
574
|
+
end
|
575
|
+
|
310
576
|
end
|
311
577
|
|
312
578
|
end
|
@@ -1,3 +1,8 @@
|
|
1
|
+
# ==========================================================================
|
2
|
+
# Project: Lebowski Framework - The SproutCore Test Automation Framework
|
3
|
+
# License: Licensed under MIT license (see License.txt)
|
4
|
+
# ==========================================================================
|
5
|
+
|
1
6
|
module Lebowski
|
2
7
|
module Foundation
|
3
8
|
|
@@ -54,6 +59,24 @@ module Lebowski
|
|
54
59
|
raise ArgumentInvalidTypeError.new name, value, Lebowski::Foundation::Views::View
|
55
60
|
end
|
56
61
|
end
|
62
|
+
|
63
|
+
def self.get_root_application_object(proxy)
|
64
|
+
if proxy.nil?
|
65
|
+
raise ArgumentInvalidTypeError.new "proxy", proxy, Lebowski::Foundation::ProxyObject
|
66
|
+
end
|
67
|
+
|
68
|
+
current_proxy = proxy
|
69
|
+
while not current_proxy.nil? do
|
70
|
+
return current_proxy if current_proxy.kind_of?(Lebowski::Foundation::Application)
|
71
|
+
current_proxy = current_proxy.parent
|
72
|
+
end
|
73
|
+
|
74
|
+
return nil
|
75
|
+
end
|
76
|
+
|
77
|
+
def get_root_application_object()
|
78
|
+
return Util.get_root_application_object(self)
|
79
|
+
end
|
57
80
|
|
58
81
|
end
|
59
82
|
|
@@ -99,6 +99,21 @@ module Lebowski
|
|
99
99
|
return @driver.get_sc_core_query_element_attribute(@handle, @index, val)
|
100
100
|
end
|
101
101
|
|
102
|
+
# @override Lebowski::Foundation::Mixins::PositionedElement#position
|
103
|
+
def position()
|
104
|
+
return @driver.get_sc_element_window_position(action_target, *action_locator_args)
|
105
|
+
end
|
106
|
+
|
107
|
+
# @override Lebowski::Foundation::Mixins::PositionedElement#width
|
108
|
+
def width()
|
109
|
+
return @driver.get_sc_element_width(action_target, *action_locator_args)
|
110
|
+
end
|
111
|
+
|
112
|
+
# @override Lebowski::Foundation::Mixins::PositionedElement#height
|
113
|
+
def height()
|
114
|
+
return @driver.get_sc_element_height(action_target, *action_locator_args)
|
115
|
+
end
|
116
|
+
|
102
117
|
#
|
103
118
|
# If the method can not be found then assume we are trying to get the value
|
104
119
|
# of an attribute on the element.
|
@@ -1,3 +1,8 @@
|
|
1
|
+
# ==========================================================================
|
2
|
+
# Project: Lebowski Framework - The SproutCore Test Automation Framework
|
3
|
+
# License: Licensed under MIT license (see License.txt)
|
4
|
+
# ==========================================================================
|
5
|
+
|
1
6
|
module Lebowski
|
2
7
|
module Foundation
|
3
8
|
|
@@ -1,3 +1,8 @@
|
|
1
|
+
# ==========================================================================
|
2
|
+
# Project: Lebowski Framework - The SproutCore Test Automation Framework
|
3
|
+
# License: Licensed under MIT license (see License.txt)
|
4
|
+
# ==========================================================================
|
5
|
+
|
1
6
|
module Lebowski
|
2
7
|
module Foundation
|
3
8
|
module Mixins
|