capybara 3.32.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (313) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +1 -0
  3. data/History.md +1813 -0
  4. data/License.txt +22 -0
  5. data/README.md +1099 -0
  6. data/lib/capybara.rb +511 -0
  7. data/lib/capybara/config.rb +94 -0
  8. data/lib/capybara/cucumber.rb +27 -0
  9. data/lib/capybara/driver/base.rb +170 -0
  10. data/lib/capybara/driver/node.rb +139 -0
  11. data/lib/capybara/dsl.rb +65 -0
  12. data/lib/capybara/helpers.rb +108 -0
  13. data/lib/capybara/minitest.rb +386 -0
  14. data/lib/capybara/minitest/spec.rb +264 -0
  15. data/lib/capybara/node/actions.rb +420 -0
  16. data/lib/capybara/node/base.rb +143 -0
  17. data/lib/capybara/node/document.rb +48 -0
  18. data/lib/capybara/node/document_matchers.rb +67 -0
  19. data/lib/capybara/node/element.rb +606 -0
  20. data/lib/capybara/node/finders.rb +325 -0
  21. data/lib/capybara/node/matchers.rb +883 -0
  22. data/lib/capybara/node/simple.rb +208 -0
  23. data/lib/capybara/queries/ancestor_query.rb +27 -0
  24. data/lib/capybara/queries/base_query.rb +106 -0
  25. data/lib/capybara/queries/current_path_query.rb +51 -0
  26. data/lib/capybara/queries/match_query.rb +26 -0
  27. data/lib/capybara/queries/selector_query.rb +710 -0
  28. data/lib/capybara/queries/sibling_query.rb +26 -0
  29. data/lib/capybara/queries/style_query.rb +45 -0
  30. data/lib/capybara/queries/text_query.rb +110 -0
  31. data/lib/capybara/queries/title_query.rb +39 -0
  32. data/lib/capybara/rack_test/browser.rb +140 -0
  33. data/lib/capybara/rack_test/css_handlers.rb +13 -0
  34. data/lib/capybara/rack_test/driver.rb +109 -0
  35. data/lib/capybara/rack_test/errors.rb +6 -0
  36. data/lib/capybara/rack_test/form.rb +127 -0
  37. data/lib/capybara/rack_test/node.rb +325 -0
  38. data/lib/capybara/rails.rb +16 -0
  39. data/lib/capybara/registrations/drivers.rb +36 -0
  40. data/lib/capybara/registrations/patches/puma_ssl.rb +27 -0
  41. data/lib/capybara/registrations/servers.rb +44 -0
  42. data/lib/capybara/result.rb +190 -0
  43. data/lib/capybara/rspec.rb +29 -0
  44. data/lib/capybara/rspec/features.rb +23 -0
  45. data/lib/capybara/rspec/matcher_proxies.rb +82 -0
  46. data/lib/capybara/rspec/matchers.rb +201 -0
  47. data/lib/capybara/rspec/matchers/base.rb +111 -0
  48. data/lib/capybara/rspec/matchers/become_closed.rb +33 -0
  49. data/lib/capybara/rspec/matchers/compound.rb +88 -0
  50. data/lib/capybara/rspec/matchers/count_sugar.rb +37 -0
  51. data/lib/capybara/rspec/matchers/have_ancestor.rb +28 -0
  52. data/lib/capybara/rspec/matchers/have_current_path.rb +29 -0
  53. data/lib/capybara/rspec/matchers/have_selector.rb +77 -0
  54. data/lib/capybara/rspec/matchers/have_sibling.rb +27 -0
  55. data/lib/capybara/rspec/matchers/have_text.rb +33 -0
  56. data/lib/capybara/rspec/matchers/have_title.rb +29 -0
  57. data/lib/capybara/rspec/matchers/match_selector.rb +27 -0
  58. data/lib/capybara/rspec/matchers/match_style.rb +38 -0
  59. data/lib/capybara/rspec/matchers/spatial_sugar.rb +39 -0
  60. data/lib/capybara/selector.rb +233 -0
  61. data/lib/capybara/selector/builders/css_builder.rb +84 -0
  62. data/lib/capybara/selector/builders/xpath_builder.rb +69 -0
  63. data/lib/capybara/selector/css.rb +102 -0
  64. data/lib/capybara/selector/definition.rb +276 -0
  65. data/lib/capybara/selector/definition/button.rb +51 -0
  66. data/lib/capybara/selector/definition/checkbox.rb +26 -0
  67. data/lib/capybara/selector/definition/css.rb +10 -0
  68. data/lib/capybara/selector/definition/datalist_input.rb +35 -0
  69. data/lib/capybara/selector/definition/datalist_option.rb +25 -0
  70. data/lib/capybara/selector/definition/element.rb +27 -0
  71. data/lib/capybara/selector/definition/field.rb +40 -0
  72. data/lib/capybara/selector/definition/fieldset.rb +14 -0
  73. data/lib/capybara/selector/definition/file_field.rb +13 -0
  74. data/lib/capybara/selector/definition/fillable_field.rb +33 -0
  75. data/lib/capybara/selector/definition/frame.rb +17 -0
  76. data/lib/capybara/selector/definition/id.rb +6 -0
  77. data/lib/capybara/selector/definition/label.rb +62 -0
  78. data/lib/capybara/selector/definition/link.rb +46 -0
  79. data/lib/capybara/selector/definition/link_or_button.rb +16 -0
  80. data/lib/capybara/selector/definition/option.rb +27 -0
  81. data/lib/capybara/selector/definition/radio_button.rb +27 -0
  82. data/lib/capybara/selector/definition/select.rb +81 -0
  83. data/lib/capybara/selector/definition/table.rb +109 -0
  84. data/lib/capybara/selector/definition/table_row.rb +21 -0
  85. data/lib/capybara/selector/definition/xpath.rb +5 -0
  86. data/lib/capybara/selector/filter.rb +5 -0
  87. data/lib/capybara/selector/filter_set.rb +124 -0
  88. data/lib/capybara/selector/filters/base.rb +77 -0
  89. data/lib/capybara/selector/filters/expression_filter.rb +22 -0
  90. data/lib/capybara/selector/filters/locator_filter.rb +29 -0
  91. data/lib/capybara/selector/filters/node_filter.rb +31 -0
  92. data/lib/capybara/selector/regexp_disassembler.rb +214 -0
  93. data/lib/capybara/selector/selector.rb +147 -0
  94. data/lib/capybara/selector/xpath_extensions.rb +17 -0
  95. data/lib/capybara/selenium/atoms/getAttribute.min.js +1 -0
  96. data/lib/capybara/selenium/atoms/isDisplayed.min.js +1 -0
  97. data/lib/capybara/selenium/atoms/src/getAttribute.js +161 -0
  98. data/lib/capybara/selenium/atoms/src/isDisplayed.js +454 -0
  99. data/lib/capybara/selenium/driver.rb +496 -0
  100. data/lib/capybara/selenium/driver_specializations/chrome_driver.rb +119 -0
  101. data/lib/capybara/selenium/driver_specializations/edge_driver.rb +126 -0
  102. data/lib/capybara/selenium/driver_specializations/firefox_driver.rb +89 -0
  103. data/lib/capybara/selenium/driver_specializations/internet_explorer_driver.rb +26 -0
  104. data/lib/capybara/selenium/driver_specializations/safari_driver.rb +24 -0
  105. data/lib/capybara/selenium/extensions/file_input_click_emulation.rb +34 -0
  106. data/lib/capybara/selenium/extensions/find.rb +110 -0
  107. data/lib/capybara/selenium/extensions/html5_drag.rb +228 -0
  108. data/lib/capybara/selenium/extensions/modifier_keys_stack.rb +28 -0
  109. data/lib/capybara/selenium/extensions/scroll.rb +78 -0
  110. data/lib/capybara/selenium/logger_suppressor.rb +34 -0
  111. data/lib/capybara/selenium/node.rb +610 -0
  112. data/lib/capybara/selenium/nodes/chrome_node.rb +119 -0
  113. data/lib/capybara/selenium/nodes/edge_node.rb +104 -0
  114. data/lib/capybara/selenium/nodes/firefox_node.rb +131 -0
  115. data/lib/capybara/selenium/nodes/ie_node.rb +22 -0
  116. data/lib/capybara/selenium/nodes/safari_node.rb +118 -0
  117. data/lib/capybara/selenium/patches/action_pauser.rb +26 -0
  118. data/lib/capybara/selenium/patches/atoms.rb +18 -0
  119. data/lib/capybara/selenium/patches/is_displayed.rb +16 -0
  120. data/lib/capybara/selenium/patches/logs.rb +47 -0
  121. data/lib/capybara/selenium/patches/pause_duration_fix.rb +9 -0
  122. data/lib/capybara/selenium/patches/persistent_client.rb +20 -0
  123. data/lib/capybara/server.rb +126 -0
  124. data/lib/capybara/server/animation_disabler.rb +58 -0
  125. data/lib/capybara/server/checker.rb +44 -0
  126. data/lib/capybara/server/middleware.rb +69 -0
  127. data/lib/capybara/session.rb +942 -0
  128. data/lib/capybara/session/config.rb +124 -0
  129. data/lib/capybara/session/matchers.rb +87 -0
  130. data/lib/capybara/spec/fixtures/another_test_file.txt +1 -0
  131. data/lib/capybara/spec/fixtures/capybara.jpg +3 -0
  132. data/lib/capybara/spec/fixtures/no_extension +1 -0
  133. data/lib/capybara/spec/fixtures/test_file.txt +1 -0
  134. data/lib/capybara/spec/public/jquery-ui.js +13 -0
  135. data/lib/capybara/spec/public/jquery.js +5 -0
  136. data/lib/capybara/spec/public/offset.js +6 -0
  137. data/lib/capybara/spec/public/test.js +268 -0
  138. data/lib/capybara/spec/session/accept_alert_spec.rb +81 -0
  139. data/lib/capybara/spec/session/accept_confirm_spec.rb +32 -0
  140. data/lib/capybara/spec/session/accept_prompt_spec.rb +78 -0
  141. data/lib/capybara/spec/session/all_spec.rb +278 -0
  142. data/lib/capybara/spec/session/ancestor_spec.rb +88 -0
  143. data/lib/capybara/spec/session/assert_all_of_selectors_spec.rb +140 -0
  144. data/lib/capybara/spec/session/assert_current_path_spec.rb +75 -0
  145. data/lib/capybara/spec/session/assert_selector_spec.rb +143 -0
  146. data/lib/capybara/spec/session/assert_style_spec.rb +26 -0
  147. data/lib/capybara/spec/session/assert_text_spec.rb +258 -0
  148. data/lib/capybara/spec/session/assert_title_spec.rb +93 -0
  149. data/lib/capybara/spec/session/attach_file_spec.rb +216 -0
  150. data/lib/capybara/spec/session/body_spec.rb +23 -0
  151. data/lib/capybara/spec/session/check_spec.rb +235 -0
  152. data/lib/capybara/spec/session/choose_spec.rb +121 -0
  153. data/lib/capybara/spec/session/click_button_spec.rb +506 -0
  154. data/lib/capybara/spec/session/click_link_or_button_spec.rb +129 -0
  155. data/lib/capybara/spec/session/click_link_spec.rb +229 -0
  156. data/lib/capybara/spec/session/current_scope_spec.rb +31 -0
  157. data/lib/capybara/spec/session/current_url_spec.rb +115 -0
  158. data/lib/capybara/spec/session/dismiss_confirm_spec.rb +36 -0
  159. data/lib/capybara/spec/session/dismiss_prompt_spec.rb +21 -0
  160. data/lib/capybara/spec/session/element/assert_match_selector_spec.rb +38 -0
  161. data/lib/capybara/spec/session/element/match_css_spec.rb +31 -0
  162. data/lib/capybara/spec/session/element/match_xpath_spec.rb +25 -0
  163. data/lib/capybara/spec/session/element/matches_selector_spec.rb +120 -0
  164. data/lib/capybara/spec/session/evaluate_async_script_spec.rb +23 -0
  165. data/lib/capybara/spec/session/evaluate_script_spec.rb +49 -0
  166. data/lib/capybara/spec/session/execute_script_spec.rb +28 -0
  167. data/lib/capybara/spec/session/fill_in_spec.rb +286 -0
  168. data/lib/capybara/spec/session/find_button_spec.rb +74 -0
  169. data/lib/capybara/spec/session/find_by_id_spec.rb +33 -0
  170. data/lib/capybara/spec/session/find_field_spec.rb +113 -0
  171. data/lib/capybara/spec/session/find_link_spec.rb +70 -0
  172. data/lib/capybara/spec/session/find_spec.rb +531 -0
  173. data/lib/capybara/spec/session/first_spec.rb +156 -0
  174. data/lib/capybara/spec/session/frame/frame_title_spec.rb +23 -0
  175. data/lib/capybara/spec/session/frame/frame_url_spec.rb +23 -0
  176. data/lib/capybara/spec/session/frame/switch_to_frame_spec.rb +116 -0
  177. data/lib/capybara/spec/session/frame/within_frame_spec.rb +112 -0
  178. data/lib/capybara/spec/session/go_back_spec.rb +12 -0
  179. data/lib/capybara/spec/session/go_forward_spec.rb +14 -0
  180. data/lib/capybara/spec/session/has_all_selectors_spec.rb +69 -0
  181. data/lib/capybara/spec/session/has_ancestor_spec.rb +46 -0
  182. data/lib/capybara/spec/session/has_any_selectors_spec.rb +25 -0
  183. data/lib/capybara/spec/session/has_button_spec.rb +69 -0
  184. data/lib/capybara/spec/session/has_css_spec.rb +374 -0
  185. data/lib/capybara/spec/session/has_current_path_spec.rb +138 -0
  186. data/lib/capybara/spec/session/has_field_spec.rb +349 -0
  187. data/lib/capybara/spec/session/has_link_spec.rb +39 -0
  188. data/lib/capybara/spec/session/has_none_selectors_spec.rb +78 -0
  189. data/lib/capybara/spec/session/has_select_spec.rb +310 -0
  190. data/lib/capybara/spec/session/has_selector_spec.rb +202 -0
  191. data/lib/capybara/spec/session/has_sibling_spec.rb +50 -0
  192. data/lib/capybara/spec/session/has_table_spec.rb +198 -0
  193. data/lib/capybara/spec/session/has_text_spec.rb +394 -0
  194. data/lib/capybara/spec/session/has_title_spec.rb +71 -0
  195. data/lib/capybara/spec/session/has_xpath_spec.rb +149 -0
  196. data/lib/capybara/spec/session/headers_spec.rb +8 -0
  197. data/lib/capybara/spec/session/html_spec.rb +47 -0
  198. data/lib/capybara/spec/session/matches_style_spec.rb +35 -0
  199. data/lib/capybara/spec/session/node_spec.rb +1292 -0
  200. data/lib/capybara/spec/session/node_wrapper_spec.rb +39 -0
  201. data/lib/capybara/spec/session/refresh_spec.rb +33 -0
  202. data/lib/capybara/spec/session/reset_session_spec.rb +148 -0
  203. data/lib/capybara/spec/session/response_code_spec.rb +8 -0
  204. data/lib/capybara/spec/session/save_and_open_page_spec.rb +21 -0
  205. data/lib/capybara/spec/session/save_and_open_screenshot_spec.rb +43 -0
  206. data/lib/capybara/spec/session/save_page_spec.rb +110 -0
  207. data/lib/capybara/spec/session/save_screenshot_spec.rb +55 -0
  208. data/lib/capybara/spec/session/screenshot_spec.rb +18 -0
  209. data/lib/capybara/spec/session/scroll_spec.rb +117 -0
  210. data/lib/capybara/spec/session/select_spec.rb +229 -0
  211. data/lib/capybara/spec/session/selectors_spec.rb +98 -0
  212. data/lib/capybara/spec/session/sibling_spec.rb +52 -0
  213. data/lib/capybara/spec/session/source_spec.rb +0 -0
  214. data/lib/capybara/spec/session/text_spec.rb +74 -0
  215. data/lib/capybara/spec/session/title_spec.rb +29 -0
  216. data/lib/capybara/spec/session/uncheck_spec.rb +100 -0
  217. data/lib/capybara/spec/session/unselect_spec.rb +116 -0
  218. data/lib/capybara/spec/session/visit_spec.rb +204 -0
  219. data/lib/capybara/spec/session/window/become_closed_spec.rb +89 -0
  220. data/lib/capybara/spec/session/window/current_window_spec.rb +28 -0
  221. data/lib/capybara/spec/session/window/open_new_window_spec.rb +31 -0
  222. data/lib/capybara/spec/session/window/switch_to_window_spec.rb +132 -0
  223. data/lib/capybara/spec/session/window/window_opened_by_spec.rb +99 -0
  224. data/lib/capybara/spec/session/window/window_spec.rb +203 -0
  225. data/lib/capybara/spec/session/window/windows_spec.rb +34 -0
  226. data/lib/capybara/spec/session/window/within_window_spec.rb +157 -0
  227. data/lib/capybara/spec/session/within_spec.rb +199 -0
  228. data/lib/capybara/spec/spec_helper.rb +134 -0
  229. data/lib/capybara/spec/test_app.rb +226 -0
  230. data/lib/capybara/spec/views/animated.erb +49 -0
  231. data/lib/capybara/spec/views/buttons.erb +5 -0
  232. data/lib/capybara/spec/views/fieldsets.erb +30 -0
  233. data/lib/capybara/spec/views/form.erb +685 -0
  234. data/lib/capybara/spec/views/frame_child.erb +18 -0
  235. data/lib/capybara/spec/views/frame_one.erb +10 -0
  236. data/lib/capybara/spec/views/frame_parent.erb +9 -0
  237. data/lib/capybara/spec/views/frame_two.erb +9 -0
  238. data/lib/capybara/spec/views/header_links.erb +8 -0
  239. data/lib/capybara/spec/views/host_links.erb +13 -0
  240. data/lib/capybara/spec/views/initial_alert.erb +10 -0
  241. data/lib/capybara/spec/views/obscured.erb +47 -0
  242. data/lib/capybara/spec/views/offset.erb +32 -0
  243. data/lib/capybara/spec/views/path.erb +13 -0
  244. data/lib/capybara/spec/views/popup_one.erb +9 -0
  245. data/lib/capybara/spec/views/popup_two.erb +9 -0
  246. data/lib/capybara/spec/views/postback.erb +14 -0
  247. data/lib/capybara/spec/views/react.erb +45 -0
  248. data/lib/capybara/spec/views/scroll.erb +20 -0
  249. data/lib/capybara/spec/views/spatial.erb +31 -0
  250. data/lib/capybara/spec/views/tables.erb +130 -0
  251. data/lib/capybara/spec/views/with_animation.erb +74 -0
  252. data/lib/capybara/spec/views/with_base_tag.erb +11 -0
  253. data/lib/capybara/spec/views/with_count.erb +8 -0
  254. data/lib/capybara/spec/views/with_dragula.erb +22 -0
  255. data/lib/capybara/spec/views/with_fixed_header_footer.erb +17 -0
  256. data/lib/capybara/spec/views/with_hover.erb +24 -0
  257. data/lib/capybara/spec/views/with_hover1.erb +10 -0
  258. data/lib/capybara/spec/views/with_html.erb +208 -0
  259. data/lib/capybara/spec/views/with_html5_svg.erb +20 -0
  260. data/lib/capybara/spec/views/with_html_entities.erb +2 -0
  261. data/lib/capybara/spec/views/with_js.erb +160 -0
  262. data/lib/capybara/spec/views/with_jstree.erb +26 -0
  263. data/lib/capybara/spec/views/with_namespace.erb +20 -0
  264. data/lib/capybara/spec/views/with_scope.erb +42 -0
  265. data/lib/capybara/spec/views/with_scope_other.erb +6 -0
  266. data/lib/capybara/spec/views/with_simple_html.erb +2 -0
  267. data/lib/capybara/spec/views/with_slow_unload.erb +17 -0
  268. data/lib/capybara/spec/views/with_sortable_js.erb +21 -0
  269. data/lib/capybara/spec/views/with_title.erb +5 -0
  270. data/lib/capybara/spec/views/with_unload_alert.erb +14 -0
  271. data/lib/capybara/spec/views/with_windows.erb +54 -0
  272. data/lib/capybara/spec/views/within_frames.erb +15 -0
  273. data/lib/capybara/version.rb +5 -0
  274. data/lib/capybara/window.rb +146 -0
  275. data/spec/basic_node_spec.rb +154 -0
  276. data/spec/capybara_spec.rb +112 -0
  277. data/spec/css_builder_spec.rb +101 -0
  278. data/spec/css_splitter_spec.rb +38 -0
  279. data/spec/dsl_spec.rb +276 -0
  280. data/spec/filter_set_spec.rb +46 -0
  281. data/spec/fixtures/capybara.csv +1 -0
  282. data/spec/fixtures/certificate.pem +25 -0
  283. data/spec/fixtures/key.pem +27 -0
  284. data/spec/fixtures/selenium_driver_rspec_failure.rb +13 -0
  285. data/spec/fixtures/selenium_driver_rspec_success.rb +13 -0
  286. data/spec/minitest_spec.rb +163 -0
  287. data/spec/minitest_spec_spec.rb +162 -0
  288. data/spec/per_session_config_spec.rb +68 -0
  289. data/spec/rack_test_spec.rb +268 -0
  290. data/spec/regexp_dissassembler_spec.rb +250 -0
  291. data/spec/result_spec.rb +196 -0
  292. data/spec/rspec/features_spec.rb +99 -0
  293. data/spec/rspec/scenarios_spec.rb +19 -0
  294. data/spec/rspec/shared_spec_matchers.rb +947 -0
  295. data/spec/rspec/views_spec.rb +14 -0
  296. data/spec/rspec_matchers_spec.rb +62 -0
  297. data/spec/rspec_spec.rb +145 -0
  298. data/spec/sauce_spec_chrome.rb +43 -0
  299. data/spec/selector_spec.rb +513 -0
  300. data/spec/selenium_spec_chrome.rb +188 -0
  301. data/spec/selenium_spec_chrome_remote.rb +96 -0
  302. data/spec/selenium_spec_edge.rb +47 -0
  303. data/spec/selenium_spec_firefox.rb +208 -0
  304. data/spec/selenium_spec_firefox_remote.rb +80 -0
  305. data/spec/selenium_spec_ie.rb +150 -0
  306. data/spec/selenium_spec_safari.rb +148 -0
  307. data/spec/server_spec.rb +292 -0
  308. data/spec/session_spec.rb +91 -0
  309. data/spec/shared_selenium_node.rb +83 -0
  310. data/spec/shared_selenium_session.rb +476 -0
  311. data/spec/spec_helper.rb +100 -0
  312. data/spec/xpath_builder_spec.rb +93 -0
  313. metadata +753 -0
@@ -0,0 +1,226 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'sinatra/base'
4
+ require 'tilt/erb'
5
+ require 'rack'
6
+ require 'yaml'
7
+
8
+ class TestApp < Sinatra::Base
9
+ class TestAppError < Exception; end # rubocop:disable Lint/InheritException
10
+ class TestAppOtherError < Exception # rubocop:disable Lint/InheritException
11
+ def initialize(string1, msg)
12
+ @something = string1
13
+ @message = msg
14
+ end
15
+ end
16
+ set :root, File.dirname(__FILE__)
17
+ set :static, true
18
+ set :raise_errors, true
19
+ set :show_exceptions, false
20
+
21
+ # Also check lib/capybara/spec/views/*.erb for pages not listed here
22
+
23
+ get '/' do
24
+ response.set_cookie('capybara', value: 'root cookie', domain: request.host, path: request.path)
25
+ 'Hello world! <a href="with_html">Relative</a>'
26
+ end
27
+
28
+ get '/foo' do
29
+ 'Another World'
30
+ end
31
+
32
+ get '/redirect' do
33
+ redirect '/redirect_again'
34
+ end
35
+
36
+ get '/redirect_again' do
37
+ redirect '/landed'
38
+ end
39
+
40
+ post '/redirect_307' do
41
+ redirect '/landed', 307
42
+ end
43
+
44
+ post '/redirect_308' do
45
+ redirect '/landed', 308
46
+ end
47
+
48
+ get '/referer_base' do
49
+ '<a href="/get_referer">direct link</a>' \
50
+ '<a href="/redirect_to_get_referer">link via redirect</a>' \
51
+ '<form action="/get_referer" method="get"><input type="submit"></form>'
52
+ end
53
+
54
+ get '/redirect_to_get_referer' do
55
+ redirect '/get_referer'
56
+ end
57
+
58
+ get '/get_referer' do
59
+ request.referer.nil? ? 'No referer' : "Got referer: #{request.referer}"
60
+ end
61
+
62
+ get '/host' do
63
+ "Current host is #{request.scheme}://#{request.host}:#{request.port}"
64
+ end
65
+
66
+ get '/redirect/:times/times' do
67
+ times = params[:times].to_i
68
+ if times.zero?
69
+ 'redirection complete'
70
+ else
71
+ redirect "/redirect/#{times - 1}/times"
72
+ end
73
+ end
74
+
75
+ get '/landed' do
76
+ 'You landed'
77
+ end
78
+
79
+ post '/landed' do
80
+ "You post landed: #{params.dig(:form, 'data')}"
81
+ end
82
+
83
+ get '/with-quotes' do
84
+ %q("No," he said, "you can't do that.")
85
+ end
86
+
87
+ get '/form/get' do
88
+ '<pre id="results">' + params[:form].to_yaml + '</pre>'
89
+ end
90
+
91
+ post '/relative' do
92
+ '<pre id="results">' + params[:form].to_yaml + '</pre>'
93
+ end
94
+
95
+ get '/favicon.ico' do
96
+ nil
97
+ end
98
+
99
+ post '/redirect' do
100
+ redirect '/redirect_again'
101
+ end
102
+
103
+ delete '/delete' do
104
+ 'The requested object was deleted'
105
+ end
106
+
107
+ get '/delete' do
108
+ 'Not deleted'
109
+ end
110
+
111
+ get '/redirect_back' do
112
+ redirect back
113
+ end
114
+
115
+ get '/redirect_secure' do
116
+ redirect "https://#{request.host}:#{request.port}/host"
117
+ end
118
+
119
+ get '/slow_response' do
120
+ sleep 2
121
+ 'Finally!'
122
+ end
123
+
124
+ get '/set_cookie' do
125
+ cookie_value = 'test_cookie'
126
+ response.set_cookie('capybara', cookie_value)
127
+ "Cookie set to #{cookie_value}"
128
+ end
129
+
130
+ get '/get_cookie' do
131
+ request.cookies['capybara']
132
+ end
133
+
134
+ get '/get_header' do
135
+ env['HTTP_FOO']
136
+ end
137
+
138
+ get '/get_header_via_redirect' do
139
+ redirect '/get_header'
140
+ end
141
+
142
+ get '/error' do
143
+ raise TestAppError, 'some error'
144
+ end
145
+
146
+ get '/other_error' do
147
+ raise TestAppOtherError.new('something', 'other error')
148
+ end
149
+
150
+ get '/load_error' do
151
+ raise LoadError
152
+ end
153
+
154
+ get '/with.*html' do
155
+ erb :with_html, locals: { referrer: request.referrer }
156
+ end
157
+
158
+ get '/with_title' do
159
+ <<-HTML
160
+ <title>#{params[:title] || 'Test Title'}</title>
161
+ <body>
162
+ <svg><title>abcdefg</title></svg>
163
+ </body>
164
+ HTML
165
+ end
166
+
167
+ get '/download.csv' do
168
+ content_type 'text/csv'
169
+ 'This, is, comma, separated' \
170
+ 'Thomas, Walpole, was , here'
171
+ end
172
+
173
+ get '/:view' do |view|
174
+ erb view.to_sym, locals: { referrer: request.referrer }
175
+ end
176
+
177
+ post '/form' do
178
+ self.class.form_post_count += 1
179
+ '<pre id="results">' + params[:form].merge('post_count' => self.class.form_post_count).to_yaml + '</pre>'
180
+ end
181
+
182
+ post '/upload_empty' do
183
+ if params[:form][:file].nil?
184
+ 'Successfully ignored empty file field.'
185
+ else
186
+ 'Something went wrong.'
187
+ end
188
+ end
189
+
190
+ post '/upload' do
191
+ begin
192
+ buffer = []
193
+ buffer << "Content-type: #{params.dig(:form, :document, :type)}"
194
+ buffer << "File content: #{params.dig(:form, :document, :tempfile).read}"
195
+ buffer.join(' | ')
196
+ rescue StandardError
197
+ 'No file uploaded'
198
+ end
199
+ end
200
+
201
+ post '/upload_multiple' do
202
+ begin
203
+ docs = params.dig(:form, :multiple_documents)
204
+ buffer = [docs.size.to_s]
205
+ docs.each do |doc|
206
+ buffer << "Content-type: #{doc[:type]}"
207
+ buffer << "File content: #{doc[:tempfile].read}"
208
+ end
209
+ buffer.join(' | ')
210
+ rescue StandardError
211
+ 'No files uploaded'
212
+ end
213
+ end
214
+
215
+ get '/apple-touch-icon-precomposed.png' do
216
+ halt(404)
217
+ end
218
+
219
+ class << self
220
+ attr_accessor :form_post_count
221
+ end
222
+
223
+ @form_post_count = 0
224
+ end
225
+
226
+ Rack::Handler::Puma.run TestApp, Port: 8070 if $PROGRAM_NAME == __FILE__
@@ -0,0 +1,49 @@
1
+ <html>
2
+ <head>
3
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
4
+ <title>with_animation</title>
5
+ <script src="/jquery.js" type="text/javascript" charset="utf-8"></script>
6
+ <script>
7
+ $(document).on('contextmenu', function(e){ e.preventDefault(); });
8
+ </script>
9
+ <style>
10
+ div {
11
+ width: 400px;
12
+ height: 400px;
13
+ position: absolute;
14
+ }
15
+ #obscured {
16
+ z-index: 1;
17
+ background-color: red;
18
+ }
19
+ #cover {
20
+ z-index: 2;
21
+ background-color: blue;
22
+ }
23
+ #offscreen {
24
+ top: 2000px;
25
+ left: 2000px;
26
+ background-color: green;
27
+ }
28
+ #offscreen_wrapper {
29
+ top: 2000px;
30
+ left: 2000px;
31
+ overflow-x: scroll;
32
+ background-color: yellow;
33
+ }
34
+ </style>
35
+ </head>
36
+
37
+ <body id="with_animation">
38
+ <div id="obscured">
39
+ <input id="obscured_input"/>
40
+ </div>
41
+ <div id="cover"></div>
42
+ <div id="offscreen_wrapper">
43
+ <div id="offscreen"></div>
44
+ </div>
45
+ </body>
46
+
47
+ <iframe id="frameOne" src="/frame_one"></iframe>
48
+ </html>
49
+
@@ -0,0 +1,5 @@
1
+
2
+ <h1>Buttons</h1>
3
+ <button>Click me!</button>
4
+ <button id="click_me_123">Click me by id!</button>
5
+ <button value="click_me">Click me by value!</button>
@@ -0,0 +1,30 @@
1
+
2
+ <form action="/form" method="post">
3
+ <fieldset id="agent_fieldset">
4
+ <legend>Agent</legend>
5
+
6
+ <p>
7
+ <label for="form_agent_name">Name</label>
8
+ <input type="text" name="form[agent_name]" value="James" id="form_agent_name"/>
9
+ </p>
10
+
11
+ <p>
12
+ <input type="submit" value="Create"/>
13
+ </p>
14
+ </fieldset>
15
+ </form>
16
+
17
+ <form action="/form" method="post">
18
+ <fieldset id="villain_fieldset">
19
+ <legend>Villain</legend>
20
+
21
+ <p>
22
+ <label for="form_villain_name">Name</label>
23
+ <input type="text" name="form[villain_name]" value="Ernst" id="form_villain_name"/>
24
+ </p>
25
+
26
+ <p>
27
+ <input type="submit" value="Create"/>
28
+ </p>
29
+ </fieldset>
30
+ </form>
@@ -0,0 +1,685 @@
1
+
2
+ <h1>Form</h1>
3
+
4
+ <form action="/form" method="post" novalidate>
5
+
6
+ <p>
7
+ <label for="form_title">Title</label>
8
+ <select name="form[title]" id="form_title" class="title">
9
+ <option class="title">Mrs</option>
10
+ <option class="title">Mr</option>
11
+ <option>Miss</option>
12
+ <option disabled="disabled">Other</option>
13
+ </select>
14
+ </p>
15
+
16
+ <p>
17
+ <label for="customer_name">Customer Name
18
+ <input type="text" name="form[customer_name]" value="Blah" id="customer_name" disabled="disabled"/>
19
+ </label>
20
+ </p>
21
+
22
+ <p>
23
+ <label for="customer_email">Customer Email
24
+ <input type="text" name="form[customer_email]" value="ben@ben.com" id="customer_email"/>
25
+ </label>
26
+ </p>
27
+
28
+ <p>
29
+ <label for="customer_other_email">Customer Other Email
30
+ <input type="text" name="form[customer_other_email]" value="notben@notben.com" id="customer_other_email"/>
31
+ </label>
32
+ </p>
33
+
34
+ <p>
35
+ <label for="form_other_title">Other title</label>
36
+ <select name="form[other_title]" id="form_other_title">
37
+ <option>Mrs</option>
38
+ <option>Mr</option>
39
+ <option>Miss</option>
40
+ </select>
41
+ </p>
42
+
43
+ <p>
44
+ <label for="form_first_name">
45
+ First Name
46
+ <input type="text" name="form[first_name]" value="John" id="form_first_name" placeholder="FirstName"/>
47
+ </label>
48
+ </p>
49
+
50
+ <p>
51
+ <label for="form_last_name">Last Name</label>
52
+ <input type="text" name="form[last_name]" value="Smith" id="form_last_name"/>
53
+ </p>
54
+
55
+ <p>
56
+ <label for="form_name_explanation">Explanation of Name</label>
57
+ <textarea name="form[name_explanation]" id="form_name_explanation"></textarea>
58
+ </p>
59
+
60
+ <p>
61
+ <label for="form_name">Name</label>
62
+ <input type="text" name="form[name]" value="John Smith" id="form_name"/>
63
+ </p>
64
+
65
+ <p>
66
+ <label for="form_age">Age</label>
67
+ <input type="range" name="form[age]" value="18" min="13" max="100" step="0.5" id="form_age"/>
68
+ </p>
69
+
70
+ <p>
71
+ <label for="form_schmooo">Schmooo</label>
72
+ <input type="schmooo" name="form[schmooo]" value="This is Schmooo!" id="form_schmooo"/>
73
+ </p>
74
+
75
+ <p>
76
+ <label>Street<br/>
77
+ <input type="text" maxlength="" name="form[street]" value="Sesame street 66"/>
78
+ </label>
79
+ </p>
80
+
81
+ <p>
82
+ <label for="form_phone">Phone</label>
83
+ <input name="form[phone]" value="+1 555 7021" id="form_phone"/>
84
+ </p>
85
+
86
+ <p>
87
+ <label for="form_password">Password</label>
88
+ <input type="password" name="form[password]" value="seeekrit" id="form_password"/>
89
+ </p>
90
+
91
+ <p>
92
+ <label for="form_terms_of_use">Terms of Use</label>
93
+ <input type="hidden" name="form[terms_of_use]" value="0" id="form_terms_of_use_default">
94
+ <input type="checkbox" name="form[terms_of_use]" value="1" id="form_terms_of_use">
95
+ </p>
96
+
97
+ <p>
98
+ <label for="form_image">Image</label>
99
+ <input type="file" name="form[image]" id="form_image"/>
100
+ </p>
101
+
102
+ <p>
103
+ <label for="form_hidden_image">Hidden Image</label>
104
+ <input type="file" name="form[hidden_image]" id="form_hidden_image" style="display: none"/>
105
+ </p>
106
+
107
+ <p>
108
+ <input type="hidden" name="form[token]" value="12345" id="form_token"/>
109
+ </p>
110
+
111
+ <p>
112
+ <label for="form_locale">Locale</label>
113
+ <select name="form[locale]" id="form_locale">
114
+ <option value="sv">Swedish</option>
115
+ <option selected="selected" value="en">English</option>
116
+ <option value="fi">Finnish</option>
117
+ <option value="no">Norwegian</option>
118
+ <option value="jo">John's made-up language</option>
119
+ <option value="jbo"> Lojban </option>
120
+ </select>
121
+ </p>
122
+
123
+ <p>
124
+ <label for="form_region">Region</label>
125
+ <select name="form[region]" id="form_region">
126
+ <option>Sweden</option>
127
+ <option selected="selected">Norway</option>
128
+ <option>Finland</option>
129
+ </select>
130
+ </p>
131
+
132
+ <p>
133
+ <label for="form_city">City</label>
134
+ <select name="form[city]" id="form_city">
135
+ <option>London</option>
136
+ <option>Stockholm</option>
137
+ <option>Paris</option>
138
+ </select>
139
+ </p>
140
+
141
+ <p>
142
+ <label for="form_zipcode">Zipcode</label>
143
+ <input type="text" maxlength="5" name="form[zipcode]" id="form_zipcode" />
144
+ </p>
145
+
146
+ <p>
147
+ <input maxlength="35" id="long_length" />
148
+ </p>
149
+
150
+ <p>
151
+ <label for="form_tendency">Tendency</label>
152
+ <select name="form[tendency]" id="form_tendency"></select>
153
+ </p>
154
+
155
+ <p>
156
+ <label for="form_description">Description</label></br>
157
+ <textarea name="form[description]" id="form_description">Descriptive text goes here</textarea>
158
+ <p>
159
+
160
+ <p>
161
+ <label for="form_newline">NewLine</label></br>
162
+ <textarea name="form[newline]" id="form_newline">
163
+
164
+ New line after and before textarea tag
165
+ </textarea>
166
+ </p>
167
+
168
+ <p>
169
+ <input type="radio" name="form[gender]" value="male" id="gender_male"/>
170
+ <label for="gender_male">Male</label>
171
+ <input type="radio" name="form[gender]" value="female" id="gender_female" checked="checked"/>
172
+ <label for="gender_female">Female</label>
173
+ <input type="radio" name="form[gender]" value="both" id="gender_both"/>
174
+ <label for="gender_both">Both</label>
175
+ </p>
176
+
177
+ <p>
178
+ <input type="radio" name="form[party]" value="democrat" id="party_democrat" style="display:none"/>
179
+ <label for="party_democrat">Democrat</label>
180
+ <input type="radio" name="form[party]" value="republican" id="party_republican" style="display:none"/>
181
+ <label for="party_republican">Republican</label>
182
+ <input type="radio" name="form[party]" value="independent" id="party_independent" checked="checked" style="display:none"/>
183
+ <label for="party_independent">Independent</label>
184
+ </p>
185
+
186
+ <p>
187
+ <input type="checkbox" id="no_attr_value_checked" value="1" checked/>
188
+ </p>
189
+
190
+ <p>
191
+ <input type="checkbox" value="dog" name="form[pets][]" id="form_pets_dog" checked="checked"/>
192
+ <label for="form_pets_dog">Dog</label>
193
+ <input type="checkbox" value="cat" name="form[pets][]" id="form_pets_cat"/>
194
+ <label for="form_pets_cat">Cat</label>
195
+ <input type="checkbox" value="hamster" name="form[pets][]" id="form_pets_hamster" checked="checked"/>
196
+ <label for="form_pets_hamster">Hamster</label>
197
+ </p>
198
+
199
+ <p>
200
+ <input type="checkbox" value="jaguar" name="form[cars][]" id="form_cars_jaguar" checked="checked" style="display: none"/>
201
+ <label for="form_cars_jaguar">Jaguar</label>
202
+ <input type="checkbox" value="tesla" name="form[cars][]" id="form_cars_tesla" style="display: none"/>
203
+ <label for="form_cars_tesla">Tesla</label>
204
+ <input type="checkbox" value="ferrari" name="form[cars][]" id="form_cars_ferrari" checked="checked" style="display: none"/>
205
+ <label for="form_cars_ferrari">Ferrari</label>
206
+ <input type="checkbox" value="pagani" name="form[cars][]" id="form_cars_pagani" style="position: absolute; left: -9999px"/>
207
+ <label for="form_cars_pagani">Pagani</label>
208
+ <div style="position: relative;">
209
+ <input type="checkbox" value="bugatti" name="form[cars][]" id="form_cars_bugatti"/>
210
+ <div style="position: absolute; top: 0; right: 0; bottom: 0; left: 0; background-color: #fff;">
211
+ <label for="form_cars_bugatti">Bugatti</label>
212
+ </div>
213
+ </div>
214
+ <input type="checkbox" value="ariel" name="form[cars][]" id="form_cars_ariel" style="display: none"/>
215
+ <input type="checkbox" value="porsche" name="form[cars][]" id="form_cars_porsche" checked="checked" style="display: none"/>
216
+ <label>
217
+ McLaren
218
+ <input type="checkbox" value="mclaren" name="form[cars][]" id="form_cars_mclaren" style="display: none"/>
219
+ </label>
220
+ <label>
221
+ Koenigsegg
222
+ <input type="checkbox" value="koenigsegg" name="form[cars][]" id="form_cars_koenigsegg" checked="checked" style="display: none"/>
223
+ </label>
224
+ <input type="checkbox" value="maserati" name="form[cars][]" id="form_cars_maserati" disabled="disabled"/>
225
+ <label for="form_cars_maserati">Maserati</label>
226
+ </p>
227
+
228
+ <p>
229
+ <input type="text" name="form[manufacturer]" list="manufacturers" id="manufacturer"/>
230
+ <datalist id="manufacturers">
231
+ <option value="Jaguar">J</option>
232
+ <option value="Audi">
233
+ <option value="Mercedes" disabled>
234
+ </datalist>
235
+ </p>
236
+
237
+ <p>
238
+ <input type="checkbox" name="form[valueless_checkbox]" id="valueless_checkbox" checked="checked"/>
239
+ <label for="valueless_checkbox">Valueless Checkbox</label>
240
+ <input type="radio" name="form[valueless_radio]" id="valueless_radio" checked="checked"/>
241
+ <label for="valueless_radio">Valueless Radio</label>
242
+ </p>
243
+
244
+ <p>
245
+ <label for="form_languages">Languages</label>
246
+ <select name="form[languages][]" id="form_languages" multiple="multiple">
247
+ <option>Ruby</option>
248
+ <option>SQL</option>
249
+ <option>HTML</option>
250
+ <option>Javascript</option>
251
+ </select>
252
+ </p>
253
+
254
+ <p>
255
+ <label for="form_underwear">Underwear</label>
256
+ <select name="form[underwear][]" id="form_underwear" multiple="multiple">
257
+ <option selected="selected">Boxerbriefs</option>
258
+ <option>Boxers</option>
259
+ <option selected="selected">Briefs</option>
260
+ <option selected="selected">Commando</option>
261
+ <option selected="selected">Frenchman's Pantalons</option>
262
+ <option selected="selected" value="thermal">Long Johns</option>
263
+ </select>
264
+ </p>
265
+
266
+ <!-- invisible select and options -->
267
+ <p style="display: none">
268
+ <label for="form_icecream">Icecream</label>
269
+ <select name="form[icecream]" id="form_icecream">
270
+ <option selected="selected">Chocolate</option>
271
+ <option>Vanilla</option>
272
+ <option>Strawberry</option>
273
+ </select>
274
+ </p>
275
+
276
+ <!-- invisible multiselect and options -->
277
+ <p style="display: none">
278
+ <label for="form_dessert">Dessert</label>
279
+ <select name="form[dessert]" id="form_dessert" multiple="multiple">
280
+ <option selected="selected">Pudding</option>
281
+ <option>Lava cake</option>
282
+ <option selected="selected">Tiramisu</option>
283
+ <option>Panna cotta</option>
284
+ </select>
285
+ </p>
286
+
287
+ <!-- visible select with invisible selected option (which some browsers may treat as visible) -->
288
+ <p>
289
+ <label for="form_sorbet">Sorbet</label>
290
+ <select name="form[sorbet]" id="form_sorbet">
291
+ <option>Chocolate</option>
292
+ <option selected="selected" style="display: none">Vanilla</option>
293
+ <option>Strawberry</option>
294
+ </select>
295
+ </p>
296
+
297
+ <!-- visible multiselect with invisible selected options (which some browsers may treat as visible) -->
298
+ <p>
299
+ <label for="form_cake">Cake</label>
300
+ <select name="form[cake]" id="form_cake" multiple="multiple">
301
+ <option>Butter Cake</option>
302
+ <option selected="selected" style="display: none">Chocolate Cake</option>
303
+ <option>Strawberry Cake</option>
304
+ <option selected="selected" style="display: none">Sponge Cake</option>
305
+ </select>
306
+ </p>
307
+
308
+ <p>
309
+ <span>First address<span>
310
+ <label for='address1_street'>Street</label>
311
+ <input type="text" name="form[addresses][][street]" value="" id="address1_street">
312
+
313
+ <label for='address1_city'>City</label>
314
+ <input type="text" name="form[addresses][][city]" value="" id="address1_city">
315
+
316
+ <label for='address1_country'>Country</label>
317
+ <select name="form[addresses][][country]" id="address1_country">
318
+ <option selected>France</option>
319
+ <option>Ukraine</option>
320
+ </select>
321
+ </p>
322
+
323
+ <p>
324
+ <span>Second address<span>
325
+ <label for='address2_street'>Street</label>
326
+ <input type="text" name="form[addresses][][street]" value="" id="address2_street">
327
+
328
+ <label for='address2_city'>City</label>
329
+ <input type="text" name="form[addresses][][city]" value="" id="address2_city">
330
+
331
+ <label for='address2_country'>Country</label>
332
+ <select name="form[addresses][][country]" id="address2_country">
333
+ <option>France</option>
334
+ <option selected>Ukraine</option>
335
+ </select>
336
+ </p>
337
+
338
+ <div style="display:none;">
339
+ <label for="form_first_name_hidden">
340
+ Super Secret
341
+ <input type="text" name="form[super_secret]" value="test123" id="form_super_secret"/>
342
+ </label>
343
+ </div>
344
+
345
+ <p>
346
+ <label for="form_disabled_text_field">
347
+ Disabled Text Field
348
+ <input type="text" name="form[disabled_text_field]" value="Should not see me" id="form_disabled_text_field" disabled="disabled" />
349
+ </label>
350
+ </p>
351
+
352
+ <p>
353
+ <label for="form_disabled_textarea">
354
+ Disabled Textarea
355
+ <textarea name="form[disabled_textarea]" value="Should not see me" id="form_disabled_textarea" disabled="disabled"></textarea>
356
+ </label>
357
+ </p>
358
+
359
+ <p>
360
+ <label for="form_disabled_checkbox">
361
+ Disabled Checkbox
362
+ <input type="checkbox" name="form[disabled_checkbox]" value="Should not see me" id="form_disabled_checkbox" checked="checked" disabled="disabled" />
363
+ </label>
364
+ </p>
365
+
366
+ <p>
367
+ <label for="form_disabled_unchecked_checkbox">
368
+ Disabled Unchecked Checkbox
369
+ <input type="checkbox" name="form[disabled_unchecked_checkbox]" value="Should not see me" id="form_disabled_unchecked_checkbox" disabled="disabled" />
370
+ </label>
371
+ </p>
372
+
373
+ <p>
374
+ <label for="form_disabled_radio">
375
+ Disabled Radio
376
+ <input type="radio" name="form[disabled_radio]" value="Should not see me" id="form_disabled_radio" checked="checked" disabled="disabled" />
377
+ </label>
378
+ </p>
379
+
380
+ <p>
381
+ <label for="form_disabled_select">
382
+ Disabled Select
383
+ <select name="form[disabled_select]" id="form_disabled_select" disabled="disabled">
384
+ <option value="Should not see me" selected="selected">Should not see me</option>
385
+ <optgroup>
386
+ <option value="Disabled too">Disabled too</option>
387
+ </optgroup>
388
+ </select>
389
+ </label>
390
+ </p>
391
+
392
+ <p>
393
+ <label for="form_disabled_select2">
394
+ Disabled Select 2
395
+ <select name="form[disabled_select2]" id="form_disabled_select2" disabled>
396
+ <option value="Should not see me" selected="selected">Should not see me</option>
397
+ </select>
398
+ </label>
399
+ </p>
400
+
401
+ <p>
402
+ <label for="form_disabled_file">
403
+ Disabled File
404
+ <input type="file" name="form[disabled_file]" value="/should/not/see/me" id="form_disabled_file" disabled="disabled" />
405
+ </label>
406
+ </p>
407
+
408
+ <fieldset>
409
+ <input name="form[enabled_fieldset_child]" id="form_enabled_fieldset_child"/>
410
+ </fieldset>
411
+
412
+ <fieldset disabled="disabled" id="form_disabled_fieldset">
413
+ <legend>Disabled Child</legend>
414
+ <input name="form[disabled_fieldset_child]" id="form_disabled_fieldset_child"/>
415
+ <select>
416
+ <option>Disabled Child Option</option>
417
+ </select>
418
+ </fieldset>
419
+
420
+ <fieldset disabled="disabled">
421
+ <legend>
422
+ Nested Disabled
423
+ <input type="checkbox" name="form[disabled_fieldeset_legend_child]" id="form_disabled_fieldset_legend_child"/>
424
+ </legend>
425
+ <legend>
426
+ Another WLegend
427
+ <input type="checkbox" name="form[disabled_fieldeset_second_legend_child]" id="form_disabled_fieldset_second_legend_child"/>
428
+ </legend>
429
+ <fieldset>
430
+ <legend>
431
+ Disabled?
432
+ <input id="form_disabled_fieldset_descendant_legend_child">
433
+ </legend>
434
+ <input name="form[disabled_fieldset_descendant]" id="form_disabled_fieldset_descendant"/>
435
+ </fieldset>
436
+ </fieldset>
437
+
438
+ <p>
439
+ <select data-test-id="my_test_id">
440
+ <optgroup label="Level One">
441
+ <option> A.1 </option>
442
+ </optgroup>
443
+ <optgroup label="Level Two" disabled="disabled">
444
+ <option> A.B.1 </option>
445
+ </optgroup>
446
+ <option> A.2 </option>
447
+ </select>
448
+ </p>
449
+
450
+ <p>
451
+ <input type="button" aria-label="Aria button" name="form[fresh]" id="fresh_btn" value="i am fresh"/>
452
+ <input type="submit" name="form[awesome]" id="awe123" title="What an Awesome Button" value="awesome"/>
453
+ <input type="submit" name="form[crappy]" id="crap321" value="crappy"/>
454
+ <input type="image" name="form[okay]" id="okay556" title="Okay 556 Image" value="okay" alt="oh hai thar"/>
455
+ <button type="submit" id="click_me_123" title="Click Title button" value="click_me">Click me!</button>
456
+ <button type="submit" name="form[no_value]">No Value!</button>
457
+ <button id="no_type">No Type!</button>
458
+ <button><img alt="A horse eating hay"/></button>
459
+ <input type="button" disabled="disabled" value="Disabled button"/>
460
+ </p>
461
+
462
+ <p>
463
+ <input type="date" name="form[date]" id="form_date"/>
464
+ <input type="time" name="form[time]" id="form_time"/>
465
+ <input type="datetime-local" name="form[datetime]" id="form_datetime">
466
+ </p>
467
+
468
+ <p>
469
+ <input id="readonly" name="form[readonly_test]" readonly/>
470
+ <input id="not_readonly" name="form[readonly_test]" />
471
+ </p>
472
+
473
+ <p>
474
+ <input id="required" name="form[required]" required />
475
+ <input id="length" name="form[length]" minlength="4" maxlength="4" />
476
+ </p>
477
+ </form>
478
+
479
+ <input type="text" name="form[outside_input]" value="outside_input" form="form1"/>
480
+
481
+ <label>
482
+ Nested Label
483
+ <input type="text" name="nested_label" id="nested_label"/>
484
+ </label>
485
+
486
+ <label id="wrapper_label">
487
+ Wrapper Label
488
+ <input type="checkbox"/>
489
+ </label>
490
+
491
+ <form id="form1" action="/form" method="post">
492
+ <input type="text" name="form[which_form]" value="form1" id="form_which_form"/>
493
+ <input type="text" name="form[for_form2]" value="for_form2" form="form2"/>
494
+ <input type="submit" name="form[submit_form1]" value="submit_form1" id="submit_form1"/>
495
+ </form>
496
+
497
+ <button type="submit" name="form[outside_button]" value="outside_button" form="form2">Outside!</button>
498
+
499
+ <form id="form2" action="/form" method="post">
500
+ <input type="text" name="form[which_form]" value="form2" id="form_which_form2"/>
501
+ <input type="submit" name="form[unused]" value="unused"/>
502
+ <button type="submit" name="form[other_form_button]" value="other_form_button" form="form1">Form1</button>
503
+ </form>
504
+
505
+ <button type="submit" name="form[no_form_button]" value="no_form_button">No Form</button>
506
+
507
+ <textarea name="form[outside_textarea]" form="form1">Some text here</textarea>
508
+ <select name="form[outside_select]" form="form1">
509
+ <option>Lisp</option>
510
+ <option selected="selected">Ruby</option>
511
+ <option>Php</option>
512
+ </select>
513
+
514
+ <input type="submit" name="form[outside_submit]" value="outside_submit" form="form1"/>
515
+
516
+ <form id="get-form" action="/form/get?foo=bar" method="get">
517
+ <p>
518
+ <label for="form_middle_name">Middle Name</label>
519
+ <input type="text" name="form[middle_name]" value="Darren" id="form_middle_name"/>
520
+ </p>
521
+
522
+ <p>
523
+ <input type="submit" name="form[mediocre]" id="mediocre" value="med" aria-label="Mediocre Button"/>
524
+ <input type="submit" formaction="/form/get?bar=foo" id="mediocre2" value="med2"/>
525
+ <p>
526
+ </form>
527
+
528
+ <form action="/upload_empty" method="post" enctype="multipart/form-data">
529
+ <p>
530
+ <label for="form_file_name">File Name</label>
531
+ <input type="file" name="form[file]" id="form_file"/>
532
+ </p>
533
+
534
+ <p>
535
+ <input type="hidden" name="form[dummy]" value="ensure params[:form] exists"/>
536
+ <input type="submit" value="Upload Empty"/>
537
+ <p>
538
+ </form>
539
+
540
+ <form action="/upload_empty" method="post" enctype="multipart/form-data">
541
+ <p>
542
+ <label>
543
+ <input type="file" name="form[file]" multiple="multiple"/>
544
+ Multiple empty files
545
+ </label>
546
+ </p>
547
+
548
+ <p>
549
+ <input type="hidden" name="form[dummy]" value="ensure params[:form] exists"/>
550
+ <input type="submit" value="Upload Empty Multiple"/>
551
+ <p>
552
+ </form>
553
+
554
+ <form action="/upload" method="post" enctype="multipart/form-data">
555
+ <p>
556
+ <label for="form_file_name">File Name</label>
557
+ <input type="file" name="form[file_name]" id="form_file_name"/>
558
+ </p>
559
+
560
+ <p>
561
+ <label for="form_document">Single Document</label>
562
+ <input type="file" name="form[document]" id="form_document"/>
563
+ </p>
564
+
565
+ <p>
566
+ <input type="submit" value="Upload Single"/>
567
+ <p>
568
+ </form>
569
+
570
+ <form action="/upload_multiple" method="post" enctype="multipart/form-data">
571
+ <p>
572
+ <label for="form_multiple_file_name">File Name</label>
573
+ <input type="file" name="form[multiple_file_name]" id="form_multiple_file_name"/>
574
+ </p>
575
+
576
+ <p>
577
+ <label for="form_multiple_documents">Multiple Documents</label>
578
+ <input type="file" name="form[multiple_documents][]" id="form_multiple_documents" multiple="multiple" />
579
+ </p>
580
+
581
+ <p>
582
+ <label for="form_directory_upload">Directory Upload</label>
583
+ <input type="file" name="form[multiple_documents][]" id="form_directory_upload" multiple="multiple" webkitdirectory="webkitdirectory" mozdirectory="mozdirectory" />
584
+ </p>
585
+
586
+ <p>
587
+ <input type="submit" value="Upload Multiple"/>
588
+ <p>
589
+ </form>
590
+
591
+ <form action="/redirect" method="post">
592
+ <p>
593
+ <input type="submit" value="Go FAR"/>
594
+ </p>
595
+
596
+ <input type="hidden" name="form[data]" value="TWTW"/>
597
+ <p>
598
+ <button formaction='/redirect_307'>Go 307</button>
599
+ </p>
600
+ <p>
601
+ <button formaction='/redirect_308'>Go 308</button>
602
+ </p>
603
+ </form>
604
+
605
+ <form action="/form" method="post">
606
+ <p>
607
+ <label for="html5_email">Html5 Email</label>
608
+ <input type="email" name="form[html5_email]" value="person@email.com" id="html5_email"/>
609
+ </p>
610
+ <p>
611
+ <label for="html5_multiple_email">Html5 Multiple Email</label>
612
+ <input type="email" multiple name="form[html5_multiple_email]" value="person@email.com" id="html5_multiple_email"/>
613
+ </p>
614
+ <p>
615
+ <label for="html5_url">Html5 Url</label>
616
+ <input type="url" name="form[html5_url]" value="http://www.example.com" id="html5_url"/>
617
+ </p>
618
+ <p>
619
+ <label for="html5_search">Html5 Search</label>
620
+ <input type="search" name="form[html5_search]" value="what are you looking for" id="html5_search"/>
621
+ </p>
622
+ <p id="emergency">Emergency Number</p>
623
+ <p>
624
+ <label for="html5_tel">Html5 Tel</label>
625
+ <input type="tel" aria-labelledby="emergency" name="form[html5_tel]" value="911" id="html5_tel"/>
626
+ </p>
627
+ <p>
628
+ <label for="html5_color">Html5 Color</label>
629
+ <input type="color" name="form[html5_color]" value="#FFFFFF" id="html5_color"/>
630
+ </p>
631
+
632
+ <p>
633
+ <input type="submit" name="form[html5_submit]" value="html5_submit"/>
634
+ </p>
635
+ </form>
636
+
637
+ <form action="/form" method="post">
638
+ <p>
639
+ <button type="submit" name="form[button]" value="button_first">Just an input that came first</button>
640
+ <button type="submit" name="form[button]" value="button_second">Just an input</button>
641
+ <input type="submit" name="form[button]" value="Just a button that came first"/>
642
+ <input type="submit" name="form[button]" value="Just a button"/>
643
+ </p>
644
+ </form>
645
+
646
+ <form action="/other_form" method="post">
647
+ <p>
648
+ <input type="text" name="form[which_form]" value="formaction form" aria-label="Unlabelled Input"/>
649
+ </p>
650
+ <input type="submit" name="form[button]" formaction="/form" value="Formaction button"/>
651
+ <input type="submit" name="form[button]" formaction="/form/get" formmethod="get" value="Formmethod button"/>
652
+ </form>
653
+
654
+ <form action="relative" method="post">
655
+ <p>
656
+ <input type="submit" name="form[relative]" value="Relative Action" />
657
+ </p>
658
+ </form>
659
+
660
+ <form method="post">
661
+ <p>
662
+ <input type="submit" name="form[no_action]" value="No Action" />
663
+ </p>
664
+ </form>
665
+
666
+ <label>Confusion
667
+ <input type="checkbox" id="confusion_checkbox" class="confusion-checkbox confusion"/>
668
+ </label>
669
+
670
+ <label>Confusion
671
+ <input type="text" id="confusion_text" class="confusion-text confusion"/>
672
+ </label>
673
+
674
+ <label>Confusion
675
+ <textarea id="confusion_textarea" class="confusion confusion-textarea"></textarea>
676
+ </label>
677
+
678
+ <p>
679
+ <label for="asterisk_input">With Asterisk<abbr title="required">*</abbr></label>
680
+ <input id="asterisk_input" type="number"value="2016"/>
681
+ </p>
682
+
683
+ <p>
684
+ <input id="special" {custom}="abcdef" value="custom attribute"/>
685
+ </p>