watir-webdriver 0.0.1.dev → 0.0.1.dev2
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +1 -1
- data/Rakefile +2 -1
- data/VERSION +1 -1
- data/lib/watir-webdriver.rb +0 -1
- data/lib/watir-webdriver/base_element.rb +6 -13
- data/lib/watir-webdriver/browser.rb +7 -1
- data/lib/watir-webdriver/browserbot.js +12 -0
- data/lib/watir-webdriver/elements/button.rb +2 -0
- data/lib/watir-webdriver/elements/checkbox.rb +9 -2
- data/lib/watir-webdriver/elements/input.rb +10 -1
- data/lib/watir-webdriver/elements/radio.rb +8 -9
- data/lib/watir-webdriver/elements/text_field.rb +1 -0
- data/lib/watir-webdriver/exception.rb +1 -0
- data/spec/spec_helper.rb +4 -1
- data/spec/watirspec/browser_spec.rb +23 -11
- data/spec/watirspec/dd_spec.rb +0 -13
- data/spec/watirspec/div_spec.rb +6 -17
- data/spec/watirspec/dl_spec.rb +1 -14
- data/spec/watirspec/dt_spec.rb +1 -14
- data/spec/watirspec/em_spec.rb +0 -13
- data/spec/watirspec/filefield_spec.rb +1 -1
- data/spec/watirspec/frame_spec.rb +0 -11
- data/spec/watirspec/li_spec.rb +1 -16
- data/spec/watirspec/link_spec.rb +5 -2
- data/spec/watirspec/map_spec.rb +1 -17
- data/spec/watirspec/p_spec.rb +0 -15
- data/spec/watirspec/pre_spec.rb +4 -17
- data/spec/watirspec/radio_spec.rb +4 -27
- data/spec/watirspec/span_spec.rb +0 -15
- data/spec/watirspec/spans_spec.rb +0 -26
- data/spec/watirspec/table_spec.rb +0 -6
- metadata +3 -4
- data/lib/watir-webdriver/elements/shared_radio_checkbox.rb +0 -13
data/LICENSE
CHANGED
data/Rakefile
CHANGED
@@ -11,7 +11,7 @@ begin
|
|
11
11
|
gem.homepage = "http://github.com/jarib/watir-webdriver"
|
12
12
|
gem.authors = ["Jari Bakken"]
|
13
13
|
|
14
|
-
gem.add_dependency "selenium-webdriver"
|
14
|
+
gem.add_dependency "selenium-webdriver"
|
15
15
|
|
16
16
|
gem.add_development_dependency "rspec"
|
17
17
|
gem.add_development_dependency "webidl"
|
@@ -32,6 +32,7 @@ Spec::Rake::SpecTask.new(:rcov) do |spec|
|
|
32
32
|
spec.libs << 'lib' << 'spec'
|
33
33
|
spec.pattern = 'spec/**/*_spec.rb'
|
34
34
|
spec.rcov = true
|
35
|
+
spec.rcov_opts = %w[--exclude spec,ruby-debug,/Library/Ruby,.gem --include lib/watir-webdriver]
|
35
36
|
end
|
36
37
|
|
37
38
|
task :spec => :check_dependencies
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.1.
|
1
|
+
0.0.1.dev2
|
data/lib/watir-webdriver.rb
CHANGED
@@ -30,7 +30,6 @@ end
|
|
30
30
|
require "watir-webdriver/base_element"
|
31
31
|
require "watir-webdriver/collections/element_collection"
|
32
32
|
require "watir-webdriver/elements/generated"
|
33
|
-
require "watir-webdriver/elements/shared_radio_checkbox"
|
34
33
|
require "watir-webdriver/elements/input"
|
35
34
|
require "watir-webdriver/elements/button"
|
36
35
|
require "watir-webdriver/collections/buttons_collection"
|
@@ -216,7 +216,7 @@ module Watir
|
|
216
216
|
|
217
217
|
def value
|
218
218
|
assert_exists
|
219
|
-
rescue_no_match { @element.value }
|
219
|
+
rescue_no_match { @element.value || "" }
|
220
220
|
end
|
221
221
|
|
222
222
|
def attribute_value(attribute_name)
|
@@ -227,25 +227,18 @@ module Watir
|
|
227
227
|
|
228
228
|
def html
|
229
229
|
assert_exists
|
230
|
-
|
231
|
-
driver.execute_script(<<-JAVASCRIPT, @element)
|
232
|
-
var e = arguments[0];
|
233
|
-
if(e.outerHTML) {
|
234
|
-
return e.outerHTML;
|
235
|
-
} else {
|
236
|
-
return e.parentNode.innerHTML;
|
237
|
-
}
|
238
|
-
JAVASCRIPT
|
230
|
+
browserbot('getOuterHTML', @element).strip
|
239
231
|
end
|
240
232
|
|
241
233
|
def focus
|
242
|
-
|
234
|
+
assert_exists
|
235
|
+
driver.execute_script "return arguments[0].focus()", @element
|
243
236
|
end
|
244
237
|
|
245
|
-
def fire_event(event_name)
|
238
|
+
def fire_event(event_name, bubble = false)
|
246
239
|
assert_exists
|
247
240
|
event_name = event_name.to_s.sub!(/^on/, '')
|
248
|
-
browserbot('triggerEvent', @element, event_name,
|
241
|
+
browserbot('triggerEvent', @element, event_name, bubble)
|
249
242
|
end
|
250
243
|
|
251
244
|
def parent
|
@@ -97,7 +97,13 @@ module Watir
|
|
97
97
|
|
98
98
|
def execute_script(script, *args)
|
99
99
|
args.map! { |e| e.kind_of?(Watir::BaseElement) ? e.element : e }
|
100
|
-
@driver.execute_script(script, *args)
|
100
|
+
returned = @driver.execute_script(script, *args)
|
101
|
+
|
102
|
+
if returned.kind_of? WebDriver::Element
|
103
|
+
Watir.element_class_for(returned.tag_name).new(self, :element, returned)
|
104
|
+
else
|
105
|
+
returned
|
106
|
+
end
|
101
107
|
end
|
102
108
|
|
103
109
|
def add_checker(checker = nil, &block)
|
@@ -30,5 +30,17 @@ var browserbot = {
|
|
30
30
|
range.selectNodeContents(document.documentElement);
|
31
31
|
selection.addRange(range);
|
32
32
|
return selection.toString();
|
33
|
+
},
|
34
|
+
|
35
|
+
getOuterHTML : function(element) {
|
36
|
+
if(element.outerHTML) {
|
37
|
+
return element.outerHTML;
|
38
|
+
} else if (typeof(XMLSerializer) != undefined) {
|
39
|
+
return new XMLSerializer().serializeToString(element);
|
40
|
+
} else {
|
41
|
+
throw "can't get outerHTML in this browser";
|
42
|
+
}
|
33
43
|
}
|
44
|
+
|
45
|
+
|
34
46
|
};
|
@@ -1,8 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
module Watir
|
3
3
|
class CheckBox < Input
|
4
|
-
include SharedRadioCheckbox
|
5
|
-
|
6
4
|
identifier :type => 'checkbox'
|
7
5
|
|
8
6
|
container_method :checkbox
|
@@ -19,5 +17,14 @@ module Watir
|
|
19
17
|
end
|
20
18
|
end
|
21
19
|
|
20
|
+
def set?
|
21
|
+
assert_exists
|
22
|
+
@element.selected?
|
23
|
+
end
|
24
|
+
|
25
|
+
def clear
|
26
|
+
set false
|
27
|
+
end
|
28
|
+
|
22
29
|
end
|
23
30
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
module Watir
|
3
|
-
class Input
|
3
|
+
class Input < HTMLElement
|
4
4
|
|
5
5
|
alias_method :readonly?, :read_only?
|
6
6
|
|
@@ -8,6 +8,15 @@ module Watir
|
|
8
8
|
!disabled?
|
9
9
|
end
|
10
10
|
|
11
|
+
def type
|
12
|
+
assert_exists
|
13
|
+
value = rescue_no_match { @element.attribute("type").to_s }
|
14
|
+
|
15
|
+
# we return 'text' if the type is invalid
|
16
|
+
# not sure if we really should do this
|
17
|
+
TextFieldLocator::NON_TEXT_TYPES.include?(value) ? value : 'text'
|
18
|
+
end
|
19
|
+
|
11
20
|
#
|
12
21
|
# not sure about this
|
13
22
|
#
|
@@ -1,22 +1,21 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
module Watir
|
3
3
|
class Radio < Input
|
4
|
-
|
5
|
-
|
6
|
-
identifier :type => 'radio' # a text field is the default for input elements, so this needs to be changed
|
4
|
+
identifier :type => 'radio'
|
7
5
|
|
8
6
|
container_method :radio
|
9
7
|
collection_method :radios
|
10
8
|
|
11
|
-
def set
|
9
|
+
def set
|
12
10
|
assert_exists
|
13
11
|
assert_enabled
|
14
12
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
13
|
+
@element.click unless set?
|
14
|
+
end
|
15
|
+
|
16
|
+
def set?
|
17
|
+
assert_exists
|
18
|
+
@element.selected?
|
20
19
|
end
|
21
20
|
|
22
21
|
end
|
@@ -4,6 +4,7 @@ module Watir
|
|
4
4
|
|
5
5
|
# perhaps we'll need a custom locate(), since this should also cover textareas
|
6
6
|
attributes Watir::TextArea.typed_attributes
|
7
|
+
def type; super; end # hacky, but we want Input#type here, which was overriden by TextArea's attributes
|
7
8
|
|
8
9
|
container_method :text_field
|
9
10
|
collection_method :text_fields
|
data/spec/spec_helper.rb
CHANGED
@@ -10,7 +10,10 @@ require 'spec/autorun'
|
|
10
10
|
include Watir
|
11
11
|
include Watir::Exception
|
12
12
|
|
13
|
+
|
13
14
|
if defined?(WatirSpec)
|
14
|
-
|
15
|
+
browser = (ENV['WATIR_WEBDRIVER_BROWSER'] || :firefox).to_sym
|
16
|
+
|
17
|
+
WatirSpec.browser_args = [browser]
|
15
18
|
WatirSpec.implementation = :webdriver
|
16
19
|
end
|
@@ -18,10 +18,10 @@ describe "Browser" do
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
+
# this should be rewritten - the actual string returned varies alot between implementations
|
21
22
|
describe "#html" do
|
22
|
-
|
23
|
-
|
24
|
-
it "returns the downloaed HTML of the page" do
|
23
|
+
deviates_on :celerity do
|
24
|
+
it "returns the downloaded HTML of the page" do
|
25
25
|
browser.goto(WatirSpec.files + "/non_control_elements.html")
|
26
26
|
browser.html.should == File.read(File.dirname(__FILE__) + "/html/non_control_elements.html")
|
27
27
|
end
|
@@ -33,6 +33,16 @@ describe "Browser" do
|
|
33
33
|
browser.html.should == "<HTML><HEAD><TITLE>Right Click Test</TITLE>\r\n<META http-equiv=Content-type content=\"text/html; charset=utf-8\">\r\n<SCRIPT src=\"javascript/helpers.js\" type=text/javascript charset=utf-8></SCRIPT>\r\n</HEAD>\r\n<BODY>\r\n<DIV id=messages></DIV>\r\n<DIV oncontextmenu='WatirSpec.addMessage(\"right-clicked\")' id=click>Right click!</DIV></BODY></HTML>"
|
34
34
|
end
|
35
35
|
end
|
36
|
+
|
37
|
+
deviates_on :webdriver do
|
38
|
+
it "returns the DOM of the page as an HTML string" do
|
39
|
+
browser.goto(WatirSpec.files + "/right_click.html")
|
40
|
+
html = browser.html
|
41
|
+
|
42
|
+
html.should =~ /^<html/
|
43
|
+
html.should include("<meta http-equiv=\"Content-type\" content=\"text/html; charset=utf-8\">")
|
44
|
+
end
|
45
|
+
end
|
36
46
|
end
|
37
47
|
|
38
48
|
describe "#title" do
|
@@ -43,14 +53,16 @@ describe "Browser" do
|
|
43
53
|
end
|
44
54
|
|
45
55
|
describe "#status" do
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
56
|
+
not_compliant_on :webdriver do # need to set Firefox preference, might do this when selenium-webdriver exposes the profile used
|
57
|
+
bug "WTR-348", :watir do
|
58
|
+
it "returns the current value of window.status" do
|
59
|
+
browser.goto(WatirSpec.files + "/non_control_elements.html")
|
60
|
+
|
61
|
+
# for firefox, this needs to be enabled in
|
62
|
+
# Preferences -> Content -> Advanced -> Change status bar text
|
63
|
+
browser.execute_script "window.status = 'All done!';"
|
64
|
+
browser.status.should == "All done!"
|
65
|
+
end
|
54
66
|
end
|
55
67
|
end
|
56
68
|
end
|
data/spec/watirspec/dd_spec.rb
CHANGED
@@ -120,17 +120,4 @@ describe "Dd" do
|
|
120
120
|
end
|
121
121
|
end
|
122
122
|
|
123
|
-
describe "#to_s" do
|
124
|
-
bug "WTR-350", :watir do
|
125
|
-
it "returns a human readable representation of the element" do
|
126
|
-
browser.dd(:id, 'someone').to_s.should ==
|
127
|
-
%q{tag: dd
|
128
|
-
id: someone
|
129
|
-
class: name
|
130
|
-
title: someone
|
131
|
-
text: John Doe}
|
132
|
-
end
|
133
|
-
end
|
134
|
-
end
|
135
|
-
|
136
123
|
end
|
data/spec/watirspec/div_spec.rb
CHANGED
@@ -179,7 +179,7 @@ describe "Div" do
|
|
179
179
|
end
|
180
180
|
end
|
181
181
|
|
182
|
-
not_compliant_on :watir do
|
182
|
+
not_compliant_on :watir, :webdriver do
|
183
183
|
describe "#double_click" do
|
184
184
|
it "fires the ondblclick event" do
|
185
185
|
browser.div(:id, 'html_test').double_click
|
@@ -198,25 +198,14 @@ describe "Div" do
|
|
198
198
|
|
199
199
|
describe "#html" do
|
200
200
|
it "returns the HTML of the element" do
|
201
|
-
html = browser.div(:id, 'footer').html
|
202
|
-
html.should include('
|
203
|
-
html.should include('
|
201
|
+
html = browser.div(:id, 'footer').html.downcase
|
202
|
+
html.should include('id="footer"')
|
203
|
+
html.should include('title="closing remarks"')
|
204
|
+
html.should include('class="profile"')
|
205
|
+
|
204
206
|
html.should_not include('<div id="content">')
|
205
207
|
html.should_not include('</body>')
|
206
208
|
end
|
207
209
|
end
|
208
210
|
|
209
|
-
describe "#to_s" do
|
210
|
-
bug "WTR-350", :watir do
|
211
|
-
it "returns a human readable representation of the element" do
|
212
|
-
browser.div(:id, 'footer').to_s.should ==
|
213
|
-
%q{tag: div
|
214
|
-
id: footer
|
215
|
-
title: Closing remarks
|
216
|
-
class: profile
|
217
|
-
text: This is a footer.}
|
218
|
-
end
|
219
|
-
end
|
220
|
-
end
|
221
|
-
|
222
211
|
end
|
data/spec/watirspec/dl_spec.rb
CHANGED
@@ -114,23 +114,10 @@ describe "Dl" do
|
|
114
114
|
|
115
115
|
describe "#html" do
|
116
116
|
it "returns the HTML of the element" do
|
117
|
-
html = browser.dl(:id, 'experience-list').html
|
117
|
+
html = browser.dl(:id, 'experience-list').html.downcase
|
118
118
|
html.should include('<dt class="current-industry">')
|
119
119
|
html.should_not include('</body>')
|
120
120
|
end
|
121
121
|
end
|
122
122
|
|
123
|
-
describe "#to_s" do
|
124
|
-
bug "WTR-350", :watir do
|
125
|
-
it "returns a human readable representation of the element" do
|
126
|
-
browser.dl(:id, 'experience-list').to_s.should ==
|
127
|
-
%q{tag: dl
|
128
|
-
id: experience-list
|
129
|
-
class: list
|
130
|
-
title: experience
|
131
|
-
text: Experience 11 years Education Master Current industry Architecture Previous industry experience Architecture}
|
132
|
-
end
|
133
|
-
end
|
134
|
-
end
|
135
|
-
|
136
123
|
end
|
data/spec/watirspec/dt_spec.rb
CHANGED
@@ -115,22 +115,9 @@ describe "Dt" do
|
|
115
115
|
describe "#html" do
|
116
116
|
it "returns the HTML of the element" do
|
117
117
|
html = browser.dt(:id, 'name').html
|
118
|
-
html.should =~ %r
|
118
|
+
html.should =~ %r[<div>.*Name.*</div>]mi
|
119
119
|
html.should_not include('</body>')
|
120
120
|
end
|
121
121
|
end
|
122
122
|
|
123
|
-
describe "#to_s" do
|
124
|
-
bug "WTR-350", :watir do
|
125
|
-
it "returns a human readable representation of the element" do
|
126
|
-
browser.dt(:id, 'experience').to_s.should ==
|
127
|
-
%q{tag: dt
|
128
|
-
id: experience
|
129
|
-
class: industry
|
130
|
-
title: experience
|
131
|
-
text: Experience}
|
132
|
-
end
|
133
|
-
end
|
134
|
-
end
|
135
|
-
|
136
123
|
end
|
data/spec/watirspec/em_spec.rb
CHANGED
@@ -94,17 +94,4 @@ describe "Em" do
|
|
94
94
|
end
|
95
95
|
end
|
96
96
|
|
97
|
-
describe "#to_s" do
|
98
|
-
bug "WTR-350", :watir do
|
99
|
-
it "returns a human readable representation of the element" do
|
100
|
-
browser.em(:id, 'important-id').to_s.should ==
|
101
|
-
%q{tag: em
|
102
|
-
class: important-class
|
103
|
-
id: important-id
|
104
|
-
title: ergo cogito
|
105
|
-
text: ergo cogito}
|
106
|
-
end
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
97
|
end
|
@@ -109,7 +109,7 @@ describe "FileField" do
|
|
109
109
|
|
110
110
|
browser.file_field(:name, "new_user_portrait").set path
|
111
111
|
browser.file_field(:name, "new_user_portrait").value.should == path
|
112
|
-
messages.first.should
|
112
|
+
messages.first.should include(File.basename(path)) # only some browser will return the full path
|
113
113
|
browser.button(:name, "new_user_submit").click
|
114
114
|
end
|
115
115
|
end
|
@@ -109,17 +109,6 @@ describe "Frame" do
|
|
109
109
|
end
|
110
110
|
end
|
111
111
|
|
112
|
-
|
113
|
-
describe "#to_s" do
|
114
|
-
it "returns a human readable representation of the frame" do
|
115
|
-
browser.frame(:index, 0).to_s.should == "tag: frame\n" +
|
116
|
-
" src: frame_1.html\n" +
|
117
|
-
" id: frame_1\n" +
|
118
|
-
" name: frame1\n" +
|
119
|
-
" class: half"
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
112
|
describe "#elements_by_xpath" do
|
124
113
|
before :each do
|
125
114
|
browser.goto(WatirSpec.files + "/iframes.html")
|
data/spec/watirspec/li_spec.rb
CHANGED
@@ -86,7 +86,7 @@ describe "Li" do
|
|
86
86
|
end
|
87
87
|
|
88
88
|
describe "#text" do
|
89
|
-
it "returns the text of the
|
89
|
+
it "returns the text of the li" do
|
90
90
|
browser.li(:id, 'non_link_1').text.should == 'Non-link 1'
|
91
91
|
end
|
92
92
|
|
@@ -109,19 +109,4 @@ describe "Li" do
|
|
109
109
|
end
|
110
110
|
end
|
111
111
|
|
112
|
-
# Other
|
113
|
-
describe "#to_s" do
|
114
|
-
it "returns a human readable representation of the element" do
|
115
|
-
browser.li(:id, 'non_link_1').to_s.should == "tag: li\n" +
|
116
|
-
" id: non_link_1\n" +
|
117
|
-
" class: nonlink\n" +
|
118
|
-
" title: This is not a link!\n" +
|
119
|
-
" text: Non-link 1"
|
120
|
-
end
|
121
|
-
|
122
|
-
it "raises UnknownObjectException if the li doesn't exist" do
|
123
|
-
lambda { browser.li(:xpath, "//li[@id='no_such_id']").text }.should raise_error( UnknownObjectException)
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
112
|
end
|
data/spec/watirspec/link_spec.rb
CHANGED
@@ -22,8 +22,11 @@ describe "Link" do
|
|
22
22
|
browser.link(:xpath, "//a[@id='link_2']").should exist
|
23
23
|
end
|
24
24
|
|
25
|
-
|
26
|
-
|
25
|
+
not_compliant_on :webdriver do
|
26
|
+
# not a technical issue - just not sure if it's really the behaviour we want
|
27
|
+
it "strips spaces from URL attributes when locating elements" do
|
28
|
+
browser.link(:url, /strip_space$/).should exist
|
29
|
+
end
|
27
30
|
end
|
28
31
|
|
29
32
|
it "returns false if the link doesn't exist" do
|
data/spec/watirspec/map_spec.rb
CHANGED
@@ -61,7 +61,7 @@ describe "Map" do
|
|
61
61
|
browser.map(:index, 1).name.should == ''
|
62
62
|
end
|
63
63
|
|
64
|
-
it "raises UnknownObjectException if the
|
64
|
+
it "raises UnknownObjectException if the map doesn't exist" do
|
65
65
|
lambda { browser.map(:id, "no_such_id").name }.should raise_error(UnknownObjectException)
|
66
66
|
lambda { browser.map(:index, 1337).name }.should raise_error(UnknownObjectException)
|
67
67
|
end
|
@@ -73,20 +73,4 @@ describe "Map" do
|
|
73
73
|
browser.map(:index, 0).should respond_to(:name)
|
74
74
|
end
|
75
75
|
end
|
76
|
-
|
77
|
-
# Other
|
78
|
-
describe "#to_s" do
|
79
|
-
bug "WTR-350", :watir do
|
80
|
-
it "returns a human readable representation of the element" do
|
81
|
-
browser.map(:index, 0).to_s.should == "tag: map\n" +
|
82
|
-
" id: triangle_map\n" +
|
83
|
-
" name: triangle_map"
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
it "raises UnknownObjectException if the p doesn't exist" do
|
88
|
-
lambda { browser.map(:xpath, "//map[@id='no_such_id']").text }.should raise_error( UnknownObjectException)
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
76
|
end
|
data/spec/watirspec/p_spec.rb
CHANGED
@@ -125,19 +125,4 @@ describe "P" do
|
|
125
125
|
end
|
126
126
|
end
|
127
127
|
|
128
|
-
# Other
|
129
|
-
describe "#to_s" do
|
130
|
-
it "returns a human readable representation of the element" do
|
131
|
-
browser.p(:index, 0).to_s.should == "tag: p\n" +
|
132
|
-
" id: lead\n" +
|
133
|
-
" class: lead\n" +
|
134
|
-
" title: Lorem ipsum\n" +
|
135
|
-
" text: Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Curabitur eu pede. Ut justo. Praesent feugiat, elit in feugiat iaculis, sem risus rutrum justo, eget fermentum dolor arcu non nunc."
|
136
|
-
end
|
137
|
-
|
138
|
-
it "raises UnknownObjectException if the p doesn't exist" do
|
139
|
-
lambda { browser.p(:xpath, "//p[@id='no_such_id']").text }.should raise_error( UnknownObjectException)
|
140
|
-
end
|
141
|
-
end
|
142
|
-
|
143
128
|
end
|
data/spec/watirspec/pre_spec.rb
CHANGED
@@ -64,7 +64,7 @@ describe "Pre" do
|
|
64
64
|
browser.pre(:index, 0).id.should == ''
|
65
65
|
end
|
66
66
|
|
67
|
-
it "raises UnknownObjectException if the
|
67
|
+
it "raises UnknownObjectException if the pre doesn't exist" do
|
68
68
|
lambda { browser.pre(:id, "no_such_id").id }.should raise_error(UnknownObjectException)
|
69
69
|
lambda { browser.pre(:index, 1337).id }.should raise_error(UnknownObjectException)
|
70
70
|
end
|
@@ -79,14 +79,14 @@ describe "Pre" do
|
|
79
79
|
browser.pre(:index, 0).title.should == ''
|
80
80
|
end
|
81
81
|
|
82
|
-
it "raises UnknownObjectException if the
|
82
|
+
it "raises UnknownObjectException if the pre doesn't exist" do
|
83
83
|
lambda { browser.pre(:id, 'no_such_id').title }.should raise_error( UnknownObjectException)
|
84
84
|
lambda { browser.pre(:xpath, "//pre[@id='no_such_id']").title }.should raise_error( UnknownObjectException)
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
88
88
|
describe "#text" do
|
89
|
-
it "returns the text of the
|
89
|
+
it "returns the text of the pre" do
|
90
90
|
browser.pre(:class, 'haskell').text.should == 'main = putStrLn "Hello World"'
|
91
91
|
end
|
92
92
|
|
@@ -94,7 +94,7 @@ describe "Pre" do
|
|
94
94
|
browser.pre(:index, 0).text.should == ''
|
95
95
|
end
|
96
96
|
|
97
|
-
it "raises UnknownObjectException if the
|
97
|
+
it "raises UnknownObjectException if the pre doesn't exist" do
|
98
98
|
lambda { browser.pre(:id, 'no_such_id').text }.should raise_error( UnknownObjectException)
|
99
99
|
lambda { browser.pre(:xpath , "//pre[@id='no_such_id']").text }.should raise_error( UnknownObjectException)
|
100
100
|
end
|
@@ -109,17 +109,4 @@ describe "Pre" do
|
|
109
109
|
end
|
110
110
|
end
|
111
111
|
|
112
|
-
# Other
|
113
|
-
describe "#to_s" do
|
114
|
-
bug "WTR-350", :watir do
|
115
|
-
it "returns a human readable representation of the element" do
|
116
|
-
browser.pre(:index, 0).to_s.should == "tag: pre"
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
it "raises UnknownObjectException if the p doesn't exist" do
|
121
|
-
lambda { browser.pre(:xpath, "//pre[@id='no_such_id']").text }.should raise_error( UnknownObjectException)
|
122
|
-
end
|
123
|
-
end
|
124
|
-
|
125
112
|
end
|
@@ -186,30 +186,6 @@ describe "Radio" do
|
|
186
186
|
end
|
187
187
|
end
|
188
188
|
|
189
|
-
# Manipulation methods
|
190
|
-
describe "#clear" do
|
191
|
-
it "clears the radio button if it is set" do
|
192
|
-
browser.radio(:id, "new_user_newsletter_yes").clear
|
193
|
-
browser.radio(:id, "new_user_newsletter_yes").should_not be_set
|
194
|
-
end
|
195
|
-
|
196
|
-
it "clears the radio button when found by :xpath" do
|
197
|
-
browser.radio(:xpath, "//input[@id='new_user_newsletter_yes']").clear
|
198
|
-
browser.radio(:xpath, "//input[@id='new_user_newsletter_yes']").should_not be_set
|
199
|
-
end
|
200
|
-
|
201
|
-
it "raises UnknownObjectException if the radio button doesn't exist" do
|
202
|
-
lambda { browser.radio(:name, "no_such_id").clear }.should raise_error(UnknownObjectException)
|
203
|
-
lambda { browser.radio(:xpath, "//input[@id='no_such_id']").clear }.should raise_error(UnknownObjectException)
|
204
|
-
end
|
205
|
-
|
206
|
-
it "raises ObjectDisabledException if the radio is disabled" do
|
207
|
-
browser.radio(:id, "new_user_newsletter_nah").should_not be_set
|
208
|
-
lambda { browser.radio(:id, "new_user_newsletter_nah").clear }.should raise_error(ObjectDisabledException)
|
209
|
-
lambda { browser.radio(:xpath, "//input[@id='new_user_newsletter_nah']").clear }.should raise_error(ObjectDisabledException)
|
210
|
-
end
|
211
|
-
end
|
212
|
-
|
213
189
|
describe "#set" do
|
214
190
|
it "sets the radio button" do
|
215
191
|
browser.radio(:id, "new_user_newsletter_no").set
|
@@ -235,8 +211,9 @@ describe "Radio" do
|
|
235
211
|
browser.radio(:value, 'certainly').set
|
236
212
|
messages.should == ["changed: new_user_newsletter"] # no event fired here - didn't change
|
237
213
|
|
238
|
-
browser.radio(:value, '
|
239
|
-
|
214
|
+
browser.radio(:value, 'yes').set
|
215
|
+
browser.radio(:value, 'certainly').set
|
216
|
+
messages.should == ["changed: new_user_newsletter", "clicked: new_user_newsletter_yes", "changed: new_user_newsletter"]
|
240
217
|
end
|
241
218
|
end
|
242
219
|
|
@@ -265,7 +242,7 @@ describe "Radio" do
|
|
265
242
|
browser.radio(:name => "new_user_newsletter", :value => 'no').should_not be_set
|
266
243
|
browser.radio(:name => "new_user_newsletter", :value => 'no').set
|
267
244
|
browser.radio(:name => "new_user_newsletter", :value => 'no').should be_set
|
268
|
-
browser.radio(:name => "new_user_newsletter", :value => '
|
245
|
+
browser.radio(:name => "new_user_newsletter", :value => 'yes').set
|
269
246
|
browser.radio(:name => "new_user_newsletter", :value => 'no').should_not be_set
|
270
247
|
end
|
271
248
|
|
data/spec/watirspec/span_spec.rb
CHANGED
@@ -139,19 +139,4 @@ describe "Span" do
|
|
139
139
|
end
|
140
140
|
end
|
141
141
|
|
142
|
-
describe "#to_s" do
|
143
|
-
bug "WTR-350", :watir do
|
144
|
-
it "returns a human readable representation of the element" do
|
145
|
-
browser.span(:index, 1).to_s.should == "tag: span\n" +
|
146
|
-
" name: invalid_attribute\n" +
|
147
|
-
" value: invalid_attribute\n" +
|
148
|
-
" text: Sed pretium metus et quam. Nullam odio dolor, vestibulum non, tempor ut, vehicula sed, sapien. Vestibulum placerat ligula at quam. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas."
|
149
|
-
end
|
150
|
-
end
|
151
|
-
|
152
|
-
it "raises UnknownObjectException if the p doesn't exist" do
|
153
|
-
lambda { browser.span(:xpath, "//span[@id='no_such_id']").text }.should raise_error(UnknownObjectException)
|
154
|
-
end
|
155
|
-
end
|
156
|
-
|
157
142
|
end
|
@@ -28,30 +28,4 @@ describe "Spans" do
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
-
describe "#to_s" do
|
32
|
-
bug "WTR-350", :watir do
|
33
|
-
it "returns a human readable representation of the collection" do
|
34
|
-
browser.spans.to_s.should == "tag: span\n" +
|
35
|
-
" id: lead\n" +
|
36
|
-
" class: lead\n" +
|
37
|
-
" title: Lorem ipsum\n" +
|
38
|
-
" text: Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Curabitur eu pede. Ut justo. Praesent feugiat, elit in feugiat iaculis, sem risus rutrum justo, eget fermentum dolor arcu non nunc.\n" +
|
39
|
-
"tag: span\n" +
|
40
|
-
" name: invalid_attribute\n" +
|
41
|
-
" value: invalid_attribute\n" +
|
42
|
-
" text: Sed pretium metus et quam. Nullam odio dolor, vestibulum non, tempor ut, vehicula sed, sapien. Vestibulum placerat ligula at quam. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.\n" +
|
43
|
-
"tag: span\n" +
|
44
|
-
" text: Suspendisse at ipsum a turpis viverra venenatis. Praesent ut nibh. Nullam eu odio. Donec tempor, elit ut lacinia porttitor, augue neque vehicula diam, in elementum ligula nisi a tellus. Aliquam vestibulum ultricies tortor.\n" +
|
45
|
-
"tag: span\n" +
|
46
|
-
" text: Dubito, ergo cogito, ergo sum.\n" +
|
47
|
-
"tag: span\n" +
|
48
|
-
"tag: span\n" +
|
49
|
-
" class: footer\n" +
|
50
|
-
" name: footer\n" +
|
51
|
-
" onclick: this.innerHTML = 'This is a footer with text set by Javascript.'\n" +
|
52
|
-
" text: This is a footer."
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
31
|
end
|
@@ -32,12 +32,6 @@ describe "Table" do
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
-
describe "#locate" do
|
36
|
-
it "is not nil for existing tables" do
|
37
|
-
browser.table(:id, 'axis_example').locate.should_not be_nil
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
35
|
describe "#length" do
|
42
36
|
bug "WTR-354", :watir do
|
43
37
|
it "returns the number of rows" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: watir-webdriver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.1.
|
4
|
+
version: 0.0.1.dev2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jari Bakken
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-01-
|
12
|
+
date: 2010-01-21 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 0
|
23
|
+
version: "0"
|
24
24
|
version:
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rspec
|
@@ -93,7 +93,6 @@ files:
|
|
93
93
|
- lib/watir-webdriver/elements/option.rb
|
94
94
|
- lib/watir-webdriver/elements/radio.rb
|
95
95
|
- lib/watir-webdriver/elements/select_list.rb
|
96
|
-
- lib/watir-webdriver/elements/shared_radio_checkbox.rb
|
97
96
|
- lib/watir-webdriver/elements/table.rb
|
98
97
|
- lib/watir-webdriver/elements/table_row.rb
|
99
98
|
- lib/watir-webdriver/elements/text_field.rb
|