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
@@ -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 "CheckBoxes" do
|
5
5
|
|
@@ -21,11 +21,17 @@ describe "CheckBoxes" do
|
|
21
21
|
|
22
22
|
describe "#each" do
|
23
23
|
it "iterates through checkboxes correctly" do
|
24
|
+
count = 0
|
25
|
+
|
24
26
|
browser.checkboxes.each_with_index do |c, index|
|
25
27
|
c.name.should == browser.checkbox(:index, index).name
|
26
28
|
c.id.should == browser.checkbox(:index, index).id
|
27
29
|
c.value.should == browser.checkbox(:index, index).value
|
30
|
+
|
31
|
+
count += 1
|
28
32
|
end
|
33
|
+
|
34
|
+
count.should > 0
|
29
35
|
end
|
30
36
|
end
|
31
37
|
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require File.expand_path('spec_helper', File.dirname(__FILE__))
|
3
|
+
|
4
|
+
describe "Collections" do
|
5
|
+
|
6
|
+
before :each do
|
7
|
+
browser.goto(WatirSpec.files + "/collections.html")
|
8
|
+
end
|
9
|
+
|
10
|
+
it "returns inner elements of parent element having different html tag" do
|
11
|
+
browser.span(:id => "a_span").divs.size.should == 2
|
12
|
+
end
|
13
|
+
|
14
|
+
it "returns inner elements of parent element having same html tag" do
|
15
|
+
browser.span(:id => "a_span").spans.size.should == 2
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
data/spec/watirspec/dd_spec.rb
CHANGED
data/spec/watirspec/dds_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 "Dds" do
|
5
5
|
|
@@ -21,10 +21,16 @@ describe "Dds" do
|
|
21
21
|
|
22
22
|
describe "#each" do
|
23
23
|
it "iterates through dds correctly" do
|
24
|
+
count = 0
|
25
|
+
|
24
26
|
browser.dds.each_with_index do |d, index|
|
25
27
|
d.id.should == browser.dd(:index, index).id
|
26
28
|
d.class_name.should == browser.dd(:index, index).class_name
|
29
|
+
|
30
|
+
count += 1
|
27
31
|
end
|
32
|
+
|
33
|
+
count.should > 0
|
28
34
|
end
|
29
35
|
end
|
30
36
|
|
@@ -0,0 +1,141 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require File.expand_path('spec_helper', File.dirname(__FILE__))
|
3
|
+
|
4
|
+
describe "Del" 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 'del' exists" do
|
13
|
+
browser.del(:id, "lead").should exist
|
14
|
+
browser.del(:id, /lead/).should exist
|
15
|
+
browser.del(:text, "This is a deleted text tag 1").should exist
|
16
|
+
browser.del(:text, /This is a deleted text tag 1/).should exist
|
17
|
+
browser.del(:class, "lead").should exist
|
18
|
+
browser.del(:class, /lead/).should exist
|
19
|
+
browser.del(:index, 0).should exist
|
20
|
+
browser.del(:xpath, "//del[@id='lead']").should exist
|
21
|
+
end
|
22
|
+
|
23
|
+
it "returns false if the element doesn't exist" do
|
24
|
+
browser.del(:id, "no_such_id").should_not exist
|
25
|
+
browser.del(:id, /no_such_id/).should_not exist
|
26
|
+
browser.del(:text, "no_such_text").should_not exist
|
27
|
+
browser.del(:text, /no_such_text/).should_not exist
|
28
|
+
browser.del(:class, "no_such_class").should_not exist
|
29
|
+
browser.del(:class, /no_such_class/).should_not exist
|
30
|
+
browser.del(:index, 1337).should_not exist
|
31
|
+
browser.del(:xpath, "//del[@id='no_such_id']").should_not exist
|
32
|
+
end
|
33
|
+
|
34
|
+
it "raises TypeError when 'what' argument is invalid" do
|
35
|
+
lambda { browser.del(:id, 3.14).exists? }.should raise_error(TypeError)
|
36
|
+
end
|
37
|
+
|
38
|
+
it "raises MissingWayOfFindingObjectException when 'how' argument is invalid" do
|
39
|
+
lambda { browser.del(: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.del(:index, 0).class_name.should == 'lead'
|
47
|
+
end
|
48
|
+
|
49
|
+
it "returns an empty string if the element exists and the attribute doesn't" do
|
50
|
+
browser.del(:index, 2).class_name.should == ''
|
51
|
+
end
|
52
|
+
|
53
|
+
it "raises UnknownObjectException if the del doesn't exist" do
|
54
|
+
lambda { browser.del(: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.del(:index, 0).id.should == "lead"
|
61
|
+
end
|
62
|
+
|
63
|
+
it "returns an empty string if the element exists and the attribute doesn't" do
|
64
|
+
browser.del(:index, 2).id.should == ''
|
65
|
+
end
|
66
|
+
|
67
|
+
it "raises UnknownObjectException if the del doesn't exist" do
|
68
|
+
lambda { browser.del(:id, "no_such_id").id }.should raise_error(UnknownObjectException)
|
69
|
+
lambda { browser.del(:index, 1337).id }.should raise_error(UnknownObjectException)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
describe "#title" do
|
74
|
+
it "returns the title attribute" do
|
75
|
+
browser.del(:index, 0).title.should == 'Lorem ipsum'
|
76
|
+
end
|
77
|
+
|
78
|
+
it "returns an empty string if the element exists and the attribute doesn't" do
|
79
|
+
browser.del(:index, 2).title.should == ''
|
80
|
+
end
|
81
|
+
|
82
|
+
it "raises UnknownObjectException if the del doesn't exist" do
|
83
|
+
lambda { browser.del(:id, 'no_such_id').title }.should raise_error( UnknownObjectException)
|
84
|
+
lambda { browser.del(:xpath, "//del[@id='no_such_id']").title }.should raise_error( UnknownObjectException)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
describe "#text" do
|
89
|
+
it "returns the text of the del" do
|
90
|
+
browser.del(:index, 1).text.should == 'This is a deleted text tag 2'
|
91
|
+
end
|
92
|
+
|
93
|
+
it "returns an empty string if the element doesn't contain any text" do
|
94
|
+
browser.del(:index, 3).text.should == ''
|
95
|
+
end
|
96
|
+
|
97
|
+
it "raises UnknownObjectException if the del doesn't exist" do
|
98
|
+
lambda { browser.del(:id, 'no_such_id').text }.should raise_error( UnknownObjectException)
|
99
|
+
lambda { browser.del(:xpath , "//del[@id='no_such_id']").text }.should raise_error( UnknownObjectException)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
describe "#value" do
|
104
|
+
it "returns the value attribute" do
|
105
|
+
browser.del(:index, 1).value.should == "invalid_attribute"
|
106
|
+
end
|
107
|
+
|
108
|
+
it "returns an empty string if the element exists and the attribute doesn't" do
|
109
|
+
browser.del(:index, 3).value.should == ''
|
110
|
+
end
|
111
|
+
|
112
|
+
it "raises UnknownObjectException if the del doesn't exist" do
|
113
|
+
lambda { browser.del(:id , "no_such_id").value }.should raise_error(UnknownObjectException)
|
114
|
+
lambda { browser.del(:index , 1337).value }.should raise_error(UnknownObjectException)
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
describe "#respond_to?" do
|
119
|
+
it "returns true for all attribute methods" do
|
120
|
+
browser.del(:index, 0).should respond_to(:class_name)
|
121
|
+
browser.del(:index, 0).should respond_to(:id)
|
122
|
+
browser.del(:index, 0).should respond_to(:title)
|
123
|
+
browser.del(:index, 0).should respond_to(:text)
|
124
|
+
browser.del(:index, 0).should respond_to(:value)
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
# Other
|
129
|
+
describe "#click" do
|
130
|
+
it "fires events" do
|
131
|
+
browser.del(:class, 'footer').text.should_not include('Javascript')
|
132
|
+
browser.del(:class, 'footer').click
|
133
|
+
browser.del(:class, 'footer').text.should include('Javascript')
|
134
|
+
end
|
135
|
+
|
136
|
+
it "raises UnknownObjectException if the del doesn't exist" do
|
137
|
+
lambda { browser.del(:id, "no_such_id").click }.should raise_error(UnknownObjectException)
|
138
|
+
lambda { browser.del(:title, "no_such_title").click }.should raise_error(UnknownObjectException)
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require File.expand_path('spec_helper', File.dirname(__FILE__))
|
3
|
+
|
4
|
+
describe "Dels" 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 dels" do
|
12
|
+
browser.dels.length.should == 5
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe "#[]" do
|
17
|
+
it "returns the del at the given index" do
|
18
|
+
browser.dels[0].id.should == "lead"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe "#each" do
|
23
|
+
it "iterates through dels correctly" do
|
24
|
+
count = 0
|
25
|
+
|
26
|
+
browser.dels.each_with_index do |s, index|
|
27
|
+
s.id.should == browser.del(:index, index).id
|
28
|
+
s.value.should == browser.del(:index, index).value
|
29
|
+
|
30
|
+
count += 1
|
31
|
+
end
|
32
|
+
|
33
|
+
count.should > 0
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
data/spec/watirspec/div_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 "Div" do
|
5
5
|
|
@@ -43,11 +43,6 @@ describe "Div" do
|
|
43
43
|
lambda { browser.div(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
|
44
44
|
end
|
45
45
|
|
46
|
-
# it "locates the correct button when there are duplicate ids and user disambiguates by parent" do
|
47
|
-
# browser.goto(WatirSpec.files + "/buttons_with_duplicate_ids.html")
|
48
|
-
# browser.form(:name, "bar-form").div(:id, "name").parent.name.should == "bar-form"
|
49
|
-
# end
|
50
|
-
|
51
46
|
end
|
52
47
|
|
53
48
|
# Attribute methods
|
@@ -90,17 +85,8 @@ describe "Div" do
|
|
90
85
|
end
|
91
86
|
|
92
87
|
describe "#style" do
|
93
|
-
|
94
|
-
|
95
|
-
browser.div(:id, 'best_language').style.should == "color: red; text-decoration: underline; cursor: pointer;"
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
deviates_on :watir do
|
100
|
-
it "returns the style attribute if the element exists" do
|
101
|
-
# just different order and missing semicolon here
|
102
|
-
browser.div(:id, 'best_language').style.should == "cursor: pointer; color: red; text-decoration: underline"
|
103
|
-
end
|
88
|
+
it "returns the style attribute if the element exists" do
|
89
|
+
browser.div(:id, 'best_language').style.should == "color: red; text-decoration: underline; cursor: pointer;"
|
104
90
|
end
|
105
91
|
|
106
92
|
it "returns an empty string if the element exists but the attribute doesn't" do
|
@@ -123,10 +109,8 @@ describe "Div" do
|
|
123
109
|
browser.div(:index, 0).text.strip.should == ""
|
124
110
|
end
|
125
111
|
|
126
|
-
|
127
|
-
|
128
|
-
browser.div(:id, 'hidden').text.should == ""
|
129
|
-
end
|
112
|
+
it "returns an empty string if the div is hidden" do
|
113
|
+
browser.div(:id, 'hidden').text.should == ""
|
130
114
|
end
|
131
115
|
|
132
116
|
it "raises UnknownObjectException if the element does not exist" do
|
@@ -179,7 +163,7 @@ describe "Div" do
|
|
179
163
|
end
|
180
164
|
end
|
181
165
|
|
182
|
-
not_compliant_on :
|
166
|
+
not_compliant_on :webdriver do
|
183
167
|
describe "#double_click" do
|
184
168
|
it "fires the ondblclick event" do
|
185
169
|
browser.div(:id, 'html_test').double_click
|
data/spec/watirspec/divs_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 "Divs" do
|
5
5
|
|
@@ -9,7 +9,7 @@ describe "Divs" do
|
|
9
9
|
|
10
10
|
describe "#length" do
|
11
11
|
it "returns the number of divs" do
|
12
|
-
browser.divs.length.should ==
|
12
|
+
browser.divs.length.should == 12
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
@@ -21,10 +21,16 @@ describe "Divs" do
|
|
21
21
|
|
22
22
|
describe "#each" do
|
23
23
|
it "iterates through divs correctly" do
|
24
|
+
count = 0
|
25
|
+
|
24
26
|
browser.divs.each_with_index do |d, index|
|
25
27
|
d.id.should == browser.div(:index, index).id
|
26
28
|
d.class_name.should == browser.div(:index, index).class_name
|
29
|
+
|
30
|
+
count += 1
|
27
31
|
end
|
32
|
+
|
33
|
+
count.should > 0
|
28
34
|
end
|
29
35
|
end
|
30
36
|
|
data/spec/watirspec/dl_spec.rb
CHANGED
data/spec/watirspec/dls_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 "Dls" do
|
5
5
|
|
@@ -21,11 +21,17 @@ describe "Dls" do
|
|
21
21
|
|
22
22
|
describe "#each" do
|
23
23
|
it "iterates through dls correctly" do
|
24
|
+
count = 0
|
25
|
+
|
24
26
|
browser.dls.each_with_index do |d, index|
|
25
27
|
d.text.should == browser.dl(:index, index).text
|
26
28
|
d.id.should == browser.dl(:index, index).id
|
27
29
|
d.class_name.should == browser.dl(:index, index).class_name
|
30
|
+
|
31
|
+
count += 1
|
28
32
|
end
|
33
|
+
|
34
|
+
count.should > 0
|
29
35
|
end
|
30
36
|
end
|
31
37
|
|
data/spec/watirspec/dt_spec.rb
CHANGED
data/spec/watirspec/dts_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 "Dts" do
|
5
5
|
|
@@ -21,10 +21,16 @@ describe "Dts" do
|
|
21
21
|
|
22
22
|
describe "#each" do
|
23
23
|
it "iterates through dts correctly" do
|
24
|
+
count = 0
|
25
|
+
|
24
26
|
browser.dts.each_with_index do |d, index|
|
25
27
|
d.id.should == browser.dt(:index, index).id
|
26
28
|
d.class_name.should == browser.dt(:index, index).class_name
|
29
|
+
|
30
|
+
count += 1
|
27
31
|
end
|
32
|
+
|
33
|
+
count.should > 0
|
28
34
|
end
|
29
35
|
end
|
30
36
|
|
@@ -1,10 +1,8 @@
|
|
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 "Element" do
|
5
5
|
|
6
|
-
Element = BaseElement if WatirSpec.implementation = :webdriver # hack
|
7
|
-
|
8
6
|
before :each do
|
9
7
|
browser.goto(WatirSpec.files + "/forms_with_input_elements.html")
|
10
8
|
end
|
@@ -16,21 +14,18 @@ describe "Element" do
|
|
16
14
|
end
|
17
15
|
|
18
16
|
it "raises UnknownObjectException with a sane error message when given a hash of :how => 'what' arguments (non-existing object)" do
|
19
|
-
|
20
|
-
lambda { browser.text_field(conditions).id }.should raise_error(UnknownObjectException)
|
17
|
+
lambda { browser.text_field(:index => 100, :name => "foo").id }.should raise_error(UnknownObjectException)
|
21
18
|
end
|
22
19
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
lambda { Element.new(container, "foo") }.should raise_error(ArgumentError)
|
28
|
-
end
|
20
|
+
it "raises ArgumentError if given the wrong number of arguments" do
|
21
|
+
container = mock("container", :null_object => true)
|
22
|
+
lambda { Element.new(container, 1,2,3,4) }.should raise_error(ArgumentError)
|
23
|
+
lambda { Element.new(container, "foo") }.should raise_error(ArgumentError)
|
29
24
|
end
|
30
25
|
end
|
31
26
|
|
32
27
|
describe "#focus" do
|
33
|
-
bug "http://
|
28
|
+
bug "http://github.com/jarib/watir-webdriver/issues/issue/20", [:webdriver, :firefox] do
|
34
29
|
it "fires the onfocus event for the given element" do
|
35
30
|
tf = browser.text_field(:id, "new_user_occupation")
|
36
31
|
tf.value.should == "Developer"
|
@@ -49,10 +44,8 @@ describe "Element" do
|
|
49
44
|
end
|
50
45
|
|
51
46
|
describe "#parent" do
|
52
|
-
|
53
|
-
|
54
|
-
browser.text_field(:id, "new_user_email").parent.should be_instance_of(FieldSet)
|
55
|
-
end
|
47
|
+
it "gets the parent of this element" do
|
48
|
+
browser.text_field(:id, "new_user_email").parent.should be_instance_of(FieldSet)
|
56
49
|
end
|
57
50
|
end
|
58
51
|
|
@@ -65,10 +58,8 @@ describe "Element" do
|
|
65
58
|
browser.text_field(:id, "new_user_interests_dolls").should_not be_visible
|
66
59
|
end
|
67
60
|
|
68
|
-
|
69
|
-
|
70
|
-
browser.div(:id, 'changed_language').should_not be_visible
|
71
|
-
end
|
61
|
+
it "returns false if the element has style='display: none;'" do
|
62
|
+
browser.div(:id, 'changed_language').should_not be_visible
|
72
63
|
end
|
73
64
|
|
74
65
|
it "returns false if the element has style='visibility: hidden;" do
|