lebowski 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.md +3 -0
- data/License.txt +20 -0
- data/Manifest.txt +84 -0
- data/README.md +146 -0
- data/Rakefile +42 -0
- data/bin/lebowski +26 -0
- data/bin/lebowski-spec +29 -0
- data/bin/lebowski-start-server +24 -0
- data/lib/lebowski.rb +15 -0
- data/lib/lebowski/core.rb +35 -0
- data/lib/lebowski/foundation.rb +52 -0
- data/lib/lebowski/foundation/application.rb +315 -0
- data/lib/lebowski/foundation/core.rb +61 -0
- data/lib/lebowski/foundation/core_query.rb +231 -0
- data/lib/lebowski/foundation/dom_element.rb +114 -0
- data/lib/lebowski/foundation/errors/argument_invalid_type.rb +31 -0
- data/lib/lebowski/foundation/errors/unexpected_type.rb +30 -0
- data/lib/lebowski/foundation/mixins/collection_item_view_support.rb +87 -0
- data/lib/lebowski/foundation/mixins/delegate_support.rb +22 -0
- data/lib/lebowski/foundation/mixins/inline_text_field_support.rb +29 -0
- data/lib/lebowski/foundation/mixins/key_check.rb +35 -0
- data/lib/lebowski/foundation/mixins/list_item_view_support.rb +36 -0
- data/lib/lebowski/foundation/mixins/positioned_element.rb +20 -0
- data/lib/lebowski/foundation/mixins/stall_support.rb +79 -0
- data/lib/lebowski/foundation/mixins/user_actions.rb +302 -0
- data/lib/lebowski/foundation/mixins/wait_actions.rb +44 -0
- data/lib/lebowski/foundation/object_array.rb +305 -0
- data/lib/lebowski/foundation/panes/alert.rb +117 -0
- data/lib/lebowski/foundation/panes/main.rb +20 -0
- data/lib/lebowski/foundation/panes/menu.rb +100 -0
- data/lib/lebowski/foundation/panes/modal.rb +21 -0
- data/lib/lebowski/foundation/panes/palette.rb +21 -0
- data/lib/lebowski/foundation/panes/pane.rb +24 -0
- data/lib/lebowski/foundation/panes/panel.rb +25 -0
- data/lib/lebowski/foundation/panes/picker.rb +43 -0
- data/lib/lebowski/foundation/panes/sheet.rb +21 -0
- data/lib/lebowski/foundation/proxy_factory.rb +87 -0
- data/lib/lebowski/foundation/proxy_object.rb +670 -0
- data/lib/lebowski/foundation/sc_object.rb +38 -0
- data/lib/lebowski/foundation/views/button.rb +20 -0
- data/lib/lebowski/foundation/views/checkbox.rb +63 -0
- data/lib/lebowski/foundation/views/collection.rb +304 -0
- data/lib/lebowski/foundation/views/container.rb +32 -0
- data/lib/lebowski/foundation/views/disclosure.rb +59 -0
- data/lib/lebowski/foundation/views/grid.rb +21 -0
- data/lib/lebowski/foundation/views/label.rb +30 -0
- data/lib/lebowski/foundation/views/list.rb +67 -0
- data/lib/lebowski/foundation/views/list_item.rb +280 -0
- data/lib/lebowski/foundation/views/menu_item.rb +27 -0
- data/lib/lebowski/foundation/views/radio.rb +32 -0
- data/lib/lebowski/foundation/views/segmented.rb +97 -0
- data/lib/lebowski/foundation/views/select_field.rb +139 -0
- data/lib/lebowski/foundation/views/support/simple_item_array.rb +249 -0
- data/lib/lebowski/foundation/views/text_field.rb +108 -0
- data/lib/lebowski/foundation/views/view.rb +108 -0
- data/lib/lebowski/runtime.rb +7 -0
- data/lib/lebowski/runtime/errors/remote_control_command_execution_error.rb +9 -0
- data/lib/lebowski/runtime/errors/remote_control_command_timeout_error.rb +9 -0
- data/lib/lebowski/runtime/errors/remote_control_error.rb +9 -0
- data/lib/lebowski/runtime/errors/selenium_server_error.rb +9 -0
- data/lib/lebowski/runtime/object_encoder.rb +123 -0
- data/lib/lebowski/runtime/sprout_core_driver.rb +14 -0
- data/lib/lebowski/runtime/sprout_core_extensions.rb +600 -0
- data/lib/lebowski/scui.rb +18 -0
- data/lib/lebowski/scui/mixins/node_item_view_support.rb +136 -0
- data/lib/lebowski/scui/mixins/terminal_view_support.rb +25 -0
- data/lib/lebowski/scui/views/combo_box.rb +119 -0
- data/lib/lebowski/scui/views/date_picker.rb +148 -0
- data/lib/lebowski/scui/views/linkit.rb +36 -0
- data/lib/lebowski/spec.rb +17 -0
- data/lib/lebowski/spec/core.rb +21 -0
- data/lib/lebowski/spec/matchers/be.rb +63 -0
- data/lib/lebowski/spec/matchers/has.rb +40 -0
- data/lib/lebowski/spec/matchers/match_supporters/has_object_function.rb +67 -0
- data/lib/lebowski/spec/matchers/match_supporters/has_predicate_with_no_prefix.rb +50 -0
- data/lib/lebowski/spec/matchers/match_supporters/has_predicate_with_prefix_has.rb +50 -0
- data/lib/lebowski/spec/matchers/match_supporters/match_supporter.rb +29 -0
- data/lib/lebowski/spec/matchers/method_missing.rb +24 -0
- data/lib/lebowski/spec/operators/operator.rb +20 -0
- data/lib/lebowski/spec/operators/that.rb +116 -0
- data/lib/lebowski/spec/util.rb +26 -0
- data/lib/lebowski/version.rb +17 -0
- data/resources/selenium-server.jar +0 -0
- data/resources/user-extensions.js +1421 -0
- metadata +198 -0
@@ -0,0 +1,59 @@
|
|
1
|
+
# ==========================================================================
|
2
|
+
# Project: Lebowski Framework - The SproutCore Test Automation Framework
|
3
|
+
# License: Licensed under MIT license (see License.txt)
|
4
|
+
# ==========================================================================
|
5
|
+
|
6
|
+
module Lebowski
|
7
|
+
module Foundation
|
8
|
+
module Views
|
9
|
+
|
10
|
+
#
|
11
|
+
# Represents a proxy to a SproutCore disclosure view (SC.DisclosureView)
|
12
|
+
#
|
13
|
+
class DisclosureView < Lebowski::Foundation::Views::ButtonView
|
14
|
+
|
15
|
+
representing_sc_class 'SC.DisclosureView'
|
16
|
+
|
17
|
+
#
|
18
|
+
# Used to determine if this view's toggle is on
|
19
|
+
#
|
20
|
+
def is_toggled_on?()
|
21
|
+
val = self['value']
|
22
|
+
return (val == self['toggleOnValue'] or val.kind_of?(Array))
|
23
|
+
end
|
24
|
+
|
25
|
+
#
|
26
|
+
# Used to determine if this view's toggle is off
|
27
|
+
#
|
28
|
+
def is_toggled_off?()
|
29
|
+
return (self['value'] == self['toggleOffValue'])
|
30
|
+
end
|
31
|
+
|
32
|
+
def toggle_on()
|
33
|
+
if in_mixed_state?
|
34
|
+
click
|
35
|
+
click
|
36
|
+
elsif is_toggled_off?
|
37
|
+
click
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def toggle_off()
|
42
|
+
click if (in_mixed_state? or is_toggled_on?)
|
43
|
+
end
|
44
|
+
|
45
|
+
#
|
46
|
+
# Used to determine if this view is in a mixed state. The view is
|
47
|
+
# in a mixed state when it has a value when it has more than one
|
48
|
+
# value (e.g. [true, false])
|
49
|
+
#
|
50
|
+
def in_mixed_state?()
|
51
|
+
val = self['value']
|
52
|
+
return val.kind_of?(Array)
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# ==========================================================================
|
2
|
+
# Project: Lebowski Framework - The SproutCore Test Automation Framework
|
3
|
+
# License: Licensed under MIT license (see License.txt)
|
4
|
+
# ==========================================================================
|
5
|
+
|
6
|
+
module Lebowski
|
7
|
+
module Foundation
|
8
|
+
module Views
|
9
|
+
|
10
|
+
#
|
11
|
+
# Represents a proxy to a SproutCore grid view (SC.GridView)
|
12
|
+
#
|
13
|
+
class GridView < Lebowski::Foundation::Views::CollectionView
|
14
|
+
|
15
|
+
representing_sc_class 'SC.GridView'
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# ==========================================================================
|
2
|
+
# Project: Lebowski Framework - The SproutCore Test Automation Framework
|
3
|
+
# License: Licensed under MIT license (see License.txt)
|
4
|
+
# ==========================================================================
|
5
|
+
|
6
|
+
module Lebowski
|
7
|
+
module Foundation
|
8
|
+
module Views
|
9
|
+
|
10
|
+
#
|
11
|
+
# Represents a proxy to a SproutCore label view (SC.LabelView)
|
12
|
+
#
|
13
|
+
class LabelView < Lebowski::Foundation::Views::View
|
14
|
+
include Lebowski::Foundation::Mixins::InlineTextFieldSupport
|
15
|
+
|
16
|
+
representing_sc_class 'SC.LabelView'
|
17
|
+
|
18
|
+
def edit(value)
|
19
|
+
return if (not self['isEditable'])
|
20
|
+
|
21
|
+
double_click
|
22
|
+
edit_inline_text_field value
|
23
|
+
click
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# ==========================================================================
|
2
|
+
# Project: Lebowski Framework - The SproutCore Test Automation Framework
|
3
|
+
# License: Licensed under MIT license (see License.txt)
|
4
|
+
# ==========================================================================
|
5
|
+
|
6
|
+
module Lebowski
|
7
|
+
module Foundation
|
8
|
+
module Views
|
9
|
+
|
10
|
+
#
|
11
|
+
# Represents a proxy to a SproutCore list view (SC.ListView)
|
12
|
+
#
|
13
|
+
class ListView < Lebowski::Foundation::Views::CollectionView
|
14
|
+
|
15
|
+
representing_sc_class 'SC.ListView'
|
16
|
+
|
17
|
+
def can_drag_to_start_of?()
|
18
|
+
return true
|
19
|
+
end
|
20
|
+
|
21
|
+
def can_drag_to_end_of?()
|
22
|
+
return true
|
23
|
+
end
|
24
|
+
|
25
|
+
def apply_drag_to_start_of(source)
|
26
|
+
if item_views.count == 0
|
27
|
+
source.drag_to self
|
28
|
+
else
|
29
|
+
item = item_views[0]
|
30
|
+
source.drag_before item
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def apply_drag_to_end_of(source)
|
35
|
+
if item_views.count == 0
|
36
|
+
source.drag_to self
|
37
|
+
else
|
38
|
+
item = item_views[item_views.count - 1]
|
39
|
+
source.drag_after item
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
protected
|
44
|
+
|
45
|
+
def create_item_views_object_array()
|
46
|
+
return Support::ListItemViewArray.new self
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
module Support
|
52
|
+
|
53
|
+
class ListItemViewArray < CollectionItemViewArray
|
54
|
+
|
55
|
+
def mix_in_support_for_object(obj)
|
56
|
+
if not obj.class.ancestors.member? Mixins::ListItemViewSupport
|
57
|
+
obj.extend Mixins::ListItemViewSupport
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,280 @@
|
|
1
|
+
# ==========================================================================
|
2
|
+
# Project: Lebowski Framework - The SproutCore Test Automation Framework
|
3
|
+
# License: Licensed under MIT license (see License.txt)
|
4
|
+
# ==========================================================================
|
5
|
+
|
6
|
+
module Lebowski
|
7
|
+
module Foundation
|
8
|
+
module Views
|
9
|
+
|
10
|
+
#
|
11
|
+
# Represents a proxy to a SproutCore button view (SC.ListItemView)
|
12
|
+
#
|
13
|
+
class ListItemView < Lebowski::Foundation::Views::View
|
14
|
+
include Lebowski::Foundation
|
15
|
+
include Lebowski::Foundation::Mixins::InlineTextFieldSupport
|
16
|
+
include Lebowski::Foundation::Mixins::ListItemViewSupport
|
17
|
+
|
18
|
+
representing_sc_class 'SC.ListItemView'
|
19
|
+
|
20
|
+
def content_checkbox_key()
|
21
|
+
return get_delegate_property('contentCheckboxKey', 'displayDelegate')
|
22
|
+
end
|
23
|
+
|
24
|
+
def content_value_key()
|
25
|
+
return get_delegate_property('contentValueKey', 'displayDelegate')
|
26
|
+
end
|
27
|
+
|
28
|
+
def content_icon_key()
|
29
|
+
return get_delegate_property('contentIconKey', 'displayDelegate')
|
30
|
+
end
|
31
|
+
|
32
|
+
def content_right_icon_key()
|
33
|
+
return get_delegate_property('contentRightIconKey', 'displayDelegate')
|
34
|
+
end
|
35
|
+
|
36
|
+
def has_icon?()
|
37
|
+
return (self['hasContentIcon'] == true)
|
38
|
+
end
|
39
|
+
|
40
|
+
def icon()
|
41
|
+
@icon = create_icon(icon_selector) if @icon.nil?
|
42
|
+
return has_icon? ? @icon : nil
|
43
|
+
end
|
44
|
+
|
45
|
+
def has_right_icon?()
|
46
|
+
return (self['hasContentRightIcon'] == true)
|
47
|
+
end
|
48
|
+
|
49
|
+
def right_icon()
|
50
|
+
@right_icon = create_right_icon(right_icon_selector) if @right_icon.nil?
|
51
|
+
return has_right_icon? ? @right_icon : nil
|
52
|
+
end
|
53
|
+
|
54
|
+
def has_checkbox?()
|
55
|
+
return (not content_checkbox_key.nil?)
|
56
|
+
end
|
57
|
+
|
58
|
+
def checkbox()
|
59
|
+
@checkbox = create_checkbox(checkbox_selector) if @checkbox.nil?
|
60
|
+
return has_checkbox? ? @checkbox : nil
|
61
|
+
end
|
62
|
+
|
63
|
+
def has_disclosure?()
|
64
|
+
return (self['disclosureState'] != SC_LEAF_NODE)
|
65
|
+
end
|
66
|
+
|
67
|
+
def disclosure()
|
68
|
+
@disclosure = create_disclosure(disclosure_selector) if @disclosure.nil?
|
69
|
+
return has_disclosure? ? @disclosure : nil
|
70
|
+
end
|
71
|
+
|
72
|
+
def expand()
|
73
|
+
dis = disclosure
|
74
|
+
dis.toggle_on if (not dis.nil?)
|
75
|
+
end
|
76
|
+
|
77
|
+
def collapse()
|
78
|
+
dis = disclosure
|
79
|
+
dis.toggle_off if (not dis.nil?)
|
80
|
+
end
|
81
|
+
|
82
|
+
def edit_label(text)
|
83
|
+
return if (not self['contentIsEditable'] or content_value_key.nil?)
|
84
|
+
scroll_to_visible
|
85
|
+
click
|
86
|
+
select
|
87
|
+
cq = core_query(label_selector)
|
88
|
+
if cq.size > 0
|
89
|
+
cq[0].click
|
90
|
+
edit_inline_text_field text
|
91
|
+
click
|
92
|
+
end
|
93
|
+
cq.done
|
94
|
+
end
|
95
|
+
|
96
|
+
protected
|
97
|
+
|
98
|
+
def create_icon(selector)
|
99
|
+
return Support::ListItemViewMainIcon.new self, selector
|
100
|
+
end
|
101
|
+
|
102
|
+
def create_right_icon(selector)
|
103
|
+
return Support::ListItemViewRightIcon.new self, selector
|
104
|
+
end
|
105
|
+
|
106
|
+
def create_checkbox(selector)
|
107
|
+
return Support::ListItemViewCheckbox.new self, selector
|
108
|
+
end
|
109
|
+
|
110
|
+
def create_disclosure(selector)
|
111
|
+
return Support::ListItemViewDisclosure.new self, selector
|
112
|
+
end
|
113
|
+
|
114
|
+
def checkbox_selector()
|
115
|
+
return '.sc-outline .sc-checkbox-view'
|
116
|
+
end
|
117
|
+
|
118
|
+
def disclosure_selector()
|
119
|
+
return '.sc-outline img.disclosure'
|
120
|
+
end
|
121
|
+
|
122
|
+
def label_selector()
|
123
|
+
return '.sc-outline label'
|
124
|
+
end
|
125
|
+
|
126
|
+
def icon_selector()
|
127
|
+
return '.sc-outline img.icon'
|
128
|
+
end
|
129
|
+
|
130
|
+
def right_icon_selector()
|
131
|
+
return '.sc-outline img.right-icon'
|
132
|
+
end
|
133
|
+
|
134
|
+
end
|
135
|
+
|
136
|
+
module Support
|
137
|
+
|
138
|
+
class ListItemViewIcon
|
139
|
+
|
140
|
+
def initialize(parent, selector)
|
141
|
+
@parent = parent
|
142
|
+
@selector = selector
|
143
|
+
end
|
144
|
+
|
145
|
+
def click()
|
146
|
+
@parent.scroll_to_visible
|
147
|
+
cq = @parent.core_query(@selector)
|
148
|
+
cq[0].click
|
149
|
+
cq.done
|
150
|
+
end
|
151
|
+
|
152
|
+
def value()
|
153
|
+
return nil
|
154
|
+
end
|
155
|
+
|
156
|
+
end
|
157
|
+
|
158
|
+
class ListItemViewMainIcon < ListItemViewIcon
|
159
|
+
|
160
|
+
def value()
|
161
|
+
key = @parent.content_icon_key
|
162
|
+
return @parent[key]
|
163
|
+
end
|
164
|
+
|
165
|
+
end
|
166
|
+
|
167
|
+
class ListItemViewRightIcon < ListItemViewIcon
|
168
|
+
|
169
|
+
def value()
|
170
|
+
key = @parent.content_right_icon_key
|
171
|
+
return @parent[key]
|
172
|
+
end
|
173
|
+
|
174
|
+
end
|
175
|
+
|
176
|
+
class ListItemViewCheckbox
|
177
|
+
include Lebowski::Foundation
|
178
|
+
|
179
|
+
def initialize(parent, selector)
|
180
|
+
@parent = parent
|
181
|
+
@selector = selector
|
182
|
+
end
|
183
|
+
|
184
|
+
def value()
|
185
|
+
key = @parent.content_checkbox_key
|
186
|
+
return nil if key.nil?
|
187
|
+
val = @parent["content.#{key}"]
|
188
|
+
return val
|
189
|
+
end
|
190
|
+
|
191
|
+
def selected?()
|
192
|
+
val = value
|
193
|
+
return (val == true or val == SC_MIXED_STATE)
|
194
|
+
end
|
195
|
+
|
196
|
+
def in_mixed_state?()
|
197
|
+
return (value == SC_MIXED_STATE)
|
198
|
+
end
|
199
|
+
|
200
|
+
def select()
|
201
|
+
val = value
|
202
|
+
return if val.nil?
|
203
|
+
if val != true
|
204
|
+
@parent.scroll_to_visible
|
205
|
+
cq = @parent.core_query(@selector)
|
206
|
+
cq[0].click
|
207
|
+
cq.done
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
def deselect()
|
212
|
+
val = value
|
213
|
+
return if val.nil?
|
214
|
+
cq = @parent.core_query(@selector)
|
215
|
+
if val == true
|
216
|
+
@parent.scroll_to_visible
|
217
|
+
cq[0].click
|
218
|
+
elsif value == SC_MIXED_STATE
|
219
|
+
@parent.scroll_to_visible
|
220
|
+
cq[0].click
|
221
|
+
cq[0].click
|
222
|
+
end
|
223
|
+
cq.done
|
224
|
+
end
|
225
|
+
|
226
|
+
end
|
227
|
+
|
228
|
+
class ListItemViewDisclosure
|
229
|
+
include Lebowski::Foundation
|
230
|
+
|
231
|
+
def initialize(parent, selector)
|
232
|
+
@parent = parent
|
233
|
+
@selector = selector
|
234
|
+
end
|
235
|
+
|
236
|
+
def value()
|
237
|
+
return @parent['disclosureState']
|
238
|
+
end
|
239
|
+
|
240
|
+
def is_toggled_on?()
|
241
|
+
return (@parent['disclosureState'] == SC_BRANCH_OPEN)
|
242
|
+
end
|
243
|
+
|
244
|
+
def is_toggled_off?()
|
245
|
+
return (@parent['disclosureState'] == SC_BRANCH_CLOSED)
|
246
|
+
end
|
247
|
+
|
248
|
+
def toggle_on()
|
249
|
+
if is_toggled_off?
|
250
|
+
@parent.scroll_to_visible
|
251
|
+
cq = @parent.core_query(@selector)
|
252
|
+
cq[0].click
|
253
|
+
cq.done
|
254
|
+
end
|
255
|
+
end
|
256
|
+
|
257
|
+
def toggle_off()
|
258
|
+
if is_toggled_on?
|
259
|
+
@parent.scroll_to_visible
|
260
|
+
cq = @parent.core_query(@selector)
|
261
|
+
cq[0].click
|
262
|
+
cq.done
|
263
|
+
end
|
264
|
+
end
|
265
|
+
|
266
|
+
alias_method :is_expanded?, :is_toggled_on?
|
267
|
+
|
268
|
+
alias_method :is_collapsed?, :is_toggled_off?
|
269
|
+
|
270
|
+
alias_method :expand, :toggle_on
|
271
|
+
|
272
|
+
alias_method :collapse, :toggle_off
|
273
|
+
|
274
|
+
end
|
275
|
+
|
276
|
+
end
|
277
|
+
|
278
|
+
end
|
279
|
+
end
|
280
|
+
end
|