watir-webdriver 0.0.1.dev5 → 0.0.1.dev6
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +13 -19
- data/VERSION +1 -1
- data/lib/watir-webdriver.rb +3 -1
- data/lib/watir-webdriver/base_element.rb +33 -27
- data/lib/watir-webdriver/browser.rb +2 -6
- data/lib/watir-webdriver/elements/font.rb +12 -0
- data/lib/watir-webdriver/elements/generated.rb +1027 -622
- data/lib/watir-webdriver/elements/select_list.rb +3 -3
- data/lib/watir-webdriver/locators/element_locator.rb +2 -2
- data/lib/watir-webdriver/xpath_support.rb +2 -2
- data/support/html5/html5.idl +942 -483
- data/support/html5/old/html5.idl +962 -0
- data/support/html5/{html5_extras.idl → old/html5_extras.idl} +0 -2
- data/support/html5/watir_visitor.rb +23 -19
- metadata +74 -100
- data/spec/watirspec/area_spec.rb +0 -78
- data/spec/watirspec/areas_spec.rb +0 -31
- data/spec/watirspec/browser_spec.rb +0 -274
- data/spec/watirspec/button_spec.rb +0 -242
- data/spec/watirspec/buttons_spec.rb +0 -48
- data/spec/watirspec/checkbox_spec.rb +0 -272
- data/spec/watirspec/checkboxes_spec.rb +0 -32
- data/spec/watirspec/dd_spec.rb +0 -123
- data/spec/watirspec/dds_spec.rb +0 -31
- data/spec/watirspec/div_spec.rb +0 -211
- data/spec/watirspec/divs_spec.rb +0 -31
- data/spec/watirspec/dl_spec.rb +0 -123
- data/spec/watirspec/dls_spec.rb +0 -32
- data/spec/watirspec/dt_spec.rb +0 -123
- data/spec/watirspec/dts_spec.rb +0 -31
- data/spec/watirspec/element_spec.rb +0 -89
- data/spec/watirspec/em_spec.rb +0 -97
- data/spec/watirspec/ems_spec.rb +0 -32
- data/spec/watirspec/filefield_spec.rb +0 -119
- data/spec/watirspec/filefields_spec.rb +0 -32
- data/spec/watirspec/form_spec.rb +0 -63
- data/spec/watirspec/forms_spec.rb +0 -33
- data/spec/watirspec/frame_spec.rb +0 -129
- data/spec/watirspec/frames_spec.rb +0 -62
- data/spec/watirspec/hidden_spec.rb +0 -102
- data/spec/watirspec/hiddens_spec.rb +0 -32
- data/spec/watirspec/hn_spec.rb +0 -93
- data/spec/watirspec/hns_spec.rb +0 -38
- data/spec/watirspec/image_spec.rb +0 -207
- data/spec/watirspec/images_spec.rb +0 -31
- data/spec/watirspec/label_spec.rb +0 -75
- data/spec/watirspec/labels_spec.rb +0 -31
- data/spec/watirspec/li_spec.rb +0 -112
- data/spec/watirspec/lib/guards.rb +0 -59
- data/spec/watirspec/lib/server.rb +0 -127
- data/spec/watirspec/lib/spec_helper.rb +0 -79
- data/spec/watirspec/lib/watirspec.rb +0 -72
- data/spec/watirspec/link_spec.rb +0 -168
- data/spec/watirspec/links_spec.rb +0 -35
- data/spec/watirspec/lis_spec.rb +0 -31
- data/spec/watirspec/map_spec.rb +0 -76
- data/spec/watirspec/maps_spec.rb +0 -32
- data/spec/watirspec/meta_spec.rb +0 -22
- data/spec/watirspec/metas_spec.rb +0 -30
- data/spec/watirspec/ol_spec.rb +0 -78
- data/spec/watirspec/ols_spec.rb +0 -31
- data/spec/watirspec/option_spec.rb +0 -173
- data/spec/watirspec/p_spec.rb +0 -128
- data/spec/watirspec/pre_spec.rb +0 -112
- data/spec/watirspec/pres_spec.rb +0 -31
- data/spec/watirspec/ps_spec.rb +0 -31
- data/spec/watirspec/radio_spec.rb +0 -255
- data/spec/watirspec/radios_spec.rb +0 -32
- data/spec/watirspec/select_list_spec.rb +0 -318
- data/spec/watirspec/select_lists_spec.rb +0 -35
- data/spec/watirspec/span_spec.rb +0 -142
- data/spec/watirspec/spans_spec.rb +0 -31
- data/spec/watirspec/spec_helper.rb +0 -17
- data/spec/watirspec/strong_spec.rb +0 -89
- data/spec/watirspec/strongs_spec.rb +0 -32
- data/spec/watirspec/table_bodies_spec.rb +0 -45
- data/spec/watirspec/table_body_spec.rb +0 -98
- data/spec/watirspec/table_cell_spec.rb +0 -68
- data/spec/watirspec/table_cells_spec.rb +0 -47
- data/spec/watirspec/table_footer_spec.rb +0 -85
- data/spec/watirspec/table_footers_spec.rb +0 -47
- data/spec/watirspec/table_header_spec.rb +0 -85
- data/spec/watirspec/table_headers_spec.rb +0 -45
- data/spec/watirspec/table_row_spec.rb +0 -87
- data/spec/watirspec/table_rows_spec.rb +0 -50
- data/spec/watirspec/table_spec.rb +0 -160
- data/spec/watirspec/tables_spec.rb +0 -33
- data/spec/watirspec/text_field_spec.rb +0 -276
- data/spec/watirspec/text_fields_spec.rb +0 -35
- data/spec/watirspec/ul_spec.rb +0 -76
- data/spec/watirspec/uls_spec.rb +0 -33
- data/support/html5/idl_extractor.rb +0 -73
@@ -1,31 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require File.dirname(__FILE__) + '/spec_helper'
|
3
|
-
|
4
|
-
describe "Spans" do
|
5
|
-
|
6
|
-
before :each do
|
7
|
-
browser.goto(WatirSpec.files + "/non_control_elements.html")
|
8
|
-
end
|
9
|
-
|
10
|
-
describe "#length" do
|
11
|
-
it "returns the number of spans" do
|
12
|
-
browser.spans.length.should == 6
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
describe "#[]" do
|
17
|
-
it "returns the p at the given index" do
|
18
|
-
browser.spans[0].id.should == "lead"
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
describe "#each" do
|
23
|
-
it "iterates through spans correctly" do
|
24
|
-
browser.spans.each_with_index do |s, index|
|
25
|
-
s.id.should == browser.span(:index, index).id
|
26
|
-
s.value.should == browser.span(:index, index).value
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
begin
|
3
|
-
require "rubygems"
|
4
|
-
rescue LoadError
|
5
|
-
end
|
6
|
-
|
7
|
-
require "sinatra/base"
|
8
|
-
require "#{File.dirname(__FILE__)}/lib/watirspec"
|
9
|
-
require "#{File.dirname(__FILE__)}/lib/server"
|
10
|
-
require "#{File.dirname(__FILE__)}/lib/spec_helper"
|
11
|
-
require "#{File.dirname(__FILE__)}/lib/guards"
|
12
|
-
|
13
|
-
if __FILE__ == $0
|
14
|
-
WatirSpec::Server.run!
|
15
|
-
else
|
16
|
-
WatirSpec::SpecHelper.execute
|
17
|
-
end
|
@@ -1,89 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require File.dirname(__FILE__) + '/spec_helper'
|
3
|
-
|
4
|
-
describe "Strong" do
|
5
|
-
|
6
|
-
before :each do
|
7
|
-
browser.goto(WatirSpec.files + "/non_control_elements.html")
|
8
|
-
end
|
9
|
-
|
10
|
-
# Exists method
|
11
|
-
describe "#exist?" do
|
12
|
-
it "returns true if the element exists" do
|
13
|
-
browser.strong(:id, "descartes").should exist
|
14
|
-
browser.strong(:id, /descartes/).should exist
|
15
|
-
browser.strong(:text, "Dubito, ergo cogito, ergo sum.").should exist
|
16
|
-
browser.strong(:text, /Dubito, ergo cogito, ergo sum/).should exist
|
17
|
-
browser.strong(:class, "descartes").should exist
|
18
|
-
browser.strong(:class, /descartes/).should exist
|
19
|
-
browser.strong(:index, 0).should exist
|
20
|
-
browser.strong(:xpath, "//strong[@id='descartes']").should exist
|
21
|
-
end
|
22
|
-
|
23
|
-
it "returns false if the element doesn't exist" do
|
24
|
-
browser.strong(:id, "no_such_id").should_not exist
|
25
|
-
browser.strong(:id, /no_such_id/).should_not exist
|
26
|
-
browser.strong(:text, "no_such_text").should_not exist
|
27
|
-
browser.strong(:text, /no_such_text/).should_not exist
|
28
|
-
browser.strong(:class, "no_such_class").should_not exist
|
29
|
-
browser.strong(:class, /no_such_class/).should_not exist
|
30
|
-
browser.strong(:index, 1337).should_not exist
|
31
|
-
browser.strong(:xpath, "//strong[@id='no_such_id']").should_not exist
|
32
|
-
end
|
33
|
-
|
34
|
-
it "raises TypeError when 'what' argument is invalid" do
|
35
|
-
lambda { browser.strong(:id, 3.14).exists? }.should raise_error(TypeError)
|
36
|
-
end
|
37
|
-
|
38
|
-
it "raises MissingWayOfFindingObjectException when 'how' argument is invalid" do
|
39
|
-
lambda { browser.strong(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
# Attribute methods
|
44
|
-
describe "#class_name" do
|
45
|
-
it "returns the class attribute" do
|
46
|
-
browser.strong(:index, 0).class_name.should == 'descartes'
|
47
|
-
end
|
48
|
-
|
49
|
-
it "returns an empty string if the element exists and the attribute doesn't" do
|
50
|
-
browser.strong(:index, 1).class_name.should == ''
|
51
|
-
end
|
52
|
-
|
53
|
-
it "raises UnknownObjectException if the element doesn't exist" do
|
54
|
-
lambda { browser.strong(:id, 'no_such_id').class_name }.should raise_error(UnknownObjectException)
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
describe "#id" do
|
59
|
-
it "returns the id attribute" do
|
60
|
-
browser.strong(:index, 0).id.should == "descartes"
|
61
|
-
end
|
62
|
-
|
63
|
-
it "raises UnknownObjectException if the element doesn't exist" do
|
64
|
-
lambda { browser.strong(:id, "no_such_id").id }.should raise_error(UnknownObjectException)
|
65
|
-
lambda { browser.strong(:index, 1337).id }.should raise_error(UnknownObjectException)
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
describe "#text" do
|
70
|
-
it "returns the text of the element" do
|
71
|
-
browser.strong(:index, 0).text.should == "Dubito, ergo cogito, ergo sum."
|
72
|
-
end
|
73
|
-
|
74
|
-
it "raises UnknownObjectException if the element doesn't exist" do
|
75
|
-
lambda { browser.strong(:id, 'no_such_id').text }.should raise_error( UnknownObjectException)
|
76
|
-
lambda { browser.strong(:xpath , "//strong[@id='no_such_id']").text }.should raise_error( UnknownObjectException)
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
describe "#respond_to?" do
|
81
|
-
it "returns true for all attribute methods" do
|
82
|
-
browser.strong(:index, 0).should respond_to(:class_name)
|
83
|
-
browser.strong(:index, 0).should respond_to(:id)
|
84
|
-
browser.strong(:index, 0).should respond_to(:text)
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
# Other
|
89
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require File.dirname(__FILE__) + '/spec_helper'
|
3
|
-
|
4
|
-
describe "Strongs" do
|
5
|
-
|
6
|
-
before :each do
|
7
|
-
browser.goto(WatirSpec.files + "/non_control_elements.html")
|
8
|
-
end
|
9
|
-
|
10
|
-
describe "#length" do
|
11
|
-
it "returns the number of divs" do
|
12
|
-
browser.strongs.length.should == 2
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
describe "#[]" do
|
17
|
-
it "returns the div at the given index" do
|
18
|
-
browser.strongs[0].id.should == "descartes"
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
describe "#each" do
|
23
|
-
it "iterates through divs correctly" do
|
24
|
-
browser.strongs.each_with_index do |s, index|
|
25
|
-
strong = browser.strong(:index, index)
|
26
|
-
s.id.should == strong.id
|
27
|
-
s.class_name.should == strong.class_name
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require File.dirname(__FILE__) + '/spec_helper'
|
3
|
-
|
4
|
-
describe "TableBodies" do
|
5
|
-
|
6
|
-
before :each do
|
7
|
-
browser.goto(WatirSpec.files + "/tables.html")
|
8
|
-
end
|
9
|
-
|
10
|
-
describe "#length" do
|
11
|
-
it "returns the correct number of table bodies (page context)" do
|
12
|
-
browser.tbodys.length.should == 5
|
13
|
-
end
|
14
|
-
|
15
|
-
it "returns the correct number of table bodies (table context)" do
|
16
|
-
browser.table(:index, 0).tbodys.length.should == 2
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
describe "#[]" do
|
21
|
-
it "returns the row at the given index (page context)" do
|
22
|
-
browser.tbodys[0].id.should == "first"
|
23
|
-
end
|
24
|
-
|
25
|
-
it "returns the row at the given index (table context)" do
|
26
|
-
browser.table(:index, 0).tbodys[0].id.should == "first"
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
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
|
35
|
-
end
|
36
|
-
|
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
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
end
|
@@ -1,98 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require File.dirname(__FILE__) + '/spec_helper'
|
3
|
-
|
4
|
-
describe "TableBody" do
|
5
|
-
|
6
|
-
before :each do
|
7
|
-
browser.goto(WatirSpec.files + "/tables.html")
|
8
|
-
end
|
9
|
-
|
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
|
18
|
-
end
|
19
|
-
|
20
|
-
it "returns true if the table body exists (table context)" do
|
21
|
-
browser.table(:index, 0).tbody(:id, 'first').should exist
|
22
|
-
browser.table(:index, 0).tbody(:id, /first/).should exist
|
23
|
-
browser.table(:index, 0).tbody(:index, 1).should exist
|
24
|
-
browser.table(:index, 0).tbody(:xpath, "//tbody[@id='first']").should exist
|
25
|
-
end
|
26
|
-
|
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
|
34
|
-
end
|
35
|
-
|
36
|
-
it "returns false if the table body doesn't exist (table context)" do
|
37
|
-
browser.table(:index, 0).tbody(:id, 'no_such_id').should_not exist
|
38
|
-
browser.table(:index, 0).tbody(:id, /no_such_id/).should_not exist
|
39
|
-
browser.table(:index, 0).tbody(:index, 1337).should_not exist
|
40
|
-
browser.table(:index, 0).tbody(:xpath, "//tbody[@id='no_such_id']").should_not exist
|
41
|
-
end
|
42
|
-
|
43
|
-
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
|
47
|
-
lambda { browser.table(:index, 0).tbody(:id, 3.14).exists? }.should raise_error(TypeError)
|
48
|
-
end
|
49
|
-
|
50
|
-
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
|
54
|
-
lambda { browser.table(:index, 0).tbody(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
describe "#length" do
|
59
|
-
bug "WTR-357", :watir do
|
60
|
-
it "returns the correct number of table bodies (page context)" do
|
61
|
-
browser.tbody(:id, 'first').length.should == 3
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
it "returns the correct number of table bodies (table context)" do
|
66
|
-
browser.table(:index, 0).tbody(:id, 'first').length.should == 3
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
describe "#[]" do
|
71
|
-
bug "WTR-357", :watir do
|
72
|
-
it "returns the row at the given index (page context)" do
|
73
|
-
browser.tbody(:id, 'first')[0].text.should == 'March 2008'
|
74
|
-
browser.tbody(:id, 'first')[1][0].text.should == 'Gregory House'
|
75
|
-
browser.tbody(:id, 'first')[2][0].text.should == 'Hugh Laurie'
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
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'
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
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"]
|
90
|
-
|
91
|
-
body.each_with_index do |row, idx|
|
92
|
-
row.id.should == expected_texts[idx]
|
93
|
-
end
|
94
|
-
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
end
|
@@ -1,68 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require File.dirname(__FILE__) + '/spec_helper'
|
3
|
-
|
4
|
-
describe "TableCell" do
|
5
|
-
|
6
|
-
before :each do
|
7
|
-
browser.goto(WatirSpec.files + "/tables.html")
|
8
|
-
end
|
9
|
-
|
10
|
-
# Exists
|
11
|
-
describe "#exists?" do
|
12
|
-
it "returns true when the table cell exists" do
|
13
|
-
browser.cell(:id, 't1_r2_c1').should exist
|
14
|
-
browser.cell(:id, /t1_r2_c1/).should exist
|
15
|
-
browser.cell(:text, 'Table 1, Row 3, Cell 1').should exist
|
16
|
-
browser.cell(:text, /Table 1/).should exist
|
17
|
-
browser.cell(:index, 0).should exist
|
18
|
-
browser.cell(:xpath, "//td[@id='t1_r2_c1']").should exist
|
19
|
-
end
|
20
|
-
|
21
|
-
it "returns false when the table cell does not exist" do
|
22
|
-
browser.cell(:id, 'no_such_id').should_not exist
|
23
|
-
browser.cell(:id, /no_such_id/).should_not exist
|
24
|
-
browser.cell(:text, 'no_such_text').should_not exist
|
25
|
-
browser.cell(:text, /no_such_text/).should_not exist
|
26
|
-
browser.cell(:index, 1337).should_not exist
|
27
|
-
browser.cell(:xpath, "//td[@id='no_such_id']").should_not exist
|
28
|
-
end
|
29
|
-
|
30
|
-
it "raises TypeError when 'what' argument is invalid" do
|
31
|
-
lambda { browser.cell(:id, 3.14).exists? }.should raise_error(TypeError)
|
32
|
-
end
|
33
|
-
|
34
|
-
it "raises MissingWayOfFindingObjectException when 'how' argument is invalid" do
|
35
|
-
lambda { browser.cell(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
describe "#click" do
|
40
|
-
it "fires the table's onclick event" do
|
41
|
-
browser.cell(:id, 't2_r1_c1').click
|
42
|
-
messages.should include('td')
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
# Attribute methods
|
47
|
-
describe "#text" do
|
48
|
-
it "returns the text inside the table cell" do
|
49
|
-
browser.cell(:id, 't1_r2_c1').text.should == 'Table 1, Row 2, Cell 1'
|
50
|
-
browser.cell(:id, 't2_r1_c1').text.should == 'Table 2, Row 1, Cell 1'
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
describe "#colspan" do
|
55
|
-
it "gets the colspan attribute" do
|
56
|
-
browser.cell(:id, 'colspan_2').colspan.should == 2
|
57
|
-
browser.cell(:id, 'no_colspan').colspan.should == 1
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
describe "#respond_to?" do
|
62
|
-
it "returns true for all attribute methods" do
|
63
|
-
browser.cell(:index, 0).should respond_to(:text)
|
64
|
-
browser.cell(:index, 0).should respond_to(:colspan)
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
end
|
@@ -1,47 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require File.dirname(__FILE__) + '/spec_helper'
|
3
|
-
|
4
|
-
describe "TableCells" do
|
5
|
-
|
6
|
-
before :each do
|
7
|
-
browser.goto(WatirSpec.files + "/tables.html")
|
8
|
-
end
|
9
|
-
|
10
|
-
# describe "#length" do
|
11
|
-
# it "returns the number of cells" do
|
12
|
-
# browser.table(:id, 'outer').cells.length.should == 6
|
13
|
-
# browser.table(:id, 'inner').cells.length.should == 2
|
14
|
-
# end
|
15
|
-
# end
|
16
|
-
#
|
17
|
-
# describe "#[]" do
|
18
|
-
# it "returns the row at the given index" do
|
19
|
-
# browser.table(:id, 'outer').cells[0].text.should == "Table 1, Row 1, Cell 1"
|
20
|
-
# browser.table(:id, 'inner').cells[0].text.should == "Table 2, Row 1, Cell 1"
|
21
|
-
# browser.table(:id, 'outer').cells[6].text.should == "Table 1, Row 3, Cell 2"
|
22
|
-
# end
|
23
|
-
# end
|
24
|
-
|
25
|
-
describe "#each" do
|
26
|
-
it "iterates through cells correctly" do
|
27
|
-
# All cells on the page
|
28
|
-
browser.cells.each_with_index do |c, index|
|
29
|
-
c.id.should == browser.cell(:index, index).id
|
30
|
-
c.value.should == browser.cell(:index, index).value
|
31
|
-
end
|
32
|
-
# Cells inside a table
|
33
|
-
inner_table = browser.table(:id, 'inner')
|
34
|
-
inner_table.cells.each_with_index do |c, index|
|
35
|
-
c.id.should == inner_table.cell(:index, index).id
|
36
|
-
c.value.should == inner_table.cell(:index, index).value
|
37
|
-
end
|
38
|
-
# Cells inside a table (should not include cells inside a table inside a table)
|
39
|
-
outer_table = browser.table(:id, 'outer')
|
40
|
-
outer_table.cells.each_with_index do |c, index|
|
41
|
-
c.id.should == outer_table.cell(:index, index).id
|
42
|
-
c.value.should == outer_table.cell(:index, index).value
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
end
|
@@ -1,85 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require File.dirname(__FILE__) + '/spec_helper'
|
3
|
-
|
4
|
-
bug "WTR-358", :watir do
|
5
|
-
|
6
|
-
describe "TableFooter" do
|
7
|
-
before :each do
|
8
|
-
browser.goto(WatirSpec.files + "/tables.html")
|
9
|
-
end
|
10
|
-
|
11
|
-
describe "#exists?" do
|
12
|
-
it "returns true if the table tfoot exists (page context)" do
|
13
|
-
browser.tfoot(:id, 'tax_totals').should exist
|
14
|
-
browser.tfoot(:id, /tax_totals/).should exist
|
15
|
-
browser.tfoot(:index, 0).should exist
|
16
|
-
browser.tfoot(:xpath, "//tfoot[@id='tax_totals']").should exist
|
17
|
-
end
|
18
|
-
|
19
|
-
it "returns true if the table tfoot exists (table context)" do
|
20
|
-
browser.table(:index, 0).tfoot(:id, 'tax_totals').should exist
|
21
|
-
browser.table(:index, 0).tfoot(:id, /tax_totals/).should exist
|
22
|
-
browser.table(:index, 0).tfoot(:index, 0).should exist
|
23
|
-
browser.table(:index, 0).tfoot(:xpath, "//tfoot[@id='tax_totals']").should exist
|
24
|
-
end
|
25
|
-
|
26
|
-
it "returns false if the table tfoot doesn't exist (page context)" do
|
27
|
-
browser.tfoot(:id, 'no_such_id').should_not exist
|
28
|
-
browser.tfoot(:id, /no_such_id/).should_not exist
|
29
|
-
browser.tfoot(:index, 1337).should_not exist
|
30
|
-
browser.tfoot(:xpath, "//tfoot[@id='no_such_id']").should_not exist
|
31
|
-
end
|
32
|
-
|
33
|
-
it "returns false if the table tfoot doesn't exist (table context)" do
|
34
|
-
browser.table(:index, 0).tfoot(:id, 'no_such_id').should_not exist
|
35
|
-
browser.table(:index, 0).tfoot(:id, /no_such_id/).should_not exist
|
36
|
-
browser.table(:index, 0).tfoot(:index, 1337).should_not exist
|
37
|
-
browser.table(:index, 0).tfoot(:xpath, "//tfoot[@id='no_such_id']").should_not exist
|
38
|
-
end
|
39
|
-
|
40
|
-
it "raises TypeError when 'what' argument is invalid" do
|
41
|
-
lambda { browser.tfoot(:id, 3.14).exists? }.should raise_error(TypeError)
|
42
|
-
lambda { browser.table(:index, 0).tfoot(:id, 3.14).exists? }.should raise_error(TypeError)
|
43
|
-
end
|
44
|
-
|
45
|
-
it "raises MissingWayOfFindingObjectException when 'how' argument is invalid" do
|
46
|
-
lambda { browser.tfoot(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
|
47
|
-
lambda { browser.table(:index, 0).tfoot(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
describe "#length" do
|
52
|
-
it "returns the correct number of table footers (page context)" do
|
53
|
-
browser.tfoot(:id, 'tax_totals').length.should == 1
|
54
|
-
end
|
55
|
-
|
56
|
-
it "returns the correct number of table footers (table context)" do
|
57
|
-
browser.table(:index, 0).tfoot(:id, 'tax_totals').length.should == 1
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
describe "#[]" do
|
62
|
-
it "returns the row at the given index (page context)" do
|
63
|
-
browser.tfoot(:id, 'tax_totals')[0].id.should == 'tfoot_row_1'
|
64
|
-
browser.tfoot(:id, 'tax_totals')[0][1].text.should == '24 349'
|
65
|
-
browser.tfoot(:id, 'tax_totals')[0][2].text.should == '5 577'
|
66
|
-
end
|
67
|
-
|
68
|
-
it "returns the row at the given index (table context)" do
|
69
|
-
browser.table(:index, 0).tfoot(:id, 'tax_totals')[0].id.should == "tfoot_row_1"
|
70
|
-
browser.table(:index, 0).tfoot(:id, 'tax_totals')[0][1].text.should == '24 349'
|
71
|
-
browser.table(:index, 0).tfoot(:id, 'tax_totals')[0][2].text.should == '5 577'
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
describe "#each" do
|
76
|
-
it "iterates through rows correctly" do
|
77
|
-
tfoot = browser.table(:index, 0).tfoot(:id, 'tax_totals')
|
78
|
-
tfoot.each_with_index do |r, idx|
|
79
|
-
r.id.should == "tfoot_row_#{idx + 1}"
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
end
|