celerity 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/History.txt +14 -0
- data/Manifest.txt +127 -151
- data/README.txt +15 -20
- data/lib/celerity.rb +13 -5
- data/lib/celerity/browser.rb +296 -0
- data/lib/celerity/clickable_element.rb +1 -0
- data/lib/celerity/collections.rb +4 -0
- data/lib/celerity/container.rb +69 -2
- data/lib/celerity/disabled_element.rb +1 -0
- data/lib/celerity/element.rb +103 -38
- data/lib/celerity/element_collections.rb +14 -8
- data/lib/celerity/element_locator.rb +61 -50
- data/lib/celerity/element_map.rb +51 -0
- data/lib/celerity/elements/button.rb +1 -0
- data/lib/celerity/elements/file_field.rb +3 -2
- data/lib/celerity/elements/form.rb +1 -0
- data/lib/celerity/elements/frame.rb +16 -1
- data/lib/celerity/elements/image.rb +15 -13
- data/lib/celerity/elements/link.rb +4 -1
- data/lib/celerity/elements/option.rb +1 -0
- data/lib/celerity/elements/radio_check.rb +19 -7
- data/lib/celerity/elements/select_list.rb +17 -2
- data/lib/celerity/elements/table.rb +34 -20
- data/lib/celerity/elements/table_body.rb +2 -2
- data/lib/celerity/elements/table_cell.rb +3 -1
- data/lib/celerity/elements/table_footer.rb +2 -2
- data/lib/celerity/elements/table_header.rb +2 -2
- data/lib/celerity/elements/table_row.rb +4 -2
- data/lib/celerity/elements/text_field.rb +20 -9
- data/lib/celerity/exception.rb +11 -18
- data/lib/celerity/extra/method_generator.rb +13 -8
- data/lib/celerity/htmlunit/download.sh +23 -0
- data/lib/celerity/htmlunit/htmlunit-2.2.jar +0 -0
- data/lib/celerity/htmlunit/htmlunit-core-js-2.2.jar +0 -0
- data/lib/celerity/htmlunit/{nekohtml-1.9.7.jar → nekohtml-1.9.8.jar} +0 -0
- data/lib/celerity/input_element.rb +1 -1
- data/lib/celerity/version.rb +1 -1
- data/lib/celerity/watir_compatibility.rb +37 -23
- data/spec/area_spec.rb +19 -4
- data/spec/areas_spec.rb +2 -3
- data/spec/{ie_spec.rb → browser_spec.rb} +66 -15
- data/spec/button_spec.rb +36 -3
- data/spec/buttons_spec.rb +2 -3
- data/spec/checkbox_spec.rb +43 -8
- data/spec/checkboxes_spec.rb +2 -3
- data/spec/div_spec.rb +31 -4
- data/spec/divs_spec.rb +2 -3
- data/spec/element_spec.rb +36 -6
- data/spec/filefield_spec.rb +28 -13
- data/spec/filefields_spec.rb +2 -3
- data/spec/form_spec.rb +6 -3
- data/spec/forms_spec.rb +2 -3
- data/spec/frame_spec.rb +14 -5
- data/spec/frames_spec.rb +71 -0
- data/spec/hidden_spec.rb +21 -3
- data/spec/hiddens_spec.rb +2 -3
- data/spec/hn_spec.rb +30 -12
- data/spec/hns_spec.rb +14 -10
- data/spec/html/form_js_bug.html +11 -0
- data/spec/html/forms_with_input_elements.html +2 -1
- data/spec/html/invalid_js.html +11 -0
- data/spec/html/latin1_text.html +1 -0
- data/spec/html/non_control_elements.html +8 -4
- data/spec/html/simple_ajax.html +22 -0
- data/spec/htmlunit_spec.rb +4 -5
- data/spec/image_spec.rb +33 -3
- data/spec/images_spec.rb +2 -3
- data/spec/label_spec.rb +16 -3
- data/spec/labels_spec.rb +2 -3
- data/spec/li_spec.rb +25 -3
- data/spec/link_spec.rb +35 -3
- data/spec/links_spec.rb +2 -3
- data/spec/lis_spec.rb +2 -3
- data/spec/map_spec.rb +19 -3
- data/spec/maps_spec.rb +2 -3
- data/spec/meta_spec.rb +3 -1
- data/spec/ol_spec.rb +17 -3
- data/spec/ols_spec.rb +2 -3
- data/spec/option_spec.rb +28 -3
- data/spec/p_spec.rb +30 -2
- data/spec/pre_spec.rb +25 -3
- data/spec/pres_spec.rb +2 -3
- data/spec/ps_spec.rb +2 -3
- data/spec/radio_spec.rb +47 -3
- data/spec/radios_spec.rb +2 -3
- data/spec/select_list_spec.rb +42 -3
- data/spec/select_lists_spec.rb +2 -3
- data/spec/span_spec.rb +32 -7
- data/spec/spans_spec.rb +2 -4
- data/spec/spec_helper.rb +5 -25
- data/spec/table_bodies_spec.rb +7 -5
- data/spec/table_body_spec.rb +11 -4
- data/spec/table_cell_spec.rb +15 -4
- data/spec/table_cells_spec.rb +3 -4
- data/spec/table_footer_spec.rb +11 -4
- data/spec/table_footers_spec.rb +7 -5
- data/spec/table_header_spec.rb +11 -4
- data/spec/table_headers_spec.rb +7 -5
- data/spec/table_row_spec.rb +31 -7
- data/spec/table_rows_spec.rb +5 -4
- data/spec/table_spec.rb +36 -7
- data/spec/tables_spec.rb +2 -3
- data/spec/text_field_spec.rb +51 -13
- data/spec/text_fields_spec.rb +2 -3
- data/spec/ul_spec.rb +18 -3
- data/spec/uls_spec.rb +2 -3
- data/spec/{watir_compatability_spec.rb → watir_compatibility_spec.rb} +42 -35
- data/support/spec_server.rb +9 -0
- metadata +167 -161
- metadata.gz.sig +0 -0
- data/benchmark/bm_2000_spans.rb +0 -48
- data/benchmark/bm_digg.rb +0 -26
- data/benchmark/bm_google_images.rb +0 -36
- data/benchmark/bm_input_locator.rb +0 -69
- data/benchmark/loader.rb +0 -9
- data/config/hoe.rb +0 -68
- data/config/requirements.rb +0 -15
- data/lib/celerity/htmlunit/htmlunit-2.2-SNAPSHOT.jar +0 -0
- data/lib/celerity/htmlunit/js-1.7R1.jar +0 -0
- data/lib/celerity/ie.rb +0 -195
- data/setup.rb +0 -1583
- data/support/celerity_viewer/rubycocoa/CelerityViewer.icns +0 -0
- data/support/celerity_viewer/rubycocoa/English.lproj/Main.nib/classes.nib +0 -37
- data/support/celerity_viewer/rubycocoa/English.lproj/Main.nib/info.nib +0 -19
- data/support/celerity_viewer/rubycocoa/English.lproj/Main.nib/keyedobjects.nib +0 -0
- data/support/celerity_viewer/rubycocoa/Info.plist.erb +0 -28
- data/support/celerity_viewer/rubycocoa/MainController.rb +0 -23
- data/support/celerity_viewer/rubycocoa/README +0 -94
- data/support/celerity_viewer/rubycocoa/Rakefile +0 -100
- data/support/celerity_viewer/rubycocoa/distributed_viewer.rb +0 -86
- data/support/celerity_viewer/rubycocoa/main.m +0 -7
- data/support/celerity_viewer/rubycocoa/main.rb +0 -27
- data/tasks/benchmark.rake +0 -4
- data/tasks/environment.rake +0 -7
- data/tasks/simple_ci.rake +0 -94
data.tar.gz.sig
ADDED
Binary file
|
data/History.txt
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
== 0.0.4 2008-08-18
|
2
|
+
* Minor enhancements
|
3
|
+
* Update HtmlUnit to 2.2
|
4
|
+
* New methods: Element#focus, Element#parent, Table#child_row, Table#child_cell, TableRow#child_cell
|
5
|
+
* Rename Celerity::IE -> Celerity::Browser (but Celerity::IE still points to the class)
|
6
|
+
* Add Celerity::Browser.new(:browser => :firefox) to use HtmlUnit's Firefox mode.
|
7
|
+
* Make it easier to run the spec suite against other implementations.
|
8
|
+
* Bugfixes:
|
9
|
+
- Image#click
|
10
|
+
- Finding elements by id could give weird errors if multiple elements had the same id.
|
11
|
+
- If getElementById returns an element with the wrong tag name, output a warning and find the correct element by iteration instead.
|
12
|
+
- Browser#goto regexp
|
13
|
+
- Frames (collection) support
|
14
|
+
|
1
15
|
== 0.0.3 2008-05-26
|
2
16
|
* 3 major enhancements:
|
3
17
|
* Added support for <ul>, <ol>, <thead>, <tfoot>, <h1>, <h2>, <h3>, <h4>, <h5> and <h6> elements
|
data/Manifest.txt
CHANGED
@@ -1,174 +1,150 @@
|
|
1
1
|
History.txt
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
2
|
+
License.txt
|
3
|
+
Manifest.txt
|
4
|
+
README.txt
|
5
|
+
Rakefile
|
6
|
+
lib/celerity.rb
|
7
|
+
lib/celerity/browser.rb
|
8
|
+
lib/celerity/clickable_element.rb
|
9
|
+
lib/celerity/collections.rb
|
10
|
+
lib/celerity/container.rb
|
11
|
+
lib/celerity/disabled_element.rb
|
12
|
+
lib/celerity/element.rb
|
13
|
+
lib/celerity/element_collections.rb
|
14
|
+
lib/celerity/element_locator.rb
|
15
|
+
lib/celerity/element_map.rb
|
16
|
+
lib/celerity/elements/button.rb
|
17
|
+
lib/celerity/elements/file_field.rb
|
18
|
+
lib/celerity/elements/form.rb
|
19
|
+
lib/celerity/elements/frame.rb
|
20
|
+
lib/celerity/elements/image.rb
|
21
|
+
lib/celerity/elements/label.rb
|
22
|
+
lib/celerity/elements/link.rb
|
23
|
+
lib/celerity/elements/option.rb
|
24
|
+
lib/celerity/elements/radio_check.rb
|
25
|
+
lib/celerity/elements/select_list.rb
|
26
|
+
lib/celerity/elements/table.rb
|
27
|
+
lib/celerity/elements/table_body.rb
|
28
|
+
lib/celerity/elements/table_cell.rb
|
29
|
+
lib/celerity/elements/table_footer.rb
|
30
|
+
lib/celerity/elements/table_header.rb
|
31
|
+
lib/celerity/elements/table_row.rb
|
32
|
+
lib/celerity/elements/text_field.rb
|
33
|
+
lib/celerity/exception.rb
|
34
|
+
lib/celerity/extra/method_generator.rb
|
35
|
+
lib/celerity/htmlunit/commons-codec-1.3.jar
|
36
|
+
lib/celerity/htmlunit/commons-collections-3.2.jar
|
37
|
+
lib/celerity/htmlunit/commons-httpclient-3.1.jar
|
38
|
+
lib/celerity/htmlunit/commons-io-1.4.jar
|
39
|
+
lib/celerity/htmlunit/commons-lang-2.4.jar
|
40
|
+
lib/celerity/htmlunit/commons-logging-1.1.1.jar
|
41
|
+
lib/celerity/htmlunit/cssparser-0.9.5.jar
|
42
|
+
lib/celerity/htmlunit/download.sh
|
43
|
+
lib/celerity/htmlunit/htmlunit-2.2.jar
|
44
|
+
lib/celerity/htmlunit/htmlunit-core-js-2.2.jar
|
45
|
+
lib/celerity/htmlunit/nekohtml-1.9.8.jar
|
46
|
+
lib/celerity/htmlunit/sac-1.3.jar
|
47
|
+
lib/celerity/htmlunit/xalan-2.7.0.jar
|
48
|
+
lib/celerity/htmlunit/xercesImpl-2.8.1.jar
|
49
|
+
lib/celerity/htmlunit/xml-apis-1.0.b2.jar
|
50
|
+
lib/celerity/identifier.rb
|
51
|
+
lib/celerity/input_element.rb
|
52
|
+
lib/celerity/non_control_elements.rb
|
53
|
+
lib/celerity/version.rb
|
54
|
+
lib/celerity/watir_compatibility.rb
|
55
|
+
spec/area_spec.rb
|
7
56
|
spec/areas_spec.rb
|
8
|
-
spec/
|
57
|
+
spec/browser_spec.rb
|
58
|
+
spec/button_spec.rb
|
59
|
+
spec/buttons_spec.rb
|
60
|
+
spec/checkbox_spec.rb
|
61
|
+
spec/checkboxes_spec.rb
|
62
|
+
spec/div_spec.rb
|
63
|
+
spec/divs_spec.rb
|
64
|
+
spec/element_spec.rb
|
65
|
+
spec/filefield_spec.rb
|
66
|
+
spec/filefields_spec.rb
|
67
|
+
spec/form_spec.rb
|
9
68
|
spec/forms_spec.rb
|
10
|
-
spec/
|
11
|
-
spec/
|
12
|
-
spec/
|
69
|
+
spec/frame_spec.rb
|
70
|
+
spec/frames_spec.rb
|
71
|
+
spec/hidden_spec.rb
|
72
|
+
spec/hiddens_spec.rb
|
73
|
+
spec/hn_spec.rb
|
74
|
+
spec/hns_spec.rb
|
75
|
+
spec/html/2000_spans.html
|
76
|
+
spec/html/bug_duplicate_attributes.html
|
13
77
|
spec/html/bug_javascript_001.html
|
14
|
-
spec/html/
|
15
|
-
spec/html/
|
78
|
+
spec/html/form_js_bug.html
|
79
|
+
spec/html/forms_with_input_elements.html
|
80
|
+
spec/html/frame_1.html
|
81
|
+
spec/html/frame_2.html
|
82
|
+
spec/html/frames.html
|
83
|
+
spec/html/iframes.html
|
84
|
+
spec/html/images.html
|
16
85
|
spec/html/images/1.gif
|
17
|
-
spec/html/images/
|
18
|
-
spec/html/images/minus.gif
|
19
|
-
spec/html/images/button.jpg
|
20
|
-
spec/html/images/map2.gif
|
86
|
+
spec/html/images/2.gif
|
21
87
|
spec/html/images/3.gif
|
88
|
+
spec/html/images/button.jpg
|
89
|
+
spec/html/images/circle.jpg
|
22
90
|
spec/html/images/map.gif
|
91
|
+
spec/html/images/map2.gif
|
92
|
+
spec/html/images/minus.gif
|
93
|
+
spec/html/images/originaltriangle.jpg
|
23
94
|
spec/html/images/plus.gif
|
95
|
+
spec/html/images/square.jpg
|
24
96
|
spec/html/images/triangle.jpg
|
25
|
-
spec/html/
|
26
|
-
spec/html/frame_2.html
|
27
|
-
spec/html/iframes.html
|
28
|
-
spec/html/tables.html
|
29
|
-
spec/html/frames.html
|
30
|
-
spec/html/2000_spans.html
|
31
|
-
spec/html/images.html
|
97
|
+
spec/html/invalid_js.html
|
32
98
|
spec/html/latin1_text.html
|
33
99
|
spec/html/non_control_elements.html
|
34
|
-
spec/html/
|
35
|
-
spec/html/
|
100
|
+
spec/html/simple_ajax.html
|
101
|
+
spec/html/tables.html
|
36
102
|
spec/html/utf8_text.html
|
37
|
-
spec/html/forms_with_input_elements.html
|
38
|
-
spec/images_spec.rb
|
39
|
-
spec/spec_helper.rb
|
40
|
-
spec/ps_spec.rb
|
41
|
-
spec/hn_spec.rb
|
42
|
-
spec/filefield_spec.rb
|
43
|
-
spec/area_spec.rb
|
44
103
|
spec/htmlunit_spec.rb
|
45
|
-
spec/
|
46
|
-
spec/
|
47
|
-
spec/div_spec.rb
|
48
|
-
spec/spans_spec.rb
|
49
|
-
spec/form_spec.rb
|
104
|
+
spec/image_spec.rb
|
105
|
+
spec/images_spec.rb
|
50
106
|
spec/label_spec.rb
|
51
|
-
spec/
|
52
|
-
spec/
|
53
|
-
spec/
|
54
|
-
spec/text_field_spec.rb
|
55
|
-
spec/button_spec.rb
|
56
|
-
spec/spec.opts
|
57
|
-
spec/radio_spec.rb
|
107
|
+
spec/labels_spec.rb
|
108
|
+
spec/li_spec.rb
|
109
|
+
spec/link_spec.rb
|
58
110
|
spec/links_spec.rb
|
59
|
-
spec/
|
60
|
-
spec/
|
61
|
-
spec/ie_spec.rb
|
62
|
-
spec/checkboxes_spec.rb
|
63
|
-
spec/ul_spec.rb
|
64
|
-
spec/table_row_spec.rb
|
65
|
-
spec/pre_spec.rb
|
66
|
-
spec/watir_compatability_spec.rb
|
67
|
-
spec/table_header_spec.rb
|
111
|
+
spec/lis_spec.rb
|
112
|
+
spec/map_spec.rb
|
68
113
|
spec/maps_spec.rb
|
114
|
+
spec/meta_spec.rb
|
115
|
+
spec/ol_spec.rb
|
116
|
+
spec/ols_spec.rb
|
69
117
|
spec/option_spec.rb
|
70
|
-
spec/
|
71
|
-
spec/
|
72
|
-
spec/radios_spec.rb
|
73
|
-
spec/frame_spec.rb
|
118
|
+
spec/p_spec.rb
|
119
|
+
spec/pre_spec.rb
|
74
120
|
spec/pres_spec.rb
|
75
|
-
spec/
|
76
|
-
spec/
|
77
|
-
spec/
|
78
|
-
spec/hidden_spec.rb
|
79
|
-
spec/table_footers_spec.rb
|
80
|
-
spec/ol_spec.rb
|
121
|
+
spec/ps_spec.rb
|
122
|
+
spec/radio_spec.rb
|
123
|
+
spec/radios_spec.rb
|
81
124
|
spec/select_list_spec.rb
|
82
|
-
spec/
|
83
|
-
spec/
|
84
|
-
spec/
|
85
|
-
spec/
|
125
|
+
spec/select_lists_spec.rb
|
126
|
+
spec/span_spec.rb
|
127
|
+
spec/spans_spec.rb
|
128
|
+
spec/spec.opts
|
129
|
+
spec/spec_helper.rb
|
130
|
+
spec/table_bodies_spec.rb
|
131
|
+
spec/table_body_spec.rb
|
132
|
+
spec/table_cell_spec.rb
|
86
133
|
spec/table_cells_spec.rb
|
87
|
-
spec/
|
88
|
-
spec/
|
89
|
-
spec/
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
lib/celerity/extra/method_generator.rb
|
101
|
-
lib/celerity/non_control_elements.rb
|
102
|
-
lib/celerity/exception.rb
|
103
|
-
lib/celerity/clickable_element.rb
|
104
|
-
lib/celerity/disabled_element.rb
|
105
|
-
lib/celerity/ie.rb
|
106
|
-
lib/celerity/element_collections.rb
|
107
|
-
lib/celerity/elements/option.rb
|
108
|
-
lib/celerity/elements/frame.rb
|
109
|
-
lib/celerity/elements/select_list.rb
|
110
|
-
lib/celerity/elements/link.rb
|
111
|
-
lib/celerity/elements/table_header.rb
|
112
|
-
lib/celerity/elements/image.rb
|
113
|
-
lib/celerity/elements/label.rb
|
114
|
-
lib/celerity/elements/table_cell.rb
|
115
|
-
lib/celerity/elements/table_footer.rb
|
116
|
-
lib/celerity/elements/table.rb
|
117
|
-
lib/celerity/elements/button.rb
|
118
|
-
lib/celerity/elements/table_row.rb
|
119
|
-
lib/celerity/elements/form.rb
|
120
|
-
lib/celerity/elements/table_body.rb
|
121
|
-
lib/celerity/elements/radio_check.rb
|
122
|
-
lib/celerity/elements/file_field.rb
|
123
|
-
lib/celerity/elements/text_field.rb
|
124
|
-
lib/celerity/htmlunit/xml-apis-1.0.b2.jar
|
125
|
-
lib/celerity/htmlunit/sac-1.3.jar
|
126
|
-
lib/celerity/htmlunit/cssparser-0.9.5.jar
|
127
|
-
lib/celerity/htmlunit/nekohtml-1.9.7.jar
|
128
|
-
lib/celerity/htmlunit/commons-logging-1.1.1.jar
|
129
|
-
lib/celerity/htmlunit/commons-codec-1.3.jar
|
130
|
-
lib/celerity/htmlunit/js-1.7R1.jar
|
131
|
-
lib/celerity/htmlunit/commons-collections-3.2.jar
|
132
|
-
lib/celerity/htmlunit/xercesImpl-2.8.1.jar
|
133
|
-
lib/celerity/htmlunit/xalan-2.7.0.jar
|
134
|
-
lib/celerity/htmlunit/commons-httpclient-3.1.jar
|
135
|
-
lib/celerity/htmlunit/htmlunit-2.2-SNAPSHOT.jar
|
136
|
-
lib/celerity/htmlunit/commons-io-1.4.jar
|
137
|
-
lib/celerity/htmlunit/commons-lang-2.4.jar
|
138
|
-
lib/celerity/element.rb
|
139
|
-
lib/celerity.rb
|
134
|
+
spec/table_footer_spec.rb
|
135
|
+
spec/table_footers_spec.rb
|
136
|
+
spec/table_header_spec.rb
|
137
|
+
spec/table_headers_spec.rb
|
138
|
+
spec/table_row_spec.rb
|
139
|
+
spec/table_rows_spec.rb
|
140
|
+
spec/table_spec.rb
|
141
|
+
spec/tables_spec.rb
|
142
|
+
spec/text_field_spec.rb
|
143
|
+
spec/text_fields_spec.rb
|
144
|
+
spec/ul_spec.rb
|
145
|
+
spec/uls_spec.rb
|
146
|
+
spec/watir_compatibility_spec.rb
|
140
147
|
support/spec_server.rb
|
141
|
-
support/celerity_viewer/rubycocoa/CelerityViewer.icns
|
142
|
-
support/celerity_viewer/rubycocoa/distributed_viewer.rb
|
143
|
-
support/celerity_viewer/rubycocoa/README
|
144
|
-
support/celerity_viewer/rubycocoa/English.lproj
|
145
|
-
support/celerity_viewer/rubycocoa/English.lproj/Main.nib
|
146
|
-
support/celerity_viewer/rubycocoa/English.lproj/Main.nib/info.nib
|
147
|
-
support/celerity_viewer/rubycocoa/English.lproj/Main.nib/classes.nib
|
148
|
-
support/celerity_viewer/rubycocoa/English.lproj/Main.nib/keyedobjects.nib
|
149
|
-
support/celerity_viewer/rubycocoa/MainController.rb
|
150
|
-
support/celerity_viewer/rubycocoa/main.m
|
151
|
-
support/celerity_viewer/rubycocoa/Rakefile
|
152
|
-
support/celerity_viewer/rubycocoa/Info.plist.erb
|
153
|
-
support/celerity_viewer/rubycocoa/CelerityViewer.app
|
154
|
-
support/celerity_viewer/rubycocoa/CelerityViewer.app/Contents
|
155
|
-
support/celerity_viewer/rubycocoa/CelerityViewer.app/Contents/MacOS
|
156
|
-
support/celerity_viewer/rubycocoa/CelerityViewer.app/Contents/Resources
|
157
|
-
support/celerity_viewer/rubycocoa/CelerityViewer.app/Contents/Resources/English.lproj
|
158
|
-
support/celerity_viewer/rubycocoa/CelerityViewer.app/Contents/Resources/English.lproj/Main.nib
|
159
|
-
support/celerity_viewer/rubycocoa/main.rb
|
160
|
-
Manifest.txt
|
161
|
-
setup.rb
|
162
|
-
License.txt
|
163
|
-
tasks/simple_ci.rake
|
164
148
|
tasks/rdoc.rake
|
165
|
-
tasks/specserver.rake
|
166
|
-
tasks/benchmark.rake
|
167
|
-
tasks/environment.rake
|
168
149
|
tasks/rspec.rake
|
169
|
-
|
170
|
-
benchmark/loader.rb
|
171
|
-
benchmark/bm_2000_spans.rb
|
172
|
-
benchmark/bm_digg.rb
|
173
|
-
benchmark/bm_google_images.rb
|
174
|
-
Rakefile
|
150
|
+
tasks/specserver.rake
|
data/README.txt
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
* http://celerity.rubyforge.org/
|
4
4
|
|
5
|
+
== TUTORIAL:
|
6
|
+
|
7
|
+
* http://celerity.rubyforge.org/wiki/wiki.pl?GettingStarted
|
8
|
+
|
5
9
|
== DESCRIPTION:
|
6
10
|
|
7
11
|
Celerity is a JRuby library for easy and fast functional test automation for web applications.
|
@@ -14,41 +18,32 @@ It is a wrapper around the HtmlUnit Java library and is currently aimed at provi
|
|
14
18
|
* Easy to use: Simple API
|
15
19
|
* Portable: Cross-platform
|
16
20
|
* Unintrusive: No browser window interrupting your workflow (runs in background)
|
17
|
-
|
18
|
-
== SYNOPSIS:
|
19
|
-
|
20
|
-
require 'rubygems'
|
21
|
-
require 'celerity'
|
22
|
-
|
23
|
-
browser = Celerity::IE.new
|
24
|
-
browser.goto("google.com")
|
25
|
-
browser.text_field(:name, 'q').set("celerity")
|
26
|
-
browser.button(:name, 'btnG').submit
|
27
21
|
|
28
22
|
== REQUIREMENTS:
|
29
23
|
|
30
|
-
* JRuby 1.1
|
31
|
-
|
24
|
+
* JRuby 1.1 or higher
|
32
25
|
* Java 6
|
33
26
|
|
34
27
|
== INSTALL:
|
35
28
|
|
36
|
-
|
29
|
+
jruby -S gem install celerity
|
37
30
|
|
38
31
|
== EXAMPLE:
|
39
|
-
require "celerity"
|
40
32
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
browser
|
33
|
+
require "rubygems"
|
34
|
+
require "celerity"
|
35
|
+
|
36
|
+
browser = Celerity::Browser.new
|
37
|
+
browser.goto('http://www.google.com')
|
38
|
+
browser.text_field(:name, 'q').value = 'Celerity'
|
39
|
+
browser.button(:name, 'btnG').click
|
45
40
|
|
46
|
-
puts "yay" if browser.text.include? 'celerity.rubyforge.org'
|
41
|
+
puts "yay" if browser.text.include? 'celerity.rubyforge.org'
|
47
42
|
|
48
43
|
== LICENSE:
|
49
44
|
|
50
45
|
Celerity - JRuby wrapper for HtmlUnit
|
51
|
-
Copyright (c) 2008
|
46
|
+
Copyright (c) 2008 FINN.no AS
|
52
47
|
|
53
48
|
This program is free software: you can redistribute it and/or modify
|
54
49
|
it under the terms of the GNU General Public License as published by
|
data/lib/celerity.rb
CHANGED
@@ -6,12 +6,18 @@ end
|
|
6
6
|
|
7
7
|
if RUBY_PLATFORM =~ /java/
|
8
8
|
require 'java'
|
9
|
+
JavaString = java.lang.String
|
10
|
+
|
9
11
|
Celerity::Jars.each { |jar| require(jar) }
|
10
12
|
|
11
13
|
module HtmlUnit
|
12
14
|
include_package 'com.gargoylesoftware.htmlunit'
|
15
|
+
|
16
|
+
module Html
|
17
|
+
include_package 'com.gargoylesoftware.htmlunit.html'
|
18
|
+
end
|
13
19
|
end
|
14
|
-
|
20
|
+
|
15
21
|
else
|
16
22
|
raise "Celerity only works on JRuby at the moment."
|
17
23
|
end
|
@@ -35,7 +41,8 @@ require "celerity/element"
|
|
35
41
|
require "celerity/input_element"
|
36
42
|
require "celerity/non_control_elements"
|
37
43
|
Dir[File.dirname(__FILE__) + "/celerity/elements/*.rb"].each { |f| require(f) }
|
38
|
-
require "celerity/
|
44
|
+
require "celerity/element_map"
|
45
|
+
require "celerity/browser"
|
39
46
|
|
40
47
|
require "celerity/watir_compatibility"
|
41
48
|
|
@@ -47,6 +54,7 @@ require "time"
|
|
47
54
|
Log = Logger.new($DEBUG ? $stderr : nil)
|
48
55
|
Log.level = Logger::DEBUG
|
49
56
|
# undefine deprecated methods to use them for Element attributes
|
50
|
-
Object.
|
51
|
-
Object.send :undef_method, :
|
52
|
-
|
57
|
+
if ["id", "type"].any? { |meth| Object.instance_methods.include?(meth) }
|
58
|
+
Object.send :undef_method, :id
|
59
|
+
Object.send :undef_method, :type
|
60
|
+
end
|
@@ -0,0 +1,296 @@
|
|
1
|
+
module Celerity
|
2
|
+
class Browser
|
3
|
+
include Container
|
4
|
+
attr_accessor :page, :object
|
5
|
+
attr_reader :webclient, :viewer
|
6
|
+
|
7
|
+
# Initialize a browser and goto the given URL
|
8
|
+
# @param uri The URL to go to.
|
9
|
+
# @return Instance of Celerity::Browser.
|
10
|
+
def self.start(uri)
|
11
|
+
browser = new
|
12
|
+
browser.goto(uri)
|
13
|
+
browser
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.attach(*args)
|
17
|
+
raise NotImplementedError, "no popup handling yet"
|
18
|
+
end
|
19
|
+
|
20
|
+
# Creates a browser object.
|
21
|
+
#
|
22
|
+
# @param [Hash[Symbol, Object]] Options for initial configuration of the browser.
|
23
|
+
#
|
24
|
+
# @option :browser[:firefox, :internet_explorer] Set the BrowserVersion used by HtmlUnit.
|
25
|
+
# Defaults to Internet Explorer.
|
26
|
+
# @option :css[true, false, nil] Enable CSS.
|
27
|
+
# Disabled by default.
|
28
|
+
# @option :secure_ssl[true, false, nil] Disable secure SSL.
|
29
|
+
# Enabled by default.
|
30
|
+
# @option :resynchronize[true, false, nil] Use HtmlUnit::NicelyResynchronizingAjaxController to resynchronize Ajax calls.
|
31
|
+
# @option :javascript_exceptions[true, false, nil] Throw exceptions on script errors.
|
32
|
+
# Disabled by default.
|
33
|
+
# @option :status_code_exceptions[true, false, nil]Throw exceptions on failing status codes (404 etc.).
|
34
|
+
# Disabled by default.
|
35
|
+
#
|
36
|
+
# @return [Celerity::Browser] An instance of the browser.
|
37
|
+
# @api public
|
38
|
+
def initialize(opts = {})
|
39
|
+
raise TypeError, "bad argument: #{opts.inspect}" unless opts.is_a? Hash
|
40
|
+
|
41
|
+
@opts = opts
|
42
|
+
@last_url, @page = nil
|
43
|
+
@page_container = self
|
44
|
+
@error_checkers = []
|
45
|
+
|
46
|
+
self.log_level = :warning
|
47
|
+
|
48
|
+
browser = @opts[:browser] == :firefox ?
|
49
|
+
::HtmlUnit::BrowserVersion::FIREFOX_2 : ::HtmlUnit::BrowserVersion::INTERNET_EXPLORER_7_0
|
50
|
+
|
51
|
+
@webclient = ::HtmlUnit::WebClient.new(browser)
|
52
|
+
|
53
|
+
configure_webclient
|
54
|
+
find_viewer
|
55
|
+
end
|
56
|
+
|
57
|
+
# Goto the given URL
|
58
|
+
#
|
59
|
+
# @param [String] the url
|
60
|
+
# @return [String] the url
|
61
|
+
def goto(uri)
|
62
|
+
uri = "http://#{uri}" unless uri =~ %r{://}
|
63
|
+
self.page = @webclient.getPage(uri)
|
64
|
+
uri
|
65
|
+
end
|
66
|
+
|
67
|
+
# Unsets the current page (mostly for Watir compatibility)
|
68
|
+
def close
|
69
|
+
@page = nil
|
70
|
+
end
|
71
|
+
|
72
|
+
# @return [String] the URL of the current page
|
73
|
+
def url
|
74
|
+
assert_exists
|
75
|
+
@page.getWebResponse.getUrl.toString
|
76
|
+
end
|
77
|
+
|
78
|
+
# @return [String] the title of the current page
|
79
|
+
def title
|
80
|
+
@page ? @page.getTitleText : ''
|
81
|
+
end
|
82
|
+
|
83
|
+
# @return [String] the HTML content of the current page
|
84
|
+
def html
|
85
|
+
@page ? @page.getWebResponse.getContentAsString : ''
|
86
|
+
end
|
87
|
+
|
88
|
+
# @return [String] a text representation of the current page
|
89
|
+
def text
|
90
|
+
return '' unless @page
|
91
|
+
|
92
|
+
if @page.respond_to?("getContent")
|
93
|
+
@page.getContent
|
94
|
+
else
|
95
|
+
# # this has minimal whitespace
|
96
|
+
@page.documentElement.asText
|
97
|
+
|
98
|
+
# if @opts[:browser] == :firefox
|
99
|
+
# # # this is what firewatir does - only works with HtmlUnit::BrowserVersion::FIREFOX_2
|
100
|
+
# res = execute_script("document.body.textContent").getJavaScriptResult
|
101
|
+
# else
|
102
|
+
# # this only works with HtmlUnit::BrowserVersion::INTERNET_EXPLORER_*, and isn't identical to Watir's ole_object.innerText
|
103
|
+
# res = execute_script("document.body.innerText").getJavaScriptResult
|
104
|
+
# end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
# Check if the current page contains the given text.
|
109
|
+
#
|
110
|
+
# @param [String, Regexp] expected_text The text to look for.
|
111
|
+
# @return [Numeric, nil] The index of the matched text, or nil if it doesn't match.
|
112
|
+
def contains_text(expected_text)
|
113
|
+
return nil unless exist?
|
114
|
+
case expected_text
|
115
|
+
when Regexp
|
116
|
+
text() =~ expected_text
|
117
|
+
when String
|
118
|
+
text().index(expected_text)
|
119
|
+
else
|
120
|
+
raise ArgumentError, "Argument must be String or Regexp, but was #{expected_text.inspect}:#{expected_text.class}"
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
# @return [HtmlUnit::HtmlHtml] the underlying HtmlUnit object.
|
125
|
+
def document
|
126
|
+
@object
|
127
|
+
end
|
128
|
+
|
129
|
+
# Goto the last url - HtmlUnit doesn't have a 'back' functionality, so we only have 1 history item :)
|
130
|
+
# @return [String, nil] The url of the resulting page, or nil if none was stored.
|
131
|
+
def back
|
132
|
+
# TODO: this is naive, need capability from HtmlUnit
|
133
|
+
goto(@last_url) if @last_url
|
134
|
+
end
|
135
|
+
|
136
|
+
# Refresh the current page
|
137
|
+
def refresh
|
138
|
+
assert_exists
|
139
|
+
self.page = @page.refresh
|
140
|
+
end
|
141
|
+
|
142
|
+
# Execute the given JavaScript on the current page
|
143
|
+
# @return [HtmlUnit::ScriptResult]
|
144
|
+
def execute_script(source)
|
145
|
+
assert_exists
|
146
|
+
@page.executeJavaScript(source.to_s)
|
147
|
+
end
|
148
|
+
|
149
|
+
# Add a 'checker' proc that will be run on every page load
|
150
|
+
#
|
151
|
+
# @param [Proc] checker the proc to be run (can also be given as a block)
|
152
|
+
# @raise [ArgumentError] if no Proc or block was given.
|
153
|
+
def add_checker(checker = nil, &block)
|
154
|
+
if block_given?
|
155
|
+
@error_checkers << block
|
156
|
+
elsif Proc === checker
|
157
|
+
@error_checkers << checker
|
158
|
+
else
|
159
|
+
raise ArgumentError, "argument must be a Proc or block"
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
# Remove the given checker from the list of checkers
|
164
|
+
# @param [Proc] the Proc to disable
|
165
|
+
def disable_checker(checker)
|
166
|
+
@error_checkers.delete(checker)
|
167
|
+
end
|
168
|
+
|
169
|
+
# Set Java log level (default is :warning)
|
170
|
+
#
|
171
|
+
# @param [Symbol] level :finest, :finer, :fine, :config, :info, :warning, :severe, or :off, :all
|
172
|
+
def log_level=(level)
|
173
|
+
java.util.logging.Logger.getLogger('com.gargoylesoftware.htmlunit').level = java.util.logging.Level.const_get(level.to_s.upcase)
|
174
|
+
end
|
175
|
+
|
176
|
+
# @return [Symbol] the current log level
|
177
|
+
def log_level
|
178
|
+
java.util.logging.Logger.getLogger('com.gargoylesoftware.htmlunit').level.to_s.downcase.to_sym
|
179
|
+
end
|
180
|
+
|
181
|
+
# Checks if we have a page currently loaded.
|
182
|
+
# @return [true, false]
|
183
|
+
def exist?
|
184
|
+
!!@page
|
185
|
+
end
|
186
|
+
alias_method :exists?, :exist?
|
187
|
+
|
188
|
+
# Allows you to temporarily switch to HtmlUnit's NicelyResynchronizingAjaxController to resynchronize ajax calls.
|
189
|
+
#
|
190
|
+
# Example:
|
191
|
+
# @browser.resynchroniced do |b|
|
192
|
+
# b.link(:id, 'load_fancy_ajax_stuff').click
|
193
|
+
# end
|
194
|
+
#
|
195
|
+
# @param [block] &block the block to execute synchronized.
|
196
|
+
def resynchronized(&block)
|
197
|
+
old_controller = @webclient.ajaxController
|
198
|
+
@webclient.setAjaxController(::HtmlUnit::NicelyResynchronizingAjaxController.new)
|
199
|
+
yield self
|
200
|
+
@webclient.setAjaxController(old_controller)
|
201
|
+
end
|
202
|
+
|
203
|
+
#--
|
204
|
+
# TODO: could be private?
|
205
|
+
#++
|
206
|
+
#
|
207
|
+
# Check that we have a @page object.
|
208
|
+
#
|
209
|
+
# @raise UnknownObjectException
|
210
|
+
# @api internal
|
211
|
+
def assert_exists
|
212
|
+
raise UnknownObjectException, "no page loaded" unless exist?
|
213
|
+
end
|
214
|
+
|
215
|
+
#--
|
216
|
+
# TODO: could be private?
|
217
|
+
#++
|
218
|
+
# Runs the all the checker procs added by +add_checker+
|
219
|
+
#
|
220
|
+
# @see add_checker
|
221
|
+
# @api internal
|
222
|
+
def run_error_checks
|
223
|
+
@error_checkers.each { |e| e.call(self) }
|
224
|
+
end
|
225
|
+
|
226
|
+
# Set the current page object for the browser
|
227
|
+
#
|
228
|
+
# @param [HtmlUnit::HtmlPage] value The page to set.
|
229
|
+
# @api internal
|
230
|
+
def page=(value)
|
231
|
+
@last_url = url() if exist?
|
232
|
+
@page = value
|
233
|
+
|
234
|
+
if @page.respond_to?("getDocumentElement")
|
235
|
+
@object = @page.getDocumentElement
|
236
|
+
end
|
237
|
+
|
238
|
+
render if @viewer
|
239
|
+
run_error_checks
|
240
|
+
|
241
|
+
value
|
242
|
+
end
|
243
|
+
|
244
|
+
# Used for #show_links(), #show_divs() etc. (for watir compatibility)
|
245
|
+
def method_missing(meth, *args)
|
246
|
+
return super unless type = meth.to_s[/^show_(.*)$/, 1]
|
247
|
+
puts collection_string(type) rescue super
|
248
|
+
end
|
249
|
+
|
250
|
+
private
|
251
|
+
|
252
|
+
# Configure the webclient according to the options given to #new.
|
253
|
+
# @see initialize
|
254
|
+
def configure_webclient
|
255
|
+
@webclient.throwExceptionOnScriptError = false unless @opts[:javascript_exceptions]
|
256
|
+
@webclient.throwExceptionOnFailingStatusCode = false unless @opts[:status_code_exceptions]
|
257
|
+
@webclient.cssEnabled = false unless @opts[:css]
|
258
|
+
@webclient.useInsecureSSL = true if @opts[:secure_ssl]
|
259
|
+
@webclient.setAjaxController(::HtmlUnit::NicelyResynchronizingAjaxController.new) if @opts[:resynchronize]
|
260
|
+
end
|
261
|
+
|
262
|
+
# Create a string representation of all the elements returned by collection_method
|
263
|
+
# @param [Symbol] collection_method
|
264
|
+
# @return [String]
|
265
|
+
def collection_string(collection_method)
|
266
|
+
collection = self.send collection_method
|
267
|
+
result = "Found #{collection.size} #{collection_method.downcase}\n"
|
268
|
+
|
269
|
+
collection.each_with_index do |element, index|
|
270
|
+
result << "#{index+1}: #{element.attribute_string}\n"
|
271
|
+
end
|
272
|
+
|
273
|
+
result
|
274
|
+
end
|
275
|
+
|
276
|
+
# Render the current page on the viewer.
|
277
|
+
# @api internal
|
278
|
+
def render
|
279
|
+
@viewer.render_html(html, url)
|
280
|
+
rescue DRb::DRbConnError, Errno::ECONNREFUSED => e
|
281
|
+
@viewer = nil
|
282
|
+
end
|
283
|
+
|
284
|
+
# Check if we have a viewer available on druby://127.0.0.1:6429
|
285
|
+
# @api internal
|
286
|
+
def find_viewer
|
287
|
+
# FIXME: not ideal
|
288
|
+
require 'drb'
|
289
|
+
viewer = DRbObject.new_with_uri("druby://127.0.0.1:6429")
|
290
|
+
@viewer = viewer if viewer.respond_to?(:render_html)
|
291
|
+
rescue DRb::DRbConnError, Errno::ECONNREFUSED
|
292
|
+
@viewer = nil
|
293
|
+
end
|
294
|
+
|
295
|
+
end # Browser
|
296
|
+
end # Celerity
|