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.
- data/Rakefile +53 -31
- data/VERSION +1 -1
- data/lib/watir-webdriver.rb +6 -8
- data/lib/watir-webdriver/attribute_helper.rb +121 -0
- data/lib/watir-webdriver/browser.rb +13 -6
- data/lib/watir-webdriver/collections/element_collection.rb +21 -15
- data/lib/watir-webdriver/collections/table_row_collection.rb +11 -0
- data/lib/watir-webdriver/container.rb +17 -11
- data/lib/watir-webdriver/element.rb +201 -0
- data/lib/watir-webdriver/elements/button.rb +19 -2
- data/lib/watir-webdriver/elements/checkbox.rb +24 -4
- data/lib/watir-webdriver/elements/file_field.rb +24 -4
- data/lib/watir-webdriver/elements/font.rb +10 -11
- data/lib/watir-webdriver/elements/frame.rb +11 -3
- data/lib/watir-webdriver/elements/generated.rb +2491 -1313
- data/lib/watir-webdriver/elements/hidden.rb +16 -5
- data/lib/watir-webdriver/elements/input.rb +44 -5
- data/lib/watir-webdriver/elements/link.rb +6 -8
- data/lib/watir-webdriver/elements/radio.rb +25 -6
- data/lib/watir-webdriver/elements/{select_list.rb → select.rb} +8 -9
- data/lib/watir-webdriver/elements/text_field.rb +32 -3
- data/lib/watir-webdriver/html.rb +18 -0
- data/lib/watir-webdriver/html/generator.rb +112 -0
- data/lib/watir-webdriver/html/idl_sorter.rb +49 -0
- data/lib/watir-webdriver/html/spec_extractor.rb +111 -0
- data/lib/watir-webdriver/html/util.rb +31 -0
- data/lib/watir-webdriver/html/visitor.rb +186 -0
- data/lib/watir-webdriver/locators/element_locator.rb +4 -0
- data/lib/watir-webdriver/locators/text_field_locator.rb +2 -2
- data/lib/watir-webdriver/xpath_support.rb +3 -5
- data/lib/yard/handlers/watir.rb +57 -0
- data/spec/{base_element_spec.rb → element_spec.rb} +3 -2
- data/spec/input_spec.rb +65 -0
- data/spec/spec_helper.rb +9 -2
- data/spec/watirspec/area_spec.rb +9 -13
- data/spec/watirspec/areas_spec.rb +7 -1
- data/spec/watirspec/browser_spec.rb +68 -72
- data/spec/watirspec/button_spec.rb +16 -9
- data/spec/watirspec/buttons_spec.rb +11 -9
- data/spec/watirspec/checkbox_spec.rb +1 -1
- data/spec/watirspec/checkboxes_spec.rb +7 -1
- data/spec/watirspec/collections_spec.rb +18 -0
- data/spec/watirspec/dd_spec.rb +1 -1
- data/spec/watirspec/dds_spec.rb +7 -1
- data/spec/watirspec/del_spec.rb +141 -0
- data/spec/watirspec/dels_spec.rb +37 -0
- data/spec/watirspec/div_spec.rb +6 -22
- data/spec/watirspec/divs_spec.rb +8 -2
- data/spec/watirspec/dl_spec.rb +1 -1
- data/spec/watirspec/dls_spec.rb +7 -1
- data/spec/watirspec/dt_spec.rb +1 -1
- data/spec/watirspec/dts_spec.rb +7 -1
- data/spec/watirspec/element_spec.rb +11 -20
- data/spec/watirspec/em_spec.rb +1 -1
- data/spec/watirspec/ems_spec.rb +7 -1
- data/spec/watirspec/filefield_spec.rb +8 -11
- data/spec/watirspec/filefields_spec.rb +7 -1
- data/spec/watirspec/font_spec.rb +2 -2
- data/spec/watirspec/form_spec.rb +10 -18
- data/spec/watirspec/forms_spec.rb +7 -1
- data/spec/watirspec/frame_spec.rb +69 -73
- data/spec/watirspec/frames_spec.rb +15 -2
- data/spec/watirspec/hidden_spec.rb +1 -1
- data/spec/watirspec/hiddens_spec.rb +7 -1
- data/spec/watirspec/hn_spec.rb +1 -1
- data/spec/watirspec/hns_spec.rb +23 -27
- data/spec/watirspec/image_spec.rb +9 -15
- data/spec/watirspec/images_spec.rb +7 -1
- data/spec/watirspec/ins_spec.rb +142 -0
- data/spec/watirspec/inses_spec.rb +37 -0
- data/spec/watirspec/label_spec.rb +1 -1
- data/spec/watirspec/labels_spec.rb +7 -1
- data/spec/watirspec/li_spec.rb +1 -1
- data/spec/watirspec/lib/guards.rb +12 -12
- data/spec/watirspec/lib/implementation.rb +48 -0
- data/spec/watirspec/lib/watirspec.rb +17 -12
- data/spec/watirspec/link_spec.rb +6 -11
- data/spec/watirspec/links_spec.rb +1 -1
- data/spec/watirspec/lis_spec.rb +7 -1
- data/spec/watirspec/map_spec.rb +1 -1
- data/spec/watirspec/maps_spec.rb +7 -1
- data/spec/watirspec/meta_spec.rb +13 -15
- data/spec/watirspec/metas_spec.rb +6 -1
- data/spec/watirspec/ol_spec.rb +57 -59
- data/spec/watirspec/ols_spec.rb +10 -4
- data/spec/watirspec/option_spec.rb +50 -83
- data/spec/watirspec/p_spec.rb +1 -1
- data/spec/watirspec/pre_spec.rb +1 -1
- data/spec/watirspec/pres_spec.rb +7 -1
- data/spec/watirspec/ps_spec.rb +7 -1
- data/spec/watirspec/radio_spec.rb +9 -11
- data/spec/watirspec/radios_spec.rb +1 -1
- data/spec/watirspec/select_list_spec.rb +27 -40
- data/spec/watirspec/select_lists_spec.rb +1 -1
- data/spec/watirspec/span_spec.rb +1 -1
- data/spec/watirspec/spans_spec.rb +7 -1
- data/spec/watirspec/spec_helper.rb +1 -0
- data/spec/watirspec/strong_spec.rb +1 -1
- data/spec/watirspec/strongs_spec.rb +7 -1
- data/spec/watirspec/table_bodies_spec.rb +22 -10
- data/spec/watirspec/table_body_spec.rb +33 -40
- data/spec/watirspec/table_cell_spec.rb +1 -1
- data/spec/watirspec/table_cells_spec.rb +36 -15
- data/spec/watirspec/table_footer_spec.rb +43 -40
- data/spec/watirspec/table_footers_spec.rb +35 -19
- data/spec/watirspec/table_header_spec.rb +44 -39
- data/spec/watirspec/table_headers_spec.rb +37 -19
- data/spec/watirspec/table_row_spec.rb +13 -9
- data/spec/watirspec/table_rows_spec.rb +16 -6
- data/spec/watirspec/table_spec.rb +83 -62
- data/spec/watirspec/tables_spec.rb +7 -1
- data/spec/watirspec/text_field_spec.rb +4 -6
- data/spec/watirspec/text_fields_spec.rb +1 -1
- data/spec/watirspec/ul_spec.rb +1 -1
- data/spec/watirspec/uls_spec.rb +25 -22
- data/support/html5.html +89235 -0
- data/watir-webdriver.gemspec +31 -21
- metadata +52 -23
- data/TODO +0 -15
- data/lib/watir-webdriver/base_element.rb +0 -361
- data/lib/watir-webdriver/collections/buttons_collection.rb +0 -15
- data/lib/watir-webdriver/collections/table_rows_collection.rb +0 -16
- data/lib/watir-webdriver/collections/text_fields_collection.rb +0 -15
- data/lib/watir-webdriver/elements/headings.rb +0 -48
- data/support/html5/html5.idl +0 -1274
- data/support/html5/old/html5.idl +0 -962
- data/support/html5/old/html5_extras.idl +0 -145
- data/support/html5/watir_visitor.rb +0 -173
- data/support/yard_handlers.rb +0 -87
data/spec/watirspec/p_spec.rb
CHANGED
data/spec/watirspec/pre_spec.rb
CHANGED
data/spec/watirspec/pres_spec.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
require File.dirname(__FILE__)
|
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
|
|
data/spec/watirspec/ps_spec.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
require File.dirname(__FILE__)
|
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__)
|
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
|
-
|
207
|
-
|
208
|
-
|
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
|
-
|
212
|
-
|
210
|
+
browser.radio(:value, 'certainly').set
|
211
|
+
messages.should == ["changed: new_user_newsletter"] # no event fired here - didn't change
|
213
212
|
|
214
|
-
|
215
|
-
|
216
|
-
|
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__)
|
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
|
-
|
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
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
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
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
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
|
-
|
283
|
-
|
284
|
-
|
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
|
-
|
288
|
-
|
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
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
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
|
-
|
304
|
-
|
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
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
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
|
data/spec/watirspec/span_spec.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
require File.dirname(__FILE__)
|
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__)
|
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__)
|
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
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
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
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
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__)
|
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
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
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
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
59
|
-
|
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
|
-
|
66
|
-
|
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
|
-
|
71
|
-
|
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
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
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
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
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
|
-
|
92
|
-
|
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
|
|