caius-celerity 0.0.6.10 → 0.0.6.11
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest.txt +335 -0
- 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/bm_text_input.rb +19 -0
- data/benchmark/loader.rb +14 -0
- data/celerity.gemspec +33 -0
- data/config/hoe.rb +78 -0
- data/config/requirements.rb +9 -0
- data/lib/celerity/version.rb +1 -1
- data/spec/area_spec.rb +97 -0
- data/spec/areas_spec.rb +40 -0
- data/spec/browser_authentication_spec.rb +20 -0
- data/spec/browser_spec.rb +537 -0
- data/spec/button_spec.rb +244 -0
- data/spec/buttons_spec.rb +51 -0
- data/spec/checkbox_spec.rb +302 -0
- data/spec/checkboxes_spec.rb +38 -0
- data/spec/clickable_element_spec.rb +43 -0
- data/spec/dd_spec.rb +143 -0
- data/spec/dds_spec.rb +39 -0
- data/spec/default_viewer_spec.rb +24 -0
- data/spec/div_spec.rb +235 -0
- data/spec/divs_spec.rb +39 -0
- data/spec/dl_spec.rb +143 -0
- data/spec/dls_spec.rb +39 -0
- data/spec/dt_spec.rb +143 -0
- data/spec/dts_spec.rb +39 -0
- data/spec/element_spec.rb +150 -0
- data/spec/em_spec.rb +116 -0
- data/spec/ems_spec.rb +39 -0
- data/spec/filefield_spec.rb +133 -0
- data/spec/filefields_spec.rb +40 -0
- data/spec/form_spec.rb +59 -0
- data/spec/forms_spec.rb +41 -0
- data/spec/frame_spec.rb +139 -0
- data/spec/frames_spec.rb +71 -0
- data/spec/hidden_spec.rb +127 -0
- data/spec/hiddens_spec.rb +39 -0
- data/spec/hn_spec.rb +104 -0
- data/spec/hns_spec.rb +45 -0
- data/spec/html/2000_spans.html +2009 -0
- data/spec/html/bug_duplicate_attributes.html +14 -0
- data/spec/html/bug_javascript_001.html +11 -0
- data/spec/html/definition_lists.html +48 -0
- data/spec/html/euc-jp_text.html +17 -0
- data/spec/html/forms_with_input_elements.html +124 -0
- data/spec/html/frame_1.html +18 -0
- data/spec/html/frame_2.html +16 -0
- data/spec/html/frames.html +11 -0
- data/spec/html/iframes.html +12 -0
- data/spec/html/images.html +27 -0
- data/spec/html/images/1.gif +0 -0
- data/spec/html/images/2.gif +0 -0
- data/spec/html/images/3.gif +0 -0
- data/spec/html/images/button.jpg +0 -0
- data/spec/html/images/circle.jpg +0 -0
- data/spec/html/images/map.gif +0 -0
- data/spec/html/images/map2.gif +0 -0
- data/spec/html/images/minus.gif +0 -0
- data/spec/html/images/originaltriangle.jpg +0 -0
- data/spec/html/images/plus.gif +0 -0
- data/spec/html/images/square.jpg +0 -0
- data/spec/html/images/triangle.jpg +0 -0
- data/spec/html/iso-2022-jp_text.html +17 -0
- data/spec/html/jquery.html +29 -0
- data/spec/html/latin1_text.html +17 -0
- data/spec/html/multiple_ids.html +14 -0
- data/spec/html/non_control_elements.html +115 -0
- data/spec/html/right_click.html +16 -0
- data/spec/html/shift_jis_text.html +17 -0
- data/spec/html/tables.html +119 -0
- data/spec/html/timeout.html +16 -0
- data/spec/html/tiny_mce.html +29 -0
- data/spec/html/utf8_text.html +15 -0
- data/spec/htmlunit_spec.rb +47 -0
- data/spec/image_spec.rb +221 -0
- data/spec/images_spec.rb +39 -0
- data/spec/index_offset_spec.rb +26 -0
- data/spec/label_spec.rb +88 -0
- data/spec/labels_spec.rb +40 -0
- data/spec/li_spec.rb +139 -0
- data/spec/link_spec.rb +200 -0
- data/spec/links_spec.rb +47 -0
- data/spec/lis_spec.rb +40 -0
- data/spec/listener_spec.rb +142 -0
- data/spec/map_spec.rb +102 -0
- data/spec/maps_spec.rb +40 -0
- data/spec/meta_spec.rb +29 -0
- data/spec/metas_spec.rb +38 -0
- data/spec/ol_spec.rb +87 -0
- data/spec/ols_spec.rb +40 -0
- data/spec/option_spec.rb +156 -0
- data/spec/p_spec.rb +171 -0
- data/spec/pre_spec.rb +135 -0
- data/spec/pres_spec.rb +40 -0
- data/spec/ps_spec.rb +40 -0
- data/spec/radio_spec.rb +314 -0
- data/spec/radios_spec.rb +42 -0
- data/spec/select_list_spec.rb +320 -0
- data/spec/select_lists_spec.rb +47 -0
- data/spec/span_spec.rb +184 -0
- data/spec/spans_spec.rb +64 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +66 -0
- data/spec/strong_spec.rb +101 -0
- data/spec/strongs_spec.rb +40 -0
- data/spec/table_bodies_spec.rb +57 -0
- data/spec/table_body_spec.rb +109 -0
- data/spec/table_cell_spec.rb +84 -0
- data/spec/table_cells_spec.rb +59 -0
- data/spec/table_footer_spec.rb +96 -0
- data/spec/table_footers_spec.rb +55 -0
- data/spec/table_header_spec.rb +101 -0
- data/spec/table_headers_spec.rb +55 -0
- data/spec/table_row_spec.rb +106 -0
- data/spec/table_rows_spec.rb +58 -0
- data/spec/table_spec.rb +169 -0
- data/spec/tables_spec.rb +42 -0
- data/spec/text_field_spec.rb +331 -0
- data/spec/text_fields_spec.rb +44 -0
- data/spec/ul_spec.rb +88 -0
- data/spec/uls_spec.rb +40 -0
- data/spec/watir_compatibility_spec.rb +268 -0
- data/support/spec_server.rb +122 -0
- data/tasks/benchmark.rake +4 -0
- data/tasks/deployment.rake +43 -0
- data/tasks/environment.rake +7 -0
- data/tasks/fix.rake +25 -0
- data/tasks/rspec.rake +31 -0
- data/tasks/simple_ci.rake +94 -0
- data/tasks/snapshot.rake +22 -0
- data/tasks/specserver.rake +21 -0
- data/tasks/website.rake +17 -0
- data/tasks/yard.rake +9 -0
- data/website/benchmarks.html +237 -0
- data/website/css/color.css +153 -0
- data/website/css/hacks.css +3 -0
- data/website/css/layout.css +179 -0
- data/website/css/screen.css +5 -0
- data/website/css/textmate.css +226 -0
- data/website/css/typography.css +72 -0
- data/website/gfx/body_bg.gif +0 -0
- data/website/gfx/button_bg.jpg +0 -0
- data/website/gfx/header_bg.jpg +0 -0
- data/website/gfx/header_left.jpg +0 -0
- data/website/gfx/header_right.jpg +0 -0
- data/website/gfx/nav_bg.jpg +0 -0
- data/website/index.html +133 -0
- data/website/yard/Celerity.html +50 -0
- data/website/yard/Celerity/Area.html +212 -0
- data/website/yard/Celerity/Areas.html +103 -0
- data/website/yard/Celerity/Browser.html +5594 -0
- data/website/yard/Celerity/Button.html +312 -0
- data/website/yard/Celerity/Buttons.html +103 -0
- data/website/yard/Celerity/CheckBox.html +347 -0
- data/website/yard/Celerity/CheckBoxes.html +103 -0
- data/website/yard/Celerity/ClickableElement.html +448 -0
- data/website/yard/Celerity/Container.html +7676 -0
- data/website/yard/Celerity/Dd.html +198 -0
- data/website/yard/Celerity/Dds.html +103 -0
- data/website/yard/Celerity/DefaultViewer.html +101 -0
- data/website/yard/Celerity/DisabledElement.html +252 -0
- data/website/yard/Celerity/Div.html +198 -0
- data/website/yard/Celerity/Divs.html +103 -0
- data/website/yard/Celerity/Dl.html +198 -0
- data/website/yard/Celerity/Dls.html +103 -0
- data/website/yard/Celerity/Dt.html +198 -0
- data/website/yard/Celerity/Dts.html +103 -0
- data/website/yard/Celerity/Element.html +1703 -0
- data/website/yard/Celerity/ElementCollection.html +725 -0
- data/website/yard/Celerity/ElementLocator.html +589 -0
- data/website/yard/Celerity/Em.html +198 -0
- data/website/yard/Celerity/Ems.html +103 -0
- data/website/yard/Celerity/Exception.html +23 -0
- data/website/yard/Celerity/Exception/CelerityException.html +32 -0
- data/website/yard/Celerity/Exception/MissingWayOfFindingObjectException.html +32 -0
- data/website/yard/Celerity/Exception/NavigationException.html +33 -0
- data/website/yard/Celerity/Exception/NoValueFoundException.html +33 -0
- data/website/yard/Celerity/Exception/ObjectDisabledException.html +33 -0
- data/website/yard/Celerity/Exception/ObjectReadOnlyException.html +33 -0
- data/website/yard/Celerity/Exception/UnexpectedPageException.html +33 -0
- data/website/yard/Celerity/Exception/UnknownCellException.html +33 -0
- data/website/yard/Celerity/Exception/UnknownFormException.html +33 -0
- data/website/yard/Celerity/Exception/UnknownFrameException.html +33 -0
- data/website/yard/Celerity/Exception/UnknownObjectException.html +33 -0
- data/website/yard/Celerity/Exception/UnknownRowException.html +33 -0
- data/website/yard/Celerity/FileField.html +289 -0
- data/website/yard/Celerity/FileFields.html +103 -0
- data/website/yard/Celerity/Form.html +284 -0
- data/website/yard/Celerity/Forms.html +103 -0
- data/website/yard/Celerity/Frame.html +527 -0
- data/website/yard/Celerity/Frames.html +103 -0
- data/website/yard/Celerity/H1.html +198 -0
- data/website/yard/Celerity/H1s.html +103 -0
- data/website/yard/Celerity/H2.html +198 -0
- data/website/yard/Celerity/H2s.html +103 -0
- data/website/yard/Celerity/H3.html +198 -0
- data/website/yard/Celerity/H3s.html +103 -0
- data/website/yard/Celerity/H4.html +198 -0
- data/website/yard/Celerity/H4s.html +103 -0
- data/website/yard/Celerity/H5.html +198 -0
- data/website/yard/Celerity/H5s.html +103 -0
- data/website/yard/Celerity/H6.html +198 -0
- data/website/yard/Celerity/H6s.html +103 -0
- data/website/yard/Celerity/Hidden.html +285 -0
- data/website/yard/Celerity/Hiddens.html +103 -0
- data/website/yard/Celerity/Image.html +645 -0
- data/website/yard/Celerity/Images.html +103 -0
- data/website/yard/Celerity/InputElement.html +271 -0
- data/website/yard/Celerity/Label.html +210 -0
- data/website/yard/Celerity/Labels.html +103 -0
- data/website/yard/Celerity/Li.html +198 -0
- data/website/yard/Celerity/Link.html +295 -0
- data/website/yard/Celerity/Links.html +103 -0
- data/website/yard/Celerity/Lis.html +103 -0
- data/website/yard/Celerity/Listener.html +821 -0
- data/website/yard/Celerity/Map.html +198 -0
- data/website/yard/Celerity/Maps.html +103 -0
- data/website/yard/Celerity/Meta.html +196 -0
- data/website/yard/Celerity/Metas.html +103 -0
- data/website/yard/Celerity/MethodGenerator.html +195 -0
- data/website/yard/Celerity/NonControlElement.html +212 -0
- data/website/yard/Celerity/Ol.html +198 -0
- data/website/yard/Celerity/Ols.html +103 -0
- data/website/yard/Celerity/Option.html +348 -0
- data/website/yard/Celerity/Options.html +103 -0
- data/website/yard/Celerity/P.html +198 -0
- data/website/yard/Celerity/Pre.html +198 -0
- data/website/yard/Celerity/Pres.html +103 -0
- data/website/yard/Celerity/Ps.html +103 -0
- data/website/yard/Celerity/Radio.html +339 -0
- data/website/yard/Celerity/RadioCheckCommon.html +453 -0
- data/website/yard/Celerity/Radios.html +103 -0
- data/website/yard/Celerity/SelectList.html +1122 -0
- data/website/yard/Celerity/SelectLists.html +103 -0
- data/website/yard/Celerity/ShortInspect.html +108 -0
- data/website/yard/Celerity/Span.html +198 -0
- data/website/yard/Celerity/Spans.html +103 -0
- data/website/yard/Celerity/Strong.html +198 -0
- data/website/yard/Celerity/Strongs.html +103 -0
- data/website/yard/Celerity/Table.html +1287 -0
- data/website/yard/Celerity/TableBodies.html +103 -0
- data/website/yard/Celerity/TableBody.html +203 -0
- data/website/yard/Celerity/TableCell.html +279 -0
- data/website/yard/Celerity/TableCells.html +103 -0
- data/website/yard/Celerity/TableElement.html +437 -0
- data/website/yard/Celerity/TableFooter.html +203 -0
- data/website/yard/Celerity/TableFooters.html +103 -0
- data/website/yard/Celerity/TableHeader.html +203 -0
- data/website/yard/Celerity/TableHeaders.html +103 -0
- data/website/yard/Celerity/TableRow.html +478 -0
- data/website/yard/Celerity/TableRows.html +103 -0
- data/website/yard/Celerity/Tables.html +103 -0
- data/website/yard/Celerity/TextField.html +938 -0
- data/website/yard/Celerity/TextFields.html +103 -0
- data/website/yard/Celerity/Th.html +208 -0
- data/website/yard/Celerity/Ul.html +209 -0
- data/website/yard/Celerity/Uls.html +103 -0
- data/website/yard/Celerity/Util.html +264 -0
- data/website/yard/Celerity/VERSION.html +44 -0
- data/website/yard/HtmlUnit.html +23 -0
- data/website/yard/HtmlUnit/Html.html +23 -0
- data/website/yard/HtmlUnit/Util.html +23 -0
- data/website/yard/Java/ComGargoylesoftwareHtmlunitHtml/HtmlPage.html +90 -0
- data/website/yard/Java/JavaLang/Iterable.html +103 -0
- data/website/yard/Java/OrgW3cDom/NamedNodeMap.html +97 -0
- data/website/yard/README.txt.html +116 -0
- data/website/yard/String.html +103 -0
- data/website/yard/all-files.html +22 -0
- data/website/yard/all-methods.html +3276 -0
- data/website/yard/all-namespaces.html +258 -0
- data/website/yard/app.js +18 -0
- data/website/yard/index.html +19 -0
- data/website/yard/jquery.js +11 -0
- data/website/yard/style.css +68 -0
- data/website/yard/syntax_highlight.css +21 -0
- metadata +285 -13
data/spec/uls_spec.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper.rb'
|
2
|
+
|
3
|
+
describe "Uls" do
|
4
|
+
|
5
|
+
before :all do
|
6
|
+
@browser = Browser.new(BROWSER_OPTIONS)
|
7
|
+
end
|
8
|
+
|
9
|
+
before :each do
|
10
|
+
@browser.goto(HTML_DIR + "/non_control_elements.html")
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "#length" do
|
14
|
+
it "returns the number of uls" do
|
15
|
+
@browser.uls.length.should == 2
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "#[]" do
|
20
|
+
it "returns the ul at the given index" do
|
21
|
+
@browser.uls[1].id.should == "navbar"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe "#each" do
|
26
|
+
it "iterates through uls correctly" do
|
27
|
+
@browser.uls.each_with_index do |ul, index|
|
28
|
+
ul.name.should == @browser.ul(:index, index+1).name
|
29
|
+
ul.id.should == @browser.ul(:index, index+1).id
|
30
|
+
ul.value.should == @browser.ul(:index, index+1).value
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
after :all do
|
36
|
+
@browser.close
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
@@ -0,0 +1,268 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper.rb'
|
2
|
+
|
3
|
+
describe "IE" do
|
4
|
+
|
5
|
+
before :each do
|
6
|
+
@browser = Browser.new(BROWSER_OPTIONS)
|
7
|
+
end
|
8
|
+
|
9
|
+
# Class methods
|
10
|
+
it "responds to .speed" do
|
11
|
+
Browser.should respond_to("speed")
|
12
|
+
end
|
13
|
+
|
14
|
+
it "responds to .speed=" do
|
15
|
+
Browser.should respond_to("speed=")
|
16
|
+
end
|
17
|
+
|
18
|
+
it "responds to .set_fast_speed" do
|
19
|
+
Browser.should respond_to("set_fast_speed")
|
20
|
+
end
|
21
|
+
|
22
|
+
it "responds to .set_slow_speed" do
|
23
|
+
Browser.should respond_to("set_slow_speed")
|
24
|
+
end
|
25
|
+
|
26
|
+
it "responds to .attach_timeout" do
|
27
|
+
Browser.should respond_to("attach_timeout")
|
28
|
+
end
|
29
|
+
|
30
|
+
it "responds to .attach_timeout=" do
|
31
|
+
Browser.should respond_to("attach_timeout=")
|
32
|
+
end
|
33
|
+
|
34
|
+
it "responds to .reset_attach_timeout" do
|
35
|
+
Browser.should respond_to("reset_attach_timeout")
|
36
|
+
end
|
37
|
+
|
38
|
+
it "responds to .visible" do
|
39
|
+
Browser.should respond_to("visible")
|
40
|
+
end
|
41
|
+
|
42
|
+
it "responds to .each" do
|
43
|
+
Browser.should respond_to("each")
|
44
|
+
end
|
45
|
+
|
46
|
+
it "responds to .quit" do
|
47
|
+
Browser.should respond_to("quit")
|
48
|
+
end
|
49
|
+
|
50
|
+
it "responds to .start" do
|
51
|
+
Browser.should respond_to("start")
|
52
|
+
end
|
53
|
+
|
54
|
+
# Instance methods
|
55
|
+
it "responds to #visible" do
|
56
|
+
@browser.should respond_to("visible")
|
57
|
+
end
|
58
|
+
|
59
|
+
it "responds to #visible=" do
|
60
|
+
@browser.should respond_to("visible=")
|
61
|
+
end
|
62
|
+
|
63
|
+
it "responds to #wait" do
|
64
|
+
@browser.should respond_to("wait")
|
65
|
+
end
|
66
|
+
|
67
|
+
describe "#bring_to_front" do
|
68
|
+
it "returns true" do
|
69
|
+
@browser.bring_to_front.should be_true
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
describe "#checkBox" do
|
74
|
+
it "behaves like #checkbox" do
|
75
|
+
@browser.goto(HTML_DIR + "/forms_with_input_elements.html")
|
76
|
+
@browser.checkbox(:id, "new_user_interests_books").should exist
|
77
|
+
@browser.checkbox(:id, "new_user_interests_cars").should_not be_set
|
78
|
+
@browser.checkbox(:id, "new_user_interests_cars").set
|
79
|
+
@browser.checkbox(:id, "new_user_interests_cars").should be_set
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
84
|
+
|
85
|
+
describe "Button" do
|
86
|
+
|
87
|
+
before :all do
|
88
|
+
@browser = Browser.new(BROWSER_OPTIONS)
|
89
|
+
end
|
90
|
+
|
91
|
+
before :each do
|
92
|
+
@browser.goto(TEST_HOST + "/forms_with_input_elements.html")
|
93
|
+
end
|
94
|
+
|
95
|
+
describe "#click_no_wait" do
|
96
|
+
it "behaves like #click" do
|
97
|
+
@browser.button(:id, 'new_user_submit').click_no_wait
|
98
|
+
@browser.text.should include("You posted the following content:")
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
end
|
103
|
+
|
104
|
+
describe "Link" do
|
105
|
+
|
106
|
+
before :all do
|
107
|
+
@browser = Browser.new(BROWSER_OPTIONS)
|
108
|
+
end
|
109
|
+
|
110
|
+
before :each do
|
111
|
+
@browser.goto(TEST_HOST + "/non_control_elements.html")
|
112
|
+
end
|
113
|
+
|
114
|
+
describe "#click_no_wait" do
|
115
|
+
it "behaves like #click" do
|
116
|
+
@browser.link(:text, "Link 3").click_no_wait
|
117
|
+
@browser.text.include?("User administration").should be_true
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
end
|
122
|
+
|
123
|
+
describe "Image" do
|
124
|
+
|
125
|
+
before :all do
|
126
|
+
@browser = Browser.new(BROWSER_OPTIONS)
|
127
|
+
end
|
128
|
+
|
129
|
+
before :each do
|
130
|
+
@browser.goto(HTML_DIR + "/images.html")
|
131
|
+
end
|
132
|
+
|
133
|
+
describe "#hasLoaded?" do
|
134
|
+
it "behaves like #loaded?" do
|
135
|
+
@browser.image(:name, 'circle').hasLoaded?.should be_true
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
describe "#has_loaded?" do
|
140
|
+
it "behaves like #loaded" do
|
141
|
+
@browser.image(:name, 'circle').has_loaded?.should be_true
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
describe "#fileSize" do
|
146
|
+
it "behaves like #file_size" do
|
147
|
+
@browser.image(:id, 'square').fileSize.should == 788
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
describe "#fileCreatedDate" do
|
152
|
+
it "behaves like #file_created_date" do
|
153
|
+
@browser.goto(TEST_HOST + "/images.html")
|
154
|
+
image = @browser.image(:index, 2)
|
155
|
+
path = File.dirname(__FILE__) + "/html/#{image.src}"
|
156
|
+
image.file_created_date.to_i.should == File.mtime(path).to_i
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
end
|
161
|
+
|
162
|
+
describe "RadioCheckCommon" do
|
163
|
+
before :all do
|
164
|
+
@browser = Browser.new(BROWSER_OPTIONS)
|
165
|
+
end
|
166
|
+
|
167
|
+
before :each do
|
168
|
+
@browser.goto(HTML_DIR + "/forms_with_input_elements.html")
|
169
|
+
end
|
170
|
+
|
171
|
+
describe "#is_set?" do
|
172
|
+
it "behaves like #set?" do
|
173
|
+
@browser.radio(:id, "new_user_newsletter_yes").is_set?.should be_true
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
describe "#isSet?" do
|
178
|
+
it "behaves like #set?" do
|
179
|
+
@browser.radio(:id, "new_user_newsletter_yes").isSet?.should be_true
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
describe "#get_state" do
|
184
|
+
it "behaves like #set?" do
|
185
|
+
@browser.checkbox(:id, "new_user_interests_books").get_state.should be_true
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
describe "#getState" do
|
190
|
+
it "behaves like #set?" do
|
191
|
+
@browser.checkbox(:id, "new_user_interests_books").getState.should be_true
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
end
|
196
|
+
|
197
|
+
describe "SelectList" do
|
198
|
+
|
199
|
+
before :all do
|
200
|
+
@browser = Browser.new(BROWSER_OPTIONS)
|
201
|
+
end
|
202
|
+
|
203
|
+
before :each do
|
204
|
+
@browser.goto(HTML_DIR + "/forms_with_input_elements.html")
|
205
|
+
end
|
206
|
+
|
207
|
+
describe "#getSelectedItems" do
|
208
|
+
it "behaves like #selected_options" do
|
209
|
+
@browser.select_list(:name, "new_user_country").getSelectedItems.should == ["Norway"]
|
210
|
+
@browser.select_list(:name, "new_user_languages").getSelectedItems.should == ["English", "Norwegian"]
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
214
|
+
describe "#getAllContents" do
|
215
|
+
it "behaves like #options" do
|
216
|
+
expected = ["Denmark" ,"Norway" , "Sweden" , "United Kingdom", "USA", "Germany"]
|
217
|
+
@browser.select_list(:name, "new_user_country").getAllContents.should == expected
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
describe "#clearSelection" do
|
222
|
+
it "behaves like #clear_selection" do
|
223
|
+
@browser.select_list(:name, "new_user_languages").clearSelection
|
224
|
+
@browser.select_list(:name, "new_user_languages").getSelectedItems.should be_empty
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
describe "#select_value" do
|
229
|
+
it "behaves like #select" do
|
230
|
+
@browser.select_list(:name, "new_user_country").select_value("Denmark")
|
231
|
+
@browser.select_list(:name, "new_user_country").getSelectedItems.should == ["Denmark"]
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
end
|
236
|
+
|
237
|
+
describe "TextField" do
|
238
|
+
|
239
|
+
before :all do
|
240
|
+
@browser = Browser.new(BROWSER_OPTIONS)
|
241
|
+
end
|
242
|
+
|
243
|
+
before :each do
|
244
|
+
@browser.goto(HTML_DIR + "/forms_with_input_elements.html")
|
245
|
+
end
|
246
|
+
|
247
|
+
describe "#dragContentsTo" do
|
248
|
+
it "behaves like #drag_contents_to" do
|
249
|
+
@browser.text_field(:name, "new_user_first_name").set("Smith")
|
250
|
+
@browser.text_field(:name, "new_user_first_name").dragContentsTo(:name, "new_user_last_name")
|
251
|
+
@browser.text_field(:name, "new_user_first_name").value.should be_empty
|
252
|
+
@browser.text_field(:id, "new_user_last_name").value.should == "Smith"
|
253
|
+
end
|
254
|
+
end
|
255
|
+
|
256
|
+
describe "#getContents" do
|
257
|
+
it "behaves like #get_contents" do
|
258
|
+
@browser.text_field(:name, "new_user_occupation").getContents.should == "Developer"
|
259
|
+
end
|
260
|
+
end
|
261
|
+
|
262
|
+
describe "#requires_typing" do
|
263
|
+
it "responds to the method" do
|
264
|
+
@browser.text_field(:name, "new_user_occupation").should respond_to(:requires_typing)
|
265
|
+
end
|
266
|
+
end
|
267
|
+
|
268
|
+
end
|
@@ -0,0 +1,122 @@
|
|
1
|
+
require 'webrick'
|
2
|
+
require 'webrick/httpproxy'
|
3
|
+
require 'webrick/https'
|
4
|
+
|
5
|
+
module Celerity
|
6
|
+
|
7
|
+
class PostHandler < WEBrick::HTTPServlet::AbstractServlet
|
8
|
+
def do_POST(req, resp)
|
9
|
+
resp['content-type'] = 'text/html'
|
10
|
+
resp.body << "You posted the following content:\n"
|
11
|
+
resp.body << req.body
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
class PlainTextHandler < WEBrick::HTTPServlet::AbstractServlet
|
16
|
+
def do_GET(req, resp)
|
17
|
+
resp['content-type'] = 'text/plain'
|
18
|
+
resp.body << "This is text/plain"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
class OctetStreamHandler < WEBrick::HTTPServlet::AbstractServlet
|
23
|
+
def do_GET(req, resp)
|
24
|
+
resp['content-type'] = 'application/octet-stream'
|
25
|
+
resp.body << "This is application/octet-stream"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
class SlowAjaxHandler < WEBrick::HTTPServlet::AbstractServlet
|
31
|
+
def do_GET(req, resp)
|
32
|
+
sleep 10
|
33
|
+
resp['content-type'] = 'text/html'
|
34
|
+
resp.body << "A slooow ajax response"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
class CookieHandler < WEBrick::HTTPServlet::AbstractServlet
|
39
|
+
def do_GET(req, resp)
|
40
|
+
resp['content-type'] = 'text/plain'
|
41
|
+
resp['set-cookie'] = "monster=/"
|
42
|
+
resp.body << "C is for cookie, it's good enough for me"
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
class HeaderEchoHandler < WEBrick::HTTPServlet::AbstractServlet
|
47
|
+
def do_GET(req, resp)
|
48
|
+
resp['content-type'] = 'text/plain'
|
49
|
+
resp.body << req.header.inspect
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
class CharsetMismatchHandler < WEBrick::HTTPServlet::AbstractServlet
|
54
|
+
def do_GET(req, resp)
|
55
|
+
resp['content-type'] = 'text/html; charset=UTF-8'
|
56
|
+
resp.body << %q{
|
57
|
+
<html>
|
58
|
+
<head>
|
59
|
+
<meta http-equiv="Content-type" content="text/html; charset=iso-8859-1" />
|
60
|
+
</head>
|
61
|
+
<body>
|
62
|
+
<h1>ø</h1>
|
63
|
+
</body>
|
64
|
+
</html>
|
65
|
+
}
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
AUTH_CALLBACK = lambda do |req, res|
|
70
|
+
WEBrick::HTTPAuth.basic_auth(req, res, '') { |u, p| u == "foo" && p == "bar" }
|
71
|
+
end
|
72
|
+
|
73
|
+
class SpecServer
|
74
|
+
attr_reader :host, :thread, :log_file
|
75
|
+
|
76
|
+
def initialize(opts = {})
|
77
|
+
@ssl = opts[:ssl] || false
|
78
|
+
@doc_root = opts[:doc_root] || File.join(File.dirname(__FILE__),"..", "spec", "html")
|
79
|
+
@log_file = opts[:log_file] || File.join(File.dirname(__FILE__), "..", "log", "webrick_log.txt")
|
80
|
+
@port = opts[:port] || 2000
|
81
|
+
end
|
82
|
+
|
83
|
+
def run
|
84
|
+
unless File.exist?(@log_file)
|
85
|
+
FileUtils.mkdir_p(File.dirname(@log_file))
|
86
|
+
FileUtils.touch(@log_file)
|
87
|
+
end
|
88
|
+
|
89
|
+
server_options = {
|
90
|
+
:Port => @port,
|
91
|
+
:DocumentRoot => @doc_root,
|
92
|
+
:Logger => WEBrick::Log.new(@log_file, WEBrick::BasicLog::WARN),
|
93
|
+
:AccessLog => [],
|
94
|
+
}
|
95
|
+
|
96
|
+
if @ssl
|
97
|
+
# java complains about this certifcate, need to create our own (when running under MRI)
|
98
|
+
server_options.merge!(
|
99
|
+
:SSLEnable => true,
|
100
|
+
:SSLVerifyClient => ::OpenSSL::SSL::VERIFY_NONE,
|
101
|
+
:SSLCertName => [["CN", "Celerity"]]
|
102
|
+
)
|
103
|
+
@host = "https://localhost:#{@port}"
|
104
|
+
else
|
105
|
+
@host = "http://localhost:#{@port}"
|
106
|
+
end
|
107
|
+
|
108
|
+
server = WEBrick::HTTPServer.new(server_options)
|
109
|
+
server.mount("/", WEBrick::HTTPServlet::FileHandler, @doc_root, :FancyIndexing=>true)
|
110
|
+
server.mount("/post_to_me", PostHandler)
|
111
|
+
server.mount("/plain_text", PlainTextHandler)
|
112
|
+
server.mount("/ajax", SlowAjaxHandler)
|
113
|
+
server.mount("/charset_mismatch", CharsetMismatchHandler)
|
114
|
+
server.mount("/octet_stream", OctetStreamHandler)
|
115
|
+
server.mount("/set_cookie", CookieHandler)
|
116
|
+
server.mount("/header_echo", HeaderEchoHandler)
|
117
|
+
server.mount("/authentication", WEBrick::HTTPServlet::FileHandler, @doc_root, :FancyIndexing => true, :HandlerCallback => AUTH_CALLBACK)
|
118
|
+
|
119
|
+
@thread = Thread.new { server.start }
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
#desc 'Release the website and new gem version'
|
2
|
+
#task :deploy => [:check_version, :website, :release] do
|
3
|
+
# puts "Remember to create SVN tag:"
|
4
|
+
# puts "svn copy svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/trunk " +
|
5
|
+
# "svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/tags/REL-#{VERS} "
|
6
|
+
# puts "Suggested comment:"
|
7
|
+
# puts "Tagging release #{CHANGES}"
|
8
|
+
#end
|
9
|
+
|
10
|
+
desc 'Builds and installs gem locally'
|
11
|
+
task :local_deploy => [:install_gem]
|
12
|
+
|
13
|
+
#task :check_version do
|
14
|
+
# unless ENV['VERSION']
|
15
|
+
# puts 'Must pass a VERSION=x.y.z release version'
|
16
|
+
# exit
|
17
|
+
# end
|
18
|
+
# unless ENV['VERSION'] == VERS
|
19
|
+
# puts "Please update your version.rb to match the release version, currently #{VERS}"
|
20
|
+
# exit
|
21
|
+
# end
|
22
|
+
#end
|
23
|
+
|
24
|
+
#desc 'Install the package as a gem, without generating documentation(ri/rdoc)'
|
25
|
+
#task :install_gem_no_doc => [:clean, :package] do
|
26
|
+
# sh "#{'sudo ' unless Hoe::WINDOZE }gem install pkg/*.gem --no-rdoc --no-ri"
|
27
|
+
#end
|
28
|
+
|
29
|
+
namespace :manifest do
|
30
|
+
desc 'Recreate Manifest.txt to include ALL files'
|
31
|
+
task :refresh do
|
32
|
+
`rake check_manifest | patch -p0 > Manifest.txt`
|
33
|
+
end
|
34
|
+
desc 'Create new Manifest.txt in diff format'
|
35
|
+
task :new do
|
36
|
+
manifest = File.new('Manifest.txt', 'w+')
|
37
|
+
Dir.glob(File.join("**", "*")).each do |f|
|
38
|
+
manifest.puts f
|
39
|
+
end
|
40
|
+
manifest.flush
|
41
|
+
puts "####\n# Remember to edit Manifest.txt and remove unwanted file entries!\n####"
|
42
|
+
end
|
43
|
+
end
|