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,48 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require File.dirname(__FILE__) + '/spec_helper'
|
3
|
-
|
4
|
-
describe "Buttons" do
|
5
|
-
|
6
|
-
before :each do
|
7
|
-
browser.goto(WatirSpec.files + "/forms_with_input_elements.html")
|
8
|
-
end
|
9
|
-
|
10
|
-
describe "#length" do
|
11
|
-
bug "WTR-349", :watir do
|
12
|
-
it "returns the number of buttons" do
|
13
|
-
browser.buttons.length.should == 8
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
describe "#[]" do
|
19
|
-
it "returns the button at the given index" do
|
20
|
-
browser.buttons[0].title.should == "Submit the form"
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
describe "#first" do
|
25
|
-
it "returns the first element in the collection" do
|
26
|
-
browser.buttons.first.value.should == browser.buttons[0].value
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
describe "#last" do
|
31
|
-
bug "WTR-349", :watir do
|
32
|
-
it "returns the last element in the collection" do
|
33
|
-
browser.buttons.last.value.should == browser.buttons[-1].value
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
describe "#each" do
|
39
|
-
it "iterates through buttons correctly" do
|
40
|
-
browser.buttons.each_with_index do |b, index|
|
41
|
-
b.name.should == browser.button(:index, index).name
|
42
|
-
b.id.should == browser.button(:index, index).id
|
43
|
-
b.value.should == browser.button(:index, index).value
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
end
|
@@ -1,272 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require File.dirname(__FILE__) + '/spec_helper'
|
3
|
-
|
4
|
-
describe "CheckBox" do
|
5
|
-
|
6
|
-
before :each do
|
7
|
-
browser.goto(WatirSpec.files + "/forms_with_input_elements.html")
|
8
|
-
end
|
9
|
-
|
10
|
-
# Exists method
|
11
|
-
|
12
|
-
describe "#exists?" do
|
13
|
-
it "returns true if the checkbox button exists" do
|
14
|
-
browser.checkbox(:id, "new_user_interests_books").should exist
|
15
|
-
browser.checkbox(:id, /new_user_interests_books/).should exist
|
16
|
-
browser.checkbox(:name, "new_user_interests").should exist
|
17
|
-
browser.checkbox(:name, /new_user_interests/).should exist
|
18
|
-
browser.checkbox(:value, "books").should exist
|
19
|
-
browser.checkbox(:value, /books/).should exist
|
20
|
-
# not sure what :text is supposed to represent here
|
21
|
-
# browser.checkbox(:text, "books").should exist
|
22
|
-
# browser.checkbox(:text, /books/).should exist
|
23
|
-
browser.checkbox(:class, "fun").should exist
|
24
|
-
browser.checkbox(:class, /fun/).should exist
|
25
|
-
browser.checkbox(:index, 0).should exist
|
26
|
-
browser.checkbox(:xpath, "//input[@id='new_user_interests_books']").should exist
|
27
|
-
end
|
28
|
-
|
29
|
-
it "returns true if the checkbox button exists (search by name and value)" do
|
30
|
-
browser.checkbox(:name => "new_user_interests", :value => 'cars').should exist
|
31
|
-
browser.checkbox(:xpath, "//input[@name='new_user_interests' and @value='cars']").set
|
32
|
-
end
|
33
|
-
|
34
|
-
it "returns false if the checkbox button does not exist" do
|
35
|
-
browser.checkbox(:id, "no_such_id").should_not exist
|
36
|
-
browser.checkbox(:id, /no_such_id/).should_not exist
|
37
|
-
browser.checkbox(:name, "no_such_name").should_not exist
|
38
|
-
browser.checkbox(:name, /no_such_name/).should_not exist
|
39
|
-
browser.checkbox(:value, "no_such_value").should_not exist
|
40
|
-
browser.checkbox(:value, /no_such_value/).should_not exist
|
41
|
-
browser.checkbox(:text, "no_such_text").should_not exist
|
42
|
-
browser.checkbox(:text, /no_such_text/).should_not exist
|
43
|
-
browser.checkbox(:class, "no_such_class").should_not exist
|
44
|
-
browser.checkbox(:class, /no_such_class/).should_not exist
|
45
|
-
browser.checkbox(:index, 1337).should_not exist
|
46
|
-
browser.checkbox(:xpath, "//input[@id='no_such_id']").should_not exist
|
47
|
-
end
|
48
|
-
|
49
|
-
it "returns false if the checkbox button does not exist (search by name and value)" do
|
50
|
-
browser.checkbox(:name => "new_user_interests", :value => 'no_such_value').should_not exist
|
51
|
-
browser.checkbox(:xpath, "//input[@name='new_user_interests' and @value='no_such_value']").should_not exist
|
52
|
-
browser.checkbox(:name => "no_such_name", :value => 'cars').should_not exist
|
53
|
-
browser.checkbox(:xpath, "//input[@name='no_such_name' and @value='cars']").should_not exist
|
54
|
-
end
|
55
|
-
|
56
|
-
it "returns true for checkboxs with a string value" do
|
57
|
-
browser.checkbox(:name => 'new_user_interests', :value => 'books').should exist
|
58
|
-
browser.checkbox(:name => 'new_user_interests', :value => 'cars').should exist
|
59
|
-
end
|
60
|
-
|
61
|
-
it "raises TypeError when 'what' argument is invalid" do
|
62
|
-
lambda { browser.checkbox(:id, 3.14).exists? }.should raise_error(TypeError)
|
63
|
-
end
|
64
|
-
|
65
|
-
it "raises MissingWayOfFindingObjectException when 'how' argument is invalid" do
|
66
|
-
lambda { browser.checkbox(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
# Attribute methods
|
71
|
-
|
72
|
-
describe "#class_name" do
|
73
|
-
it "returns the class name if the checkbox exists and has an attribute" do
|
74
|
-
browser.checkbox(:id, "new_user_interests_dancing").class_name.should == "fun"
|
75
|
-
end
|
76
|
-
|
77
|
-
it "returns an emptry string if the checkbox exists and the attribute doesn't" do
|
78
|
-
browser.checkbox(:id, "new_user_interests_books").class_name.should == ""
|
79
|
-
end
|
80
|
-
|
81
|
-
it "raises UnknownObjectException if the checkbox doesn't exist" do
|
82
|
-
lambda { browser.checkbox(:id, "no_such_id").class_name }.should raise_error(UnknownObjectException)
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
describe "#id" do
|
87
|
-
it "returns the id attribute if the checkbox exists and has an attribute" do
|
88
|
-
browser.checkbox(:index, 0).id.should == "new_user_interests_books"
|
89
|
-
end
|
90
|
-
|
91
|
-
it "returns an emptry string if the checkbox exists and the attribute doesn't" do
|
92
|
-
browser.checkbox(:index, 1).id.should == ""
|
93
|
-
end
|
94
|
-
|
95
|
-
it "raises UnknownObjectException if the checkbox doesn't exist" do
|
96
|
-
lambda { browser.checkbox(:index, 1337).id }.should raise_error(UnknownObjectException)
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
describe "#name" do
|
101
|
-
it "returns the name attribute if the checkbox exists" do
|
102
|
-
browser.checkbox(:id, 'new_user_interests_books').name.should == "new_user_interests"
|
103
|
-
end
|
104
|
-
|
105
|
-
it "returns an empty string if the checkbox exists and the attribute doesn't" do
|
106
|
-
browser.checkbox(:id, 'new_user_interests_food').name.should == ""
|
107
|
-
end
|
108
|
-
|
109
|
-
it "raises UnknownObjectException if the checkbox doesn't exist" do
|
110
|
-
lambda { browser.checkbox(:index, 1337).name }.should raise_error(UnknownObjectException)
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
describe "#title" do
|
115
|
-
it "returns the title attribute if the checkbox exists" do
|
116
|
-
browser.checkbox(:id, "new_user_interests_dancing").title.should == "Dancing is fun!"
|
117
|
-
end
|
118
|
-
|
119
|
-
it "returns an emptry string if the checkbox exists and the attribute doesn't" do
|
120
|
-
browser.checkbox(:id, "new_user_interests_books").title.should == ""
|
121
|
-
end
|
122
|
-
|
123
|
-
it "raises UnknownObjectException if the checkbox doesn't exist" do
|
124
|
-
lambda { browser.checkbox(:index, 1337).title }.should raise_error(UnknownObjectException)
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
|
-
describe "#type" do
|
129
|
-
it "returns the type attribute if the checkbox exists" do
|
130
|
-
browser.checkbox(:index, 0).type.should == "checkbox"
|
131
|
-
end
|
132
|
-
|
133
|
-
it "raises UnknownObjectException if the checkbox doesn't exist" do
|
134
|
-
lambda { browser.checkbox(:index, 1337).type }.should raise_error(UnknownObjectException)
|
135
|
-
end
|
136
|
-
end
|
137
|
-
|
138
|
-
describe "#value" do
|
139
|
-
it "returns the value attribute if the checkbox exists" do
|
140
|
-
browser.checkbox(:id, 'new_user_interests_books').value.should == 'books'
|
141
|
-
end
|
142
|
-
|
143
|
-
it "raises UnknownObjectException if the checkbox doesn't exist" do
|
144
|
-
lambda { browser.checkbox(:index, 1337).value}.should raise_error(UnknownObjectException)
|
145
|
-
end
|
146
|
-
end
|
147
|
-
|
148
|
-
describe "#respond_to?" do
|
149
|
-
it "returns true for all attribute methods" do
|
150
|
-
browser.checkbox(:index, 0).should respond_to(:class_name)
|
151
|
-
browser.checkbox(:index, 0).should respond_to(:id)
|
152
|
-
browser.checkbox(:index, 0).should respond_to(:name)
|
153
|
-
browser.checkbox(:index, 0).should respond_to(:title)
|
154
|
-
browser.checkbox(:index, 0).should respond_to(:type)
|
155
|
-
browser.checkbox(:index, 0).should respond_to(:value)
|
156
|
-
end
|
157
|
-
end
|
158
|
-
|
159
|
-
# Access methods
|
160
|
-
|
161
|
-
describe "#enabled?" do
|
162
|
-
it "returns true if the checkbox button is enabled" do
|
163
|
-
browser.checkbox(:id, "new_user_interests_books").should be_enabled
|
164
|
-
browser.checkbox(:xpath, "//input[@id='new_user_interests_books']").should be_enabled
|
165
|
-
end
|
166
|
-
|
167
|
-
it "returns false if the checkbox button is disabled" do
|
168
|
-
browser.checkbox(:id, "new_user_interests_dentistry").should_not be_enabled
|
169
|
-
browser.checkbox(:xpath,"//input[@id='new_user_interests_dentistry']").should_not be_enabled
|
170
|
-
end
|
171
|
-
|
172
|
-
it "raises UnknownObjectException if the checkbox button doesn't exist" do
|
173
|
-
lambda { browser.checkbox(:id, "no_such_id").enabled? }.should raise_error(UnknownObjectException)
|
174
|
-
lambda { browser.checkbox(:xpath, "//input[@id='no_such_id']").enabled? }.should raise_error(UnknownObjectException)
|
175
|
-
end
|
176
|
-
end
|
177
|
-
|
178
|
-
describe "#disabled?" do
|
179
|
-
it "returns true if the checkbox is disabled" do
|
180
|
-
browser.checkbox(:id, 'new_user_interests_dentistry').should be_disabled
|
181
|
-
end
|
182
|
-
|
183
|
-
it "returns false if the checkbox is enabled" do
|
184
|
-
browser.checkbox(:id, 'new_user_interests_books').should_not be_disabled
|
185
|
-
end
|
186
|
-
|
187
|
-
it "raises UnknownObjectException if the checkbox doesn't exist" do
|
188
|
-
lambda { browser.checkbox(:index, 1337).disabled? }.should raise_error(UnknownObjectException)
|
189
|
-
end
|
190
|
-
end
|
191
|
-
|
192
|
-
# Manipulation methods
|
193
|
-
|
194
|
-
describe "#clear" do
|
195
|
-
it "raises ObjectDisabledException if the checkbox is disabled" do
|
196
|
-
browser.checkbox(:id, "new_user_interests_dentistry").should_not be_set
|
197
|
-
lambda { browser.checkbox(:id, "new_user_interests_dentistry").clear }.should raise_error(ObjectDisabledException)
|
198
|
-
lambda { browser.checkbox(:xpath, "//input[@id='new_user_interests_dentistry']").clear }.should raise_error(ObjectDisabledException)
|
199
|
-
end
|
200
|
-
|
201
|
-
it "clears the checkbox button if it is set" do
|
202
|
-
browser.checkbox(:id, "new_user_interests_books").clear
|
203
|
-
browser.checkbox(:id, "new_user_interests_books").should_not be_set
|
204
|
-
end
|
205
|
-
|
206
|
-
it "clears the checkbox button when found by :xpath" do
|
207
|
-
browser.checkbox(:xpath, "//input[@id='new_user_interests_books']").clear
|
208
|
-
browser.checkbox(:xpath, "//input[@id='new_user_interests_books']").should_not be_set
|
209
|
-
end
|
210
|
-
|
211
|
-
it "raises UnknownObjectException if the checkbox button doesn't exist" do
|
212
|
-
lambda { browser.checkbox(:name, "no_such_id").clear }.should raise_error(UnknownObjectException)
|
213
|
-
lambda { browser.checkbox(:xpath, "//input[@id='no_such_id']").clear }.should raise_error(UnknownObjectException)
|
214
|
-
end
|
215
|
-
end
|
216
|
-
|
217
|
-
describe "#set" do
|
218
|
-
it "sets the checkbox button" do
|
219
|
-
browser.checkbox(:id, "new_user_interests_cars").set
|
220
|
-
browser.checkbox(:id, "new_user_interests_cars").should be_set
|
221
|
-
end
|
222
|
-
|
223
|
-
it "sets the checkbox button when found by :xpath" do
|
224
|
-
browser.checkbox(:xpath, "//input[@id='new_user_interests_cars']").set
|
225
|
-
browser.checkbox(:xpath, "//input[@id='new_user_interests_cars']").should be_set
|
226
|
-
end
|
227
|
-
|
228
|
-
it "fires the onclick event" do
|
229
|
-
browser.button(:id, "disabled_button").should be_disabled
|
230
|
-
browser.checkbox(:id, "toggle_button_checkbox").set
|
231
|
-
browser.button(:id, "disabled_button").should_not be_disabled
|
232
|
-
browser.checkbox(:id, "toggle_button_checkbox").clear
|
233
|
-
browser.button(:id, "disabled_button").should be_disabled
|
234
|
-
end
|
235
|
-
|
236
|
-
it "raises UnknownObjectException if the checkbox button doesn't exist" do
|
237
|
-
lambda { browser.checkbox(:name, "no_such_name").set }.should raise_error(UnknownObjectException)
|
238
|
-
lambda { browser.checkbox(:xpath, "//input[@name='no_such_name']").set }.should raise_error(UnknownObjectException)
|
239
|
-
end
|
240
|
-
|
241
|
-
it "raises ObjectDisabledException if the checkbox is disabled" do
|
242
|
-
lambda { browser.checkbox(:id, "new_user_interests_dentistry").set }.should raise_error(ObjectDisabledException)
|
243
|
-
lambda { browser.checkbox(:xpath, "//input[@id='new_user_interests_dentistry']").set }.should raise_error(ObjectDisabledException )
|
244
|
-
end
|
245
|
-
end
|
246
|
-
|
247
|
-
# Other
|
248
|
-
|
249
|
-
describe '#set?' do
|
250
|
-
it "returns true if the checkbox button is set" do
|
251
|
-
browser.checkbox(:id, "new_user_interests_books").should be_set
|
252
|
-
end
|
253
|
-
|
254
|
-
it "returns false if the checkbox button unset" do
|
255
|
-
browser.checkbox(:id, "new_user_interests_cars").should_not be_set
|
256
|
-
end
|
257
|
-
|
258
|
-
it "returns the state for checkboxs with string values" do
|
259
|
-
browser.checkbox(:name => "new_user_interests", :value => 'cars').should_not be_set
|
260
|
-
browser.checkbox(:name => "new_user_interests", :value => 'cars').set
|
261
|
-
browser.checkbox(:name => "new_user_interests", :value => 'cars').should be_set
|
262
|
-
browser.checkbox(:name => "new_user_interests", :value => 'cars').clear
|
263
|
-
browser.checkbox(:name => "new_user_interests", :value => 'cars').should_not be_set
|
264
|
-
end
|
265
|
-
|
266
|
-
it "raises UnknownObjectException if the checkbox button doesn't exist" do
|
267
|
-
lambda { browser.checkbox(:id, "no_such_id").set? }.should raise_error(UnknownObjectException)
|
268
|
-
lambda { browser.checkbox(:xpath, "//input[@id='no_such_id']").set? }.should raise_error(UnknownObjectException)
|
269
|
-
end
|
270
|
-
end
|
271
|
-
|
272
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require File.dirname(__FILE__) + '/spec_helper'
|
3
|
-
|
4
|
-
describe "CheckBoxes" do
|
5
|
-
|
6
|
-
before :each do
|
7
|
-
browser.goto(WatirSpec.files + "/forms_with_input_elements.html")
|
8
|
-
end
|
9
|
-
|
10
|
-
describe "#length" do
|
11
|
-
it "returns the number of checkboxes" do
|
12
|
-
browser.checkboxes.length.should == 7
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
describe "#[]" do
|
17
|
-
it "returns the checkbox at the given index" do
|
18
|
-
browser.checkboxes[0].id.should == "new_user_interests_books"
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
describe "#each" do
|
23
|
-
it "iterates through checkboxes correctly" do
|
24
|
-
browser.checkboxes.each_with_index do |c, index|
|
25
|
-
c.name.should == browser.checkbox(:index, index).name
|
26
|
-
c.id.should == browser.checkbox(:index, index).id
|
27
|
-
c.value.should == browser.checkbox(:index, index).value
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|
data/spec/watirspec/dd_spec.rb
DELETED
@@ -1,123 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require File.dirname(__FILE__) + '/spec_helper'
|
3
|
-
|
4
|
-
describe "Dd" do
|
5
|
-
|
6
|
-
before :each do
|
7
|
-
browser.goto(WatirSpec.files + "/definition_lists.html")
|
8
|
-
end
|
9
|
-
|
10
|
-
# Exists method
|
11
|
-
describe "#exists?" do
|
12
|
-
it "returns true if the element exists" do
|
13
|
-
browser.dd(:id, "someone").should exist
|
14
|
-
browser.dd(:class, "name").should exist
|
15
|
-
browser.dd(:xpath, "//dd[@id='someone']").should exist
|
16
|
-
browser.dd(:index, 0).should exist
|
17
|
-
end
|
18
|
-
|
19
|
-
it "returns false if the element does not exist" do
|
20
|
-
browser.dd(:id, "no_such_id").should_not exist
|
21
|
-
end
|
22
|
-
|
23
|
-
it "raises TypeError when 'what' argument is invalid" do
|
24
|
-
lambda { browser.dd(:id, 3.14).exists? }.should raise_error(TypeError)
|
25
|
-
end
|
26
|
-
|
27
|
-
it "raises MissingWayOfFindingObjectException when 'how' argument is invalid" do
|
28
|
-
lambda { browser.dd(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
# Attribute methods
|
33
|
-
describe "#class_name" do
|
34
|
-
it "returns the class attribute if the element exists" do
|
35
|
-
browser.dd(:id, "someone").class_name.should == "name"
|
36
|
-
end
|
37
|
-
|
38
|
-
it "returns an empty string if the element exists but the attribute doesn't" do
|
39
|
-
browser.dd(:id, "city").class_name.should == ""
|
40
|
-
end
|
41
|
-
|
42
|
-
it "raises UnknownObjectException if the element does not exist" do
|
43
|
-
lambda { browser.dd(:id, "no_such_id").class_name }.should raise_error(UnknownObjectException)
|
44
|
-
lambda { browser.dd(:title, "no_such_title").class_name }.should raise_error(UnknownObjectException)
|
45
|
-
lambda { browser.dd(:index, 1337).class_name }.should raise_error(UnknownObjectException)
|
46
|
-
lambda { browser.dd(:xpath, "//dd[@id='no_such_id']").class_name }.should raise_error(UnknownObjectException)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
describe "#id" do
|
51
|
-
it "returns the id attribute if the element exists" do
|
52
|
-
browser.dd(:class, 'name').id.should == "someone"
|
53
|
-
end
|
54
|
-
|
55
|
-
it "returns an empty string if the element exists, but the attribute doesn't" do
|
56
|
-
browser.dd(:class, 'address').id.should == ""
|
57
|
-
end
|
58
|
-
|
59
|
-
it "raises UnknownObjectException if the element does not exist" do
|
60
|
-
lambda {browser.dd(:id, "no_such_id").id }.should raise_error(UnknownObjectException)
|
61
|
-
lambda {browser.dd(:title, "no_such_id").id }.should raise_error(UnknownObjectException)
|
62
|
-
lambda {browser.dd(:index, 1337).id }.should raise_error(UnknownObjectException)
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
describe "#title" do
|
67
|
-
it "returns the title of the element" do
|
68
|
-
browser.dd(:class, "name").title.should == "someone"
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
describe "#text" do
|
73
|
-
it "returns the text of the element" do
|
74
|
-
browser.dd(:id, "someone").text.should == "John Doe"
|
75
|
-
end
|
76
|
-
|
77
|
-
it "returns an empty string if the element exists but contains no text" do
|
78
|
-
browser.dd(:class, 'noop').text.should == ""
|
79
|
-
end
|
80
|
-
|
81
|
-
it "raises UnknownObjectException if the element does not exist" do
|
82
|
-
lambda { browser.dd(:id, "no_such_id").text }.should raise_error(UnknownObjectException)
|
83
|
-
lambda { browser.dd(:title, "no_such_title").text }.should raise_error(UnknownObjectException)
|
84
|
-
lambda { browser.dd(:index, 1337).text }.should raise_error(UnknownObjectException)
|
85
|
-
lambda { browser.dd(:xpath, "//dd[@id='no_such_id']").text }.should raise_error(UnknownObjectException)
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
describe "#respond_to?" do
|
90
|
-
it "returns true for all attribute methods" do
|
91
|
-
browser.dd(:index, 0).should respond_to(:id)
|
92
|
-
browser.dd(:index, 0).should respond_to(:class_name)
|
93
|
-
browser.dd(:index, 0).should respond_to(:style)
|
94
|
-
browser.dd(:index, 0).should respond_to(:text)
|
95
|
-
browser.dd(:index, 0).should respond_to(:title)
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
# Manipulation methods
|
100
|
-
describe "#click" do
|
101
|
-
it "fires events when clicked" do
|
102
|
-
browser.dd(:title, 'education').text.should_not == 'changed'
|
103
|
-
browser.dd(:title, 'education').click
|
104
|
-
browser.dd(:title, 'education').text.should == 'changed'
|
105
|
-
end
|
106
|
-
|
107
|
-
it "raises UnknownObjectException if the element does not exist" do
|
108
|
-
lambda { browser.dd(:id, "no_such_id").click }.should raise_error(UnknownObjectException)
|
109
|
-
lambda { browser.dd(:title, "no_such_title").click }.should raise_error(UnknownObjectException)
|
110
|
-
lambda { browser.dd(:index, 1337).click }.should raise_error(UnknownObjectException)
|
111
|
-
lambda { browser.dd(:xpath, "//dd[@id='no_such_id']").click }.should raise_error(UnknownObjectException)
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
|
-
describe "#html" do
|
116
|
-
it "returns the HTML of the element" do
|
117
|
-
html = browser.dd(:id, 'someone').html
|
118
|
-
html.should =~ /John Doe/m
|
119
|
-
html.should_not include('</body>')
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
end
|