operawatir 0.4.1.pre5-jruby → 0.4.1.pre6-jruby

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. data/AUTHORS +1 -0
  2. data/CHANGES +170 -3
  3. data/README.md +30 -27
  4. data/VERSION +1 -1
  5. data/bin/desktopwatir +19 -16
  6. data/bin/operawatir +4 -4
  7. data/lib/operadriver/client-combined-nodeps.jar +0 -0
  8. data/lib/operadriver/webdriver-opera.jar +0 -0
  9. data/lib/operawatir/browser.rb +1 -2
  10. data/lib/operawatir/collection.rb +1 -1
  11. data/lib/operawatir/compat/collection.rb +13 -0
  12. data/lib/operawatir/compat/element.rb +57 -15
  13. data/lib/operawatir/compat/window.rb +41 -0
  14. data/lib/operawatir/desktop_browser.rb +26 -9
  15. data/lib/operawatir/desktop_container.rb +82 -29
  16. data/lib/operawatir/element.rb +48 -24
  17. data/lib/operawatir/keys.rb +18 -25
  18. data/lib/operawatir/preferences.rb +223 -6
  19. data/lib/operawatir/quickwidgets/quick_button.rb +8 -2
  20. data/lib/operawatir/quickwidgets/quick_checkbox.rb +4 -4
  21. data/lib/operawatir/quickwidgets/quick_editfield.rb +1 -1
  22. data/lib/operawatir/quickwidgets/quick_find.rb +11 -0
  23. data/lib/operawatir/quickwidgets/quick_griditem.rb +11 -0
  24. data/lib/operawatir/quickwidgets/quick_gridlayout.rb +11 -0
  25. data/lib/operawatir/quickwidgets/quick_searchfield.rb +5 -1
  26. data/lib/operawatir/quickwidgets/quick_tab.rb +0 -1
  27. data/lib/operawatir/quickwidgets/quick_treeitem.rb +22 -1
  28. data/lib/operawatir/quickwidgets/quick_widget.rb +61 -22
  29. data/lib/operawatir/quickwidgets/quick_window.rb +26 -0
  30. data/lib/operawatir/quickwidgets.rb +2 -1
  31. data/lib/operawatir/window.rb +36 -25
  32. data/lib/operawatir.rb +1 -1
  33. data/operawatir.gemspec +38 -5
  34. data/spec/operawatir/core/element_spec.rb +5 -0
  35. data/spec/operawatir/core/window_spec.rb +42 -0
  36. data/spec/operawatir/desktop/desktopbrowser_spec.rb +16 -0
  37. data/spec/operawatir/desktop/quickaddressfield_spec.rb +15 -3
  38. data/spec/operawatir/desktop/quickbutton_spec.rb +234 -20
  39. data/spec/operawatir/desktop/quickcheckbox_spec.rb +36 -0
  40. data/spec/operawatir/desktop/quickdialogtab_spec.rb +30 -0
  41. data/spec/operawatir/desktop/quickdropdown_spec.rb +39 -0
  42. data/spec/operawatir/desktop/quickeditfield_spec.rb +51 -0
  43. data/spec/operawatir/desktop/quickfind_spec.rb +30 -0
  44. data/spec/operawatir/desktop/quickgriditem_spec.rb +16 -0
  45. data/spec/operawatir/desktop/quickgridlayout_spec.rb +15 -0
  46. data/spec/operawatir/desktop/quicklabel_spec.rb +28 -0
  47. data/spec/operawatir/desktop/quickradiobutton_spec.rb +24 -0
  48. data/spec/operawatir/desktop/quicksearchfield_spec.rb +26 -0
  49. data/spec/operawatir/desktop/quicktab_spec.rb +86 -0
  50. data/spec/operawatir/desktop/quickthumbnail_spec.rb +37 -0
  51. data/spec/operawatir/desktop/quicktreeitem_spec.rb +135 -0
  52. data/spec/operawatir/desktop/quicktreeview_spec.rb +30 -0
  53. data/spec/operawatir/desktop/quickwidget_spec.rb +52 -11
  54. data/spec/operawatir/desktop/quickwindow_spec.rb +11 -0
  55. data/spec/operawatir/desktop/shared/shared.rb +100 -10
  56. data/spec/operawatir/fixtures/browsers.svg +367 -0
  57. data/spec/operawatir/fixtures/frames.html +13 -0
  58. data/spec/watir2/select_list_spec.rb +84 -71
  59. metadata +37 -4
  60. data/lib/operadriver/selenium-common.jar +0 -0
@@ -0,0 +1,13 @@
1
+ <!doctype html>
2
+ <html>
3
+ <meta charset="utf-8" />
4
+ <title>Frames</title>
5
+
6
+ <p>
7
+ foobar
8
+ </p>
9
+
10
+ <iframe name="test" src="paragraphs.html">
11
+ Your browser does not support frames.
12
+ </iframe>
13
+ </html>
@@ -14,21 +14,18 @@ describe "SelectList" do
14
14
  browser.select_list(:id, /new_user_country/).should exist
15
15
  browser.select_list(:name, 'new_user_country').should exist
16
16
  browser.select_list(:name, /new_user_country/).should exist
17
- # TODO: check behaviour in Watir
18
- # browser.select_list(:value, 'Norway').should exist
19
- # browser.select_list(:value, /Norway/).should exist
20
- browser.select_list(:text, 'Norway').should exist
21
- browser.select_list(:text, /Norway/).should exist
17
+
18
+ not_compliant_on :webdriver do
19
+ browser.select_list(:text, 'Norway').should exist
20
+ browser.select_list(:text, /Norway/).should exist
21
+ end
22
+
22
23
  browser.select_list(:class, 'country').should exist
23
24
  browser.select_list(:class, /country/).should exist
24
- browser.select_list(:index, 1).should exist
25
+ browser.select_list(:index, 0).should exist
25
26
  browser.select_list(:xpath, "//select[@id='new_user_country']").should exist
26
27
  end
27
28
 
28
- it "returns true if the element exists (default how = :name)" do
29
- browser.select_list("new_user_country").should exist
30
- end
31
-
32
29
  it "returns the first select if given no args" do
33
30
  browser.select_list.should exist
34
31
  end
@@ -70,7 +67,7 @@ describe "SelectList" do
70
67
 
71
68
  describe "#id" do
72
69
  it "returns the id of the element" do
73
- browser.select_list(:index, 1).id.should == "new_user_country"
70
+ browser.select_list(:index, 0).id.should == "new_user_country"
74
71
  end
75
72
 
76
73
  it "raises UnknownObjectException if the select list doesn't exist" do
@@ -80,7 +77,7 @@ describe "SelectList" do
80
77
 
81
78
  describe "#name" do
82
79
  it "returns the name of the element" do
83
- browser.select_list(:index, 1).name.should == "new_user_country"
80
+ browser.select_list(:index, 0).name.should == "new_user_country"
84
81
  end
85
82
 
86
83
  it "raises UnknownObjectException if the select list doesn't exist" do
@@ -88,22 +85,22 @@ describe "SelectList" do
88
85
  end
89
86
  end
90
87
 
91
- describe "#type" do
92
- it "returns the type of the element" do
93
- browser.select_list(:index, 1).type.should == "select-one"
94
- browser.select_list(:index, 2).type.should == "select-multiple"
88
+ describe "#multiple?" do
89
+ it "knows whether the select list allows multiple slections" do
90
+ browser.select_list(:index, 0).should_not be_multiple
91
+ browser.select_list(:index, 1).should be_multiple
95
92
  end
96
93
 
97
94
  it "raises UnknownObjectException if the select list doesn't exist" do
98
- lambda { browser.select_list(:index, 1337).type }.should raise_error(UnknownObjectException)
95
+ lambda { browser.select_list(:index, 1337).multiple? }.should raise_error(UnknownObjectException)
99
96
  end
100
97
  end
101
98
 
102
99
  describe "#value" do
103
100
  it "returns the value of the selected option" do
104
- browser.select_list(:index, 1).value.should == "2"
105
- browser.select_list(:index, 1).select(/Sweden/)
106
- browser.select_list(:index, 1).value.should == "3"
101
+ browser.select_list(:index, 0).value.should == "2"
102
+ browser.select_list(:index, 0).select(/Sweden/)
103
+ browser.select_list(:index, 0).value.should == "3"
107
104
  end
108
105
 
109
106
  it "raises UnknownObjectException if the select list doesn't exist" do
@@ -113,11 +110,10 @@ describe "SelectList" do
113
110
 
114
111
  describe "#respond_to?" do
115
112
  it "returns true for all attribute methods" do
116
- browser.select_list(:index, 1).should respond_to(:class_name)
117
- browser.select_list(:index, 1).should respond_to(:id)
118
- browser.select_list(:index, 1).should respond_to(:name)
119
- browser.select_list(:index, 1).should respond_to(:type)
120
- browser.select_list(:index, 1).should respond_to(:value)
113
+ browser.select_list(:index, 0).should respond_to(:class_name)
114
+ browser.select_list(:index, 0).should respond_to(:id)
115
+ browser.select_list(:index, 0).should respond_to(:name)
116
+ browser.select_list(:index, 0).should respond_to(:value)
121
117
  end
122
118
  end
123
119
 
@@ -138,14 +134,14 @@ describe "SelectList" do
138
134
 
139
135
  describe "#disabled?" do
140
136
  it "returns true if the select list is disabled" do
141
- browser.select_list(:index, 3).should be_disabled
137
+ browser.select_list(:index, 2).should be_disabled
142
138
  end
143
139
 
144
140
  it "returns false if the select list is enabled" do
145
- browser.select_list(:index, 1).should_not be_disabled
141
+ browser.select_list(:index, 0).should_not be_disabled
146
142
  end
147
143
 
148
- it "shoulds raise UnknownObjectException when the select list does not exist" do
144
+ it "should raise UnknownObjectException when the select list does not exist" do
149
145
  lambda { browser.select_list(:index, 1337).disabled? }.should raise_error(UnknownObjectException)
150
146
  end
151
147
  end
@@ -160,19 +156,31 @@ describe "SelectList" do
160
156
  end
161
157
 
162
158
  describe "#options" do
163
- it "shoulds raise UnknownObjectException if the select list doesn't exist" do
159
+ it "should raise UnknownObjectException if the select list doesn't exist" do
164
160
  lambda { browser.select_list(:name, 'no_such_name').options }.should raise_error(UnknownObjectException)
165
161
  end
166
162
 
167
- bug "WTR-339", :watir do
163
+ #
164
+ # The correct behaviour here needs to be discussed.
165
+ #
166
+
167
+ not_compliant_on :webdriver do
168
168
  it "returns all the options as an Array" do
169
- browser.select_list(:name, "new_user_country").options.should == ["Denmark" ,"Norway" , "Sweden" , "United Kingdom", "USA", "Germany"]
169
+ browser.select_list(:name, "new_user_country").options.should == ["Denmark", "Norway", "Sweden", "United Kingdom", "USA", "Germany"]
170
+ end
171
+ end
172
+
173
+ deviates_on :webdriver do
174
+ it "returns all the options as a collection of Options" do
175
+ options = browser.select_list(:name, "new_user_country").options
176
+ options.should be_kind_of(OptionCollection)
177
+ options.map { |opt| opt.text }.should == ["Denmark", "Norway", "Sweden", "United Kingdom", "USA", "Germany"]
170
178
  end
171
179
  end
172
180
  end
173
181
 
174
182
  describe "#selected_options" do
175
- it "shoulds raise UnknownObjectException if the select list doesn't exist" do
183
+ it "should raise UnknownObjectException if the select list doesn't exist" do
176
184
  lambda { browser.select_list(:name, 'no_such_name').selected_options }.should raise_error(UnknownObjectException)
177
185
  end
178
186
 
@@ -189,7 +197,7 @@ describe "SelectList" do
189
197
  end
190
198
 
191
199
  it "does not clear selections when not possible" do
192
- browser.select_list(:name , "new_user_country").clear
200
+ lambda { browser.select_list(:name, "new_user_country").clear }.should raise_error
193
201
  browser.select_list(:name, "new_user_country").selected_options.should == ["Norway"]
194
202
  end
195
203
 
@@ -198,24 +206,24 @@ describe "SelectList" do
198
206
  end
199
207
  end
200
208
 
201
- describe "#includes?" do
209
+ describe "#include?" do
202
210
  it "returns true if the given option exists" do
203
- browser.select_list(:name, 'new_user_country').includes?('Denmark').should be_true
211
+ browser.select_list(:name, 'new_user_country').should include('Denmark')
204
212
  end
205
213
 
206
214
  it "returns false if the given option doesn't exist" do
207
- browser.select_list(:name, 'new_user_country').includes?('Ireland').should be_false
215
+ browser.select_list(:name, 'new_user_country').should_not include('Ireland')
208
216
  end
209
217
  end
210
218
 
211
219
  describe "#selected?" do
212
220
  it "returns true if the given option is selected" do
213
221
  browser.select_list(:name, 'new_user_country').select('Denmark')
214
- browser.select_list(:name, 'new_user_country').selected?('Denmark').should be_true
222
+ browser.select_list(:name, 'new_user_country').should be_selected('Denmark')
215
223
  end
216
224
 
217
225
  it "returns false if the given option is not selected" do
218
- browser.select_list(:name, 'new_user_country').selected?('Sweden').should be_false
226
+ browser.select_list(:name, 'new_user_country').should_not be_selected('Sweden')
219
227
  end
220
228
 
221
229
  it "raises UnknonwObjectException if the option doesn't exist" do
@@ -251,18 +259,16 @@ describe "SelectList" do
251
259
  browser.select_list(:name, "new_user_languages").selected_options.should == ["Danish", "Swedish"]
252
260
  end
253
261
 
254
- bug "WTR-362", :watir do
255
- it "selects multiple items using :name and a Regexp" do
256
- browser.select_list(:name, "new_user_languages").clear
257
- browser.select_list(:name, "new_user_languages").select(/ish/)
258
- browser.select_list(:name, "new_user_languages").selected_options.should == ["Danish", "English", "Swedish"]
259
- end
262
+ it "selects multiple items using :name and a Regexp" do
263
+ browser.select_list(:name, "new_user_languages").clear
264
+ browser.select_list(:name, "new_user_languages").select(/ish/)
265
+ browser.select_list(:name, "new_user_languages").selected_options.should == ["Danish", "English", "Swedish"]
266
+ end
260
267
 
261
- it "selects multiple items using :xpath" do
262
- browser.select_list(:xpath, "//select[@name='new_user_languages']").clear
263
- browser.select_list(:xpath, "//select[@name='new_user_languages']").select(/ish/)
264
- browser.select_list(:xpath, "//select[@name='new_user_languages']").selected_options.should == ["Danish", "English", "Swedish"]
265
- end
268
+ it "selects multiple items using :xpath" do
269
+ browser.select_list(:xpath, "//select[@name='new_user_languages']").clear
270
+ browser.select_list(:xpath, "//select[@name='new_user_languages']").select(/ish/)
271
+ browser.select_list(:xpath, "//select[@name='new_user_languages']").selected_options.should == ["Danish", "English", "Swedish"]
266
272
  end
267
273
 
268
274
  it "selects empty options" do
@@ -270,14 +276,12 @@ describe "SelectList" do
270
276
  browser.select_list(:id, "delete_user_username").selected_options.should == [""]
271
277
  end
272
278
 
273
- bug "WTR-363", :watir do
274
- it "returns the value selected" do
275
- browser.select_list(:name, "new_user_languages").select("Danish").should == "Danish"
276
- end
279
+ it "returns the value selected" do
280
+ browser.select_list(:name, "new_user_languages").select("Danish").should == "Danish"
281
+ end
277
282
 
278
- it "returns the first matching value if there are multiple matches" do
279
- browser.select_list(:name, "new_user_languages").select(/ish/).should == "Danish"
280
- end
283
+ it "returns the first matching value if there are multiple matches" do
284
+ browser.select_list(:name, "new_user_languages").select(/ish/).should == "Danish"
281
285
  end
282
286
 
283
287
  it "fires onchange event when selecting an item" do
@@ -285,23 +289,34 @@ describe "SelectList" do
285
289
  messages.should == ['changed language']
286
290
  end
287
291
 
288
- bug "WTR-364", :watir do
289
- it "doesn't fire onchange event when selecting an already selected item" do
290
- browser.select_list(:id, "new_user_languages").clear # removes the two pre-selected options
291
- browser.select_list(:id, "new_user_languages").select("English")
292
- messages.size.should == 3
292
+ it "doesn't fire onchange event when selecting an already selected item" do
293
+ browser.select_list(:id, "new_user_languages").clear # removes the two pre-selected options
294
+ browser.select_list(:id, "new_user_languages").select("English")
295
+ messages.size.should == 3
293
296
 
294
- browser.select_list(:id, "new_user_languages").select("English")
295
- messages.size.should == 3
296
- end
297
+ browser.select_list(:id, "new_user_languages").select("English")
298
+ messages.size.should == 3
299
+ end
300
+
301
+ it "returns the text of the selected option" do
302
+ browser.select_list(:id, "new_user_languages").select("English").should == "English"
303
+ end
304
+
305
+ it "returns an empty string when selecting an option that disappears when selected" do
306
+ browser.select_list(:id, 'obsolete').select('sweden').should == ''
297
307
  end
298
308
 
299
309
  it "raises NoValueFoundException if the option doesn't exist" do
300
310
  lambda { browser.select_list(:name, "new_user_country").select("missing_option") }.should raise_error(NoValueFoundException)
301
311
  lambda { browser.select_list(:name, "new_user_country").select(/missing_option/) }.should raise_error(NoValueFoundException)
302
312
  end
303
- end
304
313
 
314
+ it "raises a TypeError if argument is not a String, Regexp or Numeric" do
315
+ lambda { browser.select_list(:id, "new_user_languages").select([]) }.should raise_error(TypeError)
316
+ end
317
+ end
318
+
319
+ # deprecate?
305
320
  describe "#select_value" do
306
321
  it "selects the item by value string" do
307
322
  browser.select_list(:name, "new_user_languages").clear
@@ -309,12 +324,10 @@ describe "SelectList" do
309
324
  browser.select_list(:name, "new_user_languages").selected_options.should == %w[English]
310
325
  end
311
326
 
312
- bug "WTR-362", :watir do
313
- it "selects the items by value regexp" do
314
- browser.select_list(:name, "new_user_languages").clear
315
- browser.select_list(:name, "new_user_languages").select_value(/1|3/)
316
- browser.select_list(:name, "new_user_languages").selected_options.should == %w[Danish Norwegian]
317
- end
327
+ it "selects the items by value regexp" do
328
+ browser.select_list(:name, "new_user_languages").clear
329
+ browser.select_list(:name, "new_user_languages").select_value(/1|3/)
330
+ browser.select_list(:name, "new_user_languages").selected_options.should == %w[Danish Norwegian]
318
331
  end
319
332
 
320
333
  it "raises NoValueFoundException if the option doesn't exist" do
metadata CHANGED
@@ -6,8 +6,8 @@ version: !ruby/object:Gem::Version
6
6
  - 0
7
7
  - 4
8
8
  - 1
9
- - pre5
10
- version: 0.4.1.pre5
9
+ - pre6
10
+ version: 0.4.1.pre6
11
11
  platform: jruby
12
12
  authors:
13
13
  - Andreas Tolf Tolfsen
@@ -18,7 +18,7 @@ autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
20
 
21
- date: 2011-03-18 00:00:00 +01:00
21
+ date: 2011-05-09 00:00:00 +02:00
22
22
  default_executable:
23
23
  dependencies:
24
24
  - !ruby/object:Gem::Dependency
@@ -295,10 +295,10 @@ files:
295
295
  - bin/operawatir
296
296
  - lib/operadriver/APACHE_2.0_LICENSE.txt
297
297
  - lib/operadriver/NEW_BSD_LICENSE.txt
298
+ - lib/operadriver/client-combined-nodeps.jar
298
299
  - lib/operadriver/commons-io-2.0.1.jar
299
300
  - lib/operadriver/commons-jxpath-1.3.jar
300
301
  - lib/operadriver/protobuf-java-2.3.0.jar
301
- - lib/operadriver/selenium-common.jar
302
302
  - lib/operadriver/webdriver-opera.jar
303
303
  - lib/operawatir.rb
304
304
  - lib/operawatir/browser.rb
@@ -330,6 +330,9 @@ files:
330
330
  - lib/operawatir/quickwidgets/quick_dialogtab.rb
331
331
  - lib/operawatir/quickwidgets/quick_dropdown.rb
332
332
  - lib/operawatir/quickwidgets/quick_editfield.rb
333
+ - lib/operawatir/quickwidgets/quick_find.rb
334
+ - lib/operawatir/quickwidgets/quick_griditem.rb
335
+ - lib/operawatir/quickwidgets/quick_gridlayout.rb
333
336
  - lib/operawatir/quickwidgets/quick_label.rb
334
337
  - lib/operawatir/quickwidgets/quick_radiobutton.rb
335
338
  - lib/operawatir/quickwidgets/quick_searchfield.rb
@@ -368,10 +371,26 @@ files:
368
371
  - spec/operawatir/desktop/desktopbrowser_spec.rb
369
372
  - spec/operawatir/desktop/quickaddressfield_spec.rb
370
373
  - spec/operawatir/desktop/quickbutton_spec.rb
374
+ - spec/operawatir/desktop/quickcheckbox_spec.rb
375
+ - spec/operawatir/desktop/quickdialogtab_spec.rb
376
+ - spec/operawatir/desktop/quickdropdown_spec.rb
377
+ - spec/operawatir/desktop/quickeditfield_spec.rb
378
+ - spec/operawatir/desktop/quickfind_spec.rb
379
+ - spec/operawatir/desktop/quickgriditem_spec.rb
380
+ - spec/operawatir/desktop/quickgridlayout_spec.rb
381
+ - spec/operawatir/desktop/quicklabel_spec.rb
382
+ - spec/operawatir/desktop/quickradiobutton_spec.rb
383
+ - spec/operawatir/desktop/quicksearchfield_spec.rb
384
+ - spec/operawatir/desktop/quicktab_spec.rb
385
+ - spec/operawatir/desktop/quickthumbnail_spec.rb
386
+ - spec/operawatir/desktop/quicktreeitem_spec.rb
387
+ - spec/operawatir/desktop/quicktreeview_spec.rb
371
388
  - spec/operawatir/desktop/quickwidget_spec.rb
372
389
  - spec/operawatir/desktop/quickwindow_spec.rb
373
390
  - spec/operawatir/desktop/shared/shared.rb
374
391
  - spec/operawatir/fixtures/boxes.html
392
+ - spec/operawatir/fixtures/browsers.svg
393
+ - spec/operawatir/fixtures/frames.html
375
394
  - spec/operawatir/fixtures/grid.html
376
395
  - spec/operawatir/fixtures/input_fields_value.html
377
396
  - spec/operawatir/fixtures/onclick.html
@@ -562,6 +581,20 @@ test_files:
562
581
  - spec/operawatir/desktop/desktopbrowser_spec.rb
563
582
  - spec/operawatir/desktop/quickaddressfield_spec.rb
564
583
  - spec/operawatir/desktop/quickbutton_spec.rb
584
+ - spec/operawatir/desktop/quickcheckbox_spec.rb
585
+ - spec/operawatir/desktop/quickdialogtab_spec.rb
586
+ - spec/operawatir/desktop/quickdropdown_spec.rb
587
+ - spec/operawatir/desktop/quickeditfield_spec.rb
588
+ - spec/operawatir/desktop/quickfind_spec.rb
589
+ - spec/operawatir/desktop/quickgriditem_spec.rb
590
+ - spec/operawatir/desktop/quickgridlayout_spec.rb
591
+ - spec/operawatir/desktop/quicklabel_spec.rb
592
+ - spec/operawatir/desktop/quickradiobutton_spec.rb
593
+ - spec/operawatir/desktop/quicksearchfield_spec.rb
594
+ - spec/operawatir/desktop/quicktab_spec.rb
595
+ - spec/operawatir/desktop/quickthumbnail_spec.rb
596
+ - spec/operawatir/desktop/quicktreeitem_spec.rb
597
+ - spec/operawatir/desktop/quicktreeview_spec.rb
565
598
  - spec/operawatir/desktop/quickwidget_spec.rb
566
599
  - spec/operawatir/desktop/quickwindow_spec.rb
567
600
  - spec/operawatir/desktop/shared/shared.rb
Binary file