watir-webdriver 0.0.1.dev6 → 0.0.1.dev7
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -2
- data/VERSION +1 -1
- data/lib/watir-webdriver.rb +1 -4
- data/lib/watir-webdriver/base_element.rb +14 -7
- data/lib/watir-webdriver/browser.rb +3 -1
- data/lib/watir-webdriver/elements/button.rb +1 -0
- data/lib/watir-webdriver/elements/form.rb +1 -1
- data/lib/watir-webdriver/elements/frame.rb +77 -0
- data/lib/watir-webdriver/elements/generated.rb +536 -536
- data/lib/watir-webdriver/elements/option.rb +3 -0
- data/lib/watir-webdriver/elements/table_row.rb +1 -0
- data/lib/watir-webdriver/elements/text_field.rb +5 -1
- data/lib/watir-webdriver/xpath_support.rb +0 -1
- data/spec/base_element_spec.rb +16 -0
- data/spec/html/keylogger.html +15 -0
- data/spec/watirspec/area_spec.rb +78 -0
- data/spec/watirspec/areas_spec.rb +31 -0
- data/spec/watirspec/browser_spec.rb +274 -0
- data/spec/watirspec/button_spec.rb +242 -0
- data/spec/watirspec/buttons_spec.rb +48 -0
- data/spec/watirspec/checkbox_spec.rb +272 -0
- data/spec/watirspec/checkboxes_spec.rb +32 -0
- data/spec/watirspec/dd_spec.rb +123 -0
- data/spec/watirspec/dds_spec.rb +31 -0
- data/spec/watirspec/div_spec.rb +211 -0
- data/spec/watirspec/divs_spec.rb +31 -0
- data/spec/watirspec/dl_spec.rb +123 -0
- data/spec/watirspec/dls_spec.rb +32 -0
- data/spec/watirspec/dt_spec.rb +123 -0
- data/spec/watirspec/dts_spec.rb +31 -0
- data/spec/watirspec/element_spec.rb +89 -0
- data/spec/watirspec/em_spec.rb +97 -0
- data/spec/watirspec/ems_spec.rb +32 -0
- data/spec/watirspec/filefield_spec.rb +119 -0
- data/spec/watirspec/filefields_spec.rb +32 -0
- data/spec/watirspec/font_spec.rb +26 -0
- data/spec/watirspec/form_spec.rb +63 -0
- data/spec/watirspec/forms_spec.rb +33 -0
- data/spec/watirspec/frame_spec.rb +135 -0
- data/spec/watirspec/frames_spec.rb +62 -0
- data/spec/watirspec/hidden_spec.rb +102 -0
- data/spec/watirspec/hiddens_spec.rb +32 -0
- data/spec/watirspec/hn_spec.rb +93 -0
- data/spec/watirspec/hns_spec.rb +38 -0
- data/spec/watirspec/image_spec.rb +207 -0
- data/spec/watirspec/images_spec.rb +31 -0
- data/spec/watirspec/label_spec.rb +75 -0
- data/spec/watirspec/labels_spec.rb +31 -0
- data/spec/watirspec/li_spec.rb +112 -0
- data/spec/watirspec/lib/guards.rb +59 -0
- data/spec/watirspec/lib/server.rb +136 -0
- data/spec/watirspec/lib/spec_helper.rb +79 -0
- data/spec/watirspec/lib/watirspec.rb +72 -0
- data/spec/watirspec/link_spec.rb +168 -0
- data/spec/watirspec/links_spec.rb +35 -0
- data/spec/watirspec/lis_spec.rb +31 -0
- data/spec/watirspec/map_spec.rb +76 -0
- data/spec/watirspec/maps_spec.rb +32 -0
- data/spec/watirspec/meta_spec.rb +22 -0
- data/spec/watirspec/metas_spec.rb +30 -0
- data/spec/watirspec/ol_spec.rb +78 -0
- data/spec/watirspec/ols_spec.rb +31 -0
- data/spec/watirspec/option_spec.rb +173 -0
- data/spec/watirspec/p_spec.rb +128 -0
- data/spec/watirspec/pre_spec.rb +112 -0
- data/spec/watirspec/pres_spec.rb +31 -0
- data/spec/watirspec/ps_spec.rb +31 -0
- data/spec/watirspec/radio_spec.rb +255 -0
- data/spec/watirspec/radios_spec.rb +32 -0
- data/spec/watirspec/select_list_spec.rb +318 -0
- data/spec/watirspec/select_lists_spec.rb +35 -0
- data/spec/watirspec/span_spec.rb +142 -0
- data/spec/watirspec/spans_spec.rb +31 -0
- data/spec/watirspec/spec_helper.rb +17 -0
- data/spec/watirspec/strong_spec.rb +89 -0
- data/spec/watirspec/strongs_spec.rb +32 -0
- data/spec/watirspec/table_bodies_spec.rb +45 -0
- data/spec/watirspec/table_body_spec.rb +98 -0
- data/spec/watirspec/table_cell_spec.rb +68 -0
- data/spec/watirspec/table_cells_spec.rb +47 -0
- data/spec/watirspec/table_footer_spec.rb +85 -0
- data/spec/watirspec/table_footers_spec.rb +47 -0
- data/spec/watirspec/table_header_spec.rb +85 -0
- data/spec/watirspec/table_headers_spec.rb +45 -0
- data/spec/watirspec/table_row_spec.rb +87 -0
- data/spec/watirspec/table_rows_spec.rb +50 -0
- data/spec/watirspec/table_spec.rb +160 -0
- data/spec/watirspec/tables_spec.rb +33 -0
- data/spec/watirspec/text_field_spec.rb +276 -0
- data/spec/watirspec/text_fields_spec.rb +35 -0
- data/spec/watirspec/ul_spec.rb +76 -0
- data/spec/watirspec/uls_spec.rb +33 -0
- data/support/html5/html5.idl +1 -1
- metadata +181 -21
@@ -0,0 +1,32 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
3
|
+
|
4
|
+
describe "FileFields" 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 correct number of file fields" do
|
12
|
+
browser.file_fields.length.should == 2
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe "#[]" do
|
17
|
+
it "returns the file field at the given index" do
|
18
|
+
browser.file_fields[0].id.should == "new_user_portrait"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe "#each" do
|
23
|
+
it "iterates through file fields correctly" do
|
24
|
+
browser.file_fields.each_with_index do |f, index|
|
25
|
+
f.name.should == browser.file_field(:index, index).name
|
26
|
+
f.id.should == browser.file_field(:index, index).id
|
27
|
+
f.value.should == browser.file_field(:index, index).value
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
3
|
+
|
4
|
+
describe "Font" do
|
5
|
+
|
6
|
+
before :each do
|
7
|
+
browser.goto(WatirSpec.files + "/font.html")
|
8
|
+
end
|
9
|
+
|
10
|
+
it "finds the font element" do
|
11
|
+
browser.font(:index, 0).should exist
|
12
|
+
end
|
13
|
+
|
14
|
+
it "knows about the color attribute" do
|
15
|
+
browser.font(:index, 0).color.should == "#ff00ff"
|
16
|
+
end
|
17
|
+
|
18
|
+
it "knows about the face attribute" do
|
19
|
+
browser.font(:index, 0).face.should == "Helvetica"
|
20
|
+
end
|
21
|
+
|
22
|
+
it "knows about the size attribute" do
|
23
|
+
browser.font(:index, 0).size.should == 12
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
3
|
+
|
4
|
+
describe "Form" do
|
5
|
+
|
6
|
+
before :each do
|
7
|
+
browser.goto(WatirSpec.files + "/forms_with_input_elements.html")
|
8
|
+
end
|
9
|
+
|
10
|
+
describe "#exists?" do
|
11
|
+
it "returns true if the form exists" do
|
12
|
+
browser.form(:id, 'new_user').should exist
|
13
|
+
browser.form(:id, /new_user/).should exist
|
14
|
+
|
15
|
+
bug "WTR-355", :watir do
|
16
|
+
browser.form(:class, 'user').should exist
|
17
|
+
browser.form(:class, /user/).should exist
|
18
|
+
end
|
19
|
+
|
20
|
+
browser.form(:method, 'post').should exist
|
21
|
+
browser.form(:method, /post/).should exist
|
22
|
+
browser.form(:action, 'post_to_me').should exist
|
23
|
+
browser.form(:action, /to_me/).should exist
|
24
|
+
browser.form(:index, 0).should exist
|
25
|
+
browser.form(:xpath, "//form[@id='new_user']").should exist
|
26
|
+
end
|
27
|
+
|
28
|
+
it "returns false if the form doesn't exist" do
|
29
|
+
browser.form(:id, 'no_such_id').should_not exist
|
30
|
+
browser.form(:id, /no_such_id/).should_not exist
|
31
|
+
|
32
|
+
bug "WTR-355", :watir do
|
33
|
+
browser.form(:class, 'no_such_class').should_not exist
|
34
|
+
browser.form(:class, /no_such_class/).should_not exist
|
35
|
+
end
|
36
|
+
|
37
|
+
browser.form(:method, 'no_such_method').should_not exist
|
38
|
+
browser.form(:method, /no_such_method/).should_not exist
|
39
|
+
browser.form(:action, 'no_such_action').should_not exist
|
40
|
+
browser.form(:action, /no_such_action/).should_not exist
|
41
|
+
browser.form(:index, 1337).should_not exist
|
42
|
+
browser.form(:xpath, "//form[@id='no_such_id']").should_not exist
|
43
|
+
end
|
44
|
+
|
45
|
+
bug "WTR-356", :watir do
|
46
|
+
it "raises TypeError when 'what' argument is invalid" do
|
47
|
+
lambda { browser.form(:id, 3.14).exists? }.should raise_error(TypeError)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
it "raises MissingWayOfFindingObjectException when 'how' argument is invalid" do
|
52
|
+
lambda { browser.form(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
describe "#submit" do
|
57
|
+
it "submits the form" do
|
58
|
+
browser.form(:id, "delete_user").submit
|
59
|
+
browser.text.should include("Semantic table")
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
3
|
+
|
4
|
+
describe "Forms" 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 forms in the container" do
|
12
|
+
browser.forms.length.should == 2
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe "#[]n" do
|
17
|
+
it "provides access to the nth form" do
|
18
|
+
browser.forms[0].action.should == 'post_to_me'
|
19
|
+
browser.forms[0].attribute_value('method').should == 'post'
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "#each" do
|
24
|
+
it "iterates through forms correctly" do
|
25
|
+
browser.forms.each_with_index do |f, index|
|
26
|
+
f.name.should == browser.form(:index, index).name
|
27
|
+
f.id.should == browser.form(:index, index).id
|
28
|
+
f.class_name.should == browser.form(:index, index).class_name
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -0,0 +1,135 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
3
|
+
|
4
|
+
describe "Frame" do
|
5
|
+
|
6
|
+
before :each do
|
7
|
+
browser.goto(WatirSpec.files + "/frames.html")
|
8
|
+
end
|
9
|
+
|
10
|
+
it "handles crossframe javascript" do
|
11
|
+
browser.frame(:id, "frame_1").text_field(:name, 'senderElement').value.should == 'send_this_value'
|
12
|
+
browser.frame(:id, "frame_2").text_field(:name, 'recieverElement').value.should == 'old_value'
|
13
|
+
browser.frame(:id, "frame_1").button(:id, 'send').click
|
14
|
+
browser.frame(:id, "frame_2").text_field(:name, 'recieverElement').value.should == 'send_this_value'
|
15
|
+
end
|
16
|
+
|
17
|
+
not_compliant_on :watir do
|
18
|
+
describe "#exist?" do
|
19
|
+
it "returns true if the frame exists" do
|
20
|
+
browser.frame(:id, "frame_1").should exist
|
21
|
+
browser.frame(:name, "frame1").should exist
|
22
|
+
browser.frame(:index, 0).should exist
|
23
|
+
|
24
|
+
not_compliant_on :webdriver do
|
25
|
+
browser.frame(:class, "half").should exist
|
26
|
+
browser.frame(:xpath, "//frame[@id='frame_1']").should exist
|
27
|
+
browser.frame(:src, "frame_1.html").should exist
|
28
|
+
browser.frame(:id, /frame/).should exist
|
29
|
+
browser.frame(:name, /frame/).should exist
|
30
|
+
browser.frame(:src, /frame_1/).should exist
|
31
|
+
browser.frame(:class, /half/).should exist
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
it "returns true if the iframe exists" do
|
36
|
+
browser.goto(WatirSpec.files + "/iframes.html")
|
37
|
+
browser.frame(:id, "frame_1").should exist
|
38
|
+
browser.frame(:id, /frame/).should exist
|
39
|
+
browser.frame(:name, "frame1").should exist
|
40
|
+
browser.frame(:name, /frame/).should exist
|
41
|
+
browser.frame(:src, "frame_1.html").should exist
|
42
|
+
browser.frame(:src, /frame_1/).should exist
|
43
|
+
browser.frame(:class, "iframe").should exist
|
44
|
+
browser.frame(:class, /iframe/).should exist
|
45
|
+
browser.frame(:index, 0).should exist
|
46
|
+
browser.frame(:xpath, "//iframe[@id='frame_1']").should exist
|
47
|
+
end
|
48
|
+
|
49
|
+
it "returns false if the frame doesn't exist" do
|
50
|
+
browser.frame(:id, "no_such_id").should_not exist
|
51
|
+
browser.frame(:name, "no_such_text").should_not exist
|
52
|
+
browser.frame(:index, 1337).should_not exist
|
53
|
+
|
54
|
+
not_compliant_on :webdriver do
|
55
|
+
browser.frame(:src, "no_such_src").should_not exist
|
56
|
+
browser.frame(:class, "no_such_class").should_not exist
|
57
|
+
browser.frame(:id, /no_such_id/).should_not exist
|
58
|
+
browser.frame(:name, /no_such_text/).should_not exist
|
59
|
+
browser.frame(:src, /no_such_src/).should_not exist
|
60
|
+
browser.frame(:class, /no_such_class/).should_not exist
|
61
|
+
browser.frame(:xpath, "//frame[@id='no_such_id']").should_not exist
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
it "raises TypeError when 'what' argument is invalid" do
|
66
|
+
lambda { browser.frame(:id, 3.14).exists? }.should raise_error(TypeError)
|
67
|
+
end
|
68
|
+
|
69
|
+
it "raises MissingWayOfFindingObjectException when 'how' argument is invalid" do
|
70
|
+
lambda { browser.frame(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
it "raises UnknownFrameException when accessing elements inside non-existing frame" do
|
76
|
+
lambda { browser.frame(:name, "no_such_name").p(:index, 0).id }.should raise_error(UnknownFrameException)
|
77
|
+
end
|
78
|
+
|
79
|
+
it "raises UnknownFrameException when accessing a non-existing frame" do
|
80
|
+
lambda { browser.frame(:name, "no_such_name").id }.should raise_error(UnknownFrameException)
|
81
|
+
end
|
82
|
+
|
83
|
+
it "raises UnknownFrameException when accessing a non-existing subframe" do
|
84
|
+
lambda { browser.frame(:name, "frame1").frame(:name, "no_such_name").id }.should raise_error(UnknownFrameException)
|
85
|
+
end
|
86
|
+
|
87
|
+
it "raises UnknownObjectException when accessing a non-existing element inside an existing frame" do
|
88
|
+
lambda { browser.frame(:index, 0).p(:index, 1337).id }.should raise_error(UnknownObjectException)
|
89
|
+
end
|
90
|
+
|
91
|
+
it "raises NoMethodError when trying to access attributes it doesn't have" do
|
92
|
+
lambda { browser.frame(:index, 0).foo }.should raise_error(NoMethodError)
|
93
|
+
end
|
94
|
+
|
95
|
+
it "is able to send a value to another frame by using Javascript" do
|
96
|
+
frame1, frame2 = browser.frame(:index, 0), browser.frame(:index, 1)
|
97
|
+
frame1.text_field(:index, 0).value.should == "send_this_value"
|
98
|
+
frame2.text_field(:index, 0).value.should == "old_value"
|
99
|
+
frame1.button(:index, 0).click
|
100
|
+
frame2.text_field(:index, 0).value.should == "send_this_value"
|
101
|
+
end
|
102
|
+
|
103
|
+
it "is able to set a field" do
|
104
|
+
browser.frame(:index, 0).text_field(:name, 'senderElement').set("new value")
|
105
|
+
browser.frame(:index, 0).text_field(:name, 'senderElement').value.should == "new value"
|
106
|
+
end
|
107
|
+
|
108
|
+
not_compliant_on :watir do
|
109
|
+
describe "#execute_script" do
|
110
|
+
it "executes the given javascript in the specified frame" do
|
111
|
+
frame = browser.frame(:index, 0)
|
112
|
+
frame.div(:id, 'set_by_js').text.should == ""
|
113
|
+
frame.execute_script(%Q{document.getElementById('set_by_js').innerHTML = 'Art consists of limitation. The most beautiful part of every picture is the frame.'})
|
114
|
+
frame.div(:id, 'set_by_js').text.should == "Art consists of limitation. The most beautiful part of every picture is the frame."
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
describe "#elements_by_xpath" do
|
119
|
+
before :each do
|
120
|
+
browser.goto(WatirSpec.files + "/iframes.html")
|
121
|
+
end
|
122
|
+
|
123
|
+
it "returns an Array of matching elements" do
|
124
|
+
objects = browser.frame(:index, 0).elements_by_xpath("/html")
|
125
|
+
objects.size.should == 1
|
126
|
+
end
|
127
|
+
|
128
|
+
it "returns an empty Array if there are no matching elements" do
|
129
|
+
objects = browser.frame(:index, 0).elements_by_xpath("//*[@type='foobar']")
|
130
|
+
objects.size.should == 0
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
end
|
135
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
3
|
+
|
4
|
+
not_compliant_on :watir do
|
5
|
+
describe "<frame> Frames" do
|
6
|
+
|
7
|
+
before :each do
|
8
|
+
browser.goto(WatirSpec.files + "/frames.html")
|
9
|
+
end
|
10
|
+
|
11
|
+
describe "#length" do
|
12
|
+
it "returns the correct number of frames" do
|
13
|
+
browser.frames.length.should == 2
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "#[]" do
|
18
|
+
it "returns the frame at the given index" do
|
19
|
+
browser.frames[0].id.should == "frame_1"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "#each" do
|
24
|
+
it "iterates through frames correctly" do
|
25
|
+
browser.frames.each_with_index do |f, index|
|
26
|
+
f.id.should == browser.frame(:index, index).id
|
27
|
+
f.value.should == browser.frame(:index, index).value
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe "<iframe> Frames" do
|
34
|
+
|
35
|
+
before :each do
|
36
|
+
browser.goto(WatirSpec.files + "/iframes.html")
|
37
|
+
end
|
38
|
+
|
39
|
+
describe "#length" do
|
40
|
+
it "returns the correct number of frames" do
|
41
|
+
browser.frames.length.should == 2
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
describe "#[]" do
|
46
|
+
it "returns the frame at the given index" do
|
47
|
+
browser.frames[0].id.should == "frame_1"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
describe "#each" do
|
52
|
+
it "iterates through frames correctly" do
|
53
|
+
browser.frames.each_with_index do |f, index|
|
54
|
+
f.name.should == browser.frame(:index, index).name
|
55
|
+
f.id.should == browser.frame(:index, index).id
|
56
|
+
f.value.should == browser.frame(:index, index).value
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
@@ -0,0 +1,102 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
3
|
+
|
4
|
+
describe "Hidden" do
|
5
|
+
|
6
|
+
before :each do
|
7
|
+
browser.goto(WatirSpec.files + "/forms_with_input_elements.html")
|
8
|
+
end
|
9
|
+
|
10
|
+
# Exist method
|
11
|
+
describe "#exists?" do
|
12
|
+
it "returns true if the element exists" do
|
13
|
+
browser.hidden(:id, 'new_user_interests_dolls').should exist
|
14
|
+
browser.hidden(:id, /new_user_interests_dolls/).should exist
|
15
|
+
browser.hidden(:name, 'new_user_interests').should exist
|
16
|
+
browser.hidden(:name, /new_user_interests/).should exist
|
17
|
+
browser.hidden(:value, 'dolls').should exist
|
18
|
+
browser.hidden(:value, /dolls/).should exist
|
19
|
+
# TODO: figure out what :text means for Hidden
|
20
|
+
# browser.hidden(:text, 'dolls').should exist
|
21
|
+
# browser.hidden(:text, /dolls/).should exist
|
22
|
+
browser.hidden(:class, 'fun').should exist
|
23
|
+
browser.hidden(:class, /fun/).should exist
|
24
|
+
browser.hidden(:index, 0).should exist
|
25
|
+
browser.hidden(:xpath, "//input[@id='new_user_interests_dolls']").should exist
|
26
|
+
end
|
27
|
+
|
28
|
+
it "returns false if the element does not exist" do
|
29
|
+
browser.hidden(:id, 'no_such_id').should_not exist
|
30
|
+
browser.hidden(:id, /no_such_id/).should_not exist
|
31
|
+
browser.hidden(:name, 'no_such_name').should_not exist
|
32
|
+
browser.hidden(:name, /no_such_name/).should_not exist
|
33
|
+
browser.hidden(:value, 'no_such_value').should_not exist
|
34
|
+
browser.hidden(:value, /no_such_value/).should_not exist
|
35
|
+
browser.hidden(:text, 'no_such_text').should_not exist
|
36
|
+
browser.hidden(:text, /no_such_text/).should_not exist
|
37
|
+
browser.hidden(:class, 'no_such_class').should_not exist
|
38
|
+
browser.hidden(:class, /no_such_class/).should_not exist
|
39
|
+
browser.hidden(:index, 1337).should_not exist
|
40
|
+
browser.hidden(:xpath, "//input[@id='no_such_id']").should_not exist
|
41
|
+
end
|
42
|
+
|
43
|
+
it "raises TypeError when 'what' argument is invalid" do
|
44
|
+
lambda { browser.hidden(:id, 3.14).exists? }.should raise_error(TypeError)
|
45
|
+
end
|
46
|
+
|
47
|
+
it "raises MissingWayOfFindingObjectException when 'how' argument is invalid" do
|
48
|
+
lambda { browser.hidden(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
# Attribute methods
|
53
|
+
describe "#id" do
|
54
|
+
it "returns the id attribute if the text field exists" do
|
55
|
+
browser.hidden(:index, 0).id.should == "new_user_interests_dolls"
|
56
|
+
end
|
57
|
+
|
58
|
+
it "raises UnknownObjectException if the text field doesn't exist" do
|
59
|
+
lambda { browser.hidden(:index, 1337).id }.should raise_error(UnknownObjectException)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
describe "#name" do
|
64
|
+
it "returns the name attribute if the text field exists" do
|
65
|
+
browser.hidden(:index, 0).name.should == "new_user_interests"
|
66
|
+
end
|
67
|
+
|
68
|
+
it "raises UnknownObjectException if the text field doesn't exist" do
|
69
|
+
lambda { browser.hidden(:index, 1337).name }.should raise_error(UnknownObjectException)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
describe "#type" do
|
74
|
+
it "returns the type attribute if the text field exists" do
|
75
|
+
browser.hidden(:index, 0).type.should == "hidden"
|
76
|
+
end
|
77
|
+
|
78
|
+
it "raises UnknownObjectException if the text field doesn't exist" do
|
79
|
+
lambda { browser.hidden(:index, 1337).type }.should raise_error(UnknownObjectException)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
describe "#value" do
|
84
|
+
it "returns the value attribute if the text field exists" do
|
85
|
+
browser.hidden(:index, 0).value.should == "dolls"
|
86
|
+
end
|
87
|
+
|
88
|
+
it "raises UnknownObjectException if the text field doesn't exist" do
|
89
|
+
lambda { browser.hidden(:index, 1337).value }.should raise_error(UnknownObjectException)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
describe "#respond_to?" do
|
94
|
+
it "returns true for all attribute methods" do
|
95
|
+
browser.hidden(:index, 0).should respond_to(:id)
|
96
|
+
browser.hidden(:index, 0).should respond_to(:name)
|
97
|
+
browser.hidden(:index, 0).should respond_to(:type)
|
98
|
+
browser.hidden(:index, 0).should respond_to(:value)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
end
|