watir-webdriver 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. data/Gemfile +2 -0
  2. data/Gemfile.lock +48 -0
  3. data/Rakefile +23 -8
  4. data/VERSION +1 -1
  5. data/lib/watir-webdriver.rb +7 -5
  6. data/lib/watir-webdriver/browser.rb +9 -2
  7. data/lib/watir-webdriver/browserbot.js +5 -2
  8. data/lib/watir-webdriver/container.rb +6 -9
  9. data/lib/watir-webdriver/{collections/element_collection.rb → element_collection.rb} +5 -0
  10. data/lib/watir-webdriver/elements/button.rb +5 -4
  11. data/lib/watir-webdriver/{element.rb → elements/element.rb} +29 -5
  12. data/lib/watir-webdriver/elements/file_field.rb +21 -4
  13. data/lib/watir-webdriver/elements/frame.rb +1 -1
  14. data/lib/watir-webdriver/elements/generated.rb +750 -750
  15. data/lib/watir-webdriver/elements/image.rb +6 -0
  16. data/lib/watir-webdriver/elements/link.rb +0 -4
  17. data/lib/watir-webdriver/elements/select.rb +22 -24
  18. data/lib/watir-webdriver/elements/table_row.rb +11 -1
  19. data/lib/watir-webdriver/elements/text_field.rb +5 -15
  20. data/lib/watir-webdriver/extensions/wait.rb +107 -0
  21. data/lib/watir-webdriver/html/generator.rb +1 -1
  22. data/lib/watir-webdriver/html/util.rb +1 -10
  23. data/lib/watir-webdriver/html/visitor.rb +2 -14
  24. data/lib/watir-webdriver/locators/button_locator.rb +22 -3
  25. data/lib/watir-webdriver/locators/element_locator.rb +54 -28
  26. data/lib/watir-webdriver/locators/table_row_locator.rb +3 -1
  27. data/lib/watir-webdriver/locators/text_field_locator.rb +7 -3
  28. data/lib/watir-webdriver/window_switching.rb +78 -0
  29. data/spec/browser_spec.rb +43 -0
  30. data/spec/container_spec.rb +43 -0
  31. data/spec/element_locator_spec.rb +305 -0
  32. data/spec/element_spec.rb +34 -5
  33. data/spec/html/closeable.html +13 -0
  34. data/spec/html/data_attributes.html +9 -0
  35. data/spec/html/wait.html +27 -0
  36. data/spec/html/window_switching.html +12 -0
  37. data/spec/input_spec.rb +14 -2
  38. data/spec/locator_spec_helper.rb +37 -0
  39. data/spec/spec_helper.rb +3 -0
  40. data/spec/wait_spec.rb +98 -0
  41. data/spec/watirspec/area_spec.rb +4 -4
  42. data/spec/watirspec/browser_spec.rb +37 -35
  43. data/spec/watirspec/button_spec.rb +22 -17
  44. data/spec/watirspec/buttons_spec.rb +1 -1
  45. data/spec/watirspec/checkbox_spec.rb +4 -0
  46. data/spec/watirspec/checkboxes_spec.rb +1 -1
  47. data/spec/watirspec/collections_spec.rb +4 -2
  48. data/spec/watirspec/dd_spec.rb +4 -0
  49. data/spec/watirspec/dds_spec.rb +1 -1
  50. data/spec/watirspec/del_spec.rb +4 -0
  51. data/spec/watirspec/dels_spec.rb +1 -1
  52. data/spec/watirspec/div_spec.rb +38 -12
  53. data/spec/watirspec/divs_spec.rb +1 -1
  54. data/spec/watirspec/dl_spec.rb +20 -6
  55. data/spec/watirspec/dls_spec.rb +1 -1
  56. data/spec/watirspec/dt_spec.rb +4 -0
  57. data/spec/watirspec/dts_spec.rb +1 -1
  58. data/spec/watirspec/em_spec.rb +4 -0
  59. data/spec/watirspec/ems_spec.rb +1 -1
  60. data/spec/watirspec/filefield_spec.rb +37 -2
  61. data/spec/watirspec/filefields_spec.rb +1 -1
  62. data/spec/watirspec/font_spec.rb +4 -0
  63. data/spec/watirspec/form_spec.rb +4 -0
  64. data/spec/watirspec/forms_spec.rb +6 -4
  65. data/spec/watirspec/frame_spec.rb +6 -0
  66. data/spec/watirspec/hidden_spec.rb +5 -4
  67. data/spec/watirspec/hiddens_spec.rb +1 -1
  68. data/spec/watirspec/hn_spec.rb +4 -0
  69. data/spec/watirspec/image_spec.rb +4 -0
  70. data/spec/watirspec/images_spec.rb +1 -1
  71. data/spec/watirspec/ins_spec.rb +4 -0
  72. data/spec/watirspec/inses_spec.rb +1 -1
  73. data/spec/watirspec/label_spec.rb +4 -0
  74. data/spec/watirspec/labels_spec.rb +2 -2
  75. data/spec/watirspec/li_spec.rb +4 -0
  76. data/spec/watirspec/link_spec.rb +15 -10
  77. data/spec/watirspec/links_spec.rb +6 -0
  78. data/spec/watirspec/lis_spec.rb +1 -1
  79. data/spec/watirspec/map_spec.rb +4 -0
  80. data/spec/watirspec/maps_spec.rb +1 -1
  81. data/spec/watirspec/meta_spec.rb +4 -0
  82. data/spec/watirspec/metas_spec.rb +1 -1
  83. data/spec/watirspec/ol_spec.rb +23 -9
  84. data/spec/watirspec/option_spec.rb +19 -7
  85. data/spec/watirspec/p_spec.rb +4 -0
  86. data/spec/watirspec/pre_spec.rb +4 -0
  87. data/spec/watirspec/pres_spec.rb +1 -1
  88. data/spec/watirspec/ps_spec.rb +1 -1
  89. data/spec/watirspec/radio_spec.rb +22 -13
  90. data/spec/watirspec/radios_spec.rb +6 -0
  91. data/spec/watirspec/select_list_spec.rb +29 -17
  92. data/spec/watirspec/select_lists_spec.rb +6 -0
  93. data/spec/watirspec/span_spec.rb +10 -2
  94. data/spec/watirspec/spans_spec.rb +1 -1
  95. data/spec/watirspec/strong_spec.rb +14 -4
  96. data/spec/watirspec/table_body_spec.rb +4 -0
  97. data/spec/watirspec/table_cell_spec.rb +9 -3
  98. data/spec/watirspec/table_cells_spec.rb +0 -1
  99. data/spec/watirspec/table_footer_spec.rb +4 -0
  100. data/spec/watirspec/table_header_spec.rb +4 -0
  101. data/spec/watirspec/table_row_spec.rb +15 -7
  102. data/spec/watirspec/table_rows_spec.rb +2 -2
  103. data/spec/watirspec/table_spec.rb +13 -7
  104. data/spec/watirspec/tables_spec.rb +1 -1
  105. data/spec/watirspec/text_field_spec.rb +21 -12
  106. data/spec/watirspec/text_fields_spec.rb +6 -0
  107. data/spec/watirspec/ul_spec.rb +4 -0
  108. data/spec/window_switching_spec.rb +116 -0
  109. data/watir-webdriver.gemspec +38 -16
  110. metadata +51 -27
  111. data/lib/watir-webdriver/collections/table_row_collection.rb +0 -11
@@ -21,6 +21,10 @@ describe "Image" do
21
21
  browser.image(:title, 'Circle').should exist
22
22
  end
23
23
 
24
+ it "returns the first image if given no args" do
25
+ browser.image.should exist
26
+ end
27
+
24
28
  it "returns false when the image doesn't exist" do
25
29
  browser.image(:id, 'no_such_id').should_not exist
26
30
  browser.image(:id, /no_such_id/).should_not exist
@@ -27,7 +27,7 @@ describe "Images" do
27
27
  c.id.should == browser.image(:index, index).id
28
28
  c.value.should == browser.image(:index, index).value
29
29
 
30
- count += 1
30
+ count += 1
31
31
  end
32
32
 
33
33
  count.should > 0
@@ -20,6 +20,10 @@ describe "Ins" do
20
20
  browser.ins(:xpath, "//ins[@id='lead']").should exist
21
21
  end
22
22
 
23
+ it "returns the first ins if given no args" do
24
+ browser.ins.should exist
25
+ end
26
+
23
27
  it "returns false if the element doesn't exist" do
24
28
  browser.ins(:id, "no_such_id").should_not exist
25
29
  browser.ins(:id, /no_such_id/).should_not exist
@@ -27,7 +27,7 @@ describe "Inses" do
27
27
  s.id.should == browser.ins(:index, index).id
28
28
  s.value.should == browser.ins(:index, index).value
29
29
 
30
- count += 1
30
+ count += 1
31
31
  end
32
32
 
33
33
  count.should > 0
@@ -18,6 +18,10 @@ describe "Label" do
18
18
  browser.label(:xpath, "//label[@id='first_label']").should exist
19
19
  end
20
20
 
21
+ it "returns the first label if given no args" do
22
+ browser.label.should exist
23
+ end
24
+
21
25
  it "returns false if the element does not exist" do
22
26
  browser.label(:id, 'no_such_id').should_not exist
23
27
  browser.label(:id, /no_such_id/).should_not exist
@@ -14,7 +14,7 @@ describe "Labels" do
14
14
  end
15
15
 
16
16
  describe "#[]" do
17
- it "returns the pre at the given index" do
17
+ it "returns the label at the given index" do
18
18
  browser.labels[0].id.should == "first_label"
19
19
  end
20
20
  end
@@ -27,7 +27,7 @@ describe "Labels" do
27
27
  l.id.should == browser.label(:index, index).id
28
28
  l.value.should == browser.label(:index, index).value
29
29
 
30
- count += 1
30
+ count += 1
31
31
  end
32
32
 
33
33
  count.should > 0
@@ -20,6 +20,10 @@ describe "Li" do
20
20
  browser.li(:xpath, "//li[@id='non_link_1']").should exist
21
21
  end
22
22
 
23
+ it "returns the first element if given no args" do
24
+ browser.li.should exist
25
+ end
26
+
23
27
  it "returns false if the 'li' doesn't exist" do
24
28
  browser.li(:id, "no_such_id").should_not exist
25
29
  browser.li(:id, /no_such_id/).should_not exist
@@ -16,14 +16,20 @@ describe "Link" do
16
16
  browser.link(:title, /link_title_2/).should exist
17
17
  browser.link(:text, "Link 2").should exist
18
18
  browser.link(:text, /Link 2/i).should exist
19
- browser.link(:url, 'non_control_elements.html').should exist
20
- browser.link(:url, /non_control_elements.html/).should exist
19
+ browser.link(:href, 'non_control_elements.html').should exist
20
+ browser.link(:href, /non_control_elements.html/).should exist
21
21
  browser.link(:index, 1).should exist
22
22
  browser.link(:xpath, "//a[@id='link_2']").should exist
23
23
  end
24
24
 
25
- it "strips spaces from URL attributes when locating elements" do
26
- browser.link(:url, /strip_space$/).should exist
25
+ it "returns the first link if given no args" do
26
+ browser.link.should exist
27
+ end
28
+
29
+ bug "http://code.google.com/p/selenium/issues/detail?id=748", :webdriver do
30
+ it "strips spaces from href attribute when locating elements" do
31
+ browser.link(:href, /strip_space$/).should exist
32
+ end
27
33
  end
28
34
 
29
35
  it "returns false if the link doesn't exist" do
@@ -33,8 +39,8 @@ describe "Link" do
33
39
  browser.link(:title, /no_such_title/).should_not exist
34
40
  browser.link(:text, "no_such_text").should_not exist
35
41
  browser.link(:text, /no_such_text/i).should_not exist
36
- browser.link(:url, 'no_such_href').should_not exist
37
- browser.link(:url, /no_such_href/).should_not exist
42
+ browser.link(:href, 'no_such_href').should_not exist
43
+ browser.link(:href, /no_such_href/).should_not exist
38
44
  browser.link(:index, 1337).should_not exist
39
45
  browser.link(:xpath, "//a[@id='no_such_id']").should_not exist
40
46
  end
@@ -77,9 +83,9 @@ describe "Link" do
77
83
  end
78
84
  end
79
85
 
80
- describe "#url" do
86
+ describe "#href" do
81
87
  it "returns the href attribute" do
82
- browser.link(:index, 1).url.should =~ /non_control_elements/
88
+ browser.link(:index, 1).href.should =~ /non_control_elements/
83
89
  end
84
90
  end
85
91
 
@@ -129,7 +135,6 @@ describe "Link" do
129
135
  it "returns true for all attribute methods" do
130
136
  browser.link(:index, 0).should respond_to(:class_name)
131
137
  browser.link(:index, 0).should respond_to(:href)
132
- browser.link(:index, 0).should respond_to(:url)
133
138
  browser.link(:index, 0).should respond_to(:id)
134
139
  browser.link(:index, 0).should respond_to(:style)
135
140
  browser.link(:index, 0).should respond_to(:text)
@@ -145,7 +150,7 @@ describe "Link" do
145
150
  end
146
151
 
147
152
  it "finds an existing link by (:text, Regexp) and click it" do
148
- browser.link(:url, /forms_with_input_elements/).click
153
+ browser.link(:href, /forms_with_input_elements/).click
149
154
  browser.text.include?("User administration").should be_true
150
155
  end
151
156
 
@@ -25,10 +25,16 @@ describe "Links" do
25
25
 
26
26
  describe "#each" do
27
27
  it "iterates through links correctly" do
28
+ count = 0
29
+
28
30
  browser.links.each_with_index do |c, index|
29
31
  c.id.should == browser.link(:index, index).id
30
32
  c.value.should == browser.link(:index, index).value
33
+
34
+ count += 1
31
35
  end
36
+
37
+ count.should > 0
32
38
  end
33
39
  end
34
40
 
@@ -27,7 +27,7 @@ describe "Lis" do
27
27
  l.id.should == browser.li(:index, index).id
28
28
  l.value.should == browser.li(:index, index).value
29
29
 
30
- count += 1
30
+ count += 1
31
31
  end
32
32
 
33
33
  count.should > 0
@@ -18,6 +18,10 @@ describe "Map" do
18
18
  browser.map(:xpath, "//map[@id='triangle_map']").should exist
19
19
  end
20
20
 
21
+ it "returns the first map if given no args" do
22
+ browser.map.should exist
23
+ end
24
+
21
25
  it "returns false if the 'map' doesn't exist" do
22
26
  browser.map(:id, "no_such_id").should_not exist
23
27
  browser.map(:id, /no_such_id/).should_not exist
@@ -28,7 +28,7 @@ describe "Maps" do
28
28
  m.id.should == browser.map(:index, index).id
29
29
  m.value.should == browser.map(:index, index).value
30
30
 
31
- count += 1
31
+ count += 1
32
32
  end
33
33
 
34
34
  count.should > 0
@@ -10,6 +10,10 @@ describe "Meta" do
10
10
  it "returns true if the meta tag exists" do
11
11
  browser.meta(:http_equiv, "Content-Type").should exist
12
12
  end
13
+
14
+ it "returns the first meta if given no args" do
15
+ browser.meta.should exist
16
+ end
13
17
  end
14
18
 
15
19
  describe "content" do
@@ -25,7 +25,7 @@ describe "Metas" do
25
25
 
26
26
  browser.metas.each_with_index do |m, index|
27
27
  m.content.should == browser.meta(:index, index).content
28
- count += 1
28
+ count += 1
29
29
  end
30
30
 
31
31
  count.should > 0
@@ -7,14 +7,29 @@ describe "Ol" do
7
7
  browser.goto(WatirSpec.files + "/non_control_elements.html")
8
8
  end
9
9
 
10
- # Exists method
11
- describe "#exist?" do
12
- it "returns true if the 'ol' exists" do
13
- browser.ol(:id, "favorite_compounds").should exist
14
- browser.ol(:id, /favorite_compounds/).should exist
15
- browser.ol(:index, 0).should exist
16
- browser.ol(:xpath, "//ol[@id='favorite_compounds']").should exist
17
- end
10
+ # Exists method
11
+ describe "#exist?" do
12
+ it "returns true if the 'ol' exists" do
13
+ browser.ol(:id, "favorite_compounds").should exist
14
+ browser.ol(:id, /favorite_compounds/).should exist
15
+ browser.ol(:index, 0).should exist
16
+ browser.ol(:xpath, "//ol[@id='favorite_compounds']").should exist
17
+ end
18
+
19
+ it "returns the first ol if given no args" do
20
+ browser.ol.should exist
21
+ end
22
+
23
+ it "returns false if the 'ol' doesn't exist" do
24
+ browser.ol(:id, "no_such_id").should_not exist
25
+ browser.ol(:id, /no_such_id/).should_not exist
26
+ browser.ol(:text, "no_such_text").should_not exist
27
+ browser.ol(:text, /no_such_text/).should_not exist
28
+ browser.ol(:class, "no_such_class").should_not exist
29
+ browser.ol(:class, /no_such_class/).should_not exist
30
+ browser.ol(:index, 1337).should_not exist
31
+ browser.ol(:xpath, "//ol[@id='no_such_id']").should_not exist
32
+ end
18
33
 
19
34
  it "returns false if the 'ol' doesn't exist" do
20
35
  browser.ol(:id, "no_such_id").should_not exist
@@ -72,5 +87,4 @@ describe "Ol" do
72
87
  browser.ol(:index, 0).should respond_to(:id)
73
88
  end
74
89
  end
75
-
76
90
  end
@@ -20,6 +20,10 @@ describe "Option" do
20
20
  browser.option(:xpath, "//option[@id='nor']").should exist
21
21
  end
22
22
 
23
+ it "returns the first option if given no args" do
24
+ browser.option.should exist
25
+ end
26
+
23
27
  it "returns true if the element exists (select_list context)" do
24
28
  browser.select_list(:name, "new_user_country").option(:id, "nor").should exist
25
29
  browser.select_list(:name, "new_user_country").option(:id, /nor/).should exist
@@ -90,14 +94,22 @@ describe "Option" do
90
94
  browser.select_list(:name, 'new_user_country').option(:text, 'Sweden').should be_selected
91
95
  end
92
96
 
93
- it "fires the onclick event (page context)" do
94
- browser.option(:text, "Username 3").select
95
- browser.text_field(:id, 'delete_user_comment').value.should == 'Don\'t do it!'
97
+ # there's no onclick event for Option in IE
98
+ # http://msdn.microsoft.com/en-us/library/ms535877(VS.85).aspx
99
+ not_compliant_on [:webdriver, :ie] do
100
+ it "fires the onclick event (page context)" do
101
+ browser.option(:text, "Username 3").select
102
+ browser.text_field(:id, 'delete_user_comment').value.should == 'Don\'t do it!'
103
+ end
96
104
  end
97
105
 
98
- it "fires onclick event (select_list context)" do
99
- browser.select_list(:id, 'delete_user_username').option(:text, "Username 3").select
100
- browser.text_field(:id, 'delete_user_comment').value.should == 'Don\'t do it!'
106
+ # there's no onclick event for Option in IE
107
+ # http://msdn.microsoft.com/en-us/library/ms535877(VS.85).aspx
108
+ not_compliant_on [:webdriver, :ie] do
109
+ it "fires onclick event (select_list context)" do
110
+ browser.select_list(:id, 'delete_user_username').option(:text, "Username 3").select
111
+ browser.text_field(:id, 'delete_user_comment').value.should == 'Don\'t do it!'
112
+ end
101
113
  end
102
114
 
103
115
  it "raises UnknownObjectException if the option does not exist (page context)" do
@@ -125,7 +137,7 @@ describe "Option" do
125
137
  end
126
138
 
127
139
  it "is able to get attributes (select_list context)" do
128
- browser.select_list(:name, "new_user_country").option(:text , 'Sweden').class_name.should == "scandinavia"
140
+ browser.select_list(:name, "new_user_country").option(:text, 'Sweden').class_name.should == "scandinavia"
129
141
  end
130
142
  end
131
143
 
@@ -20,6 +20,10 @@ describe "P" do
20
20
  browser.p(:xpath, "//p[@id='lead']").should exist
21
21
  end
22
22
 
23
+ it "returns the first p if given no args" do
24
+ browser.p.should exist
25
+ end
26
+
23
27
  it "returns false if the 'p' doesn't exist" do
24
28
  browser.p(:id, "no_such_id").should_not exist
25
29
  browser.p(:id, /no_such_id/).should_not exist
@@ -20,6 +20,10 @@ describe "Pre" do
20
20
  browser.pre(:xpath, "//pre[@id='rspec']").should exist
21
21
  end
22
22
 
23
+ it "returns the first pre if given no args" do
24
+ browser.pre.should exist
25
+ end
26
+
23
27
  it "returns false if the 'p' doesn't exist" do
24
28
  browser.pre(:id, "no_such_id").should_not exist
25
29
  browser.pre(:id, /no_such_id/).should_not exist
@@ -27,7 +27,7 @@ describe "Pres" do
27
27
  p.id.should == browser.pre(:index, index).id
28
28
  p.value.should == browser.pre(:index, index).value
29
29
 
30
- count += 1
30
+ count += 1
31
31
  end
32
32
 
33
33
  count.should > 0
@@ -27,7 +27,7 @@ describe "Ps" do
27
27
  p.id.should == browser.p(:index, index).id
28
28
  p.value.should == browser.p(:index, index).value
29
29
 
30
- count += 1
30
+ count += 1
31
31
  end
32
32
 
33
33
  count.should > 0
@@ -25,6 +25,10 @@ describe "Radio" do
25
25
  browser.radio(:xpath, "//input[@id='new_user_newsletter_yes']").should exist
26
26
  end
27
27
 
28
+ it "returns the first radio if given no args" do
29
+ browser.radio.should exist
30
+ end
31
+
28
32
  it "returns true if the radio button exists (search by name and value)" do
29
33
  browser.radio(:name => "new_user_newsletter", :value => 'yes').should exist
30
34
  browser.radio(:xpath, "//input[@name='new_user_newsletter' and @value='yes']").set
@@ -163,7 +167,7 @@ describe "Radio" do
163
167
 
164
168
  it "returns false if the radio button is disabled" do
165
169
  browser.radio(:id, "new_user_newsletter_nah").should_not be_enabled
166
- browser.radio(:xpath,"//input[@id='new_user_newsletter_nah']").should_not be_enabled
170
+ browser.radio(:xpath, "//input[@id='new_user_newsletter_nah']").should_not be_enabled
167
171
  end
168
172
 
169
173
  it "raises UnknownObjectException if the radio button doesn't exist" do
@@ -197,22 +201,27 @@ describe "Radio" do
197
201
  browser.radio(:xpath, "//input[@id='new_user_newsletter_no']").should be_set
198
202
  end
199
203
 
200
- it "fires the onclick event" do
201
- browser.radio(:id, "new_user_newsletter_no").set
202
- browser.radio(:id, "new_user_newsletter_yes").set
203
- messages.should == ["clicked: new_user_newsletter_no", "clicked: new_user_newsletter_yes"]
204
+ bug "http://code.google.com/p/selenium/issues/detail?id=695", [:webdriver, :ie] do
205
+ it "fires the onclick event" do
206
+ browser.radio(:id, "new_user_newsletter_no").set
207
+ browser.radio(:id, "new_user_newsletter_yes").set
208
+ messages.should == ["clicked: new_user_newsletter_no", "clicked: new_user_newsletter_yes"]
209
+ end
204
210
  end
205
211
 
206
- it "fires the onchange event" do
207
- browser.radio(:value, 'certainly').set
208
- messages.should == ["changed: new_user_newsletter"]
212
+ # http://webbugtrack.blogspot.com/2007/11/bug-193-onchange-does-not-fire-properly.html
213
+ not_compliant_on [:webdriver, :ie] do
214
+ it "fires the onchange event" do
215
+ browser.radio(:value, 'certainly').set
216
+ messages.should == ["changed: new_user_newsletter"]
209
217
 
210
- browser.radio(:value, 'certainly').set
211
- messages.should == ["changed: new_user_newsletter"] # no event fired here - didn't change
218
+ browser.radio(:value, 'certainly').set
219
+ messages.should == ["changed: new_user_newsletter"] # no event fired here - didn't change
212
220
 
213
- browser.radio(:value, 'yes').set
214
- browser.radio(:value, 'certainly').set
215
- messages.should == ["changed: new_user_newsletter", "clicked: new_user_newsletter_yes", "changed: new_user_newsletter"]
221
+ browser.radio(:value, 'yes').set
222
+ browser.radio(:value, 'certainly').set
223
+ messages.should == ["changed: new_user_newsletter", "clicked: new_user_newsletter_yes", "changed: new_user_newsletter"]
224
+ end
216
225
  end
217
226
 
218
227
  it "raises UnknownObjectException if the radio button doesn't exist" do
@@ -21,11 +21,17 @@ describe "Radios" do
21
21
 
22
22
  describe "#each" do
23
23
  it "iterates through radio buttons correctly" do
24
+ count = 0
25
+
24
26
  browser.radios.each_with_index do |r, index|
25
27
  r.name.should == browser.radio(:index, index).name
26
28
  r.id.should == browser.radio(:index, index).id
27
29
  r.value.should == browser.radio(:index, index).value
30
+
31
+ count += 1
28
32
  end
33
+
34
+ count.should > 0
29
35
  end
30
36
  end
31
37
 
@@ -26,6 +26,10 @@ describe "SelectList" do
26
26
  browser.select_list(:xpath, "//select[@id='new_user_country']").should exist
27
27
  end
28
28
 
29
+ it "returns the first select if given no args" do
30
+ browser.select_list.should exist
31
+ end
32
+
29
33
  it "returns false if the select list doesn't exist" do
30
34
  browser.select_list(:id, 'no_such_id').should_not exist
31
35
  browser.select_list(:id, /no_such_id/).should_not exist
@@ -137,7 +141,7 @@ describe "SelectList" do
137
141
  browser.select_list(:index, 0).should_not be_disabled
138
142
  end
139
143
 
140
- it "shoulds raise UnknownObjectException when the select list does not exist" do
144
+ it "should raise UnknownObjectException when the select list does not exist" do
141
145
  lambda { browser.select_list(:index, 1337).disabled? }.should raise_error(UnknownObjectException)
142
146
  end
143
147
  end
@@ -152,7 +156,7 @@ describe "SelectList" do
152
156
  end
153
157
 
154
158
  describe "#options" do
155
- it "shoulds raise UnknownObjectException if the select list doesn't exist" do
159
+ it "should raise UnknownObjectException if the select list doesn't exist" do
156
160
  lambda { browser.select_list(:name, 'no_such_name').options }.should raise_error(UnknownObjectException)
157
161
  end
158
162
 
@@ -162,7 +166,7 @@ describe "SelectList" do
162
166
 
163
167
  not_compliant_on :webdriver do
164
168
  it "returns all the options as an Array" do
165
- browser.select_list(:name, "new_user_country").options.should == ["Denmark" ,"Norway" , "Sweden" , "United Kingdom", "USA", "Germany"]
169
+ browser.select_list(:name, "new_user_country").options.should == ["Denmark", "Norway", "Sweden", "United Kingdom", "USA", "Germany"]
166
170
  end
167
171
  end
168
172
 
@@ -170,13 +174,13 @@ describe "SelectList" do
170
174
  it "returns all the options as a collection of Options" do
171
175
  options = browser.select_list(:name, "new_user_country").options
172
176
  options.should be_kind_of(OptionCollection)
173
- options.map { |opt| opt.text }.should == ["Denmark" ,"Norway" , "Sweden" , "United Kingdom", "USA", "Germany"]
177
+ options.map { |opt| opt.text }.should == ["Denmark", "Norway", "Sweden", "United Kingdom", "USA", "Germany"]
174
178
  end
175
179
  end
176
180
  end
177
181
 
178
182
  describe "#selected_options" do
179
- it "shoulds raise UnknownObjectException if the select list doesn't exist" do
183
+ it "should raise UnknownObjectException if the select list doesn't exist" do
180
184
  lambda { browser.select_list(:name, 'no_such_name').selected_options }.should raise_error(UnknownObjectException)
181
185
  end
182
186
 
@@ -193,7 +197,7 @@ describe "SelectList" do
193
197
  end
194
198
 
195
199
  it "does not clear selections when not possible" do
196
- lambda { browser.select_list(:name , "new_user_country").clear }.should raise_error
200
+ lambda { browser.select_list(:name, "new_user_country").clear }.should raise_error
197
201
  browser.select_list(:name, "new_user_country").selected_options.should == ["Norway"]
198
202
  end
199
203
 
@@ -280,25 +284,33 @@ describe "SelectList" do
280
284
  browser.select_list(:name, "new_user_languages").select(/ish/).should == "Danish"
281
285
  end
282
286
 
283
- it "fires onchange event when selecting an item" do
284
- browser.select_list(:id, "new_user_languages").select("Danish")
285
- messages.should == ['changed language']
287
+ bug "http://code.google.com/p/selenium/issues/detail?id=695", [:webdriver, :ie] do
288
+ it "fires onchange event when selecting an item" do
289
+ browser.select_list(:id, "new_user_languages").select("Danish")
290
+ messages.should == ['changed language']
291
+ end
286
292
  end
287
293
 
288
- it "doesn't fire onchange event when selecting an already selected item" do
289
- browser.select_list(:id, "new_user_languages").clear # removes the two pre-selected options
290
- browser.select_list(:id, "new_user_languages").select("English")
291
- messages.size.should == 3
294
+ bug "http://code.google.com/p/selenium/issues/detail?id=695", [:webdriver, :ie] do
295
+ it "doesn't fire onchange event when selecting an already selected item" do
296
+ browser.select_list(:id, "new_user_languages").clear # removes the two pre-selected options
297
+ browser.select_list(:id, "new_user_languages").select("English")
298
+ messages.size.should == 3
292
299
 
293
- browser.select_list(:id, "new_user_languages").select("English")
294
- messages.size.should == 3
300
+ browser.select_list(:id, "new_user_languages").select("English")
301
+ messages.size.should == 3
302
+ end
295
303
  end
296
304
 
297
305
  it "raises NoValueFoundException if the option doesn't exist" do
298
306
  lambda { browser.select_list(:name, "new_user_country").select("missing_option") }.should raise_error(NoValueFoundException)
299
307
  lambda { browser.select_list(:name, "new_user_country").select(/missing_option/) }.should raise_error(NoValueFoundException)
300
308
  end
301
- end
309
+
310
+ it "raises a TypeError if argument is not a String, Regexp or Numeric" do
311
+ lambda { browser.select_list(:id, "new_user_languages").select([]) }.should raise_error(TypeError)
312
+ end
313
+ end
302
314
 
303
315
  # deprecate?
304
316
  describe "#select_value" do
@@ -320,4 +332,4 @@ describe "SelectList" do
320
332
  end
321
333
  end
322
334
 
323
- end
335
+ end