watir-webdriver 0.1.4 → 0.1.5
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.
- data/.gitignore +9 -0
- data/Gemfile +3 -3
- data/Rakefile +3 -28
- data/lib/watir-webdriver.rb +1 -0
- data/lib/watir-webdriver/version.rb +3 -0
- data/watir-webdriver.gemspec +23 -247
- metadata +34 -326
- data/VERSION +0 -1
- data/spec/watirspec/area_spec.rb +0 -77
- data/spec/watirspec/areas_spec.rb +0 -45
- data/spec/watirspec/browser_spec.rb +0 -274
- data/spec/watirspec/button_spec.rb +0 -255
- data/spec/watirspec/buttons_spec.rb +0 -58
- data/spec/watirspec/checkbox_spec.rb +0 -276
- data/spec/watirspec/checkboxes_spec.rb +0 -47
- data/spec/watirspec/collections_spec.rb +0 -20
- data/spec/watirspec/dd_spec.rb +0 -127
- data/spec/watirspec/dds_spec.rb +0 -45
- data/spec/watirspec/del_spec.rb +0 -145
- data/spec/watirspec/dels_spec.rb +0 -45
- data/spec/watirspec/div_spec.rb +0 -221
- data/spec/watirspec/divs_spec.rb +0 -45
- data/spec/watirspec/dl_spec.rb +0 -137
- data/spec/watirspec/dls_spec.rb +0 -46
- data/spec/watirspec/dt_spec.rb +0 -127
- data/spec/watirspec/dts_spec.rb +0 -45
- data/spec/watirspec/element_spec.rb +0 -149
- data/spec/watirspec/em_spec.rb +0 -101
- data/spec/watirspec/ems_spec.rb +0 -46
- data/spec/watirspec/filefield_spec.rb +0 -156
- data/spec/watirspec/filefields_spec.rb +0 -46
- data/spec/watirspec/font_spec.rb +0 -32
- data/spec/watirspec/form_spec.rb +0 -63
- data/spec/watirspec/forms_spec.rb +0 -47
- data/spec/watirspec/frame_spec.rb +0 -144
- data/spec/watirspec/frames_spec.rb +0 -83
- data/spec/watirspec/hidden_spec.rb +0 -103
- data/spec/watirspec/hiddens_spec.rb +0 -46
- data/spec/watirspec/hn_spec.rb +0 -97
- data/spec/watirspec/hns_spec.rb +0 -42
- data/spec/watirspec/image_spec.rb +0 -208
- data/spec/watirspec/images_spec.rb +0 -45
- data/spec/watirspec/ins_spec.rb +0 -146
- data/spec/watirspec/inses_spec.rb +0 -45
- data/spec/watirspec/label_spec.rb +0 -81
- data/spec/watirspec/labels_spec.rb +0 -45
- data/spec/watirspec/li_spec.rb +0 -116
- data/spec/watirspec/lib/guards.rb +0 -59
- data/spec/watirspec/lib/implementation.rb +0 -48
- data/spec/watirspec/lib/runner.rb +0 -83
- data/spec/watirspec/lib/server.rb +0 -194
- data/spec/watirspec/lib/watirspec.rb +0 -75
- data/spec/watirspec/link_spec.rb +0 -174
- data/spec/watirspec/links_spec.rb +0 -49
- data/spec/watirspec/lis_spec.rb +0 -45
- data/spec/watirspec/map_spec.rb +0 -80
- data/spec/watirspec/maps_spec.rb +0 -46
- data/spec/watirspec/meta_spec.rb +0 -24
- data/spec/watirspec/metas_spec.rb +0 -43
- data/spec/watirspec/ol_spec.rb +0 -90
- data/spec/watirspec/ols_spec.rb +0 -45
- data/spec/watirspec/option_spec.rb +0 -152
- data/spec/watirspec/p_spec.rb +0 -132
- data/spec/watirspec/pre_spec.rb +0 -116
- data/spec/watirspec/pres_spec.rb +0 -45
- data/spec/watirspec/ps_spec.rb +0 -45
- data/spec/watirspec/radio_spec.rb +0 -262
- data/spec/watirspec/radios_spec.rb +0 -46
- data/spec/watirspec/select_list_spec.rb +0 -335
- data/spec/watirspec/select_lists_spec.rb +0 -49
- data/spec/watirspec/span_spec.rb +0 -146
- data/spec/watirspec/spans_spec.rb +0 -45
- data/spec/watirspec/spec_helper.rb +0 -20
- data/spec/watirspec/strong_spec.rb +0 -93
- data/spec/watirspec/strongs_spec.rb +0 -46
- data/spec/watirspec/table_nesting_spec.rb +0 -50
- data/spec/watirspec/table_spec.rb +0 -150
- data/spec/watirspec/tables_spec.rb +0 -47
- data/spec/watirspec/tbody_spec.rb +0 -97
- data/spec/watirspec/tbodys_spec.rb +0 -65
- data/spec/watirspec/td_spec.rb +0 -72
- data/spec/watirspec/tds_spec.rb +0 -60
- data/spec/watirspec/text_field_spec.rb +0 -283
- data/spec/watirspec/text_fields_spec.rb +0 -49
- data/spec/watirspec/tfoot_spec.rb +0 -92
- data/spec/watirspec/tfoots_spec.rb +0 -71
- data/spec/watirspec/thead_spec.rb +0 -92
- data/spec/watirspec/theads_spec.rb +0 -71
- data/spec/watirspec/tr_spec.rb +0 -88
- data/spec/watirspec/trs_spec.rb +0 -68
- data/spec/watirspec/ul_spec.rb +0 -80
- data/spec/watirspec/uls_spec.rb +0 -44
- data/spec/watirspec/window_switching_spec.rb +0 -164
data/spec/watirspec/hns_spec.rb
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require File.expand_path("../spec_helper", __FILE__)
|
3
|
-
|
4
|
-
describe "H1s", "H2s", "H3s", "H4s", "H5s", "H6s" do
|
5
|
-
before :each do
|
6
|
-
browser.goto(WatirSpec.files + "/non_control_elements.html")
|
7
|
-
end
|
8
|
-
|
9
|
-
bug "http://github.com/jarib/celerity/issues#issue/25", :celerity do
|
10
|
-
describe "with selectors" do
|
11
|
-
it "returns the matching elements" do
|
12
|
-
browser.h1s(:class => "primary").to_a.should == [browser.h1(:class => "primary")]
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
describe "#length" do
|
18
|
-
it "returns the number of h1s" do
|
19
|
-
browser.h2s.length.should == 9
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
describe "#[]" do
|
24
|
-
it "returns the h1 at the given index" do
|
25
|
-
browser.h1s[0].id.should == "first_header"
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
describe "#each" do
|
30
|
-
it "iterates through header collections correctly" do
|
31
|
-
lengths = (1..6).collect do |i|
|
32
|
-
collection = browser.send(:"h#{i}s")
|
33
|
-
collection.each_with_index do |h, index|
|
34
|
-
h.id.should == browser.send(:"h#{i}", :index, index).id
|
35
|
-
h.value.should == browser.send(:"h#{i}", :index, index).value
|
36
|
-
end
|
37
|
-
collection.length
|
38
|
-
end
|
39
|
-
lengths.should == [2, 9, 2, 1, 1, 2]
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
@@ -1,208 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require File.expand_path("../spec_helper", __FILE__)
|
3
|
-
|
4
|
-
describe "Image" do
|
5
|
-
|
6
|
-
before :each do
|
7
|
-
browser.goto(WatirSpec.files + "/images.html")
|
8
|
-
end
|
9
|
-
|
10
|
-
# Exists method
|
11
|
-
describe "#exists?" do
|
12
|
-
it "returns true when the image exists" do
|
13
|
-
browser.image(:id, 'square').should exist
|
14
|
-
browser.image(:id, /square/).should exist
|
15
|
-
|
16
|
-
browser.image(:src, 'images/circle.jpg').should exist
|
17
|
-
|
18
|
-
browser.image(:src, /circle/).should exist
|
19
|
-
browser.image(:alt, 'circle').should exist
|
20
|
-
browser.image(:alt, /cir/).should exist
|
21
|
-
browser.image(:title, 'Circle').should exist
|
22
|
-
end
|
23
|
-
|
24
|
-
it "returns the first image if given no args" do
|
25
|
-
browser.image.should exist
|
26
|
-
end
|
27
|
-
|
28
|
-
it "returns false when the image doesn't exist" do
|
29
|
-
browser.image(:id, 'no_such_id').should_not exist
|
30
|
-
browser.image(:id, /no_such_id/).should_not exist
|
31
|
-
browser.image(:src, 'no_such_src').should_not exist
|
32
|
-
browser.image(:src, /no_such_src/).should_not exist
|
33
|
-
browser.image(:alt, 'no_such_alt').should_not exist
|
34
|
-
browser.image(:alt, /no_such_alt/).should_not exist
|
35
|
-
browser.image(:title, 'no_such_title').should_not exist
|
36
|
-
browser.image(:title, /no_such_title/).should_not exist
|
37
|
-
end
|
38
|
-
|
39
|
-
it "raises TypeError when 'what' argument is invalid" do
|
40
|
-
lambda { browser.image(:id, 3.14).exists? }.should raise_error(TypeError)
|
41
|
-
end
|
42
|
-
|
43
|
-
it "raises MissingWayOfFindingObjectException when 'how' argument is invalid" do
|
44
|
-
lambda { browser.image(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
# Attribute methods
|
49
|
-
describe "#alt" do
|
50
|
-
it "returns the alt attribute of the image if the image exists" do
|
51
|
-
browser.image(:id, 'square').alt.should == "square"
|
52
|
-
browser.image(:title, 'Circle').alt.should == 'circle'
|
53
|
-
end
|
54
|
-
|
55
|
-
it "returns an empty string if the image exists and the attribute doesn't" do
|
56
|
-
browser.image(:index, 0).alt.should == ""
|
57
|
-
end
|
58
|
-
|
59
|
-
it "raises UnknownObjectException if the image doesn't exist" do
|
60
|
-
lambda { browser.image(:index, 1337).alt }.should raise_error(UnknownObjectException)
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
describe "#id" do
|
65
|
-
it "returns the id attribute of the image if the image exists" do
|
66
|
-
browser.image(:title, 'Square').id.should == 'square'
|
67
|
-
end
|
68
|
-
|
69
|
-
it "returns an empty string if the image exists and the attribute doesn't" do
|
70
|
-
browser.image(:index, 0).id.should == ""
|
71
|
-
end
|
72
|
-
|
73
|
-
it "raises UnknownObjectException if the image doesn't exist" do
|
74
|
-
lambda { browser.image(:index, 1337).id }.should raise_error(UnknownObjectException)
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
describe "#src" do
|
79
|
-
it "returns the src attribute of the image if the image exists" do
|
80
|
-
browser.image(:id, 'square').src.should =~ /square\.jpg/i
|
81
|
-
end
|
82
|
-
|
83
|
-
it "returns an empty string if the image exists and the attribute doesn't" do
|
84
|
-
browser.image(:index, 0).src.should == ""
|
85
|
-
end
|
86
|
-
|
87
|
-
it "raises UnknownObjectException if the image doesn't exist" do
|
88
|
-
lambda { browser.image(:index, 1337).src }.should raise_error(UnknownObjectException)
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
describe "#title" do
|
93
|
-
it "returns the title attribute of the image if the image exists" do
|
94
|
-
browser.image(:id, 'square').title.should == 'Square'
|
95
|
-
end
|
96
|
-
|
97
|
-
it "returns an empty string if the image exists and the attribute doesn't" do
|
98
|
-
browser.image(:index, 0).title.should == ""
|
99
|
-
end
|
100
|
-
|
101
|
-
it "raises UnknownObjectException if the image doesn't exist" do
|
102
|
-
lambda { browser.image(:index, 1337).title }.should raise_error(UnknownObjectException)
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
describe "#respond_to?" do
|
107
|
-
it "returns true for all attribute methods" do
|
108
|
-
browser.image(:index, 0).should respond_to(:class_name)
|
109
|
-
browser.image(:index, 0).should respond_to(:id)
|
110
|
-
browser.image(:index, 0).should respond_to(:style)
|
111
|
-
browser.image(:index, 0).should respond_to(:text)
|
112
|
-
browser.image(:index, 0).should respond_to(:value)
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
# Manipulation methods
|
117
|
-
describe "#click" do
|
118
|
-
it "raises UnknownObjectException when the image doesn't exist" do
|
119
|
-
lambda { browser.image(:id, 'missing_attribute').click }.should raise_error(UnknownObjectException)
|
120
|
-
lambda { browser.image(:class, 'missing_attribute').click }.should raise_error(UnknownObjectException)
|
121
|
-
lambda { browser.image(:src, 'missing_attribute').click }.should raise_error(UnknownObjectException)
|
122
|
-
lambda { browser.image(:alt, 'missing_attribute').click }.should raise_error(UnknownObjectException)
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|
126
|
-
# File methods
|
127
|
-
not_compliant_on :webdriver do
|
128
|
-
describe "#file_created_date" do
|
129
|
-
it "returns the date the image was created as reported by the file system" do
|
130
|
-
browser.goto(WatirSpec.host + "/images.html")
|
131
|
-
image = browser.image(:index, 1)
|
132
|
-
path = "#{File.dirname(__FILE__)}/html/#{image.src}"
|
133
|
-
image.file_created_date.to_i.should == File.mtime(path).to_i
|
134
|
-
end
|
135
|
-
end
|
136
|
-
end
|
137
|
-
|
138
|
-
|
139
|
-
not_compliant_on :webdriver do # WTR-346
|
140
|
-
describe "#file_size" do
|
141
|
-
it "returns the file size of the image if the image exists" do
|
142
|
-
browser.image(:id, 'square').file_size.should == File.size("#{WatirSpec.files}/images/square.jpg".sub("file://", ''))
|
143
|
-
end
|
144
|
-
end
|
145
|
-
|
146
|
-
it "raises UnknownObjectException if the image doesn't exist" do
|
147
|
-
lambda { browser.image(:index, 1337).file_size }.should raise_error(UnknownObjectException)
|
148
|
-
end
|
149
|
-
end
|
150
|
-
|
151
|
-
describe "#height" do
|
152
|
-
it "returns the height of the image if the image exists" do
|
153
|
-
browser.image(:id, 'square').height.should == 88
|
154
|
-
end
|
155
|
-
|
156
|
-
it "raises UnknownObjectException if the image doesn't exist" do
|
157
|
-
lambda { browser.image(:index, 1337).height }.should raise_error(UnknownObjectException)
|
158
|
-
end
|
159
|
-
end
|
160
|
-
|
161
|
-
describe "#width" do
|
162
|
-
it "returns the width of the image if the image exists" do
|
163
|
-
browser.image(:id, 'square').width.should == 88
|
164
|
-
end
|
165
|
-
|
166
|
-
it "raises UnknownObjectException if the image doesn't exist" do
|
167
|
-
lambda { browser.image(:index, 1337).width }.should raise_error(UnknownObjectException)
|
168
|
-
end
|
169
|
-
end
|
170
|
-
|
171
|
-
# Other
|
172
|
-
|
173
|
-
not_compliant_on :webdriver do
|
174
|
-
describe "#loaded?" do
|
175
|
-
it "returns true if the image has been loaded" do
|
176
|
-
browser.image(:title, 'Circle').should be_loaded
|
177
|
-
browser.image(:alt, 'circle').should be_loaded
|
178
|
-
browser.image(:alt, /circle/).should be_loaded
|
179
|
-
end
|
180
|
-
|
181
|
-
it "returns false if the image has not been loaded" do
|
182
|
-
browser.image(:id, 'no_such_file').should_not be_loaded
|
183
|
-
end
|
184
|
-
|
185
|
-
it "raises UnknownObjectException if the image doesn't exist" do
|
186
|
-
lambda { browser.image(:id, 'no_such_image').loaded? }.should raise_error(UnknownObjectException)
|
187
|
-
lambda { browser.image(:src, 'no_such_image').loaded? }.should raise_error(UnknownObjectException)
|
188
|
-
lambda { browser.image(:alt, 'no_such_image').loaded? }.should raise_error(UnknownObjectException)
|
189
|
-
lambda { browser.image(:index, 1337).loaded? }.should raise_error(UnknownObjectException)
|
190
|
-
end
|
191
|
-
end
|
192
|
-
end
|
193
|
-
|
194
|
-
not_compliant_on :webdriver do
|
195
|
-
describe "#save" do
|
196
|
-
it "saves the image to a file" do
|
197
|
-
file = "#{File.expand_path Dir.pwd}/sample.img.dat"
|
198
|
-
begin
|
199
|
-
browser.image(:index, 1).save(file)
|
200
|
-
File.exist?(file).should be_true
|
201
|
-
ensure
|
202
|
-
File.delete(file) if File.exist?(file)
|
203
|
-
end
|
204
|
-
end
|
205
|
-
end
|
206
|
-
end
|
207
|
-
|
208
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require File.expand_path("../spec_helper", __FILE__)
|
3
|
-
|
4
|
-
describe "Images" do
|
5
|
-
|
6
|
-
before :each do
|
7
|
-
browser.goto(WatirSpec.files + "/images.html")
|
8
|
-
end
|
9
|
-
|
10
|
-
bug "http://github.com/jarib/celerity/issues#issue/25", :celerity do
|
11
|
-
describe "with selectors" do
|
12
|
-
it "returns the matching elements" do
|
13
|
-
browser.images(:alt => "circle").to_a.should == [browser.image(:alt => "circle")]
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
describe "#length" do
|
19
|
-
it "returns the number of images" do
|
20
|
-
browser.images.length.should == 10
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
describe "#[]" do
|
25
|
-
it "returns the image at the given index" do
|
26
|
-
browser.images[5].id.should == "square"
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
describe "#each" do
|
31
|
-
it "iterates through images correctly" do
|
32
|
-
count = 0
|
33
|
-
|
34
|
-
browser.images.each_with_index do |c, index|
|
35
|
-
c.id.should == browser.image(:index, index).id
|
36
|
-
c.value.should == browser.image(:index, index).value
|
37
|
-
|
38
|
-
count += 1
|
39
|
-
end
|
40
|
-
|
41
|
-
count.should > 0
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
end
|
data/spec/watirspec/ins_spec.rb
DELETED
@@ -1,146 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require File.expand_path("../spec_helper", __FILE__)
|
3
|
-
|
4
|
-
describe "Ins" 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 'ins' exists" do
|
13
|
-
browser.ins(:id, "lead").should exist
|
14
|
-
browser.ins(:id, /lead/).should exist
|
15
|
-
browser.ins(:text, "This is an inserted text tag 1").should exist
|
16
|
-
browser.ins(:text, /This is an inserted text tag 1/).should exist
|
17
|
-
browser.ins(:class, "lead").should exist
|
18
|
-
browser.ins(:class, /lead/).should exist
|
19
|
-
browser.ins(:index, 0).should exist
|
20
|
-
browser.ins(:xpath, "//ins[@id='lead']").should exist
|
21
|
-
end
|
22
|
-
|
23
|
-
it "returns the first ins if given no args" do
|
24
|
-
browser.ins.should exist
|
25
|
-
end
|
26
|
-
|
27
|
-
it "returns false if the element doesn't exist" do
|
28
|
-
browser.ins(:id, "no_such_id").should_not exist
|
29
|
-
browser.ins(:id, /no_such_id/).should_not exist
|
30
|
-
browser.ins(:text, "no_such_text").should_not exist
|
31
|
-
browser.ins(:text, /no_such_text/).should_not exist
|
32
|
-
browser.ins(:class, "no_such_class").should_not exist
|
33
|
-
browser.ins(:class, /no_such_class/).should_not exist
|
34
|
-
browser.ins(:index, 1337).should_not exist
|
35
|
-
browser.ins(:xpath, "//ins[@id='no_such_id']").should_not exist
|
36
|
-
end
|
37
|
-
|
38
|
-
it "raises TypeError when 'what' argument is invalid" do
|
39
|
-
lambda { browser.ins(:id, 3.14).exists? }.should raise_error(TypeError)
|
40
|
-
end
|
41
|
-
|
42
|
-
it "raises MissingWayOfFindingObjectException when 'how' argument is invalid" do
|
43
|
-
lambda { browser.ins(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
# Attribute methods
|
48
|
-
describe "#class_name" do
|
49
|
-
it "returns the class attribute" do
|
50
|
-
browser.ins(:index, 0).class_name.should == 'lead'
|
51
|
-
end
|
52
|
-
|
53
|
-
it "returns an empty string if the element exists and the attribute doesn't" do
|
54
|
-
browser.ins(:index, 2).class_name.should == ''
|
55
|
-
end
|
56
|
-
|
57
|
-
it "raises UnknownObjectException if the ins doesn't exist" do
|
58
|
-
lambda { browser.ins(:id, 'no_such_id').class_name }.should raise_error(UnknownObjectException)
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
describe "#id" do
|
63
|
-
it "returns the id attribute" do
|
64
|
-
browser.ins(:index, 0).id.should == "lead"
|
65
|
-
end
|
66
|
-
|
67
|
-
it "returns an empty string if the element exists and the attribute doesn't" do
|
68
|
-
browser.ins(:index, 2).id.should == ''
|
69
|
-
end
|
70
|
-
|
71
|
-
it "raises UnknownObjectException if the ins doesn't exist" do
|
72
|
-
lambda { browser.ins(:id, "no_such_id").id }.should raise_error(UnknownObjectException)
|
73
|
-
lambda { browser.ins(:index, 1337).id }.should raise_error(UnknownObjectException)
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
describe "#title" do
|
78
|
-
it "returns the title attribute" do
|
79
|
-
browser.ins(:index, 0).title.should == 'Lorem ipsum'
|
80
|
-
end
|
81
|
-
|
82
|
-
it "returns an empty string if the element exists and the attribute doesn't" do
|
83
|
-
browser.ins(:index, 2).title.should == ''
|
84
|
-
end
|
85
|
-
|
86
|
-
it "raises UnknownObjectException if the ins doesn't exist" do
|
87
|
-
lambda { browser.ins(:id, 'no_such_id').title }.should raise_error( UnknownObjectException)
|
88
|
-
lambda { browser.ins(:xpath, "//ins[@id='no_such_id']").title }.should raise_error( UnknownObjectException)
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
describe "#text" do
|
93
|
-
it "returns the text of the ins" do
|
94
|
-
browser.ins(:index, 1).text.should == 'This is an inserted text tag 2'
|
95
|
-
end
|
96
|
-
|
97
|
-
it "returns an empty string if the element doesn't contain any text" do
|
98
|
-
browser.ins(:index, 3).text.should == ''
|
99
|
-
end
|
100
|
-
|
101
|
-
it "raises UnknownObjectException if the ins doesn't exist" do
|
102
|
-
lambda { browser.ins(:id, 'no_such_id').text }.should raise_error( UnknownObjectException)
|
103
|
-
lambda { browser.ins(:xpath , "//ins[@id='no_such_id']").text }.should raise_error( UnknownObjectException)
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
describe "#value" do
|
108
|
-
it "returns the value attribute" do
|
109
|
-
browser.ins(:index, 1).value.should == "invalid_attribute"
|
110
|
-
end
|
111
|
-
|
112
|
-
it "returns an empty string if the element exists and the attribute doesn't" do
|
113
|
-
browser.ins(:index, 3).value.should == ''
|
114
|
-
end
|
115
|
-
|
116
|
-
it "raises UnknownObjectException if the ins doesn't exist" do
|
117
|
-
lambda { browser.ins(:id , "no_such_id").value }.should raise_error(UnknownObjectException)
|
118
|
-
lambda { browser.ins(:index , 1337).value }.should raise_error(UnknownObjectException)
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
122
|
-
describe "#respond_to?" do
|
123
|
-
it "returns true for all attribute methods" do
|
124
|
-
browser.ins(:index, 0).should respond_to(:class_name)
|
125
|
-
browser.ins(:index, 0).should respond_to(:id)
|
126
|
-
browser.ins(:index, 0).should respond_to(:title)
|
127
|
-
browser.ins(:index, 0).should respond_to(:text)
|
128
|
-
browser.ins(:index, 0).should respond_to(:value)
|
129
|
-
end
|
130
|
-
end
|
131
|
-
|
132
|
-
# Other
|
133
|
-
describe "#click" do
|
134
|
-
it "fires events" do
|
135
|
-
browser.ins(:class, 'footer').text.should_not include('Javascript')
|
136
|
-
browser.ins(:class, 'footer').click
|
137
|
-
browser.ins(:class, 'footer').text.should include('Javascript')
|
138
|
-
end
|
139
|
-
|
140
|
-
it "raises UnknownObjectException if the ins doesn't exist" do
|
141
|
-
lambda { browser.ins(:id, "no_such_id").click }.should raise_error(UnknownObjectException)
|
142
|
-
lambda { browser.ins(:title, "no_such_title").click }.should raise_error(UnknownObjectException)
|
143
|
-
end
|
144
|
-
end
|
145
|
-
|
146
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require File.expand_path("../spec_helper", __FILE__)
|
3
|
-
|
4
|
-
describe "Inses" do
|
5
|
-
|
6
|
-
before :each do
|
7
|
-
browser.goto(WatirSpec.files + "/non_control_elements.html")
|
8
|
-
end
|
9
|
-
|
10
|
-
bug "http://github.com/jarib/celerity/issues#issue/25", :celerity do
|
11
|
-
describe "with selectors" do
|
12
|
-
it "returns the matching elements" do
|
13
|
-
browser.inses(:class => "lead").to_a.should == [browser.ins(:class => "lead")]
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
describe "#length" do
|
19
|
-
it "returns the number of inses" do
|
20
|
-
browser.inses.length.should == 5
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
describe "#[]" do
|
25
|
-
it "returns the ins at the given index" do
|
26
|
-
browser.inses[0].id.should == "lead"
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
describe "#each" do
|
31
|
-
it "iterates through inses correctly" do
|
32
|
-
count = 0
|
33
|
-
|
34
|
-
browser.inses.each_with_index do |s, index|
|
35
|
-
s.id.should == browser.ins(:index, index).id
|
36
|
-
s.value.should == browser.ins(:index, index).value
|
37
|
-
|
38
|
-
count += 1
|
39
|
-
end
|
40
|
-
|
41
|
-
count.should > 0
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
end
|