nimboids-capybara 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. data/History.txt +289 -0
  2. data/README.rdoc +722 -0
  3. data/lib/capybara.rb +252 -0
  4. data/lib/capybara/cucumber.rb +28 -0
  5. data/lib/capybara/driver/base.rb +64 -0
  6. data/lib/capybara/driver/node.rb +74 -0
  7. data/lib/capybara/dsl.rb +168 -0
  8. data/lib/capybara/node/actions.rb +162 -0
  9. data/lib/capybara/node/base.rb +63 -0
  10. data/lib/capybara/node/document.rb +25 -0
  11. data/lib/capybara/node/element.rb +201 -0
  12. data/lib/capybara/node/finders.rb +197 -0
  13. data/lib/capybara/node/matchers.rb +417 -0
  14. data/lib/capybara/node/simple.rb +132 -0
  15. data/lib/capybara/rack_test/browser.rb +121 -0
  16. data/lib/capybara/rack_test/driver.rb +80 -0
  17. data/lib/capybara/rack_test/form.rb +80 -0
  18. data/lib/capybara/rack_test/node.rb +105 -0
  19. data/lib/capybara/rails.rb +17 -0
  20. data/lib/capybara/rspec.rb +26 -0
  21. data/lib/capybara/rspec/features.rb +22 -0
  22. data/lib/capybara/rspec/matchers.rb +154 -0
  23. data/lib/capybara/selector.rb +89 -0
  24. data/lib/capybara/selenium/driver.rb +163 -0
  25. data/lib/capybara/selenium/node.rb +91 -0
  26. data/lib/capybara/server.rb +90 -0
  27. data/lib/capybara/session.rb +321 -0
  28. data/lib/capybara/spec/driver.rb +301 -0
  29. data/lib/capybara/spec/fixtures/capybara.jpg +3 -0
  30. data/lib/capybara/spec/fixtures/test_file.txt +1 -0
  31. data/lib/capybara/spec/public/test.js +43 -0
  32. data/lib/capybara/spec/session.rb +154 -0
  33. data/lib/capybara/spec/session/all_spec.rb +78 -0
  34. data/lib/capybara/spec/session/attach_file_spec.rb +73 -0
  35. data/lib/capybara/spec/session/check_spec.rb +65 -0
  36. data/lib/capybara/spec/session/choose_spec.rb +26 -0
  37. data/lib/capybara/spec/session/click_button_spec.rb +304 -0
  38. data/lib/capybara/spec/session/click_link_or_button_spec.rb +36 -0
  39. data/lib/capybara/spec/session/click_link_spec.rb +119 -0
  40. data/lib/capybara/spec/session/current_host_spec.rb +68 -0
  41. data/lib/capybara/spec/session/current_url_spec.rb +15 -0
  42. data/lib/capybara/spec/session/fill_in_spec.rb +125 -0
  43. data/lib/capybara/spec/session/find_button_spec.rb +18 -0
  44. data/lib/capybara/spec/session/find_by_id_spec.rb +18 -0
  45. data/lib/capybara/spec/session/find_field_spec.rb +26 -0
  46. data/lib/capybara/spec/session/find_link_spec.rb +19 -0
  47. data/lib/capybara/spec/session/find_spec.rb +149 -0
  48. data/lib/capybara/spec/session/first_spec.rb +105 -0
  49. data/lib/capybara/spec/session/has_button_spec.rb +32 -0
  50. data/lib/capybara/spec/session/has_content_spec.rb +106 -0
  51. data/lib/capybara/spec/session/has_css_spec.rb +243 -0
  52. data/lib/capybara/spec/session/has_field_spec.rb +192 -0
  53. data/lib/capybara/spec/session/has_link_spec.rb +37 -0
  54. data/lib/capybara/spec/session/has_select_spec.rb +129 -0
  55. data/lib/capybara/spec/session/has_selector_spec.rb +129 -0
  56. data/lib/capybara/spec/session/has_table_spec.rb +96 -0
  57. data/lib/capybara/spec/session/has_xpath_spec.rb +123 -0
  58. data/lib/capybara/spec/session/headers.rb +19 -0
  59. data/lib/capybara/spec/session/javascript.rb +289 -0
  60. data/lib/capybara/spec/session/response_code.rb +19 -0
  61. data/lib/capybara/spec/session/select_spec.rb +113 -0
  62. data/lib/capybara/spec/session/text_spec.rb +19 -0
  63. data/lib/capybara/spec/session/uncheck_spec.rb +21 -0
  64. data/lib/capybara/spec/session/unselect_spec.rb +61 -0
  65. data/lib/capybara/spec/session/within_spec.rb +178 -0
  66. data/lib/capybara/spec/test_app.rb +142 -0
  67. data/lib/capybara/spec/views/buttons.erb +4 -0
  68. data/lib/capybara/spec/views/fieldsets.erb +29 -0
  69. data/lib/capybara/spec/views/form.erb +365 -0
  70. data/lib/capybara/spec/views/frame_one.erb +8 -0
  71. data/lib/capybara/spec/views/frame_two.erb +8 -0
  72. data/lib/capybara/spec/views/header_links.erb +7 -0
  73. data/lib/capybara/spec/views/host_links.erb +12 -0
  74. data/lib/capybara/spec/views/popup_one.erb +8 -0
  75. data/lib/capybara/spec/views/popup_two.erb +8 -0
  76. data/lib/capybara/spec/views/postback.erb +13 -0
  77. data/lib/capybara/spec/views/tables.erb +122 -0
  78. data/lib/capybara/spec/views/with_html.erb +78 -0
  79. data/lib/capybara/spec/views/with_html_entities.erb +1 -0
  80. data/lib/capybara/spec/views/with_js.erb +48 -0
  81. data/lib/capybara/spec/views/with_scope.erb +36 -0
  82. data/lib/capybara/spec/views/with_simple_html.erb +1 -0
  83. data/lib/capybara/spec/views/within_frames.erb +10 -0
  84. data/lib/capybara/spec/views/within_popups.erb +25 -0
  85. data/lib/capybara/util/save_and_open_page.rb +44 -0
  86. data/lib/capybara/util/timeout.rb +27 -0
  87. data/lib/capybara/version.rb +3 -0
  88. data/spec/basic_node_spec.rb +77 -0
  89. data/spec/capybara_spec.rb +46 -0
  90. data/spec/driver/rack_test_driver_spec.rb +89 -0
  91. data/spec/driver/selenium_driver_spec.rb +50 -0
  92. data/spec/dsl_spec.rb +253 -0
  93. data/spec/fixtures/selenium_driver_rspec_failure.rb +8 -0
  94. data/spec/fixtures/selenium_driver_rspec_success.rb +8 -0
  95. data/spec/rspec/features_spec.rb +45 -0
  96. data/spec/rspec/matchers_spec.rb +495 -0
  97. data/spec/rspec_spec.rb +53 -0
  98. data/spec/save_and_open_page_spec.rb +155 -0
  99. data/spec/server_spec.rb +89 -0
  100. data/spec/session/rack_test_session_spec.rb +55 -0
  101. data/spec/session/selenium_session_spec.rb +26 -0
  102. data/spec/spec_helper.rb +30 -0
  103. data/spec/string_spec.rb +77 -0
  104. data/spec/timeout_spec.rb +28 -0
  105. metadata +346 -0
@@ -0,0 +1,4 @@
1
+ <h1>Buttons</h1>
2
+ <button>Click me!</button>
3
+ <button id="click_me_123">Click me by id!</button>
4
+ <button value="click_me">Click me by value!</button>
@@ -0,0 +1,29 @@
1
+ <form action="/form" method="post">
2
+ <fieldset id="agent_fieldset">
3
+ <legend>Agent</legend>
4
+
5
+ <p>
6
+ <label for="form_agent_name">Name</label>
7
+ <input type="text" name="form[agent_name]" value="James" id="form_agent_name"/>
8
+ </p>
9
+
10
+ <p>
11
+ <input type="submit" value="Create"/>
12
+ </p>
13
+ </fieldset>
14
+ </form>
15
+
16
+ <form action="/form" method="post">
17
+ <fieldset id="villain_fieldset">
18
+ <legend>Villain</legend>
19
+
20
+ <p>
21
+ <label for="form_villain_name">Name</label>
22
+ <input type="text" name="form[villain_name]" value="Ernst" id="form_villain_name"/>
23
+ </p>
24
+
25
+ <p>
26
+ <input type="submit" value="Create"/>
27
+ </p>
28
+ </fieldset>
29
+ </form>
@@ -0,0 +1,365 @@
1
+ <h1>Form</h1>
2
+
3
+ <form action="/form" method="post">
4
+
5
+ <p>
6
+ <label for="form_title">Title</label>
7
+ <select name="form[title]" id="form_title">
8
+ <option>Mrs</option>
9
+ <option>Mr</option>
10
+ <option>Miss</option>
11
+ </select>
12
+ </p>
13
+
14
+
15
+ <p>
16
+ <label for="form_other_title">Other title</label>
17
+ <select name="form[other_title]" id="form_other_title">
18
+ <option>Mrs</option>
19
+ <option>Mr</option>
20
+ <option>Miss</option>
21
+ </select>
22
+ </p>
23
+
24
+ <p>
25
+ <label for="form_first_name">
26
+ First Name
27
+ <input type="text" name="form[first_name]" value="John" id="form_first_name"/>
28
+ </label>
29
+ </p>
30
+
31
+ <p>
32
+ <label for="form_last_name">Last Name</label>
33
+ <input type="text" name="form[last_name]" value="Smith" id="form_last_name"/>
34
+ </p>
35
+
36
+ <p>
37
+ <label for="form_name_explanation">Explanation of Name</label>
38
+ <textarea name="form[name_explanation]" id="form_name_explanation"></textarea>
39
+ </p>
40
+
41
+ <p>
42
+ <label for="form_name">Name</label>
43
+ <input type="text" name="form[name]" value="John Smith" id="form_name"/>
44
+ </p>
45
+
46
+ <p>
47
+ <label for="form_schmooo">Schmooo</label>
48
+ <input type="schmooo" name="form[schmooo]" value="This is Schmooo!" id="form_schmooo"/>
49
+ </p>
50
+
51
+ <p>
52
+ <label>Street<br/>
53
+ <input type="text" maxlength="" name="form[street]" value="Sesame street 66"/>
54
+ </label>
55
+ </p>
56
+
57
+ <p>
58
+ <label for="form_phone">Phone</label>
59
+ <input name="form[phone]" value="+1 555 7021" id="form_phone"/>
60
+ </p>
61
+
62
+ <p>
63
+ <label for="form_password">Password</label>
64
+ <input type="password" name="form[password]" value="seeekrit" id="form_password"/>
65
+ </p>
66
+
67
+ <p>
68
+ <label for="form_terms_of_use">Terms of Use</label>
69
+ <input type="hidden" name="form[terms_of_use]" value="0" id="form_terms_of_use_default">
70
+ <input type="checkbox" name="form[terms_of_use]" value="1" id="form_terms_of_use">
71
+ </p>
72
+
73
+ <p>
74
+ <label for="form_image">Image</label>
75
+ <input type="file" name="form[image]" id="form_image"/>
76
+ </p>
77
+
78
+ <p>
79
+ <input type="hidden" name="form[token]" value="12345" id="form_token"/>
80
+ </p>
81
+
82
+ <p>
83
+ <label for="form_locale">Locale</label>
84
+ <select name="form[locale]" id="form_locale">
85
+ <option value="sv">Swedish</option>
86
+ <option selected="selected" value="en">English</option>
87
+ <option value="fi">Finish</option>
88
+ <option value="no">Norwegian</option>
89
+ <option value="jo">John's made-up language</option>
90
+ <option value="jbo"> Lojban </option>
91
+ </select>
92
+ </p>
93
+
94
+ <p>
95
+ <label for="form_region">Region</label>
96
+ <select name="form[region]" id="form_region">
97
+ <option>Sweden</option>
98
+ <option selected="selected">Norway</option>
99
+ <option>Finland</option>
100
+ </select>
101
+ </p>
102
+
103
+ <p>
104
+ <label for="form_city">City</label>
105
+ <select name="form[city]" id="form_city">
106
+ <option>London</option>
107
+ <option>Stockholm</option>
108
+ <option>Paris</option>
109
+ </select>
110
+ </p>
111
+
112
+ <p>
113
+ <label for="form_zipcode">Zipcode</label>
114
+ <input type="text" maxlength="5" name="form[zipcode]" id="form_zipcode" />
115
+ </p>
116
+
117
+ <p>
118
+ <label for="form_tendency">Tendency</label>
119
+ <select name="form[tendency]" id="form_tendency"></select>
120
+ </p>
121
+
122
+ <p>
123
+ <label for="form_description">Description</label></br>
124
+ <textarea name="form[description]" id="form_description">Descriptive text goes here</textarea>
125
+ <p>
126
+
127
+ <p>
128
+ <input type="radio" name="form[gender]" value="male" id="gender_male"/>
129
+ <label for="gender_male">Male</label>
130
+ <input type="radio" name="form[gender]" value="female" id="gender_female" checked="checked"/>
131
+ <label for="gender_female">Female</label>
132
+ <input type="radio" name="form[gender]" value="both" id="gender_both"/>
133
+ <label for="gender_both">Both</label>
134
+ </p>
135
+
136
+ <p>
137
+ <input type="checkbox" value="dog" name="form[pets][]" id="form_pets_dog" checked="checked"/>
138
+ <label for="form_pets_dog">Dog</label>
139
+ <input type="checkbox" value="cat" name="form[pets][]" id="form_pets_cat"/>
140
+ <label for="form_pets_cat">Cat</label>
141
+ <input type="checkbox" value="hamster" name="form[pets][]" id="form_pets_hamster" checked="checked"/>
142
+ <label for="form_pets_hamster">Hamster</label>
143
+ </p>
144
+
145
+ <p>
146
+ <label for="form_languages">Languages</label>
147
+ <select name="form[languages][]" id="form_languages" multiple="multiple">
148
+ <option>Ruby</option>
149
+ <option>SQL</option>
150
+ <option>HTML</option>
151
+ <option>Javascript</option>
152
+ </select>
153
+ </p>
154
+
155
+ <p>
156
+ <label for="form_underwear">Underwear</label>
157
+ <select name="form[underwear][]" id="form_underwear" multiple="multiple">
158
+ <option selected="selected">Boxer Briefs</option>
159
+ <option>Boxers</option>
160
+ <option selected="selected">Briefs</option>
161
+ <option selected="selected">Commando</option>
162
+ <option selected="selected">Frenchman's Pantalons</option>
163
+ <option selected="selected" value="thermal">Long Johns</option>
164
+ </select>
165
+ </p>
166
+
167
+ <p>
168
+ <span>First address<span>
169
+ <label for='address1_street'>Street</label>
170
+ <input type="text" name="form[addresses][][street]" value="" id="address1_street">
171
+
172
+ <label for='address1_city'>City</label>
173
+ <input type="text" name="form[addresses][][city]" value="" id="address1_city">
174
+
175
+ <label for='address1_country'>Country</label>
176
+ <select name="form[addresses][][country]" id="address1_country">
177
+ <option>France</option>
178
+ <option>Ukraine</option>
179
+ </select>
180
+ </p>
181
+
182
+ <p>
183
+ <span>Second address<span>
184
+ <label for='address2_street'>Street</label>
185
+ <input type="text" name="form[addresses][][street]" value="" id="address2_street">
186
+
187
+ <label for='address2_city'>City</label>
188
+ <input type="text" name="form[addresses][][city]" value="" id="address2_city">
189
+
190
+ <label for='address2_country'>Country</label>
191
+ <select name="form[addresses][][country]" id="address2_country">
192
+ <option>France</option>
193
+ <option>Ukraine</option>
194
+ </select>
195
+ </p>
196
+
197
+ <div style="display:none;">
198
+ <label for="form_first_name_hidden">
199
+ Super Secret
200
+ <input type="text" name="form[super_secret]" value="test123" id="form_super_secret"/>
201
+ </label>
202
+ </div>
203
+
204
+ <p>
205
+ <label for="form_disabled_text_field">
206
+ Disabled Text Field
207
+ <input type="text" name="form[disabled_text_field]" value="Should not see me" id="form_disabled_text_field" disabled="disabled" />
208
+ </label>
209
+ </p>
210
+
211
+ <p>
212
+ <label for="form_disabled_textarea">
213
+ Disabled Textarea
214
+ <textarea name="form[disabled_textarea]" value="Should not see me" id="form_disabled_textarea" disabled="disabled"></textarea>
215
+ </label>
216
+ </p>
217
+
218
+ <p>
219
+ <label for="form_disabled_checkbox">
220
+ Disabled Checkbox
221
+ <input type="checkbox" name="form[disabled_checkbox]" value="Should not see me" id="form_disabled_checkbox" checked="checked" disabled="disabled" />
222
+ </label>
223
+ </p>
224
+
225
+ <p>
226
+ <label for="form_disabled_radio">
227
+ Disabled Radio
228
+ <input type="radio" name="form[disabled_radio]" value="Should not see me" id="form_disabled_radio" checked="checked" disabled="disabled" />
229
+ </label>
230
+ </p>
231
+
232
+ <p>
233
+ <label for="form_disabled_select">
234
+ Disabled Select
235
+ <select name="form[disabled_select]" id="form_disabled_select" disabled="disabled">
236
+ <option value="Should not see me" selected="selected">Should not see me</option>
237
+ </select>
238
+ </label>
239
+ </p>
240
+
241
+ <p>
242
+ <label for="form_disabled_file">
243
+ Disabled File
244
+ <input type="file" name="form[disabled_file]" value="/should/not/see/me" id="form_disabled_file" disabled="disabled" />
245
+ </label>
246
+ </p>
247
+
248
+ <p>
249
+ <input type="button" name="form[fresh]" id="fresh_btn" value="i am fresh"/>
250
+ <input type="submit" name="form[awesome]" id="awe123" title="What an Awesome Button" value="awesome"/>
251
+ <input type="submit" name="form[crappy]" id="crap321" value="crappy"/>
252
+ <input type="image" name="form[okay]" id="okay556" title="Okay 556 Image" value="okay" alt="oh hai thar"/>
253
+ <button type="submit" id="click_me_123" title="Click Title button" value="click_me">Click me!</button>
254
+ <button type="submit" name="form[no_value]">No Value!</button>
255
+ <button id="no_type">No Type!</button>
256
+ </p>
257
+ </form>
258
+
259
+ <form id="get-form" action="/form/get?foo=bar" method="get">
260
+ <p>
261
+ <label for="form_middle_name">Middle Name</label>
262
+ <input type="text" name="form[middle_name]" value="Darren" id="form_middle_name"/>
263
+ </p>
264
+
265
+ <p>
266
+ <input type="submit" name="form[mediocre]" id="mediocre" value="med"/>
267
+ <p>
268
+ </form>
269
+
270
+ <form action="/upload_empty" method="post" enctype="multipart/form-data">
271
+ <p>
272
+ <label for="form_file_name">File Name</label>
273
+ <input type="file" name="form[file]" id="form_file"/>
274
+ </p>
275
+
276
+ <p>
277
+ <input type="submit" value="Upload Empty"/>
278
+ <p>
279
+ </form>
280
+
281
+ <form action="/upload" method="post" enctype="multipart/form-data">
282
+ <p>
283
+ <label for="form_file_name">File Name</label>
284
+ <input type="file" name="form[file_name]" id="form_file_name"/>
285
+ </p>
286
+
287
+ <p>
288
+ <label for="form_document">Document</label>
289
+ <input type="file" name="form[document]" id="form_document"/>
290
+ </p>
291
+
292
+ <p>
293
+ <input type="submit" value="Upload"/>
294
+ <p>
295
+ </form>
296
+
297
+ <form action="/upload_multiple" method="post" enctype="multipart/form-data">
298
+ <p>
299
+ <label for="form_multiple_file_name">File Name</label>
300
+ <input type="file" name="form[multiple_file_name]" id="form_multiple_file_name"/>
301
+ </p>
302
+
303
+ <p>
304
+ <label for="form_multiple_documents">Multiple Documents</label>
305
+ <input type="file" name="form[multiple_documents][]" id="form_multiple_documents" multiple />
306
+ </p>
307
+
308
+ <p>
309
+ <input type="submit" value="Upload Multiple"/>
310
+ <p>
311
+ </form>
312
+
313
+ <form action="/redirect" method="post">
314
+ <p>
315
+ <input type="submit" value="Go FAR"/>
316
+ </p>
317
+ </form>
318
+
319
+ <form action="/form" method="post">
320
+ <p>
321
+ <label for="html5_email">Html5 Email</label>
322
+ <input type="email" name="form[html5_email]" value="person@email.com" id="html5_email"/>
323
+ </p>
324
+ <p>
325
+ <label for="html5_url">Html5 Url</label>
326
+ <input type="url" name="form[html5_url]" value="http://www.example.com" id="html5_url"/>
327
+ </p>
328
+ <p>
329
+ <label for="html5_search">Html5 Search</label>
330
+ <input type="search" name="form[html5_search]" value="what are you looking for" id="html5_search"/>
331
+ </p>
332
+ <p>
333
+ <label for="html5_tel">Html5 Tel</label>
334
+ <input type="tel" name="form[html5_tel]" value="911" id="html5_tel"/>
335
+ </p>
336
+ <p>
337
+ <label for="html5_color">Html5 Color</label>
338
+ <input type="color" name="form[html5_color]" value="#FFFFFF" id="html5_color"/>
339
+ </p>
340
+
341
+ <p>
342
+ <input type="submit" name="form[html5_submit]" value="html5_submit"/>
343
+ </p>
344
+ </form>
345
+
346
+ <form action="/form" method="post">
347
+ <p>
348
+ <button type="submit" name="form[button]" value="button_first">Just an input that came first</button>
349
+ <button type="submit" name="form[button]" value="button_second">Just an input</button>
350
+ <input type="submit" name="form[button]" value="Just a button that came first"/>
351
+ <input type="submit" name="form[button]" value="Just a button"/>
352
+ </p>
353
+ </form>
354
+
355
+ <form action="relative" method="post">
356
+ <p>
357
+ <input type="submit" name="form[relative]" value="Relative Action" />
358
+ </p>
359
+ </form>
360
+
361
+ <form method="post">
362
+ <p>
363
+ <input type="submit" name="form[no_action]" value="No Action" />
364
+ </p>
365
+ </form>
@@ -0,0 +1,8 @@
1
+ <html>
2
+ <head>
3
+ <title>This is the title of frame one</title>
4
+ </head>
5
+ <body>
6
+ <div id="divInFrameOne">This is the text of divInFrameOne</div>
7
+ </body>
8
+ </html>
@@ -0,0 +1,8 @@
1
+ <html>
2
+ <head>
3
+ <title>This is the title of frame two</title>
4
+ </head>
5
+ <body>
6
+ <div id="divInFrameTwo">This is the text of divInFrameTwo</div>
7
+ </body>
8
+ </html>
@@ -0,0 +1,7 @@
1
+ <p>
2
+ <a href="/get_header">Link</a>
3
+ </p>
4
+
5
+ <form action="/get_header" method="get">
6
+ <p><input type="submit" value="Post"/></p>
7
+ </form>
@@ -0,0 +1,12 @@
1
+ <p>
2
+ <a href="/host">Relative Host</a>
3
+ <a href="http://capybara2.elabs.se/host">Absolute Host</a>
4
+ </p>
5
+
6
+ <form action="/host">
7
+ <p><input type="submit" value="Relative Host"/></p>
8
+ </form>
9
+
10
+ <form action="http://capybara2.elabs.se/host">
11
+ <p><input type="submit" value="Absolute Host"/></p>
12
+ </form>
@@ -0,0 +1,8 @@
1
+ <html>
2
+ <head>
3
+ <title>This is the title of the first popup</title>
4
+ </head>
5
+ <body>
6
+ <div id="divInPopupOne">This is the text of divInPopupOne</div>
7
+ </body>
8
+ </html>