celerity 0.0.1 → 0.0.2
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 +10 -0
- data/README.txt +8 -11
- data/Rakefile +5 -3
- data/benchmark/bm_2000_spans.rb +48 -0
- data/benchmark/bm_digg.rb +26 -0
- data/benchmark/bm_google_images.rb +36 -0
- data/benchmark/bm_input_locator.rb +69 -0
- data/benchmark/loader.rb +9 -0
- data/lib/celerity.rb +3 -1
- data/lib/celerity/container.rb +23 -171
- data/lib/celerity/disabled_element.rb +1 -1
- data/lib/celerity/element.rb +78 -47
- data/lib/celerity/element_collections.rb +16 -32
- data/lib/celerity/element_locator.rb +135 -0
- data/lib/celerity/elements/button.rb +15 -0
- data/lib/celerity/elements/file_field.rb +1 -1
- data/lib/celerity/elements/form.rb +2 -1
- data/lib/celerity/elements/frame.rb +18 -21
- data/lib/celerity/elements/image.rb +2 -8
- data/lib/celerity/elements/label.rb +1 -3
- data/lib/celerity/elements/link.rb +1 -1
- data/lib/celerity/elements/option.rb +16 -0
- data/lib/celerity/elements/radio_check.rb +18 -7
- data/lib/celerity/elements/select_list.rb +1 -17
- data/lib/celerity/elements/table.rb +4 -4
- data/lib/celerity/elements/table_body.rb +6 -8
- data/lib/celerity/elements/table_cell.rb +3 -14
- data/lib/celerity/elements/table_row.rb +4 -10
- data/lib/celerity/elements/text_field.rb +16 -4
- data/lib/celerity/extra/method_generator.rb +144 -0
- data/lib/celerity/identifier.rb +10 -0
- data/lib/celerity/ie.rb +28 -13
- data/lib/celerity/input_element.rb +0 -4
- data/lib/celerity/non_control_elements.rb +12 -12
- data/lib/celerity/version.rb +1 -1
- data/spec/area_spec.rb +41 -41
- data/spec/areas_spec.rb +11 -11
- data/spec/button_spec.rb +73 -68
- data/spec/buttons_spec.rb +10 -10
- data/spec/checkbox_spec.rb +102 -96
- data/spec/checkboxes_spec.rb +10 -10
- data/spec/div_spec.rb +78 -73
- data/spec/divs_spec.rb +10 -10
- data/spec/element_spec.rb +20 -11
- data/spec/filefield_spec.rb +36 -41
- data/spec/filefields_spec.rb +10 -10
- data/spec/form_spec.rb +29 -29
- data/spec/forms_spec.rb +11 -11
- data/spec/frame_spec.rb +54 -49
- data/spec/hidden_spec.rb +43 -43
- data/spec/hiddens_spec.rb +10 -10
- data/spec/html/2000_spans.html +2009 -0
- data/spec/html/forms_with_input_elements.html +15 -9
- data/spec/html/non_control_elements.html +4 -2
- data/spec/ie_spec.rb +82 -48
- data/spec/image_spec.rb +83 -100
- data/spec/images_spec.rb +10 -10
- data/spec/label_spec.rb +29 -29
- data/spec/labels_spec.rb +10 -10
- data/spec/li_spec.rb +41 -41
- data/spec/link_spec.rb +65 -59
- data/spec/links_spec.rb +11 -11
- data/spec/lis_spec.rb +10 -10
- data/spec/map_spec.rb +30 -30
- data/spec/maps_spec.rb +10 -10
- data/spec/p_spec.rb +49 -49
- data/spec/pre_spec.rb +41 -41
- data/spec/pres_spec.rb +10 -10
- data/spec/ps_spec.rb +10 -10
- data/spec/radio_spec.rb +104 -97
- data/spec/radios_spec.rb +11 -11
- data/spec/select_list_spec.rb +118 -106
- data/spec/select_lists_spec.rb +15 -15
- data/spec/span_spec.rb +54 -54
- data/spec/spans_spec.rb +11 -11
- data/spec/spec.opts +1 -1
- data/spec/spec_helper.rb +23 -3
- data/spec/table_bodies.rb +8 -8
- data/spec/table_bodies_spec.rb +9 -9
- data/spec/table_body_spec.rb +28 -27
- data/spec/table_cell_spec.rb +25 -25
- data/spec/table_cells_spec.rb +16 -16
- data/spec/table_row_spec.rb +16 -16
- data/spec/table_rows_spec.rb +12 -12
- data/spec/table_spec.rb +36 -36
- data/spec/tables_spec.rb +12 -12
- data/spec/text_field_spec.rb +111 -92
- data/spec/text_fields_spec.rb +13 -13
- data/tasks/benchmark.rake +3 -0
- data/tasks/rspec.rake +2 -2
- data/tasks/testserver.rake +15 -0
- metadata +58 -46
- data/tasks/simple_ci.rake +0 -94
data/spec/text_field_spec.rb
CHANGED
@@ -5,55 +5,60 @@ require File.dirname(__FILE__) + '/spec_helper.rb'
|
|
5
5
|
describe "TextField" do
|
6
6
|
|
7
7
|
before :all do
|
8
|
-
@
|
9
|
-
add_spec_checker(@
|
8
|
+
@browser = IE.new
|
9
|
+
add_spec_checker(@browser)
|
10
10
|
end
|
11
11
|
|
12
12
|
before :each do
|
13
|
-
@
|
13
|
+
@browser.goto(TEST_HOST + "/forms_with_input_elements.html")
|
14
14
|
end
|
15
15
|
|
16
16
|
# Exist method
|
17
17
|
describe "#exists?" do
|
18
18
|
it "should return true if the element exists" do
|
19
|
-
@
|
20
|
-
@
|
21
|
-
@
|
22
|
-
@
|
23
|
-
@
|
24
|
-
@
|
25
|
-
@
|
26
|
-
@
|
27
|
-
@
|
28
|
-
@
|
29
|
-
@
|
30
|
-
@
|
19
|
+
@browser.text_field(:id, 'new_user_email').should exist
|
20
|
+
@browser.text_field(:id, /new_user_email/).should exist
|
21
|
+
@browser.text_field(:name, 'new_user_email').should exist
|
22
|
+
@browser.text_field(:name, /new_user_email/).should exist
|
23
|
+
@browser.text_field(:value, 'Developer').should exist
|
24
|
+
@browser.text_field(:value, /Developer/).should exist
|
25
|
+
@browser.text_field(:text, 'Developer').should exist
|
26
|
+
@browser.text_field(:text, /Developer/).should exist
|
27
|
+
@browser.text_field(:class, 'name').should exist
|
28
|
+
@browser.text_field(:class, /name/).should exist
|
29
|
+
@browser.text_field(:index, 1).should exist
|
30
|
+
@browser.text_field(:xpath, "//input[@id='new_user_email']").should exist
|
31
31
|
end
|
32
|
-
|
33
|
-
|
32
|
+
|
33
|
+
it "should return true if the element exists (no type attribute)" do
|
34
|
+
@browser.text_field(:id, 'new_user_first_name').should exist
|
34
35
|
end
|
35
|
-
|
36
|
-
|
36
|
+
|
37
|
+
it "should return true if the element exists (invalid type attribute)" do
|
38
|
+
@browser.text_field(:id, 'new_user_last_name').should exist
|
37
39
|
end
|
40
|
+
|
38
41
|
it "should return false if the element does not exist" do
|
39
|
-
@
|
40
|
-
@
|
41
|
-
@
|
42
|
-
@
|
43
|
-
@
|
44
|
-
@
|
45
|
-
@
|
46
|
-
@
|
47
|
-
@
|
48
|
-
@
|
49
|
-
@
|
50
|
-
@
|
42
|
+
@browser.text_field(:id, 'no_such_id').should_not exist
|
43
|
+
@browser.text_field(:id, /no_such_id/).should_not exist
|
44
|
+
@browser.text_field(:name, 'no_such_name').should_not exist
|
45
|
+
@browser.text_field(:name, /no_such_name/).should_not exist
|
46
|
+
@browser.text_field(:value, 'no_such_value').should_not exist
|
47
|
+
@browser.text_field(:value, /no_such_value/).should_not exist
|
48
|
+
@browser.text_field(:text, 'no_such_text').should_not exist
|
49
|
+
@browser.text_field(:text, /no_such_text/).should_not exist
|
50
|
+
@browser.text_field(:class, 'no_such_class').should_not exist
|
51
|
+
@browser.text_field(:class, /no_such_class/).should_not exist
|
52
|
+
@browser.text_field(:index, 1337).should_not exist
|
53
|
+
@browser.text_field(:xpath, "//input[@id='no_such_id']").should_not exist
|
51
54
|
end
|
52
|
-
|
53
|
-
|
55
|
+
|
56
|
+
it "should raise ArgumentError when 'what' argument is invalid" do
|
57
|
+
lambda { @browser.text_field(:id, 3.14).exists? }.should raise_error(ArgumentError)
|
54
58
|
end
|
55
|
-
|
56
|
-
|
59
|
+
|
60
|
+
it "should raise MissingWayOfFindingObjectException when 'how' argument is invalid" do
|
61
|
+
lambda { @browser.text_field(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
|
57
62
|
end
|
58
63
|
end
|
59
64
|
|
@@ -61,82 +66,82 @@ describe "TextField" do
|
|
61
66
|
# Attribute methods
|
62
67
|
describe "#id" do
|
63
68
|
it "should return the id attribute if the text field exists" do
|
64
|
-
@
|
69
|
+
@browser.text_field(:index, 4).id.should == "new_user_occupation"
|
65
70
|
end
|
66
71
|
it "should raise UnknownObjectException if the text field doesn't exist" do
|
67
|
-
lambda { @
|
72
|
+
lambda { @browser.text_field(:index, 1337).id }.should raise_error(UnknownObjectException)
|
68
73
|
end
|
69
74
|
end
|
70
75
|
|
71
76
|
describe "#name" do
|
72
77
|
it "should return the name attribute if the text field exists" do
|
73
|
-
@
|
78
|
+
@browser.text_field(:index, 4).name.should == "new_user_occupation"
|
74
79
|
end
|
75
80
|
it "should raise UnknownObjectException if the text field doesn't exist" do
|
76
|
-
lambda { @
|
81
|
+
lambda { @browser.text_field(:index, 1337).name }.should raise_error(UnknownObjectException)
|
77
82
|
end
|
78
83
|
end
|
79
84
|
|
80
85
|
describe "#title" do
|
81
86
|
it "should return the title attribute if the text field exists" do
|
82
|
-
@
|
87
|
+
@browser.text_field(:id, "new_user_code").title.should == "Your personal code"
|
83
88
|
end
|
84
89
|
it "should raise UnknownObjectException if the text field doesn't exist" do
|
85
|
-
lambda { @
|
90
|
+
lambda { @browser.text_field(:index, 1337).title }.should raise_error(UnknownObjectException)
|
86
91
|
end
|
87
92
|
end
|
88
93
|
|
89
94
|
describe "#type" do
|
90
95
|
#TODO: What if the type attribute is non-existent or invalid?
|
91
96
|
it "should return the type attribute if the text field exists" do
|
92
|
-
@
|
97
|
+
@browser.text_field(:index, 4).type.should == "text"
|
93
98
|
end
|
94
99
|
it "should raise UnknownObjectException if the text field doesn't exist" do
|
95
|
-
lambda { @
|
100
|
+
lambda { @browser.text_field(:index, 1337).type }.should raise_error(UnknownObjectException)
|
96
101
|
end
|
97
102
|
end
|
98
103
|
|
99
104
|
describe "#value" do
|
100
105
|
it "should return the value attribute if the text field exists" do
|
101
|
-
@
|
102
|
-
@
|
103
|
-
@
|
106
|
+
@browser.text_field(:name, "new_user_occupation").value.should == "Developer"
|
107
|
+
@browser.text_field(:index, 4).value.should == "Developer"
|
108
|
+
@browser.text_field(:name, /new_user_occupation/i).value.should == "Developer"
|
104
109
|
end
|
105
110
|
it "should raise UnknownObjectException if the text field doesn't exist" do
|
106
|
-
lambda { @
|
111
|
+
lambda { @browser.text_field(:index, 1337).value }.should raise_error(UnknownObjectException)
|
107
112
|
end
|
108
113
|
end
|
109
114
|
|
110
115
|
# Access methods
|
111
116
|
describe "#enabled?" do
|
112
117
|
it "should return true for enabled text fields" do
|
113
|
-
@
|
114
|
-
@
|
118
|
+
@browser.text_field(:name, "new_user_occupation").should be_enabled
|
119
|
+
@browser.text_field(:id, "new_user_email").should be_enabled
|
115
120
|
end
|
116
121
|
it "should return false for disabled text fields" do
|
117
|
-
@
|
122
|
+
@browser.text_field(:name, "new_user_species").should_not be_enabled
|
118
123
|
end
|
119
124
|
end
|
120
125
|
|
121
126
|
describe "#disabled?" do
|
122
127
|
it "should return true if the text field is disabled" do
|
123
|
-
@
|
128
|
+
@browser.text_field(:id, 'new_user_species').should be_disabled
|
124
129
|
end
|
125
130
|
it "should return false if the text field is enabled" do
|
126
|
-
@
|
131
|
+
@browser.text_field(:index, 1).should_not be_disabled
|
127
132
|
end
|
128
133
|
it "should raise UnknownObjectException if the text field doesn't exist" do
|
129
|
-
lambda { @
|
134
|
+
lambda { @browser.text_field(:index, 1337).disabled? }.should raise_error(UnknownObjectException)
|
130
135
|
end
|
131
136
|
end
|
132
137
|
|
133
138
|
describe "#readonly?" do
|
134
139
|
it "should return true for read-only text fields" do
|
135
|
-
@
|
136
|
-
@
|
140
|
+
@browser.text_field(:name, "new_user_code").should be_readonly
|
141
|
+
@browser.text_field(:id, "new_user_code").should be_readonly
|
137
142
|
end
|
138
143
|
it "should return false for writeable text fields" do
|
139
|
-
@
|
144
|
+
@browser.text_field(:name, "new_user_email").should_not be_readonly
|
140
145
|
end
|
141
146
|
end
|
142
147
|
|
@@ -145,90 +150,104 @@ describe "TextField" do
|
|
145
150
|
|
146
151
|
describe "#append" do
|
147
152
|
it "should append the text to the text field" do
|
148
|
-
@
|
149
|
-
@
|
153
|
+
@browser.text_field(:name, "new_user_occupation").append(" Append This")
|
154
|
+
@browser.text_field(:name, "new_user_occupation").get_contents.should == "Developer Append This"
|
150
155
|
end
|
151
|
-
it "should append
|
152
|
-
@
|
153
|
-
@
|
156
|
+
it "should append multi-byte characters" do
|
157
|
+
@browser.text_field(:name, "new_user_occupation").append(" ijij")
|
158
|
+
@browser.text_field(:name, "new_user_occupation").get_contents.should == "Developer ijij"
|
154
159
|
end
|
155
160
|
it "should raise ObjectReadOnlyException if the object is read only" do
|
156
|
-
lambda { @
|
161
|
+
lambda { @browser.text_field(:id, "new_user_code").append("Append This") }.should raise_error(ObjectReadOnlyException)
|
157
162
|
end
|
158
163
|
it "should raise ObjectDisabledException if the object is disabled" do
|
159
|
-
lambda { @
|
164
|
+
lambda { @browser.text_field(:name, "new_user_species").append("Append This") }.should raise_error(ObjectDisabledException)
|
160
165
|
end
|
161
166
|
it "should raise UnknownObjectException if the object doesn't exist" do
|
162
|
-
lambda { @
|
167
|
+
lambda { @browser.text_field(:name, "no_such_name").append("Append This") }.should raise_error(UnknownObjectException)
|
163
168
|
end
|
164
169
|
end
|
165
170
|
|
166
171
|
describe "#clear" do
|
167
172
|
it "should remove all text from the text field" do
|
168
|
-
@
|
169
|
-
@
|
170
|
-
@
|
171
|
-
@
|
173
|
+
@browser.text_field(:name, "new_user_occupation").clear
|
174
|
+
@browser.text_field(:name, "new_user_occupation").get_contents.should be_empty
|
175
|
+
@browser.text_field(:id, "delete_user_comment").clear
|
176
|
+
@browser.text_field(:id, "delete_user_comment").get_contents.should be_empty
|
172
177
|
end
|
173
178
|
end
|
174
179
|
|
175
180
|
describe "#drag_contents_to" do
|
176
181
|
it "should drag contents to another text field" do
|
177
|
-
@
|
178
|
-
@
|
179
|
-
@
|
180
|
-
@
|
182
|
+
@browser.text_field(:name, "new_user_first_name").set("Smith")
|
183
|
+
@browser.text_field(:name, "new_user_first_name").drag_contents_to(:name, "new_user_last_name")
|
184
|
+
@browser.text_field(:name, "new_user_first_name").value.should be_empty
|
185
|
+
@browser.text_field(:id, "new_user_last_name").value.should == "Smith"
|
181
186
|
end
|
182
187
|
end
|
183
188
|
|
184
189
|
describe "#get_contents" do
|
185
190
|
it "should raise UnknownObjectException when accessing a non-existing element" do
|
186
|
-
lambda { @
|
191
|
+
lambda { @browser.text_field(:name, "no_such_name").get_contents }.should raise_error(UnknownObjectException)
|
187
192
|
end
|
188
193
|
end
|
189
194
|
|
190
195
|
describe "#value=" do
|
191
196
|
it "should set the value of the element" do
|
192
|
-
@
|
193
|
-
@
|
194
|
-
|
195
|
-
|
197
|
+
@browser.text_field(:id, 'new_user_email').value = 'Hello Cruel World'
|
198
|
+
@browser.text_field(:id, "new_user_email").value.should == 'Hello Cruel World'
|
199
|
+
end
|
200
|
+
|
201
|
+
it "should be able to set multi-byte characters" do
|
202
|
+
@browser.text_field(:name, "new_user_occupation").value = "ijij"
|
203
|
+
@browser.text_field(:name, "new_user_occupation").get_contents.should == "ijij"
|
204
|
+
end
|
205
|
+
|
206
|
+
it "should set the value of a textarea element" do
|
207
|
+
@browser.text_field(:id, 'delete_user_comment').value = 'Hello Cruel World'
|
208
|
+
@browser.text_field(:id, "delete_user_comment").value.should == 'Hello Cruel World'
|
196
209
|
end
|
197
210
|
end
|
198
211
|
|
199
212
|
describe "#set" do
|
200
213
|
it "should set the value of the element" do
|
201
|
-
@
|
202
|
-
@
|
203
|
-
@ie.text_field(:id, 'delete_user_comment').set('Hello Cruel World')
|
204
|
-
@ie.text_field(:id, "delete_user_comment").value.should == 'Hello Cruel World'
|
214
|
+
@browser.text_field(:id, 'new_user_email').set('Bye Cruel World')
|
215
|
+
@browser.text_field(:id, "new_user_email").value.should == 'Bye Cruel World'
|
205
216
|
end
|
206
217
|
|
207
|
-
it "should
|
218
|
+
it "should set the value of a textarea element" do
|
219
|
+
@browser.text_field(:id, 'delete_user_comment').set('Hello Cruel World')
|
220
|
+
@browser.text_field(:id, "delete_user_comment").value.should == 'Hello Cruel World'
|
221
|
+
end
|
222
|
+
|
223
|
+
it "should fire events" do
|
224
|
+
@browser.text_field(:id, "new_user_username").set("Hello World")
|
225
|
+
@browser.span(:id, "current_length").text.should == "11"
|
226
|
+
end
|
208
227
|
|
209
228
|
it "should be able to set the value of a password field" do
|
210
|
-
@
|
211
|
-
@
|
229
|
+
@browser.text_field(:name , 'new_user_password').set('secret')
|
230
|
+
@browser.text_field(:name , 'new_user_password').value.should == 'secret'
|
212
231
|
end
|
213
|
-
it "should be able to set
|
214
|
-
@
|
215
|
-
@
|
232
|
+
it "should be able to set multi-byte characters" do
|
233
|
+
@browser.text_field(:name, "new_user_occupation").set("ijij")
|
234
|
+
@browser.text_field(:name, "new_user_occupation").get_contents.should == "ijij"
|
216
235
|
end
|
217
236
|
end
|
218
237
|
|
219
238
|
describe "#verify_contains" do
|
220
239
|
it "should verify that a text field contains its value" do
|
221
|
-
@
|
222
|
-
@
|
240
|
+
@browser.text_field(:name, "new_user_occupation").verify_contains("Developer").should be_true
|
241
|
+
@browser.text_field(:name, "new_user_occupation").verify_contains(/Developer/).should be_true
|
223
242
|
end
|
224
243
|
it "should not verify that a text field contains a non-existing value" do
|
225
|
-
@
|
226
|
-
@
|
244
|
+
@browser.text_field(:name, "new_user_email").verify_contains("no_such_text").should be_false
|
245
|
+
@browser.text_field(:name, "new_user_email").verify_contains(/no_such_text/).should be_false
|
227
246
|
end
|
228
247
|
end
|
229
248
|
|
230
249
|
after :all do
|
231
|
-
@
|
250
|
+
@browser.close
|
232
251
|
end
|
233
252
|
end
|
234
253
|
|
data/spec/text_fields_spec.rb
CHANGED
@@ -3,43 +3,43 @@ require File.dirname(__FILE__) + '/spec_helper.rb'
|
|
3
3
|
describe "TextFields" do
|
4
4
|
|
5
5
|
before :all do
|
6
|
-
@
|
7
|
-
add_spec_checker(@
|
6
|
+
@browser = IE.new
|
7
|
+
add_spec_checker(@browser)
|
8
8
|
end
|
9
9
|
|
10
10
|
before :each do
|
11
|
-
@
|
11
|
+
@browser.goto(TEST_HOST + "/forms_with_input_elements.html")
|
12
12
|
end
|
13
13
|
|
14
14
|
describe "#length" do
|
15
15
|
it "should return the number of text fields" do
|
16
|
-
@
|
16
|
+
@browser.text_fields.length.should == 9
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
20
|
describe "#[]" do
|
21
21
|
it "should return the text field at the given index" do
|
22
|
-
@
|
23
|
-
@
|
24
|
-
@
|
22
|
+
@browser.text_fields[1].id.should == "new_user_first_name"
|
23
|
+
@browser.text_fields[2].id.should == "new_user_last_name"
|
24
|
+
@browser.text_fields[3].id.should == "new_user_email"
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
28
|
describe "#each" do
|
29
29
|
it "should iterate through text fields correctly" do
|
30
30
|
index = 1
|
31
|
-
@
|
32
|
-
r.name.should == @
|
33
|
-
r.id.should == @
|
34
|
-
r.value.should == @
|
31
|
+
@browser.text_fields.each do |r|
|
32
|
+
r.name.should == @browser.text_field(:index, index).name
|
33
|
+
r.id.should == @browser.text_field(:index, index).id
|
34
|
+
r.value.should == @browser.text_field(:index, index).value
|
35
35
|
index += 1
|
36
36
|
end
|
37
|
-
@
|
37
|
+
@browser.text_fields.length.should == index - 1
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
41
|
after :all do
|
42
|
-
@
|
42
|
+
@browser.close
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
data/tasks/rspec.rake
CHANGED
@@ -18,6 +18,6 @@ desc "Run the specs under spec/models"
|
|
18
18
|
Spec::Rake::SpecTask.new do |t|
|
19
19
|
t.spec_opts = ['--options', "spec/spec.opts"]
|
20
20
|
t.spec_files = FileList['spec/**/*_spec.rb']
|
21
|
-
t.rcov = true
|
22
|
-
t.rcov_opts = ['--exclude', 'spec,fcntl,path_helper']
|
21
|
+
# t.rcov = true
|
22
|
+
# t.rcov_opts = ['--exclude', 'spec,fcntl,path_helper']
|
23
23
|
end
|
data/tasks/testserver.rake
CHANGED
@@ -4,14 +4,29 @@ task :testserver do
|
|
4
4
|
require 'webrick'
|
5
5
|
doc_root = File.join(File.dirname(__FILE__),"..", "spec", "html")
|
6
6
|
log_file = File.join(File.dirname(__FILE__), "..", "log", "webrick_log.txt")
|
7
|
+
unless File.exist?(log_file)
|
8
|
+
FileUtils.mkdir_p(File.dirname(log_file))
|
9
|
+
FileUtils.touch(log_file)
|
10
|
+
end
|
11
|
+
|
7
12
|
server_port = 2000
|
8
13
|
TEST_HOST = "http://localhost:#{server_port.to_s}"
|
9
14
|
|
15
|
+
class PostServlet < WEBrick::HTTPServlet::AbstractServlet
|
16
|
+
def do_POST(req, resp)
|
17
|
+
resp['content-type'] = 'text/plain'
|
18
|
+
resp.body << "You posted the following content:\n"
|
19
|
+
resp.body << req.body
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
10
23
|
server = WEBrick::HTTPServer.new(:Port => server_port,
|
11
24
|
:DocumentRoot => doc_root,
|
12
25
|
:Logger => WEBrick::Log.new(log_file, WEBrick::BasicLog::WARN),
|
13
26
|
:AccessLog => [])
|
14
27
|
server.mount("/", WEBrick::HTTPServlet::FileHandler, doc_root, {:FancyIndexing=>true})
|
28
|
+
server.mount("/post_to_me", PostServlet)
|
29
|
+
|
15
30
|
WEBRICK_SERVER = Thread.new { server.start }
|
16
31
|
WEBRICK_SERVER.join
|
17
32
|
end
|
metadata
CHANGED
@@ -1,39 +1,40 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: celerity
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- T. Alexander Lystad
|
8
|
+
- Knut Johannes Dahle
|
9
|
+
- Jari Bakken
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
9
12
|
cert_chain: []
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
13
|
+
|
14
|
+
date: 2008-05-15 00:00:00 +02:00
|
15
|
+
default_executable:
|
16
|
+
dependencies: []
|
17
|
+
|
18
|
+
description: Celerity is a JRuby wrapper around the HtmlUnit Java library (http://htmlunit.sourceforge.net/). The goal of the project is to duplicate the Watir API (http://wtf.rubyforge.org/) using HtmlUnit as the underlying engine.
|
19
|
+
email: alexander.lystad@finntech.no
|
20
|
+
executables: []
|
21
|
+
|
22
|
+
extensions: []
|
23
|
+
|
14
24
|
extra_rdoc_files:
|
15
25
|
- History.txt
|
16
26
|
- License.txt
|
17
27
|
- README.txt
|
18
|
-
homepage: http://celerity.rubyforge.org
|
19
|
-
signing_key:
|
20
|
-
name: celerity
|
21
|
-
rdoc_options:
|
22
|
-
- --main
|
23
|
-
- README.txt
|
24
|
-
autorequire:
|
25
|
-
rubyforge_project: celerity
|
26
|
-
executables: []
|
27
|
-
description: Celerity is a JRuby wrapper around the HtmlUnit Java library (http://htmlunit.sourceforge.net/).
|
28
|
-
The goal of the project is to duplicate the Watir API (http://wtf.rubyforge.org/)
|
29
|
-
using HtmlUnit as the underlying engine.
|
30
|
-
specification_version: 2
|
31
|
-
default_executable:
|
32
28
|
files:
|
33
29
|
- History.txt
|
34
30
|
- License.txt
|
35
31
|
- README.txt
|
36
32
|
- Rakefile
|
33
|
+
- benchmark/bm_2000_spans.rb
|
34
|
+
- benchmark/bm_digg.rb
|
35
|
+
- benchmark/bm_google_images.rb
|
36
|
+
- benchmark/bm_input_locator.rb
|
37
|
+
- benchmark/loader.rb
|
37
38
|
- lib/celerity.rb
|
38
39
|
- lib/celerity/clickable_element.rb
|
39
40
|
- lib/celerity/collections.rb
|
@@ -41,6 +42,7 @@ files:
|
|
41
42
|
- lib/celerity/disabled_element.rb
|
42
43
|
- lib/celerity/element.rb
|
43
44
|
- lib/celerity/element_collections.rb
|
45
|
+
- lib/celerity/element_locator.rb
|
44
46
|
- lib/celerity/elements/button.rb
|
45
47
|
- lib/celerity/elements/file_field.rb
|
46
48
|
- lib/celerity/elements/form.rb
|
@@ -48,6 +50,7 @@ files:
|
|
48
50
|
- lib/celerity/elements/image.rb
|
49
51
|
- lib/celerity/elements/label.rb
|
50
52
|
- lib/celerity/elements/link.rb
|
53
|
+
- lib/celerity/elements/option.rb
|
51
54
|
- lib/celerity/elements/radio_check.rb
|
52
55
|
- lib/celerity/elements/select_list.rb
|
53
56
|
- lib/celerity/elements/table.rb
|
@@ -56,6 +59,7 @@ files:
|
|
56
59
|
- lib/celerity/elements/table_row.rb
|
57
60
|
- lib/celerity/elements/text_field.rb
|
58
61
|
- lib/celerity/exception.rb
|
62
|
+
- lib/celerity/extra/method_generator.rb
|
59
63
|
- lib/celerity/htmlunit/commons-codec-1.3.jar
|
60
64
|
- lib/celerity/htmlunit/commons-collections-3.2.jar
|
61
65
|
- lib/celerity/htmlunit/commons-httpclient-3.1.jar
|
@@ -70,6 +74,7 @@ files:
|
|
70
74
|
- lib/celerity/htmlunit/xalan-2.7.0.jar
|
71
75
|
- lib/celerity/htmlunit/xercesImpl-2.8.1.jar
|
72
76
|
- lib/celerity/htmlunit/xml-apis-1.0.b2.jar
|
77
|
+
- lib/celerity/identifier.rb
|
73
78
|
- lib/celerity/ie.rb
|
74
79
|
- lib/celerity/input_element.rb
|
75
80
|
- lib/celerity/non_control_elements.rb
|
@@ -91,6 +96,7 @@ files:
|
|
91
96
|
- spec/frame_spec.rb
|
92
97
|
- spec/hidden_spec.rb
|
93
98
|
- spec/hiddens_spec.rb
|
99
|
+
- spec/html/2000_spans.html
|
94
100
|
- spec/html/forms_with_input_elements.html
|
95
101
|
- spec/html/frame_1.html
|
96
102
|
- spec/html/frame_2.html
|
@@ -147,28 +153,34 @@ files:
|
|
147
153
|
- spec/text_fields_spec.rb
|
148
154
|
- tasks/environment.rake
|
149
155
|
- tasks/rspec.rake
|
150
|
-
- tasks/simple_ci.rake
|
151
156
|
- tasks/testserver.rake
|
152
|
-
|
157
|
+
- tasks/benchmark.rake
|
158
|
+
has_rdoc: true
|
159
|
+
homepage: http://celerity.rubyforge.org
|
160
|
+
post_install_message:
|
161
|
+
rdoc_options:
|
162
|
+
- --main
|
163
|
+
- README.txt
|
164
|
+
require_paths:
|
165
|
+
- lib
|
166
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
153
167
|
requirements:
|
154
|
-
- -
|
155
|
-
- !ruby/object:Gem::Version
|
156
|
-
version:
|
168
|
+
- - ">="
|
169
|
+
- !ruby/object:Gem::Version
|
170
|
+
version: "0"
|
171
|
+
version:
|
172
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
173
|
+
requirements:
|
174
|
+
- - ">="
|
175
|
+
- !ruby/object:Gem::Version
|
176
|
+
version: "0"
|
157
177
|
version:
|
158
|
-
extensions: []
|
159
|
-
rubygems_version: 1.0.1
|
160
178
|
requirements: []
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
179
|
+
|
180
|
+
rubyforge_project: celerity
|
181
|
+
rubygems_version: 1.1.1
|
182
|
+
signing_key:
|
183
|
+
specification_version: 2
|
184
|
+
summary: Celerity is a JRuby wrapper around the HtmlUnit Java library (http://htmlunit.sourceforge.net/). The goal of the project is to duplicate the Watir API (http://wtf.rubyforge.org/) using HtmlUnit as the underlying engine.
|
167
185
|
test_files: []
|
168
|
-
|
169
|
-
version: 0.0.1
|
170
|
-
require_paths:
|
171
|
-
- lib
|
172
|
-
dependencies: []
|
173
|
-
bindir: bin
|
174
|
-
has_rdoc: true
|
186
|
+
|