watir-webdriver 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. data/Rakefile +53 -31
  2. data/VERSION +1 -1
  3. data/lib/watir-webdriver.rb +6 -8
  4. data/lib/watir-webdriver/attribute_helper.rb +121 -0
  5. data/lib/watir-webdriver/browser.rb +13 -6
  6. data/lib/watir-webdriver/collections/element_collection.rb +21 -15
  7. data/lib/watir-webdriver/collections/table_row_collection.rb +11 -0
  8. data/lib/watir-webdriver/container.rb +17 -11
  9. data/lib/watir-webdriver/element.rb +201 -0
  10. data/lib/watir-webdriver/elements/button.rb +19 -2
  11. data/lib/watir-webdriver/elements/checkbox.rb +24 -4
  12. data/lib/watir-webdriver/elements/file_field.rb +24 -4
  13. data/lib/watir-webdriver/elements/font.rb +10 -11
  14. data/lib/watir-webdriver/elements/frame.rb +11 -3
  15. data/lib/watir-webdriver/elements/generated.rb +2491 -1313
  16. data/lib/watir-webdriver/elements/hidden.rb +16 -5
  17. data/lib/watir-webdriver/elements/input.rb +44 -5
  18. data/lib/watir-webdriver/elements/link.rb +6 -8
  19. data/lib/watir-webdriver/elements/radio.rb +25 -6
  20. data/lib/watir-webdriver/elements/{select_list.rb → select.rb} +8 -9
  21. data/lib/watir-webdriver/elements/text_field.rb +32 -3
  22. data/lib/watir-webdriver/html.rb +18 -0
  23. data/lib/watir-webdriver/html/generator.rb +112 -0
  24. data/lib/watir-webdriver/html/idl_sorter.rb +49 -0
  25. data/lib/watir-webdriver/html/spec_extractor.rb +111 -0
  26. data/lib/watir-webdriver/html/util.rb +31 -0
  27. data/lib/watir-webdriver/html/visitor.rb +186 -0
  28. data/lib/watir-webdriver/locators/element_locator.rb +4 -0
  29. data/lib/watir-webdriver/locators/text_field_locator.rb +2 -2
  30. data/lib/watir-webdriver/xpath_support.rb +3 -5
  31. data/lib/yard/handlers/watir.rb +57 -0
  32. data/spec/{base_element_spec.rb → element_spec.rb} +3 -2
  33. data/spec/input_spec.rb +65 -0
  34. data/spec/spec_helper.rb +9 -2
  35. data/spec/watirspec/area_spec.rb +9 -13
  36. data/spec/watirspec/areas_spec.rb +7 -1
  37. data/spec/watirspec/browser_spec.rb +68 -72
  38. data/spec/watirspec/button_spec.rb +16 -9
  39. data/spec/watirspec/buttons_spec.rb +11 -9
  40. data/spec/watirspec/checkbox_spec.rb +1 -1
  41. data/spec/watirspec/checkboxes_spec.rb +7 -1
  42. data/spec/watirspec/collections_spec.rb +18 -0
  43. data/spec/watirspec/dd_spec.rb +1 -1
  44. data/spec/watirspec/dds_spec.rb +7 -1
  45. data/spec/watirspec/del_spec.rb +141 -0
  46. data/spec/watirspec/dels_spec.rb +37 -0
  47. data/spec/watirspec/div_spec.rb +6 -22
  48. data/spec/watirspec/divs_spec.rb +8 -2
  49. data/spec/watirspec/dl_spec.rb +1 -1
  50. data/spec/watirspec/dls_spec.rb +7 -1
  51. data/spec/watirspec/dt_spec.rb +1 -1
  52. data/spec/watirspec/dts_spec.rb +7 -1
  53. data/spec/watirspec/element_spec.rb +11 -20
  54. data/spec/watirspec/em_spec.rb +1 -1
  55. data/spec/watirspec/ems_spec.rb +7 -1
  56. data/spec/watirspec/filefield_spec.rb +8 -11
  57. data/spec/watirspec/filefields_spec.rb +7 -1
  58. data/spec/watirspec/font_spec.rb +2 -2
  59. data/spec/watirspec/form_spec.rb +10 -18
  60. data/spec/watirspec/forms_spec.rb +7 -1
  61. data/spec/watirspec/frame_spec.rb +69 -73
  62. data/spec/watirspec/frames_spec.rb +15 -2
  63. data/spec/watirspec/hidden_spec.rb +1 -1
  64. data/spec/watirspec/hiddens_spec.rb +7 -1
  65. data/spec/watirspec/hn_spec.rb +1 -1
  66. data/spec/watirspec/hns_spec.rb +23 -27
  67. data/spec/watirspec/image_spec.rb +9 -15
  68. data/spec/watirspec/images_spec.rb +7 -1
  69. data/spec/watirspec/ins_spec.rb +142 -0
  70. data/spec/watirspec/inses_spec.rb +37 -0
  71. data/spec/watirspec/label_spec.rb +1 -1
  72. data/spec/watirspec/labels_spec.rb +7 -1
  73. data/spec/watirspec/li_spec.rb +1 -1
  74. data/spec/watirspec/lib/guards.rb +12 -12
  75. data/spec/watirspec/lib/implementation.rb +48 -0
  76. data/spec/watirspec/lib/watirspec.rb +17 -12
  77. data/spec/watirspec/link_spec.rb +6 -11
  78. data/spec/watirspec/links_spec.rb +1 -1
  79. data/spec/watirspec/lis_spec.rb +7 -1
  80. data/spec/watirspec/map_spec.rb +1 -1
  81. data/spec/watirspec/maps_spec.rb +7 -1
  82. data/spec/watirspec/meta_spec.rb +13 -15
  83. data/spec/watirspec/metas_spec.rb +6 -1
  84. data/spec/watirspec/ol_spec.rb +57 -59
  85. data/spec/watirspec/ols_spec.rb +10 -4
  86. data/spec/watirspec/option_spec.rb +50 -83
  87. data/spec/watirspec/p_spec.rb +1 -1
  88. data/spec/watirspec/pre_spec.rb +1 -1
  89. data/spec/watirspec/pres_spec.rb +7 -1
  90. data/spec/watirspec/ps_spec.rb +7 -1
  91. data/spec/watirspec/radio_spec.rb +9 -11
  92. data/spec/watirspec/radios_spec.rb +1 -1
  93. data/spec/watirspec/select_list_spec.rb +27 -40
  94. data/spec/watirspec/select_lists_spec.rb +1 -1
  95. data/spec/watirspec/span_spec.rb +1 -1
  96. data/spec/watirspec/spans_spec.rb +7 -1
  97. data/spec/watirspec/spec_helper.rb +1 -0
  98. data/spec/watirspec/strong_spec.rb +1 -1
  99. data/spec/watirspec/strongs_spec.rb +7 -1
  100. data/spec/watirspec/table_bodies_spec.rb +22 -10
  101. data/spec/watirspec/table_body_spec.rb +33 -40
  102. data/spec/watirspec/table_cell_spec.rb +1 -1
  103. data/spec/watirspec/table_cells_spec.rb +36 -15
  104. data/spec/watirspec/table_footer_spec.rb +43 -40
  105. data/spec/watirspec/table_footers_spec.rb +35 -19
  106. data/spec/watirspec/table_header_spec.rb +44 -39
  107. data/spec/watirspec/table_headers_spec.rb +37 -19
  108. data/spec/watirspec/table_row_spec.rb +13 -9
  109. data/spec/watirspec/table_rows_spec.rb +16 -6
  110. data/spec/watirspec/table_spec.rb +83 -62
  111. data/spec/watirspec/tables_spec.rb +7 -1
  112. data/spec/watirspec/text_field_spec.rb +4 -6
  113. data/spec/watirspec/text_fields_spec.rb +1 -1
  114. data/spec/watirspec/ul_spec.rb +1 -1
  115. data/spec/watirspec/uls_spec.rb +25 -22
  116. data/support/html5.html +89235 -0
  117. data/watir-webdriver.gemspec +31 -21
  118. metadata +52 -23
  119. data/TODO +0 -15
  120. data/lib/watir-webdriver/base_element.rb +0 -361
  121. data/lib/watir-webdriver/collections/buttons_collection.rb +0 -15
  122. data/lib/watir-webdriver/collections/table_rows_collection.rb +0 -16
  123. data/lib/watir-webdriver/collections/text_fields_collection.rb +0 -15
  124. data/lib/watir-webdriver/elements/headings.rb +0 -48
  125. data/support/html5/html5.idl +0 -1274
  126. data/support/html5/old/html5.idl +0 -962
  127. data/support/html5/old/html5_extras.idl +0 -145
  128. data/support/html5/watir_visitor.rb +0 -173
  129. data/support/yard_handlers.rb +0 -87
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- require File.dirname(__FILE__) + '/spec_helper'
2
+ require File.expand_path('spec_helper', File.dirname(__FILE__))
3
3
 
4
4
  describe "P" do
5
5
 
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- require File.dirname(__FILE__) + '/spec_helper'
2
+ require File.expand_path('spec_helper', File.dirname(__FILE__))
3
3
 
4
4
  describe "Pre" do
5
5
 
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- require File.dirname(__FILE__) + '/spec_helper'
2
+ require File.expand_path('spec_helper', File.dirname(__FILE__))
3
3
 
4
4
  describe "Pres" do
5
5
 
@@ -21,10 +21,16 @@ describe "Pres" do
21
21
 
22
22
  describe "#each" do
23
23
  it "iterates through pres correctly" do
24
+ count = 0
25
+
24
26
  browser.pres.each_with_index do |p, index|
25
27
  p.id.should == browser.pre(:index, index).id
26
28
  p.value.should == browser.pre(:index, index).value
29
+
30
+ count += 1
27
31
  end
32
+
33
+ count.should > 0
28
34
  end
29
35
  end
30
36
 
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- require File.dirname(__FILE__) + '/spec_helper'
2
+ require File.expand_path('spec_helper', File.dirname(__FILE__))
3
3
 
4
4
  describe "Ps" do
5
5
 
@@ -21,10 +21,16 @@ describe "Ps" do
21
21
 
22
22
  describe "#each" do
23
23
  it "iterates through ps correctly" do
24
+ count = 0
25
+
24
26
  browser.ps.each_with_index do |p, index|
25
27
  p.id.should == browser.p(:index, index).id
26
28
  p.value.should == browser.p(:index, index).value
29
+
30
+ count += 1
27
31
  end
32
+
33
+ count.should > 0
28
34
  end
29
35
  end
30
36
 
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- require File.dirname(__FILE__) + '/spec_helper'
2
+ require File.expand_path('spec_helper', File.dirname(__FILE__))
3
3
 
4
4
  describe "Radio" do
5
5
 
@@ -203,18 +203,16 @@ describe "Radio" do
203
203
  messages.should == ["clicked: new_user_newsletter_no", "clicked: new_user_newsletter_yes"]
204
204
  end
205
205
 
206
- bug "WTR-337", :watir do
207
- it "fires the onchange event" do
208
- browser.radio(:value, 'certainly').set
209
- messages.should == ["changed: new_user_newsletter"]
206
+ it "fires the onchange event" do
207
+ browser.radio(:value, 'certainly').set
208
+ messages.should == ["changed: new_user_newsletter"]
210
209
 
211
- browser.radio(:value, 'certainly').set
212
- messages.should == ["changed: new_user_newsletter"] # no event fired here - didn't change
210
+ browser.radio(:value, 'certainly').set
211
+ messages.should == ["changed: new_user_newsletter"] # no event fired here - didn't change
213
212
 
214
- browser.radio(:value, 'yes').set
215
- browser.radio(:value, 'certainly').set
216
- messages.should == ["changed: new_user_newsletter", "clicked: new_user_newsletter_yes", "changed: new_user_newsletter"]
217
- end
213
+ browser.radio(:value, 'yes').set
214
+ browser.radio(:value, 'certainly').set
215
+ messages.should == ["changed: new_user_newsletter", "clicked: new_user_newsletter_yes", "changed: new_user_newsletter"]
218
216
  end
219
217
 
220
218
  it "raises UnknownObjectException if the radio button doesn't exist" do
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- require File.dirname(__FILE__) + '/spec_helper'
2
+ require File.expand_path('spec_helper', File.dirname(__FILE__))
3
3
 
4
4
  describe "Radios" do
5
5
 
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- require File.dirname(__FILE__) + '/spec_helper'
2
+ require File.expand_path('spec_helper', File.dirname(__FILE__))
3
3
 
4
4
  describe "SelectList" do
5
5
 
@@ -160,7 +160,7 @@ describe "SelectList" do
160
160
  # The correct behaviour here needs to be discussed.
161
161
  #
162
162
 
163
- deviates_on :celerity do
163
+ not_compliant_on :webdriver do
164
164
  it "returns all the options as an Array" do
165
165
  browser.select_list(:name, "new_user_country").options.should == ["Denmark" ,"Norway" , "Sweden" , "United Kingdom", "USA", "Germany"]
166
166
  end
@@ -169,15 +169,10 @@ describe "SelectList" do
169
169
  deviates_on :webdriver do
170
170
  it "returns all the options as a collection of Options" do
171
171
  options = browser.select_list(:name, "new_user_country").options
172
+ options.should be_kind_of(OptionCollection)
172
173
  options.map { |opt| opt.text }.should == ["Denmark" ,"Norway" , "Sweden" , "United Kingdom", "USA", "Germany"]
173
174
  end
174
175
  end
175
-
176
- deviates_on :watir do # see also WTR-339
177
- it "returns all the options as an Array" do
178
- browser.select_list(:name, "new_user_country").options.should == ["Denmark" ,"Norway" , "Sweden" , "United Kingdom", "USA"]
179
- end
180
- end
181
176
  end
182
177
 
183
178
  describe "#selected_options" do
@@ -260,18 +255,16 @@ describe "SelectList" do
260
255
  browser.select_list(:name, "new_user_languages").selected_options.should == ["Danish", "Swedish"]
261
256
  end
262
257
 
263
- bug "WTR-362", :watir do
264
- it "selects multiple items using :name and a Regexp" do
265
- browser.select_list(:name, "new_user_languages").clear
266
- browser.select_list(:name, "new_user_languages").select(/ish/)
267
- browser.select_list(:name, "new_user_languages").selected_options.should == ["Danish", "English", "Swedish"]
268
- end
258
+ it "selects multiple items using :name and a Regexp" do
259
+ browser.select_list(:name, "new_user_languages").clear
260
+ browser.select_list(:name, "new_user_languages").select(/ish/)
261
+ browser.select_list(:name, "new_user_languages").selected_options.should == ["Danish", "English", "Swedish"]
262
+ end
269
263
 
270
- it "selects multiple items using :xpath" do
271
- browser.select_list(:xpath, "//select[@name='new_user_languages']").clear
272
- browser.select_list(:xpath, "//select[@name='new_user_languages']").select(/ish/)
273
- browser.select_list(:xpath, "//select[@name='new_user_languages']").selected_options.should == ["Danish", "English", "Swedish"]
274
- end
264
+ it "selects multiple items using :xpath" do
265
+ browser.select_list(:xpath, "//select[@name='new_user_languages']").clear
266
+ browser.select_list(:xpath, "//select[@name='new_user_languages']").select(/ish/)
267
+ browser.select_list(:xpath, "//select[@name='new_user_languages']").selected_options.should == ["Danish", "English", "Swedish"]
275
268
  end
276
269
 
277
270
  it "selects empty options" do
@@ -279,14 +272,12 @@ describe "SelectList" do
279
272
  browser.select_list(:id, "delete_user_username").selected_options.should == [""]
280
273
  end
281
274
 
282
- bug "WTR-363", :watir do
283
- it "returns the value selected" do
284
- browser.select_list(:name, "new_user_languages").select("Danish").should == "Danish"
285
- end
275
+ it "returns the value selected" do
276
+ browser.select_list(:name, "new_user_languages").select("Danish").should == "Danish"
277
+ end
286
278
 
287
- it "returns the first matching value if there are multiple matches" do
288
- browser.select_list(:name, "new_user_languages").select(/ish/).should == "Danish"
289
- end
279
+ it "returns the first matching value if there are multiple matches" do
280
+ browser.select_list(:name, "new_user_languages").select(/ish/).should == "Danish"
290
281
  end
291
282
 
292
283
  it "fires onchange event when selecting an item" do
@@ -294,15 +285,13 @@ describe "SelectList" do
294
285
  messages.should == ['changed language']
295
286
  end
296
287
 
297
- bug "WTR-364", :watir do
298
- it "doesn't fire onchange event when selecting an already selected item" do
299
- browser.select_list(:id, "new_user_languages").clear # removes the two pre-selected options
300
- browser.select_list(:id, "new_user_languages").select("English")
301
- messages.size.should == 3
288
+ it "doesn't fire onchange event when selecting an already selected item" do
289
+ browser.select_list(:id, "new_user_languages").clear # removes the two pre-selected options
290
+ browser.select_list(:id, "new_user_languages").select("English")
291
+ messages.size.should == 3
302
292
 
303
- browser.select_list(:id, "new_user_languages").select("English")
304
- messages.size.should == 3
305
- end
293
+ browser.select_list(:id, "new_user_languages").select("English")
294
+ messages.size.should == 3
306
295
  end
307
296
 
308
297
  it "raises NoValueFoundException if the option doesn't exist" do
@@ -319,12 +308,10 @@ describe "SelectList" do
319
308
  browser.select_list(:name, "new_user_languages").selected_options.should == %w[English]
320
309
  end
321
310
 
322
- bug "WTR-362", :watir do
323
- it "selects the items by value regexp" do
324
- browser.select_list(:name, "new_user_languages").clear
325
- browser.select_list(:name, "new_user_languages").select_value(/1|3/)
326
- browser.select_list(:name, "new_user_languages").selected_options.should == %w[Danish Norwegian]
327
- end
311
+ it "selects the items by value regexp" do
312
+ browser.select_list(:name, "new_user_languages").clear
313
+ browser.select_list(:name, "new_user_languages").select_value(/1|3/)
314
+ browser.select_list(:name, "new_user_languages").selected_options.should == %w[Danish Norwegian]
328
315
  end
329
316
 
330
317
  it "raises NoValueFoundException if the option doesn't exist" do
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- require File.dirname(__FILE__) + '/spec_helper'
2
+ require File.expand_path('spec_helper', File.dirname(__FILE__))
3
3
 
4
4
  describe "SelectLists" do
5
5
 
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- require File.dirname(__FILE__) + '/spec_helper'
2
+ require File.expand_path('spec_helper', File.dirname(__FILE__))
3
3
 
4
4
  describe "Span" do
5
5
 
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- require File.dirname(__FILE__) + '/spec_helper'
2
+ require File.expand_path('spec_helper', File.dirname(__FILE__))
3
3
 
4
4
  describe "Spans" do
5
5
 
@@ -21,10 +21,16 @@ describe "Spans" do
21
21
 
22
22
  describe "#each" do
23
23
  it "iterates through spans correctly" do
24
+ count = 0
25
+
24
26
  browser.spans.each_with_index do |s, index|
25
27
  s.id.should == browser.span(:index, index).id
26
28
  s.value.should == browser.span(:index, index).value
29
+
30
+ count += 1
27
31
  end
32
+
33
+ count.should > 0
28
34
  end
29
35
  end
30
36
 
@@ -6,6 +6,7 @@ end
6
6
 
7
7
  require "sinatra/base"
8
8
  require "#{File.dirname(__FILE__)}/lib/watirspec"
9
+ require "#{File.dirname(__FILE__)}/lib/implementation"
9
10
  require "#{File.dirname(__FILE__)}/lib/server"
10
11
  require "#{File.dirname(__FILE__)}/lib/spec_helper"
11
12
  require "#{File.dirname(__FILE__)}/lib/guards"
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- require File.dirname(__FILE__) + '/spec_helper'
2
+ require File.expand_path('spec_helper', File.dirname(__FILE__))
3
3
 
4
4
  describe "Strong" do
5
5
 
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- require File.dirname(__FILE__) + '/spec_helper'
2
+ require File.expand_path('spec_helper', File.dirname(__FILE__))
3
3
 
4
4
  describe "Strongs" do
5
5
 
@@ -21,11 +21,17 @@ describe "Strongs" do
21
21
 
22
22
  describe "#each" do
23
23
  it "iterates through divs correctly" do
24
+ count = 0
25
+
24
26
  browser.strongs.each_with_index do |s, index|
25
27
  strong = browser.strong(:index, index)
26
28
  s.id.should == strong.id
27
29
  s.class_name.should == strong.class_name
30
+
31
+ count += 1
28
32
  end
33
+
34
+ count.should > 0
29
35
  end
30
36
  end
31
37
 
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- require File.dirname(__FILE__) + '/spec_helper'
2
+ require File.expand_path('spec_helper', File.dirname(__FILE__))
3
3
 
4
4
  describe "TableBodies" do
5
5
 
@@ -28,18 +28,30 @@ describe "TableBodies" do
28
28
  end
29
29
 
30
30
  describe "#each" do
31
- it "iterates through table bodies correctly (table context)" do
32
- browser.tbodys.each_with_index do |body, index|
33
- body.id.should == browser.tbody(:index, index).id
34
- end
31
+ it "iterates through table bodies correctly (table context)" do
32
+ count = 0
33
+
34
+ browser.tbodys.each_with_index do |body, index|
35
+ body.id.should == browser.tbody(:index, index).id
36
+
37
+ count += 1
35
38
  end
36
39
 
37
- it "iterates through table bodies correctly (table context)" do
38
- table = browser.table(:index, 0)
39
- table.tbodys.each_with_index do |body, index|
40
- body.id.should == table.tbody(:index, index).id
41
- end
40
+ count.should > 0
41
+ end
42
+
43
+ it "iterates through table bodies correctly (table context)" do
44
+ table = browser.table(:index, 0)
45
+ count = 0
46
+
47
+ table.tbodys.each_with_index do |body, index|
48
+ body.id.should == table.tbody(:index, index).id
49
+
50
+ count += 1
42
51
  end
52
+
53
+ count.should > 0
43
54
  end
55
+ end
44
56
 
45
57
  end
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- require File.dirname(__FILE__) + '/spec_helper'
2
+ require File.expand_path('spec_helper', File.dirname(__FILE__))
3
3
 
4
4
  describe "TableBody" do
5
5
 
@@ -8,13 +8,11 @@ describe "TableBody" do
8
8
  end
9
9
 
10
10
  describe "#exists?" do
11
- bug "WTR-357", :watir do
12
- it "returns true if the table body exists (page context)" do
13
- browser.tbody(:id, 'first').should exist
14
- browser.tbody(:id, /first/).should exist
15
- browser.tbody(:index, 0).should exist
16
- browser.tbody(:xpath, "//tbody[@id='first']").should exist
17
- end
11
+ it "returns true if the table body exists (page context)" do
12
+ browser.tbody(:id, 'first').should exist
13
+ browser.tbody(:id, /first/).should exist
14
+ browser.tbody(:index, 0).should exist
15
+ browser.tbody(:xpath, "//tbody[@id='first']").should exist
18
16
  end
19
17
 
20
18
  it "returns true if the table body exists (table context)" do
@@ -24,13 +22,11 @@ describe "TableBody" do
24
22
  browser.table(:index, 0).tbody(:xpath, "//tbody[@id='first']").should exist
25
23
  end
26
24
 
27
- bug "WTR-357", :watir do
28
- it "returns false if the table body doesn't exist (page context)" do
29
- browser.tbody(:id, 'no_such_id').should_not exist
30
- browser.tbody(:id, /no_such_id/).should_not exist
31
- browser.tbody(:index, 1337).should_not exist
32
- browser.tbody(:xpath, "//tbody[@id='no_such_id']").should_not exist
33
- end
25
+ it "returns false if the table body doesn't exist (page context)" do
26
+ browser.tbody(:id, 'no_such_id').should_not exist
27
+ browser.tbody(:id, /no_such_id/).should_not exist
28
+ browser.tbody(:index, 1337).should_not exist
29
+ browser.tbody(:xpath, "//tbody[@id='no_such_id']").should_not exist
34
30
  end
35
31
 
36
32
  it "returns false if the table body doesn't exist (table context)" do
@@ -41,57 +37,54 @@ describe "TableBody" do
41
37
  end
42
38
 
43
39
  it "raises TypeError when 'what' argument is invalid" do
44
- bug "WTR-357", :watir do
45
- lambda { browser.tbody(:id, 3.14).exists? }.should raise_error(TypeError)
46
- end
40
+ lambda { browser.tbody(:id, 3.14).exists? }.should raise_error(TypeError)
47
41
  lambda { browser.table(:index, 0).tbody(:id, 3.14).exists? }.should raise_error(TypeError)
48
42
  end
49
43
 
50
44
  it "raises MissingWayOfFindingObjectException when 'how' argument is invalid" do
51
- bug "WTR-357", :watir do
52
- lambda { browser.tbody(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
53
- end
45
+ lambda { browser.tbody(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
54
46
  lambda { browser.table(:index, 0).tbody(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
55
47
  end
56
48
  end
57
49
 
58
- describe "#length" do
59
- bug "WTR-357", :watir do
50
+ bug "http://github.com/jarib/watir-webdriver/issues/#issue/2", :webdriver do
51
+ describe "#length" do
60
52
  it "returns the correct number of table bodies (page context)" do
61
53
  browser.tbody(:id, 'first').length.should == 3
62
54
  end
63
- end
64
55
 
65
- it "returns the correct number of table bodies (table context)" do
66
- browser.table(:index, 0).tbody(:id, 'first').length.should == 3
56
+ it "returns the correct number of table bodies (table context)" do
57
+ browser.table(:index, 0).tbody(:id, 'first').length.should == 3
58
+ end
67
59
  end
68
60
  end
69
61
 
70
- describe "#[]" do
71
- bug "WTR-357", :watir do
62
+ bug "http://github.com/jarib/watir-webdriver/issues/#issue/2", :webdriver do
63
+ describe "#[]" do
72
64
  it "returns the row at the given index (page context)" do
73
65
  browser.tbody(:id, 'first')[0].text.should == 'March 2008'
74
66
  browser.tbody(:id, 'first')[1][0].text.should == 'Gregory House'
75
67
  browser.tbody(:id, 'first')[2][0].text.should == 'Hugh Laurie'
76
68
  end
77
- end
78
69
 
79
- it "returns the row at the given index (table context)" do
80
- browser.table(:index, 0).tbody(:id, 'first')[0].text.should == 'March 2008'
81
- browser.table(:index, 0).tbody(:id, 'first')[1][0].text.should == 'Gregory House'
82
- browser.table(:index, 0).tbody(:id, 'first')[2][0].text.should == 'Hugh Laurie'
70
+ it "returns the row at the given index (table context)" do
71
+ browser.table(:index, 0).tbody(:id, 'first')[0].text.should == 'March 2008'
72
+ browser.table(:index, 0).tbody(:id, 'first')[1][0].text.should == 'Gregory House'
73
+ browser.table(:index, 0).tbody(:id, 'first')[2][0].text.should == 'Hugh Laurie'
74
+ end
83
75
  end
84
76
  end
85
77
 
86
- describe "#each" do
87
- it "iterates through rows correctly" do
88
- body = browser.table(:index, 0).tbody(:id, 'first')
89
- expected_texts = ["march", "gregory", "hugh"]
78
+ bug "http://github.com/jarib/watir-webdriver/issues/#issue/2", :webdriver do
79
+ describe "#each" do
80
+ it "iterates through rows correctly" do
81
+ body = browser.table(:index, 0).tbody(:id, 'first')
82
+ expected_texts = ["march", "gregory", "hugh"]
90
83
 
91
- body.each_with_index do |row, idx|
92
- row.id.should == expected_texts[idx]
84
+ body.each_with_index do |row, idx|
85
+ row.id.should == expected_texts[idx]
86
+ end
93
87
  end
94
-
95
88
  end
96
89
  end
97
90