operawatir 0.4.1.pre2-jruby → 0.4.1.pre3-jruby
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.
- data/CHANGES +233 -0
- data/VERSION +1 -1
- data/bin/desktopwatir +36 -16
- data/bin/operawatir +27 -14
- data/lib/operadriver/webdriver-opera.jar +0 -0
- data/lib/operawatir/compat/browser.rb +0 -5
- data/lib/operawatir/compat/collection.rb +2 -0
- data/lib/operawatir/compat/element.rb +3 -0
- data/lib/operawatir/compat/element_finders.rb +4 -0
- data/lib/operawatir/compat/selector.rb +7 -0
- data/lib/operawatir/compat/window.rb +8 -0
- data/lib/operawatir/compat.rb +3 -2
- data/lib/operawatir/desktop_browser.rb +18 -6
- data/lib/operawatir/desktop_helper.rb +2 -0
- data/lib/operawatir/quickwidgets/quick_addressfield.rb +12 -0
- data/lib/operawatir/quickwidgets/quick_checkbox.rb +1 -1
- data/lib/operawatir/quickwidgets/quick_editfield.rb +7 -4
- data/lib/operawatir/quickwidgets/quick_searchfield.rb +2 -0
- data/lib/operawatir/quickwidgets/quick_widget.rb +1 -1
- data/lib/operawatir/quickwidgets/quick_window.rb +6 -2
- data/lib/operawatir/screenshot.rb +46 -0
- data/lib/operawatir/window.rb +19 -16
- data/lib/operawatir.rb +1 -0
- data/operawatir.gemspec +23 -2
- data/spec/operawatir/core/screenshot_spec.rb +76 -0
- data/spec/operawatir/core/window_spec.rb +1 -12
- data/spec/operawatir/desktop/desktopbrowser_spec.rb +300 -0
- data/spec/operawatir/desktop/quickaddressfield_spec.rb +47 -0
- data/spec/operawatir/desktop/quickbutton_spec.rb +34 -0
- data/spec/operawatir/desktop/quickwidget_spec.rb +60 -0
- data/spec/operawatir/desktop/quickwindow_spec.rb +97 -0
- data/spec/operawatir/desktop/shared/shared.rb +48 -0
- data/spec/operawatir/matchers.rb +68 -0
- data/spec/operawatir/watirspec_desktophelper.rb +14 -0
- data/spec/operawatir/watirspec_helper.rb +1 -1
- data/spec/watir2/element_spec.rb +90 -21
- metadata +24 -3
@@ -3,17 +3,6 @@ require 'tmpdir'
|
|
3
3
|
|
4
4
|
describe 'Window' do
|
5
5
|
|
6
|
-
describe '#screenshot' do
|
7
|
-
after (:each) do
|
8
|
-
File.delete(Dir.tmpdir + '/screenshot.png')
|
9
|
-
end
|
10
|
-
|
11
|
-
it 'takes a screenshot of the specified element' do
|
12
|
-
browser.url = fixture('boxes.html')
|
13
|
-
window.screenshot(Dir.tmpdir + '/screenshot.png').should be_true
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
6
|
describe '#visual_hash' do
|
18
7
|
before :each do
|
19
8
|
browser.url = fixture('boxes.html')
|
@@ -21,7 +10,7 @@ describe 'Window' do
|
|
21
10
|
end
|
22
11
|
|
23
12
|
it 'returns a hash' do
|
24
|
-
@reference.
|
13
|
+
@reference.should match /^(0x)[a-f0-9]{32}$/
|
25
14
|
end
|
26
15
|
|
27
16
|
it 'returns identical hashes for visually identical pages' do
|
@@ -0,0 +1,300 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require File.expand_path('../../watirspec_desktophelper', __FILE__)
|
3
|
+
|
4
|
+
describe 'DesktopBrowser' do
|
5
|
+
before :all do
|
6
|
+
browser.url = fixture('simple.html')
|
7
|
+
#@window = browser.quick_window(:name, "Tab 0")
|
8
|
+
end
|
9
|
+
|
10
|
+
describe '#goto' do
|
11
|
+
it 'loads page'
|
12
|
+
end
|
13
|
+
|
14
|
+
|
15
|
+
describe '#quit_opera' do
|
16
|
+
it 'quits opera without quitting driver'
|
17
|
+
end
|
18
|
+
|
19
|
+
describe '#start_opera' do
|
20
|
+
before(:each) do
|
21
|
+
browser.quit_opera
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'starts opera' do
|
25
|
+
browser.start_opera
|
26
|
+
browser.quick_windows.should_not be_empty
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe '#quit_driver' do
|
31
|
+
it 'quits driver'
|
32
|
+
end
|
33
|
+
|
34
|
+
describe '#restart' do
|
35
|
+
it 'starts opera' do
|
36
|
+
browser.restart
|
37
|
+
browser.quick_windows.should_not be_empty
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe 'open and load window' do
|
42
|
+
after(:each) do
|
43
|
+
browser.close_all_tabs
|
44
|
+
end
|
45
|
+
|
46
|
+
describe '#open_window_with_action' do
|
47
|
+
it 'opens new window' do
|
48
|
+
browser.open_window_with_action("Document Window", "New page", "1").should open_window
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'fails for actions not opening a new window'
|
52
|
+
end
|
53
|
+
|
54
|
+
describe '#load_window_with_action' do
|
55
|
+
it 'loads window' do
|
56
|
+
browser.load_window_with_action("Document Window", "Open url in new page", WatirSpec.files + "/boxes.html").should > 0
|
57
|
+
end
|
58
|
+
it 'fails for actions not loading'
|
59
|
+
end
|
60
|
+
|
61
|
+
describe '#open_window_with_key_press' do
|
62
|
+
it 'opens window' do
|
63
|
+
browser.open_window_with_key_press("Document Window", "t", :ctrl).should > 0
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
describe 'close window' do
|
69
|
+
before(:each) do
|
70
|
+
browser.open_window_with_key_press("Document Window", "t", :ctrl).should > 0
|
71
|
+
end
|
72
|
+
|
73
|
+
describe '#close_window_with_action' do
|
74
|
+
it 'closes window' do
|
75
|
+
browser.close_window_with_action("Document Window", "Close page").should > 0
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
describe '#close_window_with_key_press' do
|
80
|
+
it 'closes window' do
|
81
|
+
browser.close_window_with_key_press("Document Window", "w", :ctrl).should > 0
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
describe 'open dialogs' do
|
87
|
+
after(:each) do
|
88
|
+
browser.close_all_dialogs
|
89
|
+
end
|
90
|
+
describe '#open_dialog_with_url' do
|
91
|
+
it 'opens dialog'
|
92
|
+
end
|
93
|
+
|
94
|
+
describe '#open_dialog_with_click' do
|
95
|
+
it 'opens dialog'
|
96
|
+
end
|
97
|
+
|
98
|
+
end
|
99
|
+
|
100
|
+
describe 'close dialogs' do
|
101
|
+
before(:each) do
|
102
|
+
browser.open_dialog_with_key_press("New Preferences Dialog", "F12", :ctrl)
|
103
|
+
end
|
104
|
+
|
105
|
+
describe '#close_dialog' do
|
106
|
+
it 'closes dialog' do
|
107
|
+
browser.close_dialog("New Preferences Dialog").should > 0
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
|
112
|
+
describe '#close_all_dialogs' do
|
113
|
+
it 'closes all dialogs' do
|
114
|
+
browser.close_all_dialogs
|
115
|
+
browser.quick_windows.select { |win| win.type == "Dialog" }.should be_empty
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
describe '#activate_tab_with_key_press' do
|
121
|
+
it 'activates tab'
|
122
|
+
end
|
123
|
+
|
124
|
+
describe '#set_alignment_with_action' do
|
125
|
+
it 'sets alignment'
|
126
|
+
end
|
127
|
+
|
128
|
+
describe '#widgets' do
|
129
|
+
it 'retrieves all widgets' do
|
130
|
+
browser.widgets("Browser Window").should_not be_empty
|
131
|
+
end
|
132
|
+
it 'retrieves only windows'
|
133
|
+
end
|
134
|
+
|
135
|
+
describe '#quick_windows' do
|
136
|
+
it 'retrieves all windows' do
|
137
|
+
browser.quick_windows.should_not be_empty
|
138
|
+
end
|
139
|
+
it 'retrieves only windows'
|
140
|
+
end
|
141
|
+
|
142
|
+
describe '#open_pages' do
|
143
|
+
it 'holds open tabs' do
|
144
|
+
browser.open_pages.should_not be_empty
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
describe '#quick_buttons' do
|
149
|
+
it 'retrieves buttons' do
|
150
|
+
browser.quick_buttons("Document Window").should_not be_empty
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
describe '#quick_tabbuttons' do
|
155
|
+
it 'retrieves tabbuttons' do
|
156
|
+
browser.quick_tabbuttons("Browser Window").should_not be_empty
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
describe '#quick_thumbnails' do
|
161
|
+
before do
|
162
|
+
browser.open_window_with_key_press("Document Window", "t", :ctrl).should > 0
|
163
|
+
end
|
164
|
+
after do
|
165
|
+
browser.quick_window(:name, "Browser Window").quick_toolbar(:name, "Pagebar").quick_tab(:text, "Speed Dial").quick_button(:name, "pb_CloseButton").close_window_with_click("Document Window")
|
166
|
+
end
|
167
|
+
it 'retrieves thumbnails from the active window' do
|
168
|
+
browser.quick_thumbnails("Document Window").length.should be > 0
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
describe '#quick_checkboxes' do
|
173
|
+
before(:each) do
|
174
|
+
browser.open_dialog_with_action("New Preferences Dialog", "Show preferences", 4).should > 0
|
175
|
+
end
|
176
|
+
it 'retrieves checkboxes' do
|
177
|
+
browser.quick_checkboxes("New Preferences Dialog").should_not be_empty
|
178
|
+
end
|
179
|
+
it 'retrieves only checkboxes' do
|
180
|
+
browser.quick_checkboxes("New Preferences Dialog").select { |c| c.type != :checkbox }.should be_empty
|
181
|
+
end
|
182
|
+
after(:each) do
|
183
|
+
browser.close_dialog("New Preferences Dialog")
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
#TODO: Add all other collection types
|
188
|
+
|
189
|
+
describe '#window_name' do
|
190
|
+
it 'returns empty string for invalid id' do
|
191
|
+
browser.window_name(-1).should be_empty
|
192
|
+
end
|
193
|
+
|
194
|
+
it 'returns window name for valid id' do
|
195
|
+
valid_id = browser.open_window_with_key_press("Document Window", "t", :ctrl)
|
196
|
+
browser.window_name(valid_id).should == "Document Window"
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
describe '#load_page_with_key_press' do
|
201
|
+
it 'load page'
|
202
|
+
end
|
203
|
+
|
204
|
+
describe '#path' do
|
205
|
+
it 'is not be empty' do
|
206
|
+
browser.path.should_not be_empty
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
describe '#large_preferences_path' do
|
211
|
+
it 'is not be empty' do
|
212
|
+
browser.large_preferences_path.should_not be_empty
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
describe '#small_preferences_path' do
|
217
|
+
it 'returns path' do
|
218
|
+
browser.small_preferences_path.should_not be_empty
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
222
|
+
describe '#cache_preferences_path' do
|
223
|
+
it 'returns path' do
|
224
|
+
browser.cache_preferences_path.should_not be_empty
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
describe '#mac?' do
|
229
|
+
end
|
230
|
+
|
231
|
+
describe '#linux?' do
|
232
|
+
end
|
233
|
+
|
234
|
+
describe '#driver' do
|
235
|
+
end
|
236
|
+
|
237
|
+
# @private
|
238
|
+
# Special method to access the driver
|
239
|
+
#attr_reader :driver
|
240
|
+
|
241
|
+
describe '#clear_all_private_data' do
|
242
|
+
it 'clears private data'
|
243
|
+
end
|
244
|
+
|
245
|
+
describe '#clear_history' do
|
246
|
+
it 'clears history'
|
247
|
+
end
|
248
|
+
|
249
|
+
describe '#clear_cache' do
|
250
|
+
it 'clears cache'
|
251
|
+
end
|
252
|
+
|
253
|
+
describe '#close_all_tabs' do
|
254
|
+
it 'closes all tabs except last' do
|
255
|
+
browser.close_all_tabs
|
256
|
+
browser.open_pages.should have(1).item
|
257
|
+
end
|
258
|
+
end
|
259
|
+
|
260
|
+
describe '#reset_prefs' do
|
261
|
+
it 'resets prefs'
|
262
|
+
end
|
263
|
+
|
264
|
+
describe '#delete_profile' do
|
265
|
+
it 'deletes profile' do
|
266
|
+
|
267
|
+
end
|
268
|
+
it 'doesn\'t delete main profile'
|
269
|
+
end
|
270
|
+
|
271
|
+
describe '#set_preference' do
|
272
|
+
it 'sets preference' do
|
273
|
+
browser.set_preference("User Prefs", "Speed Dial State", 0)
|
274
|
+
end
|
275
|
+
end
|
276
|
+
|
277
|
+
describe '#get_preference' do
|
278
|
+
it 'returns string' do
|
279
|
+
browser.get_preference("User Prefs", "Speed Dial State").should be_kind_of String
|
280
|
+
end
|
281
|
+
end
|
282
|
+
|
283
|
+
describe '#get_default_preference' do
|
284
|
+
it 'gets default value of preference'
|
285
|
+
end
|
286
|
+
|
287
|
+
# Gets the parent widget name of which there is none here
|
288
|
+
#describe "#parent_widget" do
|
289
|
+
# it "is nil" do
|
290
|
+
# browser.parent_widget.should be_nil
|
291
|
+
# end
|
292
|
+
#end
|
293
|
+
|
294
|
+
#describe "#window_id" do
|
295
|
+
# it "is nil" do
|
296
|
+
# browser.window_id.should be_nil
|
297
|
+
# end
|
298
|
+
#end
|
299
|
+
end
|
300
|
+
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require File.expand_path('../../watirspec_desktophelper', __FILE__)
|
2
|
+
require File.expand_path('../shared/shared', __FILE__)
|
3
|
+
|
4
|
+
describe 'QuickAddressfield' do
|
5
|
+
|
6
|
+
let(:addressfield) { browser.quick_toolbar(:name, "Document Toolbar").quick_addressfield(:name, "tba_address_field") }
|
7
|
+
let(:unknown_addressfield) { browser.quick_toolbar(:name, "Document Toolbar").quick_addressfield(:name, "no_address_field") }
|
8
|
+
let(:widget) { browser.quick_toolbar(:name, "Document Toolbar").quick_addressfield(:name, "tba_address_field") }
|
9
|
+
|
10
|
+
subject { addressfield }
|
11
|
+
|
12
|
+
it_behaves_like "a widget"
|
13
|
+
it_behaves_like "an editfield"
|
14
|
+
|
15
|
+
describe '#load_page_with_url' do
|
16
|
+
it 'loads page' do
|
17
|
+
addressfield.load_page_with_url("opera:debug").should == "opera:debug"
|
18
|
+
end
|
19
|
+
it 'throws exception if unknown addressfield' do
|
20
|
+
expect { unknown_addressfield.highlighted_text }.to raise_error OperaWatir::Exceptions::UnknownObjectException
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '#text' do
|
25
|
+
its(:text) { should == "opera:debug" }
|
26
|
+
|
27
|
+
it 'throws exception if unknown addressfield' do
|
28
|
+
expect { unknown_addressfield.highlighted_text }.to raise_error OperaWatir::Exceptions::UnknownObjectException
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe '#visible_text' do
|
33
|
+
its(:visible_text) { should == "debug" }
|
34
|
+
|
35
|
+
it 'throws exception if unknown addressfield' do
|
36
|
+
expect { unknown_addressfield.highlighted_text }.to raise_error OperaWatir::Exceptions::UnknownObjectException
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
describe '#highlighted_text' do
|
41
|
+
its(:highlighted_text) { should == "" }
|
42
|
+
|
43
|
+
it 'throws exception if unknown addressfield' do
|
44
|
+
expect { unknown_addressfield.highlighted_text }.to raise_error OperaWatir::Exceptions::UnknownObjectException
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require File.expand_path('../../watirspec_desktophelper', __FILE__)
|
2
|
+
|
3
|
+
describe 'QuickButton' do
|
4
|
+
describe '#default?' do
|
5
|
+
end
|
6
|
+
|
7
|
+
describe '#open_window_with_click' do
|
8
|
+
end
|
9
|
+
|
10
|
+
describe '#change_page_with_click' do
|
11
|
+
end
|
12
|
+
|
13
|
+
describe '#close_window_with_click' do
|
14
|
+
it 'raises exception'
|
15
|
+
end
|
16
|
+
|
17
|
+
describe '#load_page_with_click' do
|
18
|
+
end
|
19
|
+
|
20
|
+
describe '#toggle_with_click' do
|
21
|
+
end
|
22
|
+
|
23
|
+
describe '#close_toolbar_with_click' do
|
24
|
+
end
|
25
|
+
|
26
|
+
describe '#expand_with_click' do
|
27
|
+
end
|
28
|
+
|
29
|
+
describe '#value' do
|
30
|
+
end
|
31
|
+
|
32
|
+
describe '#wait_for_enabled' do
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require File.expand_path('../../watirspec_desktophelper', __FILE__)
|
2
|
+
|
3
|
+
describe 'QuickWidget' do
|
4
|
+
describe '#open_window_with_hover' do
|
5
|
+
it 'opens window on hover' do
|
6
|
+
browser.quick_window(:name, "Browser Window").quick_toolbar(:name, "Pagebar").quick_tab(:pos, 0).open_window_with_hover.should > 0
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
describe '#type' do
|
11
|
+
end
|
12
|
+
|
13
|
+
describe '#verify_text' do
|
14
|
+
end
|
15
|
+
|
16
|
+
describe '#verify_includes_text' do
|
17
|
+
end
|
18
|
+
|
19
|
+
describe 'print_row' do
|
20
|
+
end
|
21
|
+
|
22
|
+
describe '#print_widget_info' do
|
23
|
+
end
|
24
|
+
|
25
|
+
describe '#focus_with_click' do
|
26
|
+
end
|
27
|
+
|
28
|
+
#describe '#element' do
|
29
|
+
#end
|
30
|
+
|
31
|
+
#describe '#drag_and_drop_on' do
|
32
|
+
#end
|
33
|
+
|
34
|
+
#describe '#parent_widget' do
|
35
|
+
#end
|
36
|
+
|
37
|
+
#describe '#row' do
|
38
|
+
#end
|
39
|
+
|
40
|
+
#describe '#col' do
|
41
|
+
#end
|
42
|
+
|
43
|
+
#def window_id
|
44
|
+
#end
|
45
|
+
|
46
|
+
#describe '#click' do
|
47
|
+
#end
|
48
|
+
|
49
|
+
#describe '#right_click' do
|
50
|
+
#end
|
51
|
+
|
52
|
+
#describe '#double_click' do
|
53
|
+
#end
|
54
|
+
|
55
|
+
#describe '#set_selector' do
|
56
|
+
#end
|
57
|
+
|
58
|
+
#describe '#find' do
|
59
|
+
#end
|
60
|
+
end
|