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.
Files changed (92) hide show
  1. data/Rakefile +13 -19
  2. data/VERSION +1 -1
  3. data/lib/watir-webdriver.rb +3 -1
  4. data/lib/watir-webdriver/base_element.rb +33 -27
  5. data/lib/watir-webdriver/browser.rb +2 -6
  6. data/lib/watir-webdriver/elements/font.rb +12 -0
  7. data/lib/watir-webdriver/elements/generated.rb +1027 -622
  8. data/lib/watir-webdriver/elements/select_list.rb +3 -3
  9. data/lib/watir-webdriver/locators/element_locator.rb +2 -2
  10. data/lib/watir-webdriver/xpath_support.rb +2 -2
  11. data/support/html5/html5.idl +942 -483
  12. data/support/html5/old/html5.idl +962 -0
  13. data/support/html5/{html5_extras.idl → old/html5_extras.idl} +0 -2
  14. data/support/html5/watir_visitor.rb +23 -19
  15. metadata +74 -100
  16. data/spec/watirspec/area_spec.rb +0 -78
  17. data/spec/watirspec/areas_spec.rb +0 -31
  18. data/spec/watirspec/browser_spec.rb +0 -274
  19. data/spec/watirspec/button_spec.rb +0 -242
  20. data/spec/watirspec/buttons_spec.rb +0 -48
  21. data/spec/watirspec/checkbox_spec.rb +0 -272
  22. data/spec/watirspec/checkboxes_spec.rb +0 -32
  23. data/spec/watirspec/dd_spec.rb +0 -123
  24. data/spec/watirspec/dds_spec.rb +0 -31
  25. data/spec/watirspec/div_spec.rb +0 -211
  26. data/spec/watirspec/divs_spec.rb +0 -31
  27. data/spec/watirspec/dl_spec.rb +0 -123
  28. data/spec/watirspec/dls_spec.rb +0 -32
  29. data/spec/watirspec/dt_spec.rb +0 -123
  30. data/spec/watirspec/dts_spec.rb +0 -31
  31. data/spec/watirspec/element_spec.rb +0 -89
  32. data/spec/watirspec/em_spec.rb +0 -97
  33. data/spec/watirspec/ems_spec.rb +0 -32
  34. data/spec/watirspec/filefield_spec.rb +0 -119
  35. data/spec/watirspec/filefields_spec.rb +0 -32
  36. data/spec/watirspec/form_spec.rb +0 -63
  37. data/spec/watirspec/forms_spec.rb +0 -33
  38. data/spec/watirspec/frame_spec.rb +0 -129
  39. data/spec/watirspec/frames_spec.rb +0 -62
  40. data/spec/watirspec/hidden_spec.rb +0 -102
  41. data/spec/watirspec/hiddens_spec.rb +0 -32
  42. data/spec/watirspec/hn_spec.rb +0 -93
  43. data/spec/watirspec/hns_spec.rb +0 -38
  44. data/spec/watirspec/image_spec.rb +0 -207
  45. data/spec/watirspec/images_spec.rb +0 -31
  46. data/spec/watirspec/label_spec.rb +0 -75
  47. data/spec/watirspec/labels_spec.rb +0 -31
  48. data/spec/watirspec/li_spec.rb +0 -112
  49. data/spec/watirspec/lib/guards.rb +0 -59
  50. data/spec/watirspec/lib/server.rb +0 -127
  51. data/spec/watirspec/lib/spec_helper.rb +0 -79
  52. data/spec/watirspec/lib/watirspec.rb +0 -72
  53. data/spec/watirspec/link_spec.rb +0 -168
  54. data/spec/watirspec/links_spec.rb +0 -35
  55. data/spec/watirspec/lis_spec.rb +0 -31
  56. data/spec/watirspec/map_spec.rb +0 -76
  57. data/spec/watirspec/maps_spec.rb +0 -32
  58. data/spec/watirspec/meta_spec.rb +0 -22
  59. data/spec/watirspec/metas_spec.rb +0 -30
  60. data/spec/watirspec/ol_spec.rb +0 -78
  61. data/spec/watirspec/ols_spec.rb +0 -31
  62. data/spec/watirspec/option_spec.rb +0 -173
  63. data/spec/watirspec/p_spec.rb +0 -128
  64. data/spec/watirspec/pre_spec.rb +0 -112
  65. data/spec/watirspec/pres_spec.rb +0 -31
  66. data/spec/watirspec/ps_spec.rb +0 -31
  67. data/spec/watirspec/radio_spec.rb +0 -255
  68. data/spec/watirspec/radios_spec.rb +0 -32
  69. data/spec/watirspec/select_list_spec.rb +0 -318
  70. data/spec/watirspec/select_lists_spec.rb +0 -35
  71. data/spec/watirspec/span_spec.rb +0 -142
  72. data/spec/watirspec/spans_spec.rb +0 -31
  73. data/spec/watirspec/spec_helper.rb +0 -17
  74. data/spec/watirspec/strong_spec.rb +0 -89
  75. data/spec/watirspec/strongs_spec.rb +0 -32
  76. data/spec/watirspec/table_bodies_spec.rb +0 -45
  77. data/spec/watirspec/table_body_spec.rb +0 -98
  78. data/spec/watirspec/table_cell_spec.rb +0 -68
  79. data/spec/watirspec/table_cells_spec.rb +0 -47
  80. data/spec/watirspec/table_footer_spec.rb +0 -85
  81. data/spec/watirspec/table_footers_spec.rb +0 -47
  82. data/spec/watirspec/table_header_spec.rb +0 -85
  83. data/spec/watirspec/table_headers_spec.rb +0 -45
  84. data/spec/watirspec/table_row_spec.rb +0 -87
  85. data/spec/watirspec/table_rows_spec.rb +0 -50
  86. data/spec/watirspec/table_spec.rb +0 -160
  87. data/spec/watirspec/tables_spec.rb +0 -33
  88. data/spec/watirspec/text_field_spec.rb +0 -276
  89. data/spec/watirspec/text_fields_spec.rb +0 -35
  90. data/spec/watirspec/ul_spec.rb +0 -76
  91. data/spec/watirspec/uls_spec.rb +0 -33
  92. data/support/html5/idl_extractor.rb +0 -73
@@ -1,33 +0,0 @@
1
- # encoding: utf-8
2
- require File.dirname(__FILE__) + '/spec_helper'
3
-
4
- describe "Tables" 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 tables" do
12
- browser.tables.length.should == 4
13
- end
14
- end
15
-
16
- describe "#[]" do
17
- it "returns the p at the given index" do
18
- browser.tables[0].id.should == "axis_example"
19
- browser.tables[1].id.should == "outer"
20
- browser.tables[2].id.should == "inner"
21
- end
22
- end
23
-
24
- describe "#each" do
25
- it "iterates through tables correctly" do
26
- browser.tables.each_with_index do |t, index|
27
- t.id.should == browser.table(:index, index).id
28
- t.value.should == browser.table(:index, index).value
29
- end
30
- end
31
- end
32
-
33
- end
@@ -1,276 +0,0 @@
1
- # encoding: utf-8
2
- require File.dirname(__FILE__) + '/spec_helper'
3
-
4
- describe "TextField" do
5
-
6
- before :each do
7
- browser.goto(WatirSpec.files + "/forms_with_input_elements.html")
8
- end
9
-
10
- # Exists method
11
- describe "#exists?" do
12
- it "returns true if the element exists" do
13
- browser.text_field(:id, 'new_user_email').should exist
14
- browser.text_field(:id, /new_user_email/).should exist
15
- browser.text_field(:name, 'new_user_email').should exist
16
- browser.text_field(:name, /new_user_email/).should exist
17
- browser.text_field(:value, 'Developer').should exist
18
- browser.text_field(:value, /Developer/).should exist
19
- browser.text_field(:text, 'Developer').should exist
20
- browser.text_field(:text, /Developer/).should exist
21
- browser.text_field(:class, 'name').should exist
22
- browser.text_field(:class, /name/).should exist
23
- browser.text_field(:index, 0).should exist
24
- browser.text_field(:xpath, "//input[@id='new_user_email']").should exist
25
- browser.text_field(:label, "First name").should exist
26
- browser.text_field(:label, /(Last|First) name/).should exist
27
- end
28
-
29
- it "returns true if the element exists (no type attribute)" do
30
- browser.text_field(:id, 'new_user_first_name').should exist
31
- end
32
-
33
- it "returns true if the element exists (invalid type attribute)" do
34
- browser.text_field(:id, 'new_user_last_name').should exist
35
- end
36
-
37
- it "returns false if the element does not exist" do
38
- browser.text_field(:id, 'no_such_id').should_not exist
39
- browser.text_field(:id, /no_such_id/).should_not exist
40
- browser.text_field(:name, 'no_such_name').should_not exist
41
- browser.text_field(:name, /no_such_name/).should_not exist
42
- browser.text_field(:value, 'no_such_value').should_not exist
43
- browser.text_field(:value, /no_such_value/).should_not exist
44
- browser.text_field(:text, 'no_such_text').should_not exist
45
- browser.text_field(:text, /no_such_text/).should_not exist
46
- browser.text_field(:class, 'no_such_class').should_not exist
47
- browser.text_field(:class, /no_such_class/).should_not exist
48
- browser.text_field(:index, 1337).should_not exist
49
- browser.text_field(:xpath, "//input[@id='no_such_id']").should_not exist
50
- browser.text_field(:label, "bad label").should_not exist
51
- browser.text_field(:label, /bad label/).should_not exist
52
- end
53
-
54
- it "raises TypeError when 'what' argument is invalid" do
55
- lambda { browser.text_field(:id, 3.14).exists? }.should raise_error(TypeError)
56
- end
57
-
58
- it "raises MissingWayOfFindingObjectException when 'how' argument is invalid" do
59
- lambda { browser.text_field(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
60
- end
61
- end
62
-
63
- # Attribute methods
64
- describe "#id" do
65
- it "returns the id attribute if the text field exists" do
66
- browser.text_field(:index, 3).id.should == "new_user_occupation"
67
- end
68
-
69
- it "raises UnknownObjectException if the text field doesn't exist" do
70
- lambda { browser.text_field(:index, 1337).id }.should raise_error(UnknownObjectException)
71
- end
72
- end
73
-
74
- describe "#name" do
75
- it "returns the name attribute if the text field exists" do
76
- browser.text_field(:index, 3).name.should == "new_user_occupation"
77
- end
78
-
79
- it "raises UnknownObjectException if the text field doesn't exist" do
80
- lambda { browser.text_field(:index, 1337).name }.should raise_error(UnknownObjectException)
81
- end
82
- end
83
-
84
- describe "#title" do
85
- it "returns the title attribute if the text field exists" do
86
- browser.text_field(:id, "new_user_code").title.should == "Your personal code"
87
- end
88
-
89
- it "raises UnknownObjectException if the text field doesn't exist" do
90
- lambda { browser.text_field(:index, 1337).title }.should raise_error(UnknownObjectException)
91
- end
92
- end
93
-
94
- describe "#type" do
95
- it "returns the type attribute if the text field exists" do
96
- browser.text_field(:index, 3).type.should == "text"
97
- end
98
-
99
- it "returns 'text' if the type attribute is invalid" do
100
- browser.text_field(:id, 'new_user_last_name').type.should == "text"
101
- end
102
-
103
- it "returns 'text' if the type attribute does not exist" do
104
- browser.text_field(:id, 'new_user_first_name').type.should == "text"
105
- end
106
-
107
- it "raises UnknownObjectException if the text field doesn't exist" do
108
- lambda { browser.text_field(:index, 1337).type }.should raise_error(UnknownObjectException)
109
- end
110
- end
111
-
112
- describe "#value" do
113
- it "returns the value attribute if the text field exists" do
114
- browser.text_field(:name, "new_user_occupation").value.should == "Developer"
115
- browser.text_field(:index, 3).value.should == "Developer"
116
- browser.text_field(:name, /new_user_occupation/i).value.should == "Developer"
117
- end
118
-
119
- it "raises UnknownObjectException if the text field doesn't exist" do
120
- lambda { browser.text_field(:index, 1337).value }.should raise_error(UnknownObjectException)
121
- end
122
- end
123
-
124
- describe "#respond_to?" do
125
- it "returns true for all attribute methods" do
126
- browser.text_field(:index, 0).should respond_to(:class_name)
127
- browser.text_field(:index, 0).should respond_to(:id)
128
- browser.text_field(:index, 0).should respond_to(:name)
129
- browser.text_field(:index, 0).should respond_to(:title)
130
- browser.text_field(:index, 0).should respond_to(:type)
131
- browser.text_field(:index, 0).should respond_to(:value)
132
- end
133
- end
134
-
135
- # Access methods
136
- describe "#enabled?" do
137
- it "returns true for enabled text fields" do
138
- browser.text_field(:name, "new_user_occupation").should be_enabled
139
- browser.text_field(:id, "new_user_email").should be_enabled
140
- end
141
-
142
- it "returns false for disabled text fields" do
143
- browser.text_field(:name, "new_user_species").should_not be_enabled
144
- end
145
-
146
- it "raises UnknownObjectException if the text field doesn't exist" do
147
- lambda { browser.text_field(:id, "no_such_id").enabled? }.should raise_error(UnknownObjectException)
148
- end
149
- end
150
-
151
- describe "#disabled?" do
152
- it "returns true if the text field is disabled" do
153
- browser.text_field(:id, 'new_user_species').should be_disabled
154
- end
155
-
156
- it "returns false if the text field is enabled" do
157
- browser.text_field(:index, 0).should_not be_disabled
158
- end
159
-
160
- it "raises UnknownObjectException if the text field doesn't exist" do
161
- lambda { browser.text_field(:index, 1337).disabled? }.should raise_error(UnknownObjectException)
162
- end
163
- end
164
-
165
- describe "#readonly?" do
166
- it "returns true for read-only text fields" do
167
- browser.text_field(:name, "new_user_code").should be_readonly
168
- browser.text_field(:id, "new_user_code").should be_readonly
169
- end
170
-
171
- it "returns false for writeable text fields" do
172
- browser.text_field(:name, "new_user_email").should_not be_readonly
173
- end
174
-
175
- it "raises UnknownObjectException if the text field doesn't exist" do
176
- lambda { browser.text_field(:id, 'no_such_id').readonly? }.should raise_error(UnknownObjectException)
177
- end
178
- end
179
-
180
- # Manipulation methods
181
- describe "#append" do
182
- it "appends the text to the text field" do
183
- browser.text_field(:name, "new_user_occupation").append(" Append This")
184
- browser.text_field(:name, "new_user_occupation").value.should == "Developer Append This"
185
- end
186
-
187
- it "appends multi-byte characters" do
188
- browser.text_field(:name, "new_user_occupation").append(" ijij")
189
- browser.text_field(:name, "new_user_occupation").value.should == "Developer ijij"
190
- end
191
-
192
- it "raises ObjectReadOnlyException if the object is read only" do
193
- lambda { browser.text_field(:id, "new_user_code").append("Append This") }.should raise_error(ObjectReadOnlyException)
194
- end
195
-
196
- it "raises ObjectDisabledException if the object is disabled" do
197
- lambda { browser.text_field(:name, "new_user_species").append("Append This") }.should raise_error(ObjectDisabledException)
198
- end
199
-
200
- it "raises UnknownObjectException if the object doesn't exist" do
201
- lambda { browser.text_field(:name, "no_such_name").append("Append This") }.should raise_error(UnknownObjectException)
202
- end
203
- end
204
-
205
- describe "#clear" do
206
- it "removes all text from the text field" do
207
- browser.text_field(:name, "new_user_occupation").clear
208
- browser.text_field(:name, "new_user_occupation").value.should be_empty
209
- browser.text_field(:id, "delete_user_comment").clear
210
- browser.text_field(:id, "delete_user_comment").value.should be_empty
211
- end
212
-
213
- it "raises UnknownObjectException if the text field doesn't exist" do
214
- lambda { browser.text_field(:id, "no_such_id").clear }.should raise_error(UnknownObjectException)
215
- end
216
- end
217
-
218
- describe "#value=" do
219
- it "sets the value of the element" do
220
- browser.text_field(:id, 'new_user_email').value = 'Hello Cruel World'
221
- browser.text_field(:id, "new_user_email").value.should == 'Hello Cruel World'
222
- end
223
-
224
- it "is able to set multi-byte characters" do
225
- browser.text_field(:name, "new_user_occupation").value = "ijij"
226
- browser.text_field(:name, "new_user_occupation").value.should == "ijij"
227
- end
228
-
229
- it "sets the value of a textarea element" do
230
- browser.text_field(:id, 'delete_user_comment').value = 'Hello Cruel World'
231
- browser.text_field(:id, "delete_user_comment").value.should == 'Hello Cruel World'
232
- end
233
-
234
- it "raises UnknownObjectException if the text field doesn't exist" do
235
- lambda { browser.text_field(:name, "no_such_name").value = 'yo' }.should raise_error(UnknownObjectException)
236
- end
237
- end
238
-
239
- describe "#set" do
240
- it "sets the value of the element" do
241
- browser.text_field(:id, 'new_user_email').set('Bye Cruel World')
242
- browser.text_field(:id, "new_user_email").value.should == 'Bye Cruel World'
243
- end
244
-
245
- it "sets the value of a textarea element" do
246
- browser.text_field(:id, 'delete_user_comment').set('Hello Cruel World')
247
- browser.text_field(:id, "delete_user_comment").value.should == 'Hello Cruel World'
248
- end
249
-
250
- bug "WTR-341", :watir do
251
- it "fires events" do
252
- browser.text_field(:id, "new_user_username").set("Hello World")
253
- browser.span(:id, "current_length").text.should == "11"
254
- end
255
- end
256
-
257
- it "sets the value of a password field" do
258
- browser.text_field(:name , 'new_user_password').set('secret')
259
- browser.text_field(:name , 'new_user_password').value.should == 'secret'
260
- end
261
-
262
- it "sets the value when accessed through the enclosing Form" do
263
- browser.form(:id, 'new_user').text_field(:name , 'new_user_password').set('secret')
264
- browser.form(:id, 'new_user').text_field(:name , 'new_user_password').value.should == 'secret'
265
- end
266
-
267
- it "is able to set multi-byte characters" do
268
- browser.text_field(:name, "new_user_occupation").set("ijij")
269
- browser.text_field(:name, "new_user_occupation").value.should == "ijij"
270
- end
271
-
272
- it "raises UnknownObjectException if the text field doesn't exist" do
273
- lambda { browser.text_field(:id, "no_such_id").set('secret') }.should raise_error(UnknownObjectException)
274
- end
275
- end
276
- end
@@ -1,35 +0,0 @@
1
- # encoding: utf-8
2
- require File.dirname(__FILE__) + '/spec_helper'
3
-
4
- describe "TextFields" 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 text fields" do
12
- browser.text_fields.length.should == 9
13
- end
14
- end
15
-
16
- describe "#[]" do
17
- it "returns the text field at the given index" do
18
- browser.text_fields[0].id.should == "new_user_first_name"
19
- browser.text_fields[1].id.should == "new_user_last_name"
20
- browser.text_fields[2].id.should == "new_user_email"
21
- end
22
- end
23
-
24
- describe "#each" do
25
- it "iterates through text fields correctly" do
26
- browser.text_fields.each_with_index do |r, index|
27
- r.name.should == browser.text_field(:index, index).name
28
- r.id.should == browser.text_field(:index, index).id
29
- r.value.should == browser.text_field(:index, index).value
30
- end
31
- end
32
- end
33
-
34
-
35
- end
@@ -1,76 +0,0 @@
1
- # encoding: utf-8
2
- require File.dirname(__FILE__) + '/spec_helper'
3
-
4
- describe "Ul" 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 'ul' exists" do
13
- browser.ul(:id, "navbar").should exist
14
- browser.ul(:id, /navbar/).should exist
15
- browser.ul(:index, 0).should exist
16
- browser.ul(:xpath, "//ul[@id='navbar']").should exist
17
- end
18
-
19
- it "returns false if the 'ul' doesn't exist" do
20
- browser.ul(:id, "no_such_id").should_not exist
21
- browser.ul(:id, /no_such_id/).should_not exist
22
- browser.ul(:text, "no_such_text").should_not exist
23
- browser.ul(:text, /no_such_text/).should_not exist
24
- browser.ul(:class, "no_such_class").should_not exist
25
- browser.ul(:class, /no_such_class/).should_not exist
26
- browser.ul(:index, 1337).should_not exist
27
- browser.ul(:xpath, "//ul[@id='no_such_id']").should_not exist
28
- end
29
-
30
- it "raises TypeError when 'what' argument is invalid" do
31
- lambda { browser.ul(:id, 3.14).exists? }.should raise_error(TypeError)
32
- end
33
-
34
- it "raises MissingWayOfFindingObjectException when 'how' argument is invalid" do
35
- lambda { browser.ul(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
36
- end
37
- end
38
-
39
- # Attribute methods
40
- describe "#class_name" do
41
- it "returns the class attribute" do
42
- browser.ul(:id, 'navbar').class_name.should == 'navigation'
43
- end
44
-
45
- it "returns an empty string if the element exists and the attribute doesn't" do
46
- browser.ul(:index, 1).class_name.should == ''
47
- end
48
-
49
- it "raises UnknownObjectException if the ul doesn't exist" do
50
- lambda { browser.ul(:id, 'no_such_id').class_name }.should raise_error(UnknownObjectException)
51
- end
52
- end
53
-
54
- describe "#id" do
55
- it "returns the id attribute" do
56
- browser.ul(:class, 'navigation').id.should == "navbar"
57
- end
58
-
59
- it "returns an empty string if the element exists and the attribute doesn't" do
60
- browser.ul(:index, 1).id.should == ''
61
- end
62
-
63
- it "raises UnknownObjectException if the ul doesn't exist" do
64
- lambda { browser.ul(:id, "no_such_id").id }.should raise_error(UnknownObjectException)
65
- lambda { browser.ul(:index, 1337).id }.should raise_error(UnknownObjectException)
66
- end
67
- end
68
-
69
- describe "#respond_to?" do
70
- it "returns true for all attribute methods" do
71
- browser.ul(:index, 0).should respond_to(:class_name)
72
- browser.ul(:index, 0).should respond_to(:id)
73
- end
74
- end
75
-
76
- end
@@ -1,33 +0,0 @@
1
- # encoding: utf-8
2
- require File.dirname(__FILE__) + '/spec_helper'
3
-
4
- bug "WTR-332", :watir do
5
- describe "Uls" do
6
-
7
- before :each do
8
- browser.goto(WatirSpec.files + "/non_control_elements.html")
9
- end
10
-
11
- describe "#length" do
12
- it "returns the number of uls" do
13
- browser.uls.length.should == 2
14
- end
15
- end
16
-
17
- describe "#[]" do
18
- it "returns the ul at the given index" do
19
- browser.uls[0].id.should == "navbar"
20
- end
21
- end
22
-
23
- describe "#each" do
24
- it "iterates through uls correctly" do
25
- browser.uls.each_with_index do |ul, index|
26
- ul.id.should == browser.ul(:index, index).id
27
- ul.value.should == browser.ul(:index, index).value
28
- end
29
- end
30
- end
31
-
32
- end
33
- end