celerity 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. data/History.txt +15 -1
  2. data/Manifest.txt +174 -0
  3. data/README.txt +19 -10
  4. data/config/hoe.rb +68 -0
  5. data/config/requirements.rb +15 -0
  6. data/lib/celerity.rb +14 -11
  7. data/lib/celerity/collections.rb +37 -8
  8. data/lib/celerity/container.rb +100 -3
  9. data/lib/celerity/disabled_element.rb +4 -2
  10. data/lib/celerity/element.rb +21 -8
  11. data/lib/celerity/element_collections.rb +4 -7
  12. data/lib/celerity/element_locator.rb +1 -0
  13. data/lib/celerity/elements/button.rb +6 -2
  14. data/lib/celerity/elements/file_field.rb +1 -1
  15. data/lib/celerity/elements/form.rb +1 -2
  16. data/lib/celerity/elements/frame.rb +0 -3
  17. data/lib/celerity/elements/image.rb +1 -4
  18. data/lib/celerity/elements/label.rb +1 -0
  19. data/lib/celerity/elements/link.rb +2 -0
  20. data/lib/celerity/elements/option.rb +1 -0
  21. data/lib/celerity/elements/radio_check.rb +3 -5
  22. data/lib/celerity/elements/select_list.rb +3 -10
  23. data/lib/celerity/elements/table.rb +8 -22
  24. data/lib/celerity/elements/table_body.rb +5 -11
  25. data/lib/celerity/elements/table_cell.rb +1 -0
  26. data/lib/celerity/elements/table_footer.rb +30 -0
  27. data/lib/celerity/elements/table_header.rb +30 -0
  28. data/lib/celerity/elements/table_row.rb +5 -3
  29. data/lib/celerity/elements/text_field.rb +18 -13
  30. data/lib/celerity/exception.rb +8 -8
  31. data/lib/celerity/extra/method_generator.rb +5 -2
  32. data/lib/celerity/htmlunit/htmlunit-2.2-SNAPSHOT.jar +0 -0
  33. data/lib/celerity/ie.rb +195 -141
  34. data/lib/celerity/non_control_elements.rb +30 -4
  35. data/lib/celerity/version.rb +1 -1
  36. data/lib/celerity/watir_compatibility.rb +62 -0
  37. data/setup.rb +0 -2
  38. data/spec/area_spec.rb +4 -1
  39. data/spec/areas_spec.rb +1 -1
  40. data/spec/button_spec.rb +35 -17
  41. data/spec/buttons_spec.rb +1 -1
  42. data/spec/checkbox_spec.rb +6 -4
  43. data/spec/checkboxes_spec.rb +1 -1
  44. data/spec/div_spec.rb +20 -19
  45. data/spec/divs_spec.rb +2 -2
  46. data/spec/element_spec.rb +13 -2
  47. data/spec/filefield_spec.rb +6 -3
  48. data/spec/filefields_spec.rb +1 -1
  49. data/spec/form_spec.rb +4 -1
  50. data/spec/forms_spec.rb +1 -1
  51. data/spec/frame_spec.rb +6 -2
  52. data/spec/hidden_spec.rb +8 -4
  53. data/spec/hiddens_spec.rb +1 -1
  54. data/spec/hn_spec.rb +86 -0
  55. data/spec/hns_spec.rb +41 -0
  56. data/spec/html/bug_duplicate_attributes.html +14 -0
  57. data/spec/html/bug_javascript_001.html +11 -0
  58. data/spec/html/forms_with_input_elements.html +11 -11
  59. data/spec/html/images.html +18 -15
  60. data/spec/html/latin1_text.html +16 -0
  61. data/spec/html/non_control_elements.html +28 -4
  62. data/spec/html/tables.html +3 -3
  63. data/spec/html/utf8_text.html +15 -0
  64. data/spec/htmlunit_spec.rb +27 -0
  65. data/spec/ie_spec.rb +47 -12
  66. data/spec/image_spec.rb +4 -7
  67. data/spec/images_spec.rb +3 -2
  68. data/spec/label_spec.rb +4 -3
  69. data/spec/labels_spec.rb +1 -1
  70. data/spec/li_spec.rb +11 -8
  71. data/spec/link_spec.rb +5 -1
  72. data/spec/links_spec.rb +2 -1
  73. data/spec/lis_spec.rb +3 -2
  74. data/spec/map_spec.rb +4 -1
  75. data/spec/maps_spec.rb +1 -1
  76. data/spec/meta_spec.rb +6 -0
  77. data/spec/ol_spec.rb +73 -0
  78. data/spec/ols_spec.rb +41 -0
  79. data/spec/option_spec.rb +129 -0
  80. data/spec/p_spec.rb +4 -1
  81. data/spec/pre_spec.rb +4 -1
  82. data/spec/pres_spec.rb +1 -1
  83. data/spec/ps_spec.rb +2 -1
  84. data/spec/radio_spec.rb +7 -19
  85. data/spec/radios_spec.rb +1 -1
  86. data/spec/select_list_spec.rb +19 -57
  87. data/spec/select_lists_spec.rb +3 -2
  88. data/spec/span_spec.rb +8 -5
  89. data/spec/spans_spec.rb +2 -1
  90. data/spec/spec_helper.rb +8 -43
  91. data/spec/table_bodies_spec.rb +17 -4
  92. data/spec/table_body_spec.rb +47 -16
  93. data/spec/table_cell_spec.rb +5 -3
  94. data/spec/table_cells_spec.rb +1 -1
  95. data/spec/table_footer_spec.rb +94 -0
  96. data/spec/table_footers_spec.rb +53 -0
  97. data/spec/table_header_spec.rb +94 -0
  98. data/spec/table_headers_spec.rb +53 -0
  99. data/spec/table_row_spec.rb +25 -4
  100. data/spec/table_rows_spec.rb +1 -1
  101. data/spec/table_spec.rb +22 -2
  102. data/spec/tables_spec.rb +2 -1
  103. data/spec/text_field_spec.rb +52 -20
  104. data/spec/text_fields_spec.rb +1 -1
  105. data/spec/ul_spec.rb +73 -0
  106. data/spec/uls_spec.rb +41 -0
  107. data/spec/watir_compatability_spec.rb +253 -0
  108. data/support/celerity_viewer/rubycocoa/CelerityViewer.icns +0 -0
  109. data/support/celerity_viewer/rubycocoa/English.lproj/Main.nib/classes.nib +37 -0
  110. data/support/celerity_viewer/rubycocoa/English.lproj/Main.nib/info.nib +19 -0
  111. data/support/celerity_viewer/rubycocoa/English.lproj/Main.nib/keyedobjects.nib +0 -0
  112. data/support/celerity_viewer/rubycocoa/Info.plist.erb +28 -0
  113. data/support/celerity_viewer/rubycocoa/MainController.rb +23 -0
  114. data/support/celerity_viewer/rubycocoa/README +94 -0
  115. data/support/celerity_viewer/rubycocoa/Rakefile +100 -0
  116. data/support/celerity_viewer/rubycocoa/distributed_viewer.rb +86 -0
  117. data/support/celerity_viewer/rubycocoa/main.m +7 -0
  118. data/support/celerity_viewer/rubycocoa/main.rb +27 -0
  119. data/support/spec_server.rb +64 -0
  120. data/tasks/benchmark.rake +1 -0
  121. data/tasks/rdoc.rake +4 -0
  122. data/tasks/rspec.rake +10 -3
  123. data/tasks/simple_ci.rake +94 -0
  124. data/tasks/specserver.rake +21 -0
  125. metadata +160 -114
  126. data/spec/table_bodies.rb +0 -40
  127. data/tasks/testserver.rake +0 -32
@@ -1,6 +1,6 @@
1
1
  require File.dirname(__FILE__) + '/spec_helper.rb'
2
2
 
3
- describe "TextFields" do
3
+ describe TextFields do
4
4
 
5
5
  before :all do
6
6
  @browser = IE.new
@@ -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 'ul' exists" do
17
+ @browser.ul(:id, "navbar").should exist
18
+ @browser.ul(:id, /navbar/).should exist
19
+ @browser.ul(:index, 1).should exist
20
+ @browser.ul(:xpath, "//ul[@id='navbar']").should exist
21
+ end
22
+ it "should return true if the element exists (default how = :id)" do
23
+ @browser.ul("navbar").should exist
24
+ end
25
+ it "should return false if the 'ul' doesn't exist" do
26
+ @browser.ul(:id, "no_such_id").should_not exist
27
+ @browser.ul(:id, /no_such_id/).should_not exist
28
+ @browser.ul(:text, "no_such_text").should_not exist
29
+ @browser.ul(:text, /no_such_text/).should_not exist
30
+ @browser.ul(:class, "no_such_class").should_not exist
31
+ @browser.ul(:class, /no_such_class/).should_not exist
32
+ @browser.ul(:index, 1337).should_not exist
33
+ @browser.ul(:xpath, "//ul[@id='no_such_id']").should_not exist
34
+ end
35
+ it "should raise ArgumentError when 'what' argument is invalid" do
36
+ lambda { @browser.ul(:id, 3.14).exists? }.should raise_error(ArgumentError)
37
+ end
38
+ it "should raise MissingWayOfFindingObjectException when 'how' argument is invalid" do
39
+ lambda { @browser.ul(: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.ul(:id, 'navbar').class_name.should == 'navigation'
47
+ end
48
+ it "should return an empty string if the element exists and the attribute doesn't" do
49
+ @browser.ul(:index, 2).class_name.should == ''
50
+ end
51
+ it "should raise UnknownObjectException if the ul doesn't exist" do
52
+ lambda { @browser.ul(: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.ul(:class, 'navigation').id.should == "navbar"
59
+ end
60
+ it "should return an empty string if the element exists and the attribute doesn't" do
61
+ @browser.ul(:index, 2).id.should == ''
62
+ end
63
+ it "should raise UnknownObjectException if the ul doesn't exist" do
64
+ lambda { @browser.ul(:id, "no_such_id").id }.should raise_error(UnknownObjectException)
65
+ lambda { @browser.ul(:index, 1337).id }.should raise_error(UnknownObjectException)
66
+ end
67
+ end
68
+
69
+ after :all do
70
+ @browser.close
71
+ end
72
+
73
+ end
@@ -0,0 +1,41 @@
1
+ require File.dirname(__FILE__) + '/spec_helper.rb'
2
+
3
+ describe Uls 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
+ describe "#length" do
15
+ it "should return the number of uls" do
16
+ @browser.uls.length.should == 2
17
+ end
18
+ end
19
+
20
+ describe "#[]" do
21
+ it "should return the ul at the given index" do
22
+ @browser.uls[1].id.should == "navbar"
23
+ end
24
+ end
25
+
26
+ describe "#each" do
27
+ it "should iterate through uls correctly" do
28
+ @browser.uls.each_with_index do |ul, index|
29
+ ul.name.should == @browser.ul(:index, index+1).name
30
+ ul.id.should == @browser.ul(:index, index+1).id
31
+ ul.value.should == @browser.ul(:index, index+1).value
32
+ end
33
+ end
34
+ end
35
+
36
+ after :all do
37
+ @browser.close
38
+ end
39
+
40
+ end
41
+
@@ -0,0 +1,253 @@
1
+ require File.dirname(__FILE__) + '/spec_helper.rb'
2
+
3
+ describe IE do
4
+
5
+ before :each do
6
+ @browser = IE.new
7
+ add_spec_checker(@browser)
8
+ end
9
+
10
+ # Class methods
11
+ it "should respond to .speed" do
12
+ IE.should respond_to("speed")
13
+ end
14
+ it "should respond to .speed=" do
15
+ IE.should respond_to("speed=")
16
+ end
17
+ it "should respond to .set_fast_speed" do
18
+ IE.should respond_to("set_fast_speed")
19
+ end
20
+ it "should respond to .set_slow_speed" do
21
+ IE.should respond_to("set_slow_speed")
22
+ end
23
+ it "should respond to .attach_timeout" do
24
+ IE.should respond_to("attach_timeout")
25
+ end
26
+ it "should respond to .attach_timeout=" do
27
+ IE.should respond_to("attach_timeout=")
28
+ end
29
+ it "should respond to .reset_attach_timeout" do
30
+ IE.should respond_to("reset_attach_timeout")
31
+ end
32
+ it "should respond to .visible" do
33
+ IE.should respond_to("visible")
34
+ end
35
+ it "should respond to .each" do
36
+ IE.should respond_to("each")
37
+ end
38
+ it "should respond to .quit" do
39
+ IE.should respond_to("quit")
40
+ end
41
+ it "should alias .start_window to .start" do
42
+ IE.should respond_to("start")
43
+ end
44
+
45
+ # Instance methods
46
+ it "should respond to #visible" do
47
+ @browser.should respond_to("visible")
48
+ end
49
+ it "should respond to #visible=" do
50
+ @browser.should respond_to("visible=")
51
+ end
52
+ it "should respond to #wait" do
53
+ @browser.should respond_to("wait")
54
+ end
55
+
56
+ describe "#bring_to_front" do
57
+ it "should return true" do
58
+ @browser.bring_to_front.should be_true
59
+ end
60
+ end
61
+
62
+ describe "#checkBox" do
63
+ it "should behave like #checkbox" do
64
+
65
+ end
66
+ end
67
+
68
+ end
69
+
70
+ describe Button do
71
+
72
+ before :all do
73
+ @browser = IE.new
74
+ add_spec_checker(@browser)
75
+ end
76
+
77
+ before :each do
78
+ @browser.goto(TEST_HOST + "/forms_with_input_elements.html")
79
+ end
80
+
81
+ describe "#click_no_wait" do
82
+ it "should behave like #click" do
83
+ @browser.button(:id, 'new_user_submit').click_no_wait
84
+ @browser.text.should include("You posted the following content:")
85
+ end
86
+ end
87
+
88
+ end
89
+
90
+ describe Link do
91
+
92
+ before :all do
93
+ @browser = IE.new
94
+ add_spec_checker(@browser)
95
+ end
96
+
97
+ before :each do
98
+ @browser.goto(TEST_HOST + "/non_control_elements.html")
99
+ end
100
+
101
+ describe "#click_no_wait" do
102
+ it "should behave like #click" do
103
+ @browser.link(:text, "Link 3").click_no_wait
104
+ @browser.text.include?("User administration").should be_true
105
+ end
106
+ end
107
+
108
+ end
109
+
110
+
111
+ describe Image do
112
+
113
+ before :all do
114
+ @browser = IE.new
115
+ add_spec_checker(@browser)
116
+ end
117
+
118
+ before :each do
119
+ @browser.goto(TEST_HOST + "/images.html")
120
+ end
121
+
122
+ describe "#hasLoaded?" do
123
+ it "should behave like #loaded?" do
124
+ @browser.image(:name, 'circle').hasLoaded?.should be_true
125
+ end
126
+ end
127
+
128
+ describe "#has_loaded?" do
129
+ it "should behave like #loaded" do
130
+ @browser.image(:name, 'circle').has_loaded?.should be_true
131
+ end
132
+ end
133
+
134
+ describe "#fileSize" do
135
+ it "should behave like #file_size" do
136
+ @browser.image(:id, 'square').fileSize.should == 788
137
+ end
138
+ end
139
+
140
+ describe "#fileCreatedDate" do
141
+ it "should behave like #file_created_date" do
142
+ image = @browser.image(:index, 2)
143
+ path = File.dirname(__FILE__) + "/html/#{image.src}"
144
+ image.file_created_date.to_i.should == File.mtime(path).to_i
145
+ end
146
+ end
147
+
148
+ end
149
+
150
+ describe RadioCheckCommon do
151
+
152
+ before :all do
153
+ @browser = IE.new
154
+ add_spec_checker(@browser)
155
+ end
156
+
157
+ before :each do
158
+ @browser.goto(TEST_HOST + "/forms_with_input_elements.html")
159
+ end
160
+
161
+ describe "#is_set?" do
162
+ it "should behave like #set?" do
163
+ @browser.radio(:id, "new_user_newsletter_yes").is_set?.should be_true
164
+ end
165
+ end
166
+
167
+ describe "#isSet?" do
168
+ it "should behave like #set?" do
169
+ @browser.radio(:id, "new_user_newsletter_yes").isSet?.should be_true
170
+ end
171
+ end
172
+
173
+ describe "#get_state" do
174
+ it "should behave like #set?" do
175
+ @browser.checkbox(:id, "new_user_interests_books").get_state.should be_true
176
+ end
177
+ end
178
+
179
+ describe "#getState" do
180
+ it "should behave like #set?" do
181
+ @browser.checkbox(:id, "new_user_interests_books").getState.should be_true
182
+ end
183
+ end
184
+
185
+ end
186
+
187
+ describe SelectList do
188
+
189
+ before :all do
190
+ @browser = Celerity::IE.new
191
+ add_spec_checker(@browser)
192
+ end
193
+
194
+ before :each do
195
+ @browser.goto(TEST_HOST + "/forms_with_input_elements.html")
196
+ end
197
+
198
+ describe "#getSelectedItems" do
199
+ it "should behave like #get_selected_items" do
200
+ @browser.select_list(:name, "new_user_country").getSelectedItems.should == ["Norway"]
201
+ @browser.select_list(:name, "new_user_languages").getSelectedItems.should == ["English", "Norwegian"]
202
+ end
203
+ end
204
+
205
+ describe "#getAllContents" do
206
+ it "should behave like #get_all_contents" do
207
+ @browser.select_list(:name, "new_user_country").getAllContents.should == ["Denmark" ,"Norway" , "Sweden" , "United Kingdom", "USA"]
208
+ end
209
+ end
210
+
211
+ describe "#clearSelection" do
212
+ it "should behave like #clear selection" do
213
+ @browser.select_list(:name, "new_user_languages").clearSelection
214
+ @browser.select_list(:name, "new_user_languages").getSelectedItems.should be_empty
215
+ end
216
+ end
217
+
218
+ describe "#select_value" do
219
+ it "should behave like #select" do
220
+ @browser.select_list(:name, "new_user_country").select_value("Denmark")
221
+ @browser.select_list(:name, "new_user_country").getSelectedItems.should == ["Denmark"]
222
+ end
223
+ end
224
+
225
+ end
226
+
227
+ describe TextField do
228
+
229
+ before :all do
230
+ @browser = IE.new
231
+ add_spec_checker(@browser)
232
+ end
233
+
234
+ before :each do
235
+ @browser.goto(TEST_HOST + "/forms_with_input_elements.html")
236
+ end
237
+
238
+ describe "#dragContentsTo" do
239
+ it "should behave like #drag_contents_to" do
240
+ @browser.text_field(:name, "new_user_first_name").set("Smith")
241
+ @browser.text_field(:name, "new_user_first_name").dragContentsTo(:name, "new_user_last_name")
242
+ @browser.text_field(:name, "new_user_first_name").value.should be_empty
243
+ @browser.text_field(:id, "new_user_last_name").value.should == "Smith"
244
+ end
245
+ end
246
+
247
+ describe "#getContents" do
248
+ it "should behave like #get_contents" do
249
+ @browser.text_field(:name, "new_user_occupation").getContents.should == "Developer"
250
+ end
251
+ end
252
+
253
+ end
@@ -0,0 +1,37 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>IBClasses</key>
6
+ <array>
7
+ <dict>
8
+ <key>CLASS</key>
9
+ <string>FirstResponder</string>
10
+ <key>LANGUAGE</key>
11
+ <string>ObjC</string>
12
+ <key>SUPERCLASS</key>
13
+ <string>NSObject</string>
14
+ </dict>
15
+ <dict>
16
+ <key>ACTIONS</key>
17
+ <dict>
18
+ <key>load_url</key>
19
+ <string>id</string>
20
+ </dict>
21
+ <key>CLASS</key>
22
+ <string>MainController</string>
23
+ <key>LANGUAGE</key>
24
+ <string>ObjC</string>
25
+ <key>OUTLETS</key>
26
+ <dict>
27
+ <key>text_field</key>
28
+ <string>id</string>
29
+ <key>web_view</key>
30
+ <string>id</string>
31
+ </dict>
32
+ </dict>
33
+ </array>
34
+ <key>IBVersion</key>
35
+ <string>1</string>
36
+ </dict>
37
+ </plist>
@@ -0,0 +1,19 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>IBFramework Version</key>
6
+ <string>644</string>
7
+ <key>IBOldestOS</key>
8
+ <integer>5</integer>
9
+ <key>IBOpenObjects</key>
10
+ <array>
11
+ <integer>81</integer>
12
+ <integer>21</integer>
13
+ </array>
14
+ <key>IBSystem Version</key>
15
+ <string>9C7010</string>
16
+ <key>targetFramework</key>
17
+ <string>IBCocoaFramework</string>
18
+ </dict>
19
+ </plist>
@@ -0,0 +1,28 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
3
+ <plist version="0.9">
4
+ <dict>
5
+ <key>CFBundleExecutable</key>
6
+ <string><%=APPNAME%></string>
7
+ <key>CFBundleIdentifier</key>
8
+ <string><%=BUNDLEID%></string>
9
+ <key>CFBundlePackageType</key>
10
+ <string>APPL</string>
11
+ <key>CFBundleSignature</key>
12
+ <string>????</string>
13
+ <key>NSHumanReadableCopyright</key>
14
+ <string><%=COPYRIGHT%></string>
15
+ <key>CFBundleIconFile</key>
16
+ <string>CelerityViewer</string>
17
+
18
+ <key>NSMainNibFile</key>
19
+ <string>Main</string>
20
+ <key>NSPrincipalClass</key>
21
+ <string>NSApplication</string>
22
+
23
+ <!-- Not Show in Dock
24
+ <key>LSUIElement</key>
25
+ <string>1</string>
26
+ -->
27
+ </dict>
28
+ </plist>