celerity 0.0.2 → 0.0.3
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/History.txt +15 -1
- data/Manifest.txt +174 -0
- data/README.txt +19 -10
- data/config/hoe.rb +68 -0
- data/config/requirements.rb +15 -0
- data/lib/celerity.rb +14 -11
- data/lib/celerity/collections.rb +37 -8
- data/lib/celerity/container.rb +100 -3
- data/lib/celerity/disabled_element.rb +4 -2
- data/lib/celerity/element.rb +21 -8
- data/lib/celerity/element_collections.rb +4 -7
- data/lib/celerity/element_locator.rb +1 -0
- data/lib/celerity/elements/button.rb +6 -2
- data/lib/celerity/elements/file_field.rb +1 -1
- data/lib/celerity/elements/form.rb +1 -2
- data/lib/celerity/elements/frame.rb +0 -3
- data/lib/celerity/elements/image.rb +1 -4
- data/lib/celerity/elements/label.rb +1 -0
- data/lib/celerity/elements/link.rb +2 -0
- data/lib/celerity/elements/option.rb +1 -0
- data/lib/celerity/elements/radio_check.rb +3 -5
- data/lib/celerity/elements/select_list.rb +3 -10
- data/lib/celerity/elements/table.rb +8 -22
- data/lib/celerity/elements/table_body.rb +5 -11
- data/lib/celerity/elements/table_cell.rb +1 -0
- data/lib/celerity/elements/table_footer.rb +30 -0
- data/lib/celerity/elements/table_header.rb +30 -0
- data/lib/celerity/elements/table_row.rb +5 -3
- data/lib/celerity/elements/text_field.rb +18 -13
- data/lib/celerity/exception.rb +8 -8
- data/lib/celerity/extra/method_generator.rb +5 -2
- data/lib/celerity/htmlunit/htmlunit-2.2-SNAPSHOT.jar +0 -0
- data/lib/celerity/ie.rb +195 -141
- data/lib/celerity/non_control_elements.rb +30 -4
- data/lib/celerity/version.rb +1 -1
- data/lib/celerity/watir_compatibility.rb +62 -0
- data/setup.rb +0 -2
- data/spec/area_spec.rb +4 -1
- data/spec/areas_spec.rb +1 -1
- data/spec/button_spec.rb +35 -17
- data/spec/buttons_spec.rb +1 -1
- data/spec/checkbox_spec.rb +6 -4
- data/spec/checkboxes_spec.rb +1 -1
- data/spec/div_spec.rb +20 -19
- data/spec/divs_spec.rb +2 -2
- data/spec/element_spec.rb +13 -2
- data/spec/filefield_spec.rb +6 -3
- data/spec/filefields_spec.rb +1 -1
- data/spec/form_spec.rb +4 -1
- data/spec/forms_spec.rb +1 -1
- data/spec/frame_spec.rb +6 -2
- data/spec/hidden_spec.rb +8 -4
- data/spec/hiddens_spec.rb +1 -1
- data/spec/hn_spec.rb +86 -0
- data/spec/hns_spec.rb +41 -0
- data/spec/html/bug_duplicate_attributes.html +14 -0
- data/spec/html/bug_javascript_001.html +11 -0
- data/spec/html/forms_with_input_elements.html +11 -11
- data/spec/html/images.html +18 -15
- data/spec/html/latin1_text.html +16 -0
- data/spec/html/non_control_elements.html +28 -4
- data/spec/html/tables.html +3 -3
- data/spec/html/utf8_text.html +15 -0
- data/spec/htmlunit_spec.rb +27 -0
- data/spec/ie_spec.rb +47 -12
- data/spec/image_spec.rb +4 -7
- data/spec/images_spec.rb +3 -2
- data/spec/label_spec.rb +4 -3
- data/spec/labels_spec.rb +1 -1
- data/spec/li_spec.rb +11 -8
- data/spec/link_spec.rb +5 -1
- data/spec/links_spec.rb +2 -1
- data/spec/lis_spec.rb +3 -2
- data/spec/map_spec.rb +4 -1
- data/spec/maps_spec.rb +1 -1
- data/spec/meta_spec.rb +6 -0
- data/spec/ol_spec.rb +73 -0
- data/spec/ols_spec.rb +41 -0
- data/spec/option_spec.rb +129 -0
- data/spec/p_spec.rb +4 -1
- data/spec/pre_spec.rb +4 -1
- data/spec/pres_spec.rb +1 -1
- data/spec/ps_spec.rb +2 -1
- data/spec/radio_spec.rb +7 -19
- data/spec/radios_spec.rb +1 -1
- data/spec/select_list_spec.rb +19 -57
- data/spec/select_lists_spec.rb +3 -2
- data/spec/span_spec.rb +8 -5
- data/spec/spans_spec.rb +2 -1
- data/spec/spec_helper.rb +8 -43
- data/spec/table_bodies_spec.rb +17 -4
- data/spec/table_body_spec.rb +47 -16
- data/spec/table_cell_spec.rb +5 -3
- data/spec/table_cells_spec.rb +1 -1
- data/spec/table_footer_spec.rb +94 -0
- data/spec/table_footers_spec.rb +53 -0
- data/spec/table_header_spec.rb +94 -0
- data/spec/table_headers_spec.rb +53 -0
- data/spec/table_row_spec.rb +25 -4
- data/spec/table_rows_spec.rb +1 -1
- data/spec/table_spec.rb +22 -2
- data/spec/tables_spec.rb +2 -1
- data/spec/text_field_spec.rb +52 -20
- data/spec/text_fields_spec.rb +1 -1
- data/spec/ul_spec.rb +73 -0
- data/spec/uls_spec.rb +41 -0
- data/spec/watir_compatability_spec.rb +253 -0
- data/support/celerity_viewer/rubycocoa/CelerityViewer.icns +0 -0
- data/support/celerity_viewer/rubycocoa/English.lproj/Main.nib/classes.nib +37 -0
- data/support/celerity_viewer/rubycocoa/English.lproj/Main.nib/info.nib +19 -0
- data/support/celerity_viewer/rubycocoa/English.lproj/Main.nib/keyedobjects.nib +0 -0
- data/support/celerity_viewer/rubycocoa/Info.plist.erb +28 -0
- data/support/celerity_viewer/rubycocoa/MainController.rb +23 -0
- data/support/celerity_viewer/rubycocoa/README +94 -0
- data/support/celerity_viewer/rubycocoa/Rakefile +100 -0
- data/support/celerity_viewer/rubycocoa/distributed_viewer.rb +86 -0
- data/support/celerity_viewer/rubycocoa/main.m +7 -0
- data/support/celerity_viewer/rubycocoa/main.rb +27 -0
- data/support/spec_server.rb +64 -0
- data/tasks/benchmark.rake +1 -0
- data/tasks/rdoc.rake +4 -0
- data/tasks/rspec.rake +10 -3
- data/tasks/simple_ci.rake +94 -0
- data/tasks/specserver.rake +21 -0
- metadata +160 -114
- data/spec/table_bodies.rb +0 -40
- data/tasks/testserver.rake +0 -32
data/spec/html/tables.html
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
<caption>Income tax information for Gregory House and Hugh Laurie</caption>
|
|
12
12
|
<colgroup width="25%" align="left"></colgroup>
|
|
13
13
|
<colgroup width="25%" span="3" align="right"></colgroup>
|
|
14
|
-
<thead>
|
|
14
|
+
<thead id="tax_headers">
|
|
15
15
|
<tr style="border-bottom: 1px solid black;" class="dark">
|
|
16
16
|
<th></th>
|
|
17
17
|
<th id="before_tax" axis="cash" abbr="Before tax">Before income tax</th>
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
<th id="after_tax" axis="cash" abbr="After tax">After income tax</th>
|
|
20
20
|
</tr>
|
|
21
21
|
</thead>
|
|
22
|
-
<tfoot>
|
|
22
|
+
<tfoot id="tax_totals">
|
|
23
23
|
<tr class="dark">
|
|
24
24
|
<th axis="sum">Sum</th>
|
|
25
25
|
<td headers="before_tax">24 349</td>
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
<td headers="after_tax p2 d1">4 821</td>
|
|
48
48
|
</tr>
|
|
49
49
|
</tbody>
|
|
50
|
-
<tbody name="second">
|
|
50
|
+
<tbody name="second" id="second">
|
|
51
51
|
<tr>
|
|
52
52
|
<th id="d2" axis="date" scope="rowgroup">April 2008</th>
|
|
53
53
|
<th></th>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
4
|
+
<head>
|
|
5
|
+
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
|
|
6
|
+
<title>
|
|
7
|
+
UTF-8
|
|
8
|
+
</title>
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
<p>
|
|
12
|
+
æåø
|
|
13
|
+
</p>
|
|
14
|
+
</body>
|
|
15
|
+
</html>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper.rb'
|
|
2
|
+
|
|
3
|
+
describe "HtmlUnit bugs" do
|
|
4
|
+
|
|
5
|
+
before :all do
|
|
6
|
+
@browser = IE.new
|
|
7
|
+
add_spec_checker(@browser)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
describe "HtmlUnit bug 1968686: https://sourceforge.net/tracker/index.php?func=detail&aid=1968686&group_id=47038&atid=448266" do
|
|
11
|
+
# it "should not raise NativeException: java.lang.StackOverflowError when going to a page where Javascripts prints a <body> tag inside another <body> tag" do
|
|
12
|
+
# lambda { @browser.goto(TEST_HOST + "/bug_javascript_001.html") }.should_not raise_error(NativeException)
|
|
13
|
+
# end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
describe "HtmlUnit bug 1968708: https://sourceforge.net/tracker/index.php?func=detail&aid=1968708&group_id=47038&atid=448266" do
|
|
17
|
+
it "should only consider the first attribute if there are duplicate attributes" do
|
|
18
|
+
@browser.goto(TEST_HOST + "/bug_duplicate_attributes.html")
|
|
19
|
+
@browser.text_field(:index, 1).id.should == "org_id"
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
after :all do
|
|
24
|
+
@browser.close
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
end
|
data/spec/ie_spec.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require File.dirname(__FILE__) + '/spec_helper.rb'
|
|
2
2
|
|
|
3
|
-
describe
|
|
3
|
+
describe IE do
|
|
4
4
|
|
|
5
5
|
before :all do
|
|
6
6
|
@browser = IE.new
|
|
@@ -37,7 +37,20 @@ describe "IE" do
|
|
|
37
37
|
describe "#text" do
|
|
38
38
|
it "should return the text of the page" do
|
|
39
39
|
@browser.goto(TEST_HOST + "/non_control_elements.html")
|
|
40
|
-
@browser.text.include
|
|
40
|
+
@browser.text.should include("Dubito, ergo cogito, ergo sum.")
|
|
41
|
+
end
|
|
42
|
+
it "should return the text also if the content-type is text/plain" do
|
|
43
|
+
# more specs for text/plain? what happens if we call other methods?
|
|
44
|
+
@browser.goto(TEST_HOST + "/plain_text")
|
|
45
|
+
@browser.text.strip.should == 'This is text/plain'
|
|
46
|
+
end
|
|
47
|
+
it "should return text in the correct charset (utf-8)" do
|
|
48
|
+
@browser.goto(TEST_HOST + "/utf8_text.html")
|
|
49
|
+
@browser.text.strip.should == "\303\246\303\245\303\270"
|
|
50
|
+
end
|
|
51
|
+
it "should return text in the correct charset (latin-1)" do
|
|
52
|
+
@browser.goto(TEST_HOST + "/latin1_text.html")
|
|
53
|
+
@browser.text.strip.should == "\370\345\346"
|
|
41
54
|
end
|
|
42
55
|
end
|
|
43
56
|
|
|
@@ -59,14 +72,36 @@ describe "IE" do
|
|
|
59
72
|
end
|
|
60
73
|
end
|
|
61
74
|
|
|
62
|
-
|
|
63
|
-
|
|
75
|
+
# Show methods
|
|
76
|
+
describe "#method_missing" do
|
|
77
|
+
it "should return all div elements on the page in a human readable format" do
|
|
64
78
|
@browser.goto(TEST_HOST + "/non_control_elements.html")
|
|
65
|
-
|
|
79
|
+
temp_stdout = StringIO.new
|
|
80
|
+
old_stdout = $stdout
|
|
81
|
+
$stdout = temp_stdout
|
|
82
|
+
begin
|
|
83
|
+
@browser.show_divs
|
|
84
|
+
ensure
|
|
85
|
+
$stdout = old_stdout
|
|
86
|
+
end
|
|
87
|
+
temp_stdout.string.should ==
|
|
88
|
+
'Found 8 divs
|
|
89
|
+
1:
|
|
90
|
+
2: id="outer_container"
|
|
91
|
+
3: id="header" title="Header and primary navigation" class="profile"
|
|
92
|
+
4: id="promo" name="invalid_attribute" value="invalid_attribute"
|
|
93
|
+
5: id="content"
|
|
94
|
+
6: id="best_language" onclick="this.innerHTML = \'Ruby!\'" style="color: red; text-decoration: underline; cursor: pointer;"
|
|
95
|
+
7: id="html_test" class="some_class" title="This is a title"
|
|
96
|
+
8: id="footer" title="Closing remarks" class="profile"
|
|
97
|
+
'
|
|
98
|
+
end
|
|
99
|
+
it "should raise NoMethodError if the collection does not exist" do
|
|
100
|
+
@browser.goto(TEST_HOST + "/non_control_elements.html")
|
|
101
|
+
lambda { @browser.show_no_such_collection }.should raise_error(NoMethodError)
|
|
66
102
|
end
|
|
67
103
|
end
|
|
68
104
|
|
|
69
|
-
|
|
70
105
|
# Manipulation methods
|
|
71
106
|
describe ".start" do
|
|
72
107
|
it "should go to the given URL and return an instance of itself" do
|
|
@@ -77,6 +112,10 @@ describe "IE" do
|
|
|
77
112
|
end
|
|
78
113
|
|
|
79
114
|
describe "#goto" do
|
|
115
|
+
# waiting for JRuby OpenSSL
|
|
116
|
+
# it "should handle HTTPS" do
|
|
117
|
+
# pending
|
|
118
|
+
# end
|
|
80
119
|
it "should go to the given url without raising errors" do
|
|
81
120
|
lambda { @browser.goto(TEST_HOST + "/non_control_elements.html") }.should_not raise_error
|
|
82
121
|
end
|
|
@@ -118,23 +157,19 @@ describe "IE" do
|
|
|
118
157
|
before :each do
|
|
119
158
|
@browser.goto(TEST_HOST + "/non_control_elements.html")
|
|
120
159
|
end
|
|
121
|
-
|
|
122
160
|
it "should raise ArgumentError when called with no or wrong arguments" do
|
|
123
161
|
lambda { @browser.contains_text }.should raise_error(ArgumentError)
|
|
124
162
|
lambda { @browser.contains_text(nil) }.should raise_error(ArgumentError)
|
|
125
163
|
lambda { @browser.contains_text(42) }.should raise_error(ArgumentError)
|
|
126
164
|
end
|
|
127
|
-
|
|
128
165
|
it "should return the index if the given text exists" do
|
|
129
166
|
@browser.contains_text('Dubito, ergo cogito, ergo sum.').should be_instance_of(Fixnum)
|
|
130
167
|
@browser.contains_text(/Dubito.*sum./).should_not be_nil
|
|
131
168
|
end
|
|
132
|
-
|
|
133
169
|
it "should return nil if the text doesn't exist" do
|
|
134
170
|
@browser.contains_text('no_such_text').should be_nil
|
|
135
171
|
@browser.contains_text(/no_such_text/).should be_nil
|
|
136
172
|
end
|
|
137
|
-
|
|
138
173
|
it "should not raise error on a blank page" do
|
|
139
174
|
@browser = IE.new
|
|
140
175
|
lambda { @browser.contains_text('') }.should_not raise_error
|
|
@@ -147,7 +182,8 @@ describe "IE" do
|
|
|
147
182
|
end
|
|
148
183
|
it "should run the given proc on each page load" do
|
|
149
184
|
output = ''
|
|
150
|
-
|
|
185
|
+
proc = Proc.new { |ie| output << ie.text }
|
|
186
|
+
@browser.add_checker(proc)
|
|
151
187
|
@browser.goto(TEST_HOST + "/non_control_elements.html")
|
|
152
188
|
output.should include('Dubito, ergo cogito, ergo sum')
|
|
153
189
|
end
|
|
@@ -166,7 +202,6 @@ describe "IE" do
|
|
|
166
202
|
@browser.add_checker(checker)
|
|
167
203
|
@browser.goto(TEST_HOST + "/non_control_elements.html")
|
|
168
204
|
output.should include('Dubito, ergo cogito, ergo sum')
|
|
169
|
-
|
|
170
205
|
@browser.disable_checker(checker)
|
|
171
206
|
@browser.goto(TEST_HOST + "/non_control_elements.html")
|
|
172
207
|
output.should include('Dubito, ergo cogito, ergo sum')
|
data/spec/image_spec.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require File.dirname(__FILE__) + '/spec_helper.rb'
|
|
2
2
|
|
|
3
|
-
describe
|
|
3
|
+
describe Image do
|
|
4
4
|
|
|
5
5
|
before :all do
|
|
6
6
|
@browser = IE.new
|
|
@@ -24,6 +24,9 @@ describe "Image" do
|
|
|
24
24
|
@browser.image(:alt, /cir/).should exist
|
|
25
25
|
@browser.image(:title, 'Circle').should exist
|
|
26
26
|
end
|
|
27
|
+
it "should return true if the element exists (default how = :id)" do
|
|
28
|
+
@browser.image("images/circle.jpg").should exist
|
|
29
|
+
end
|
|
27
30
|
it "should return false when the image exists" do
|
|
28
31
|
@browser.image(:id, 'no_such_id').should_not exist
|
|
29
32
|
@browser.image(:id, /no_such_id/).should_not exist
|
|
@@ -171,12 +174,6 @@ describe "Image" do
|
|
|
171
174
|
end
|
|
172
175
|
end
|
|
173
176
|
|
|
174
|
-
describe "#html" do
|
|
175
|
-
it "should return the image element as a string of html" do
|
|
176
|
-
@browser.image(:id, 'triangle').html.chomp.should == '<img src="images/triangle.jpg" id="triangle" usemap="#triangle_map" />'
|
|
177
|
-
end
|
|
178
|
-
end
|
|
179
|
-
|
|
180
177
|
describe "#save" do
|
|
181
178
|
it "should save an image to file" do
|
|
182
179
|
file = "sample.img.dat"
|
data/spec/images_spec.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
require File.dirname(__FILE__) + '/spec_helper.rb'
|
|
2
2
|
|
|
3
|
-
describe
|
|
3
|
+
describe Images do
|
|
4
|
+
|
|
4
5
|
before :all do
|
|
5
6
|
@browser = IE.new
|
|
6
7
|
add_spec_checker(@browser)
|
|
@@ -12,7 +13,7 @@ describe "Images" do
|
|
|
12
13
|
|
|
13
14
|
describe "#length" do
|
|
14
15
|
it "should return the number of images" do
|
|
15
|
-
@browser.images.length.should ==
|
|
16
|
+
@browser.images.length.should == 9
|
|
16
17
|
end
|
|
17
18
|
end
|
|
18
19
|
|
data/spec/label_spec.rb
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
require File.dirname(__FILE__) + '/spec_helper.rb'
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
describe "Label" do
|
|
3
|
+
describe Label do
|
|
6
4
|
|
|
7
5
|
before :all do
|
|
8
6
|
@browser = IE.new
|
|
@@ -23,6 +21,9 @@ describe "Label" do
|
|
|
23
21
|
@browser.label(:index, 1).should exist
|
|
24
22
|
@browser.label(:xpath, "//label[@id='first_label']").should exist
|
|
25
23
|
end
|
|
24
|
+
it "should return true if the element exists (default how = :text)" do
|
|
25
|
+
@browser.label("First name").should exist
|
|
26
|
+
end
|
|
26
27
|
it "should return false if the element does not exist" do
|
|
27
28
|
@browser.label(:id, 'no_such_id').should_not exist
|
|
28
29
|
@browser.label(:id, /no_such_id/).should_not exist
|
data/spec/labels_spec.rb
CHANGED
data/spec/li_spec.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require File.dirname(__FILE__) + '/spec_helper.rb'
|
|
2
2
|
|
|
3
|
-
describe
|
|
3
|
+
describe Li do
|
|
4
4
|
|
|
5
5
|
before :all do
|
|
6
6
|
@browser = IE.new
|
|
@@ -13,7 +13,7 @@ describe "Li" do
|
|
|
13
13
|
|
|
14
14
|
# Exists method
|
|
15
15
|
describe "#exist?" do
|
|
16
|
-
it "should return true if the '
|
|
16
|
+
it "should return true if the 'li' exists" do
|
|
17
17
|
@browser.li(:id, "non_link_1").should exist
|
|
18
18
|
@browser.li(:id, /non_link_1/).should exist
|
|
19
19
|
@browser.li(:text, "Non-link 3").should exist
|
|
@@ -23,7 +23,10 @@ describe "Li" do
|
|
|
23
23
|
@browser.li(:index, 1).should exist
|
|
24
24
|
@browser.li(:xpath, "//li[@id='non_link_1']").should exist
|
|
25
25
|
end
|
|
26
|
-
it "should return
|
|
26
|
+
it "should return true if the element exists (default how = :id)" do
|
|
27
|
+
@browser.li("non_link_1").should exist
|
|
28
|
+
end
|
|
29
|
+
it "should return false if the 'li' doesn't exist" do
|
|
27
30
|
@browser.li(:id, "no_such_id").should_not exist
|
|
28
31
|
@browser.li(:id, /no_such_id/).should_not exist
|
|
29
32
|
@browser.li(:text, "no_such_text").should_not exist
|
|
@@ -49,7 +52,7 @@ describe "Li" do
|
|
|
49
52
|
it "should return an empty string if the element exists and the attribute doesn't" do
|
|
50
53
|
@browser.li(:index, 1).class_name.should == ''
|
|
51
54
|
end
|
|
52
|
-
it "should raise UnknownObjectException if the
|
|
55
|
+
it "should raise UnknownObjectException if the li doesn't exist" do
|
|
53
56
|
lambda { @browser.li(:id, 'no_such_id').class_name }.should raise_error(UnknownObjectException)
|
|
54
57
|
end
|
|
55
58
|
end
|
|
@@ -61,7 +64,7 @@ describe "Li" do
|
|
|
61
64
|
it "should return an empty string if the element exists and the attribute doesn't" do
|
|
62
65
|
@browser.li(:index, 1).id.should == ''
|
|
63
66
|
end
|
|
64
|
-
it "should raise UnknownObjectException if the
|
|
67
|
+
it "should raise UnknownObjectException if the li doesn't exist" do
|
|
65
68
|
lambda { @browser.li(:id, "no_such_id").id }.should raise_error(UnknownObjectException)
|
|
66
69
|
lambda { @browser.li(:index, 1337).id }.should raise_error(UnknownObjectException)
|
|
67
70
|
end
|
|
@@ -74,7 +77,7 @@ describe "Li" do
|
|
|
74
77
|
it "should return an empty string if the element exists and the attribute doesn't" do
|
|
75
78
|
@browser.li(:index, 1).title.should == ''
|
|
76
79
|
end
|
|
77
|
-
it "should raise UnknownObjectException if the
|
|
80
|
+
it "should raise UnknownObjectException if the li doesn't exist" do
|
|
78
81
|
lambda { @browser.li(:id, 'no_such_id').title }.should raise_error( UnknownObjectException)
|
|
79
82
|
lambda { @browser.li(:xpath, "//li[@id='no_such_id']").title }.should raise_error( UnknownObjectException)
|
|
80
83
|
end
|
|
@@ -87,7 +90,7 @@ describe "Li" do
|
|
|
87
90
|
it "should return an empty string if the element doesn't contain any text" do
|
|
88
91
|
@browser.li(:index, 1).text.should == ''
|
|
89
92
|
end
|
|
90
|
-
it "should raise UnknownObjectException if the
|
|
93
|
+
it "should raise UnknownObjectException if the li doesn't exist" do
|
|
91
94
|
lambda { @browser.li(:id, 'no_such_id').text }.should raise_error( UnknownObjectException)
|
|
92
95
|
lambda { @browser.li(:xpath , "//li[@id='no_such_id']").text }.should raise_error( UnknownObjectException)
|
|
93
96
|
end
|
|
@@ -102,7 +105,7 @@ describe "Li" do
|
|
|
102
105
|
" title: This is not a link!\n" +
|
|
103
106
|
" text: Non-link 1"
|
|
104
107
|
end
|
|
105
|
-
it "should raise UnknownObjectException if the
|
|
108
|
+
it "should raise UnknownObjectException if the li doesn't exist" do
|
|
106
109
|
lambda { @browser.li(:xpath, "//li[@id='no_such_id']").to_s }.should raise_error( UnknownObjectException)
|
|
107
110
|
end
|
|
108
111
|
end
|
data/spec/link_spec.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
require File.dirname(__FILE__) + '/spec_helper.rb'
|
|
2
2
|
|
|
3
|
-
describe
|
|
3
|
+
describe Link do
|
|
4
|
+
|
|
4
5
|
before :all do
|
|
5
6
|
@browser = IE.new
|
|
6
7
|
add_spec_checker(@browser)
|
|
@@ -26,6 +27,9 @@ describe "Link" do
|
|
|
26
27
|
@browser.link(:index, 2).should exist
|
|
27
28
|
@browser.link(:xpath, "//a[@id='link_2']").should exist
|
|
28
29
|
end
|
|
30
|
+
it "should return true if the element exists (default how = :href)" do
|
|
31
|
+
@browser.link(/input_elements/).should exist
|
|
32
|
+
end
|
|
29
33
|
it "should return false if the link doesn't exist" do
|
|
30
34
|
@browser.link(:id, 'no_such_id').should_not exist
|
|
31
35
|
@browser.link(:id, /no_such_id/).should_not exist
|
data/spec/links_spec.rb
CHANGED
data/spec/lis_spec.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
require File.dirname(__FILE__) + '/spec_helper.rb'
|
|
2
2
|
|
|
3
|
-
describe
|
|
3
|
+
describe Lis do
|
|
4
|
+
|
|
4
5
|
before :all do
|
|
5
6
|
@browser = IE.new
|
|
6
7
|
add_spec_checker(@browser)
|
|
@@ -12,7 +13,7 @@ describe "Lis" do
|
|
|
12
13
|
|
|
13
14
|
describe "#length" do
|
|
14
15
|
it "should return the number of lis" do
|
|
15
|
-
@browser.lis.length.should ==
|
|
16
|
+
@browser.lis.length.should == 18
|
|
16
17
|
end
|
|
17
18
|
end
|
|
18
19
|
|
data/spec/map_spec.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require File.dirname(__FILE__) + '/spec_helper.rb'
|
|
2
2
|
|
|
3
|
-
describe
|
|
3
|
+
describe Map do
|
|
4
4
|
|
|
5
5
|
before :all do
|
|
6
6
|
@browser = IE.new
|
|
@@ -21,6 +21,9 @@ describe "P" do
|
|
|
21
21
|
@browser.map(:index, 1).should exist
|
|
22
22
|
@browser.map(:xpath, "//map[@id='triangle_map']").should exist
|
|
23
23
|
end
|
|
24
|
+
it "should return true if the element exists (default how = :id)" do
|
|
25
|
+
@browser.map("triangle_map").should exist
|
|
26
|
+
end
|
|
24
27
|
it "should return false if the 'map' doesn't exist" do
|
|
25
28
|
@browser.map(:id, "no_such_id").should_not exist
|
|
26
29
|
@browser.map(:id, /no_such_id/).should_not exist
|
data/spec/maps_spec.rb
CHANGED
data/spec/meta_spec.rb
ADDED
data/spec/ol_spec.rb
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper.rb'
|
|
2
|
+
|
|
3
|
+
describe Ul do
|
|
4
|
+
|
|
5
|
+
before :all do
|
|
6
|
+
@browser = IE.new
|
|
7
|
+
add_spec_checker(@browser)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
before :each do
|
|
11
|
+
@browser.goto(TEST_HOST + "/non_control_elements.html")
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# Exists method
|
|
15
|
+
describe "#exist?" do
|
|
16
|
+
it "should return true if the 'ol' exists" do
|
|
17
|
+
@browser.ol(:id, "favorite_compounds").should exist
|
|
18
|
+
@browser.ol(:id, /favorite_compounds/).should exist
|
|
19
|
+
@browser.ol(:index, 1).should exist
|
|
20
|
+
@browser.ol(:xpath, "//ol[@id='favorite_compounds']").should exist
|
|
21
|
+
end
|
|
22
|
+
it "should return true if the element exists (default how = :id)" do
|
|
23
|
+
@browser.ol("favorite_compounds").should exist
|
|
24
|
+
end
|
|
25
|
+
it "should return false if the 'ol' doesn't exist" do
|
|
26
|
+
@browser.ol(:id, "no_such_id").should_not exist
|
|
27
|
+
@browser.ol(:id, /no_such_id/).should_not exist
|
|
28
|
+
@browser.ol(:text, "no_such_text").should_not exist
|
|
29
|
+
@browser.ol(:text, /no_such_text/).should_not exist
|
|
30
|
+
@browser.ol(:class, "no_such_class").should_not exist
|
|
31
|
+
@browser.ol(:class, /no_such_class/).should_not exist
|
|
32
|
+
@browser.ol(:index, 1337).should_not exist
|
|
33
|
+
@browser.ol(:xpath, "//ol[@id='no_such_id']").should_not exist
|
|
34
|
+
end
|
|
35
|
+
it "should raise ArgumentError when 'what' argument is invalid" do
|
|
36
|
+
lambda { @browser.ol(:id, 3.14).exists? }.should raise_error(ArgumentError)
|
|
37
|
+
end
|
|
38
|
+
it "should raise MissingWayOfFindingObjectException when 'how' argument is invalid" do
|
|
39
|
+
lambda { @browser.ol(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Attribute methods
|
|
44
|
+
describe "#class_name" do
|
|
45
|
+
it "should return the class attribute" do
|
|
46
|
+
@browser.ol(:id, 'favorite_compounds').class_name.should == 'chemistry'
|
|
47
|
+
end
|
|
48
|
+
it "should return an empty string if the element exists and the attribute doesn't" do
|
|
49
|
+
@browser.ol(:index, 2).class_name.should == ''
|
|
50
|
+
end
|
|
51
|
+
it "should raise UnknownObjectException if the ol doesn't exist" do
|
|
52
|
+
lambda { @browser.ol(:id, 'no_such_id').class_name }.should raise_error(UnknownObjectException)
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
describe "#id" do
|
|
57
|
+
it "should return the id attribute" do
|
|
58
|
+
@browser.ol(:class, 'chemistry').id.should == "favorite_compounds"
|
|
59
|
+
end
|
|
60
|
+
it "should return an empty string if the element exists and the attribute doesn't" do
|
|
61
|
+
@browser.ol(:index, 2).id.should == ''
|
|
62
|
+
end
|
|
63
|
+
it "should raise UnknownObjectException if the ol doesn't exist" do
|
|
64
|
+
lambda { @browser.ol(:id, "no_such_id").id }.should raise_error(UnknownObjectException)
|
|
65
|
+
lambda { @browser.ol(:index, 1337).id }.should raise_error(UnknownObjectException)
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
after :all do
|
|
70
|
+
@browser.close
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
end
|