watir 1.4.1 → 7.3.0

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 (422) hide show
  1. checksums.yaml +7 -0
  2. data/.document +4 -0
  3. data/.github/ISSUE_TEMPLATE.md +16 -0
  4. data/.github/workflows/chrome.yml +55 -0
  5. data/.github/workflows/edge.yml +44 -0
  6. data/.github/workflows/firefox.yml +55 -0
  7. data/.github/workflows/ie.yml +30 -0
  8. data/.github/workflows/safari.yml +38 -0
  9. data/.github/workflows/unit.yml +60 -0
  10. data/.gitignore +21 -0
  11. data/.rubocop.yml +114 -0
  12. data/.rubocop_todo.yml +17 -0
  13. data/CHANGES.md +2212 -0
  14. data/Gemfile +15 -0
  15. data/LICENSE +24 -0
  16. data/README.md +113 -0
  17. data/Rakefile +173 -0
  18. data/lib/watir/adjacent.rb +128 -0
  19. data/lib/watir/after_hooks.rb +135 -0
  20. data/lib/watir/alert.rb +113 -0
  21. data/lib/watir/aliases.rb +8 -0
  22. data/lib/watir/attribute_helper.rb +97 -0
  23. data/lib/watir/browser.rb +323 -0
  24. data/lib/watir/capabilities.rb +179 -0
  25. data/lib/watir/cell_container.rb +25 -0
  26. data/lib/watir/container.rb +33 -0
  27. data/lib/watir/cookies.rb +130 -0
  28. data/lib/watir/element_collection.rb +223 -0
  29. data/lib/watir/elements/button.rb +28 -0
  30. data/lib/watir/elements/cell.rb +18 -0
  31. data/lib/watir/elements/checkbox.rb +56 -0
  32. data/lib/watir/elements/date_field.rb +42 -0
  33. data/lib/watir/elements/date_time_field.rb +42 -0
  34. data/lib/watir/elements/dlist.rb +12 -0
  35. data/lib/watir/elements/element.rb +807 -0
  36. data/lib/watir/elements/file_field.rb +43 -0
  37. data/lib/watir/elements/font.rb +26 -0
  38. data/lib/watir/elements/form.rb +16 -0
  39. data/lib/watir/elements/hidden.rb +26 -0
  40. data/lib/watir/elements/html_elements.rb +1981 -0
  41. data/lib/watir/elements/iframe.rb +156 -0
  42. data/lib/watir/elements/image.rb +22 -0
  43. data/lib/watir/elements/input.rb +15 -0
  44. data/lib/watir/elements/link.rb +8 -0
  45. data/lib/watir/elements/list.rb +51 -0
  46. data/lib/watir/elements/option.rb +60 -0
  47. data/lib/watir/elements/radio.rb +65 -0
  48. data/lib/watir/elements/row.rb +18 -0
  49. data/lib/watir/elements/select.rb +214 -0
  50. data/lib/watir/elements/svg_elements.rb +497 -0
  51. data/lib/watir/elements/table.rb +77 -0
  52. data/lib/watir/elements/table_cell.rb +32 -0
  53. data/lib/watir/elements/table_row.rb +34 -0
  54. data/lib/watir/elements/table_section.rb +17 -0
  55. data/lib/watir/elements/text_area.rb +7 -0
  56. data/lib/watir/elements/text_field.rb +39 -0
  57. data/lib/watir/exception.rb +16 -0
  58. data/lib/watir/extensions/nokogiri.rb +14 -0
  59. data/lib/watir/generator/base/generator.rb +114 -0
  60. data/lib/watir/generator/base/idl_sorter.rb +51 -0
  61. data/lib/watir/generator/base/spec_extractor.rb +158 -0
  62. data/lib/watir/generator/base/util.rb +21 -0
  63. data/lib/watir/generator/base/visitor.rb +133 -0
  64. data/lib/watir/generator/base.rb +12 -0
  65. data/lib/watir/generator/html/generator.rb +36 -0
  66. data/lib/watir/generator/html/spec_extractor.rb +52 -0
  67. data/lib/watir/generator/html/visitor.rb +23 -0
  68. data/lib/watir/generator/html.rb +17 -0
  69. data/lib/watir/generator/svg/generator.rb +38 -0
  70. data/lib/watir/generator/svg/spec_extractor.rb +55 -0
  71. data/lib/watir/generator/svg/visitor.rb +23 -0
  72. data/lib/watir/generator/svg.rb +9 -0
  73. data/lib/watir/generator.rb +5 -0
  74. data/lib/watir/has_window.rb +72 -0
  75. data/lib/watir/http_client.rb +11 -0
  76. data/lib/watir/js_execution.rb +165 -0
  77. data/lib/watir/js_snippets/attributeValues.js +11 -0
  78. data/lib/watir/js_snippets/backgroundColor.js +7 -0
  79. data/lib/watir/js_snippets/elementObscured.js +14 -0
  80. data/lib/watir/js_snippets/fireEvent.js +31 -0
  81. data/lib/watir/js_snippets/focus.js +3 -0
  82. data/lib/watir/js_snippets/getElementTags.js +3 -0
  83. data/lib/watir/js_snippets/getInnerHtml.js +19 -0
  84. data/lib/watir/js_snippets/getInnerText.js +19 -0
  85. data/lib/watir/js_snippets/getOuterHtml.js +20 -0
  86. data/lib/watir/js_snippets/getTextContent.js +19 -0
  87. data/lib/watir/js_snippets/isElementInViewport.js +20 -0
  88. data/lib/watir/js_snippets/isImageLoaded.js +3 -0
  89. data/lib/watir/js_snippets/selectOptionsLabel.js +10 -0
  90. data/lib/watir/js_snippets/selectOptionsText.js +10 -0
  91. data/lib/watir/js_snippets/selectOptionsValue.js +10 -0
  92. data/lib/watir/js_snippets/selectText.js +64 -0
  93. data/lib/watir/js_snippets/selectedOptions.js +11 -0
  94. data/lib/watir/js_snippets/selectedText.js +17 -0
  95. data/lib/watir/js_snippets/setText.js +3 -0
  96. data/lib/watir/js_snippets/setValue.js +3 -0
  97. data/lib/watir/js_snippets.rb +18 -0
  98. data/lib/watir/locators/anchor/selector_builder.rb +43 -0
  99. data/lib/watir/locators/button/matcher.rb +19 -0
  100. data/lib/watir/locators/button/selector_builder/xpath.rb +69 -0
  101. data/lib/watir/locators/button/selector_builder.rb +10 -0
  102. data/lib/watir/locators/cell/selector_builder/xpath.rb +23 -0
  103. data/lib/watir/locators/cell/selector_builder.rb +13 -0
  104. data/lib/watir/locators/element/locator.rb +81 -0
  105. data/lib/watir/locators/element/matcher.rb +118 -0
  106. data/lib/watir/locators/element/selector_builder/regexp_disassembler.rb +69 -0
  107. data/lib/watir/locators/element/selector_builder/xpath.rb +268 -0
  108. data/lib/watir/locators/element/selector_builder/xpath_support.rb +29 -0
  109. data/lib/watir/locators/element/selector_builder.rb +164 -0
  110. data/lib/watir/locators/option/matcher.rb +26 -0
  111. data/lib/watir/locators/option/selector_builder/xpath.rb +39 -0
  112. data/lib/watir/locators/option/selector_builder.rb +10 -0
  113. data/lib/watir/locators/row/selector_builder/xpath.rb +53 -0
  114. data/lib/watir/locators/row/selector_builder.rb +18 -0
  115. data/lib/watir/locators/text_area/selector_builder/xpath.rb +21 -0
  116. data/lib/watir/locators/text_area/selector_builder.rb +10 -0
  117. data/lib/watir/locators/text_field/matcher.rb +37 -0
  118. data/lib/watir/locators/text_field/selector_builder/xpath.rb +50 -0
  119. data/lib/watir/locators/text_field/selector_builder.rb +10 -0
  120. data/lib/watir/locators.rb +77 -0
  121. data/lib/watir/logger.rb +30 -0
  122. data/lib/watir/navigation.rb +51 -0
  123. data/lib/watir/radio_set.rb +230 -0
  124. data/lib/watir/row_container.rb +36 -0
  125. data/lib/watir/screenshot.rb +51 -0
  126. data/lib/watir/scroll.rb +95 -0
  127. data/lib/watir/search_context.rb +96 -0
  128. data/lib/watir/shadow_root.rb +60 -0
  129. data/lib/watir/user_editable.rb +85 -0
  130. data/lib/watir/version.rb +5 -0
  131. data/lib/watir/wait/timer.rb +52 -0
  132. data/lib/watir/wait.rb +171 -0
  133. data/lib/watir/window.rb +276 -0
  134. data/lib/watir/window_collection.rb +82 -0
  135. data/lib/watir.rb +108 -0
  136. data/lib/watirspec/guards.rb +65 -0
  137. data/lib/watirspec/implementation.rb +56 -0
  138. data/lib/watirspec/rake_tasks.rb +118 -0
  139. data/lib/watirspec/remote_server.rb +39 -0
  140. data/lib/watirspec/runner.rb +64 -0
  141. data/lib/watirspec/server/app.rb +86 -0
  142. data/lib/watirspec/server.rb +104 -0
  143. data/lib/watirspec.rb +93 -0
  144. data/spec/locator_spec_helper.rb +88 -0
  145. data/spec/spec_helper.rb +24 -0
  146. data/spec/unit/capabilities_spec.rb +670 -0
  147. data/spec/unit/element_locator_spec.rb +97 -0
  148. data/spec/unit/match_elements/button_spec.rb +76 -0
  149. data/spec/unit/match_elements/element_spec.rb +424 -0
  150. data/spec/unit/match_elements/text_field_spec.rb +84 -0
  151. data/spec/unit/selector_builder/anchor_spec.rb +59 -0
  152. data/spec/unit/selector_builder/button_spec.rb +217 -0
  153. data/spec/unit/selector_builder/cell_spec.rb +71 -0
  154. data/spec/unit/selector_builder/element_spec.rb +804 -0
  155. data/spec/unit/selector_builder/row_spec.rb +128 -0
  156. data/spec/unit/selector_builder/text_field_spec.rb +203 -0
  157. data/spec/unit/selector_builder/textarea_spec.rb +35 -0
  158. data/spec/unit/unit_helper.rb +4 -0
  159. data/spec/unit/wait_spec.rb +99 -0
  160. data/spec/watirspec/adjacent_spec.rb +256 -0
  161. data/spec/watirspec/after_hooks_spec.rb +204 -0
  162. data/spec/watirspec/alert_spec.rb +89 -0
  163. data/spec/watirspec/browser_spec.rb +536 -0
  164. data/spec/watirspec/capabilities_spec.rb +556 -0
  165. data/spec/watirspec/cookies_spec.rb +196 -0
  166. data/spec/watirspec/drag_and_drop_spec.rb +38 -0
  167. data/spec/watirspec/element_hidden_spec.rb +86 -0
  168. data/spec/watirspec/elements/area_spec.rb +69 -0
  169. data/spec/watirspec/elements/areas_spec.rb +44 -0
  170. data/spec/watirspec/elements/button_spec.rb +265 -0
  171. data/spec/watirspec/elements/buttons_spec.rb +57 -0
  172. data/spec/watirspec/elements/checkbox_spec.rb +290 -0
  173. data/spec/watirspec/elements/checkboxes_spec.rb +46 -0
  174. data/spec/watirspec/elements/collections_spec.rb +132 -0
  175. data/spec/watirspec/elements/date_field_spec.rb +209 -0
  176. data/spec/watirspec/elements/date_fields_spec.rb +46 -0
  177. data/spec/watirspec/elements/date_time_field_spec.rb +223 -0
  178. data/spec/watirspec/elements/date_time_fields_spec.rb +47 -0
  179. data/spec/watirspec/elements/dd_spec.rb +108 -0
  180. data/spec/watirspec/elements/dds_spec.rb +44 -0
  181. data/spec/watirspec/elements/del_spec.rb +113 -0
  182. data/spec/watirspec/elements/dels_spec.rb +42 -0
  183. data/spec/watirspec/elements/div_spec.rb +232 -0
  184. data/spec/watirspec/elements/divs_spec.rb +56 -0
  185. data/spec/watirspec/elements/dl_spec.rb +117 -0
  186. data/spec/watirspec/elements/dls_spec.rb +45 -0
  187. data/spec/watirspec/elements/dt_spec.rb +107 -0
  188. data/spec/watirspec/elements/dts_spec.rb +44 -0
  189. data/spec/watirspec/elements/element_spec.rb +1069 -0
  190. data/spec/watirspec/elements/elements_spec.rb +60 -0
  191. data/spec/watirspec/elements/em_spec.rb +85 -0
  192. data/spec/watirspec/elements/ems_spec.rb +45 -0
  193. data/spec/watirspec/elements/filefield_spec.rb +135 -0
  194. data/spec/watirspec/elements/filefields_spec.rb +45 -0
  195. data/spec/watirspec/elements/font_spec.rb +31 -0
  196. data/spec/watirspec/elements/form_spec.rb +70 -0
  197. data/spec/watirspec/elements/forms_spec.rb +46 -0
  198. data/spec/watirspec/elements/frame_spec.rb +117 -0
  199. data/spec/watirspec/elements/frames_spec.rb +43 -0
  200. data/spec/watirspec/elements/hidden_spec.rb +106 -0
  201. data/spec/watirspec/elements/hiddens_spec.rb +45 -0
  202. data/spec/watirspec/elements/hn_spec.rb +80 -0
  203. data/spec/watirspec/elements/hns_spec.rb +42 -0
  204. data/spec/watirspec/elements/iframe_spec.rb +244 -0
  205. data/spec/watirspec/elements/iframes_spec.rb +49 -0
  206. data/spec/watirspec/elements/image_spec.rb +160 -0
  207. data/spec/watirspec/elements/images_spec.rb +42 -0
  208. data/spec/watirspec/elements/input_spec.rb +17 -0
  209. data/spec/watirspec/elements/ins_spec.rb +113 -0
  210. data/spec/watirspec/elements/inses_spec.rb +42 -0
  211. data/spec/watirspec/elements/label_spec.rb +77 -0
  212. data/spec/watirspec/elements/labels_spec.rb +42 -0
  213. data/spec/watirspec/elements/li_spec.rb +99 -0
  214. data/spec/watirspec/elements/link_spec.rb +180 -0
  215. data/spec/watirspec/elements/links_spec.rb +66 -0
  216. data/spec/watirspec/elements/lis_spec.rb +44 -0
  217. data/spec/watirspec/elements/list_spec.rb +50 -0
  218. data/spec/watirspec/elements/map_spec.rb +78 -0
  219. data/spec/watirspec/elements/maps_spec.rb +43 -0
  220. data/spec/watirspec/elements/meta_spec.rb +27 -0
  221. data/spec/watirspec/elements/metas_spec.rb +42 -0
  222. data/spec/watirspec/elements/ol_spec.rb +63 -0
  223. data/spec/watirspec/elements/ols_spec.rb +42 -0
  224. data/spec/watirspec/elements/option_spec.rb +113 -0
  225. data/spec/watirspec/elements/p_spec.rb +102 -0
  226. data/spec/watirspec/elements/pre_spec.rb +100 -0
  227. data/spec/watirspec/elements/pres_spec.rb +42 -0
  228. data/spec/watirspec/elements/ps_spec.rb +42 -0
  229. data/spec/watirspec/elements/radio_spec.rb +259 -0
  230. data/spec/watirspec/elements/radios_spec.rb +45 -0
  231. data/spec/watirspec/elements/select_list_spec.rb +701 -0
  232. data/spec/watirspec/elements/select_lists_spec.rb +49 -0
  233. data/spec/watirspec/elements/span_spec.rb +119 -0
  234. data/spec/watirspec/elements/spans_spec.rb +42 -0
  235. data/spec/watirspec/elements/strong_spec.rb +78 -0
  236. data/spec/watirspec/elements/strongs_spec.rb +45 -0
  237. data/spec/watirspec/elements/table_spec.rb +210 -0
  238. data/spec/watirspec/elements/tables_spec.rb +44 -0
  239. data/spec/watirspec/elements/tbody_spec.rb +94 -0
  240. data/spec/watirspec/elements/tbodys_spec.rb +64 -0
  241. data/spec/watirspec/elements/td_spec.rb +92 -0
  242. data/spec/watirspec/elements/tds_spec.rb +55 -0
  243. data/spec/watirspec/elements/text_field_spec.rb +223 -0
  244. data/spec/watirspec/elements/text_fields_spec.rb +47 -0
  245. data/spec/watirspec/elements/textarea_spec.rb +30 -0
  246. data/spec/watirspec/elements/textareas_spec.rb +28 -0
  247. data/spec/watirspec/elements/tfoot_spec.rb +89 -0
  248. data/spec/watirspec/elements/tfoots_spec.rb +72 -0
  249. data/spec/watirspec/elements/thead_spec.rb +88 -0
  250. data/spec/watirspec/elements/theads_spec.rb +72 -0
  251. data/spec/watirspec/elements/tr_spec.rb +69 -0
  252. data/spec/watirspec/elements/trs_spec.rb +63 -0
  253. data/spec/watirspec/elements/ul_spec.rb +63 -0
  254. data/spec/watirspec/elements/uls_spec.rb +42 -0
  255. data/spec/watirspec/html/alerts.html +12 -0
  256. data/spec/watirspec/html/aria_attributes.html +9 -0
  257. data/spec/watirspec/html/child_frame.html +29 -0
  258. data/spec/watirspec/html/class_locator.html +11 -0
  259. data/spec/watirspec/html/clicks.html +19 -0
  260. data/spec/watirspec/html/closeable.html +21 -0
  261. data/spec/watirspec/html/collections.html +15 -0
  262. data/spec/watirspec/html/css/jquery-ui-1.8.17.custom.css +287 -0
  263. data/spec/watirspec/html/data_attributes.html +10 -0
  264. data/spec/watirspec/html/definition_lists.html +48 -0
  265. data/spec/watirspec/html/drag_and_drop.html +106 -0
  266. data/spec/watirspec/html/font.html +10 -0
  267. data/spec/watirspec/html/forms_with_input_elements.html +194 -0
  268. data/spec/watirspec/html/frame_1.html +22 -0
  269. data/spec/watirspec/html/frame_2.html +16 -0
  270. data/spec/watirspec/html/frames.html +11 -0
  271. data/spec/watirspec/html/iframe_1.html +22 -0
  272. data/spec/watirspec/html/iframes.html +15 -0
  273. data/spec/watirspec/html/images/button.png +0 -0
  274. data/spec/watirspec/html/images/circle.png +0 -0
  275. data/spec/watirspec/html/images/map.gif +0 -0
  276. data/spec/watirspec/html/images/map2.gif +0 -0
  277. data/spec/watirspec/html/images/originaltriangle.png +0 -0
  278. data/spec/watirspec/html/images/square.png +0 -0
  279. data/spec/watirspec/html/images/triangle.png +0 -0
  280. data/spec/watirspec/html/images.html +28 -0
  281. data/spec/watirspec/html/inner_outer.html +5 -0
  282. data/spec/watirspec/html/javascript/angular.min.js +332 -0
  283. data/spec/watirspec/html/javascript/helpers.js +16 -0
  284. data/spec/watirspec/html/javascript/jquery-1.7.1.min.js +4 -0
  285. data/spec/watirspec/html/javascript/jquery-ui-1.8.17.custom.min.js +68 -0
  286. data/spec/watirspec/html/keylogger.html +15 -0
  287. data/spec/watirspec/html/modal_dialog.html +9 -0
  288. data/spec/watirspec/html/multiple_ids.html +15 -0
  289. data/spec/watirspec/html/nested_elements.html +44 -0
  290. data/spec/watirspec/html/nested_frame_1.html +1 -0
  291. data/spec/watirspec/html/nested_frame_2.html +9 -0
  292. data/spec/watirspec/html/nested_frame_3.html +14 -0
  293. data/spec/watirspec/html/nested_frames.html +10 -0
  294. data/spec/watirspec/html/nested_iframe_2.html +12 -0
  295. data/spec/watirspec/html/nested_iframes.html +13 -0
  296. data/spec/watirspec/html/nested_tables.html +203 -0
  297. data/spec/watirspec/html/non_control_elements.html +145 -0
  298. data/spec/watirspec/html/obscured.html +36 -0
  299. data/spec/watirspec/html/removed_element.html +24 -0
  300. data/spec/watirspec/html/right_click.html +23 -0
  301. data/spec/watirspec/html/scroll.html +15 -0
  302. data/spec/watirspec/html/scroll_nested.html +17 -0
  303. data/spec/watirspec/html/scroll_nested_offscreen.html +18 -0
  304. data/spec/watirspec/html/shadow_dom.html +28 -0
  305. data/spec/watirspec/html/special_chars.html +15 -0
  306. data/spec/watirspec/html/sticky_elements.html +10 -0
  307. data/spec/watirspec/html/tables.html +121 -0
  308. data/spec/watirspec/html/timeout_window_location.html +19 -0
  309. data/spec/watirspec/html/uneven_table.html +20 -0
  310. data/spec/watirspec/html/wait.html +99 -0
  311. data/spec/watirspec/html/watirspec.css +0 -0
  312. data/spec/watirspec/html/window_switching.html +22 -0
  313. data/spec/watirspec/radio_set_spec.rb +346 -0
  314. data/spec/watirspec/screenshot_spec.rb +33 -0
  315. data/spec/watirspec/scroll_spec.rb +208 -0
  316. data/spec/watirspec/shadow_root_spec.rb +108 -0
  317. data/spec/watirspec/support/rspec_matchers.rb +161 -0
  318. data/spec/watirspec/user_editable_spec.rb +207 -0
  319. data/spec/watirspec/wait_spec.rb +345 -0
  320. data/spec/watirspec/window_switching_spec.rb +580 -0
  321. data/spec/watirspec_helper.rb +163 -0
  322. data/support/doctest_helper.rb +101 -0
  323. data/support/version_differ.rb +60 -0
  324. data/watir.gemspec +50 -0
  325. metadata +652 -148
  326. data/readme.rb +0 -211
  327. data/unittests/WindowLogonExample.rb +0 -30
  328. data/unittests/WindowLogonExtra.rb +0 -7
  329. data/unittests/all_tests.rb +0 -10
  330. data/unittests/all_tests_concurrent.rb +0 -57
  331. data/unittests/attachToExistingWindow_test.rb +0 -40
  332. data/unittests/buttons_test.rb +0 -131
  333. data/unittests/checkbox_test.rb +0 -149
  334. data/unittests/core_tests.rb +0 -9
  335. data/unittests/css_test.rb +0 -60
  336. data/unittests/div_test.rb +0 -179
  337. data/unittests/errorchecker_test.rb +0 -29
  338. data/unittests/filefield_test.rb +0 -35
  339. data/unittests/form_test.rb +0 -279
  340. data/unittests/frame_test.rb +0 -141
  341. data/unittests/html/blankpage.html +0 -12
  342. data/unittests/html/buttons1.html +0 -40
  343. data/unittests/html/checkboxes1.html +0 -69
  344. data/unittests/html/complex_table.html +0 -36
  345. data/unittests/html/cssTest.html +0 -42
  346. data/unittests/html/div.html +0 -105
  347. data/unittests/html/fileupload.html +0 -45
  348. data/unittests/html/formTest1.html +0 -39
  349. data/unittests/html/forms2.html +0 -45
  350. data/unittests/html/forms3.html +0 -132
  351. data/unittests/html/forms4.html +0 -27
  352. data/unittests/html/frame_buttons.html +0 -4
  353. data/unittests/html/frame_links.html +0 -4
  354. data/unittests/html/frame_multi.html +0 -5
  355. data/unittests/html/iframeTest.html +0 -13
  356. data/unittests/html/iframeTest1.html +0 -7
  357. data/unittests/html/iframeTest2.html +0 -6
  358. data/unittests/html/images/button.jpg +0 -0
  359. data/unittests/html/images/circle.jpg +0 -0
  360. data/unittests/html/images/originaltriangle.jpg +0 -0
  361. data/unittests/html/images/square.jpg +0 -0
  362. data/unittests/html/images/triangle.jpg +0 -0
  363. data/unittests/html/images1.html +0 -52
  364. data/unittests/html/javascriptevents.html +0 -39
  365. data/unittests/html/link_pass.html +0 -11
  366. data/unittests/html/links1.html +0 -37
  367. data/unittests/html/links2.html +0 -11
  368. data/unittests/html/nestedFrames.html +0 -6
  369. data/unittests/html/pass.html +0 -10
  370. data/unittests/html/popups1.html +0 -60
  371. data/unittests/html/radioButtons1.html +0 -71
  372. data/unittests/html/select_tealeaf.html +0 -54
  373. data/unittests/html/selectboxes1.html +0 -55
  374. data/unittests/html/simple_table.html +0 -26
  375. data/unittests/html/simple_table_buttons.html +0 -104
  376. data/unittests/html/simple_table_columns.html +0 -76
  377. data/unittests/html/table1.html +0 -142
  378. data/unittests/html/textarea.html +0 -30
  379. data/unittests/html/textfields1.html +0 -87
  380. data/unittests/html/textsearch.html +0 -44
  381. data/unittests/ie_mock.rb +0 -93
  382. data/unittests/ie_test.rb +0 -50
  383. data/unittests/images_test.rb +0 -179
  384. data/unittests/iostring.rb +0 -30
  385. data/unittests/iostring_test.rb +0 -48
  386. data/unittests/js_events_test.rb +0 -77
  387. data/unittests/jscriptExtraAlert.rb +0 -6
  388. data/unittests/jscriptExtraConfirmCancel.rb +0 -7
  389. data/unittests/jscriptExtraConfirmOk.rb +0 -7
  390. data/unittests/jscriptPushButton.rb +0 -5
  391. data/unittests/jscript_test.rb +0 -57
  392. data/unittests/links_test.rb +0 -169
  393. data/unittests/minmax_test.rb +0 -31
  394. data/unittests/navigate_test.rb +0 -56
  395. data/unittests/non_core_tests.rb +0 -9
  396. data/unittests/pagecontainstext_test.rb +0 -49
  397. data/unittests/popups_test.rb +0 -44
  398. data/unittests/radios_test.rb +0 -164
  399. data/unittests/screen_capture_test.rb +0 -53
  400. data/unittests/selectbox_test.rb +0 -197
  401. data/unittests/send_keys_test.rb +0 -29
  402. data/unittests/setup.rb +0 -47
  403. data/unittests/table_test.rb +0 -306
  404. data/unittests/textAreafields_test.rb +0 -81
  405. data/unittests/textfields_test.rb +0 -239
  406. data/watir/AutoItX3.dll +0 -0
  407. data/watir/WindowHelper.rb +0 -47
  408. data/watir/camel_case.rb +0 -37
  409. data/watir/clickJSDialog.rb +0 -19
  410. data/watir/cookiemanager.rb +0 -53
  411. data/watir/exceptions.rb +0 -60
  412. data/watir/screen_capture.rb +0 -115
  413. data/watir/setFileDialog.rb +0 -16
  414. data/watir/testUnitAddons.rb +0 -47
  415. data/watir/watir_simple.rb +0 -475
  416. data/watir/winClicker.rb +0 -505
  417. data/watir.rb +0 -3744
  418. /data/{unittests → spec/watirspec}/html/images/1.gif +0 -0
  419. /data/{unittests/html/images/2.GIF → spec/watirspec/html/images/2.gif} +0 -0
  420. /data/{unittests/html/images/3.GIF → spec/watirspec/html/images/3.gif} +0 -0
  421. /data/{unittests/html/images/minus.GIF → spec/watirspec/html/images/minus.gif} +0 -0
  422. /data/{unittests → spec/watirspec}/html/images/plus.gif +0 -0
@@ -0,0 +1,64 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'watirspec_helper'
4
+
5
+ module Watir
6
+ describe 'TableBodies' do
7
+ before do
8
+ browser.goto(WatirSpec.url_for('tables.html'))
9
+ end
10
+
11
+ describe 'with selectors' do
12
+ it 'returns the matching elements' do
13
+ expect(browser.tbodys(id: 'first').to_a).to eq [browser.tbody(id: 'first')]
14
+ end
15
+ end
16
+
17
+ describe '#length' do
18
+ it 'returns the correct number of table bodies (page context)' do
19
+ expect(browser.tbodys.length).to eq 5
20
+ end
21
+
22
+ it 'returns the correct number of table bodies (table context)' do
23
+ expect(browser.table(index: 0).tbodys.length).to eq 2
24
+ end
25
+ end
26
+
27
+ describe '#[]' do
28
+ it 'returns the row at the given index (page context)' do
29
+ expect(browser.tbodys[0].id).to eq 'first'
30
+ end
31
+
32
+ it 'returns the row at the given index (table context)' do
33
+ expect(browser.table(index: 0).tbodys[0].id).to eq 'first'
34
+ end
35
+ end
36
+
37
+ describe '#each' do
38
+ it 'iterates through table bodies correctly (browser context)' do
39
+ count = 0
40
+
41
+ browser.tbodys.each_with_index do |body, index|
42
+ expect(body.id).to eq browser.tbody(index: index).id
43
+
44
+ count += 1
45
+ end
46
+
47
+ expect(count).to be > 0
48
+ end
49
+
50
+ it 'iterates through table bodies correctly (table context)' do
51
+ table = browser.table(index: 0)
52
+ count = 0
53
+
54
+ table.tbodys.each_with_index do |body, index|
55
+ expect(body.id).to eq table.tbody(index: index).id
56
+
57
+ count += 1
58
+ end
59
+
60
+ expect(count).to be > 0
61
+ end
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,92 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'watirspec_helper'
4
+
5
+ module Watir
6
+ describe TableDataCell do
7
+ before do
8
+ browser.goto(WatirSpec.url_for('tables.html'))
9
+ end
10
+
11
+ # Exists
12
+ describe '#exists?' do
13
+ it 'returns true when the table cell exists' do
14
+ expect(browser.td(id: 't1_r2_c1')).to exist
15
+ expect(browser.td(id: /t1_r2_c1/)).to exist
16
+ expect(browser.td(text: 'Table 1, Row 3, Cell 1')).to exist
17
+ expect(browser.td(text: /Table 1/)).to exist
18
+ expect(browser.td(index: 0)).to exist
19
+ expect(browser.td(xpath: "//td[@id='t1_r2_c1']")).to exist
20
+ end
21
+
22
+ it 'returns the first cell if given no args' do
23
+ expect(browser.td).to exist
24
+ end
25
+
26
+ it 'returns false when the table cell does not exist' do
27
+ expect(browser.td(id: 'no_such_id')).not_to exist
28
+ expect(browser.td(id: /no_such_id/)).not_to exist
29
+ expect(browser.td(text: 'no_such_text')).not_to exist
30
+ expect(browser.td(text: /no_such_text/)).not_to exist
31
+ expect(browser.td(index: 1337)).not_to exist
32
+ expect(browser.td(xpath: "//td[@id='no_such_id']")).not_to exist
33
+ end
34
+
35
+ it "raises TypeError when 'what' argument is invalid" do
36
+ expect { browser.td(id: 3.14).exists? }.to raise_error(TypeError)
37
+ end
38
+ end
39
+
40
+ describe '#click' do
41
+ it "fires the table's onclick event" do
42
+ browser.td(id: 't2_r1_c1').click
43
+ expect(messages).to include('td')
44
+ end
45
+ end
46
+
47
+ # Attribute methods
48
+ describe '#text', except: {browser: :safari, reason: 'Safari does not strip text'} do
49
+ it 'returns the text inside the table cell' do
50
+ expect(browser.td(id: 't1_r2_c1').text).to eq 'Table 1, Row 2, Cell 1'
51
+ expect(browser.td(id: 't2_r1_c1').text).to eq 'Table 2, Row 1, Cell 1'
52
+ end
53
+ end
54
+
55
+ describe '#colspan' do
56
+ it 'gets the colspan attribute' do
57
+ expect(browser.td(id: 'colspan_2').colspan).to eq 2
58
+ expect(browser.td(id: 'no_colspan').colspan).to eq 1
59
+ end
60
+ end
61
+
62
+ describe '#respond_to?' do
63
+ it 'returns true for all attribute methods' do
64
+ expect(browser.td(index: 0)).to respond_to(:text)
65
+ expect(browser.td(index: 0)).to respond_to(:colspan)
66
+ end
67
+ end
68
+
69
+ describe '#column_header' do
70
+ it 'returns the corresponding column header' do
71
+ header = browser.td(text: '1 331').column_header
72
+ expect(header).to eq 'Income tax'
73
+ end
74
+ end
75
+
76
+ describe '#sibling_from_header' do
77
+ it 'returns the corresponding sibling cell by text' do
78
+ local_td = browser.td(text: '1 331')
79
+
80
+ td = local_td.sibling_from_header(text: 'After income tax')
81
+ expect(td.text).to eq '4 532'
82
+ end
83
+
84
+ it 'returns the corresponding sibling cell by index' do
85
+ local_td = browser.td(text: '1 331')
86
+
87
+ td = local_td.sibling_from_header(text: /tax/, index: 2)
88
+ expect(td.text).to eq '4 532'
89
+ end
90
+ end
91
+ end
92
+ end
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'watirspec_helper'
4
+
5
+ module Watir
6
+ describe TableDataCellCollection do
7
+ before do
8
+ browser.goto(WatirSpec.url_for('tables.html'))
9
+ end
10
+
11
+ describe 'with selectors' do
12
+ it 'returns the matching elements' do
13
+ expect(browser.tds(headers: 'before_tax').to_a).to eq [browser.td(headers: 'before_tax')]
14
+ end
15
+ end
16
+
17
+ # describe "#length" do
18
+ # it "returns the number of cells" do
19
+ # browser.table(id: 'outer').cells.length.to eq 6
20
+ # browser.table(id: 'inner').cells.length.to eq 2
21
+ # end
22
+ # end
23
+ #
24
+ # describe "#[]" do
25
+ # it "returns the row at the given index" do
26
+ # browser.table(id: 'outer').cells[0].text.to eq "Table 1, Row 1, Cell 1"
27
+ # browser.table(id: 'inner').cells[0].text.to eq "Table 2, Row 1, Cell 1"
28
+ # browser.table(id: 'outer').cells[6].text.to eq "Table 1, Row 3, Cell 2"
29
+ # end
30
+ # end
31
+
32
+ describe '#each' do
33
+ it 'iterates through all cells on the page correctly' do
34
+ count = 0
35
+
36
+ browser.tds.each_with_index do |c, index|
37
+ expect(c.id).to eq browser.td(index: index).id
38
+ count += 1
39
+ end
40
+
41
+ expect(count).to be > 0
42
+ end
43
+
44
+ it 'iterates through cells inside a table' do
45
+ count = 0
46
+
47
+ inner_table = browser.table(id: 'inner')
48
+ inner_table.tds.each_with_index do |c, index|
49
+ expect(c.id).to eq inner_table.td(index: index).id
50
+ count += 1
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,223 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'watirspec_helper'
4
+
5
+ module Watir
6
+ describe TextField do
7
+ before do
8
+ browser.goto(WatirSpec.url_for('forms_with_input_elements.html'))
9
+ end
10
+
11
+ # Exists method
12
+ describe '#exists?' do
13
+ it 'returns true if the element exists' do
14
+ expect(browser.text_field(id: 'new_user_email')).to exist
15
+ expect(browser.text_field(id: /new_user_email/)).to exist
16
+ expect(browser.text_field(name: 'new_user_email')).to exist
17
+ expect(browser.text_field(name: /new_user_email/)).to exist
18
+ expect(browser.text_field(name: /new_user_occupation/i)).to exist
19
+ expect(browser.text_field(value: 'Developer')).to exist
20
+ expect(browser.text_field(value: /Developer/)).to exist
21
+ expect(browser.text_field(class: 'name')).to exist
22
+ expect(browser.text_field(class: /name/)).to exist
23
+ expect(browser.text_field(index: 0)).to exist
24
+ expect(browser.text_field(xpath: "//input[@id='new_user_email']")).to exist
25
+ expect(browser.text_field(label: 'First name')).to exist
26
+ expect(browser.text_field(label: /(q|a)st? name/)).to exist
27
+ expect(browser.text_field(label: 'Without for')).to exist
28
+ expect(browser.text_field(label: /Without for/)).to exist
29
+ expect(browser.text_field(label: 'With hidden text')).to exist
30
+ expect(browser.text_field(label: 'With text')).not_to exist
31
+
32
+ expect(browser.text_field(label: /With hidden text/)).to exist
33
+ expect(browser.text_field(label: /With text/)).not_to exist
34
+ end
35
+
36
+ it 'returns true in spite of hidden text',
37
+ except: {browser: :safari, reason: 'Safari is not filtering out hidden text'} do
38
+ expect(browser.text_field(visible_label: 'With hidden text')).not_to exist
39
+ expect(browser.text_field(visible_label: 'With text')).to exist
40
+ expect(browser.text_field(visible_label: /With text/)).to exist
41
+ expect(browser.text_field(visible_label: /With hidden text/)).not_to exist
42
+ end
43
+
44
+ it 'locates value of text_field using text locators' do
45
+ browser.text_field(id: 'new_user_occupation').set 'Firefighter'
46
+
47
+ expect(browser.text_field(text: 'Firefighter')).to exist
48
+ expect(browser.text_field(text: /Fire/)).to exist
49
+ expect(browser.text_field(visible_text: 'Firefighter')).to exist
50
+ expect(browser.text_field(visible_text: /Fire/)).to exist
51
+ end
52
+
53
+ it 'returns the first text field if given no args' do
54
+ expect(browser.text_field).to exist
55
+ end
56
+
57
+ it 'respects text fields types' do
58
+ expect(browser.text_field.type).to eq('text')
59
+ end
60
+
61
+ it 'returns true if the element exists (no type attribute)' do
62
+ expect(browser.text_field(id: 'new_user_first_name')).to exist
63
+ end
64
+
65
+ it 'returns true if the element exists (invalid type attribute)' do
66
+ expect(browser.text_field(id: 'new_user_last_name')).to exist
67
+ end
68
+
69
+ it 'returns true for element with upper case type' do
70
+ expect(browser.text_field(id: 'new_user_email_confirm')).to exist
71
+ end
72
+
73
+ it 'returns true for element with unknown type attribute' do
74
+ expect(browser.text_field(id: 'unknown_text_field')).to exist
75
+ end
76
+
77
+ it 'returns false if the element does not exist' do
78
+ expect(browser.text_field(id: 'no_such_id')).not_to exist
79
+ expect(browser.text_field(id: /no_such_id/)).not_to exist
80
+ expect(browser.text_field(name: 'no_such_name')).not_to exist
81
+ expect(browser.text_field(name: /no_such_name/)).not_to exist
82
+ expect(browser.text_field(value: 'no_such_value')).not_to exist
83
+ expect(browser.text_field(value: /no_such_value/)).not_to exist
84
+ expect(browser.text_field(text: 'no_such_text')).not_to exist
85
+ expect(browser.text_field(text: /no_such_text/)).not_to exist
86
+ expect(browser.text_field(class: 'no_such_class')).not_to exist
87
+ expect(browser.text_field(class: /no_such_class/)).not_to exist
88
+ expect(browser.text_field(index: 1337)).not_to exist
89
+ expect(browser.text_field(xpath: "//input[@id='no_such_id']")).not_to exist
90
+ expect(browser.text_field(label: 'bad label')).not_to exist
91
+ expect(browser.text_field(label: /bad label/)).not_to exist
92
+
93
+ # input type='hidden' should not be found by #text_field
94
+ expect(browser.text_field(id: 'new_user_interests_dolls')).not_to exist
95
+ end
96
+
97
+ it "raises TypeError when 'what' argument is invalid" do
98
+ expect { browser.text_field(id: 3.14).exists? }.to raise_error(TypeError)
99
+ end
100
+ end
101
+
102
+ # Attribute methods
103
+ describe '#id' do
104
+ it 'returns the id attribute if the text field exists' do
105
+ expect(browser.text_field(index: 4).id).to eq 'new_user_occupation'
106
+ end
107
+
108
+ it "raises UnknownObjectException if the text field doesn't exist" do
109
+ expect { browser.text_field(index: 1337).id }.to raise_unknown_object_exception
110
+ end
111
+ end
112
+
113
+ describe '#name' do
114
+ it 'returns the name attribute if the text field exists' do
115
+ expect(browser.text_field(index: 3).name).to eq 'new_user_email_confirm'
116
+ end
117
+
118
+ it "raises UnknownObjectException if the text field doesn't exist" do
119
+ expect { browser.text_field(index: 1337).name }.to raise_unknown_object_exception
120
+ end
121
+ end
122
+
123
+ describe '#title' do
124
+ it 'returns the title attribute if the text field exists' do
125
+ expect(browser.text_field(id: 'new_user_code').title).to eq 'Your personal code'
126
+ end
127
+
128
+ it "raises UnknownObjectException if the text field doesn't exist" do
129
+ expect { browser.text_field(index: 1337).title }.to raise_unknown_object_exception
130
+ end
131
+ end
132
+
133
+ describe '#type' do
134
+ it 'returns the type attribute if the text field exists' do
135
+ expect(browser.text_field(index: 3).type).to eq 'text'
136
+ end
137
+
138
+ it "returns 'text' if the type attribute is invalid" do
139
+ expect(browser.text_field(id: 'new_user_last_name').type).to eq 'text'
140
+ end
141
+
142
+ it "returns 'text' if the type attribute does not exist" do
143
+ expect(browser.text_field(id: 'new_user_first_name').type).to eq 'text'
144
+ end
145
+
146
+ it "raises UnknownObjectException if the text field doesn't exist" do
147
+ expect { browser.text_field(index: 1337).type }.to raise_unknown_object_exception
148
+ end
149
+ end
150
+
151
+ describe '#value' do
152
+ it 'returns the value attribute if the text field exists' do
153
+ expect(browser.text_field(name: 'new_user_occupation').value).to eq 'Developer'
154
+ expect(browser.text_field(index: 4).value).to eq 'Developer'
155
+ expect(browser.text_field(name: /new_user_occupation/i).value).to eq 'Developer'
156
+ end
157
+
158
+ it "raises UnknownObjectException if the text field doesn't exist" do
159
+ expect { browser.text_field(index: 1337).value }.to raise_unknown_object_exception
160
+ end
161
+ end
162
+
163
+ describe '#respond_to?' do
164
+ it 'returns true for all attribute methods' do
165
+ expect(browser.text_field(index: 0)).to respond_to(:class_name)
166
+ expect(browser.text_field(index: 0)).to respond_to(:id)
167
+ expect(browser.text_field(index: 0)).to respond_to(:name)
168
+ expect(browser.text_field(index: 0)).to respond_to(:title)
169
+ expect(browser.text_field(index: 0)).to respond_to(:type)
170
+ expect(browser.text_field(index: 0)).to respond_to(:value)
171
+ end
172
+ end
173
+
174
+ # Access methods
175
+ describe '#enabled?' do
176
+ it 'returns true for enabled text fields' do
177
+ expect(browser.text_field(name: 'new_user_occupation')).to be_enabled
178
+ expect(browser.text_field(id: 'new_user_email')).to be_enabled
179
+ end
180
+
181
+ it 'returns false for disabled text fields' do
182
+ expect(browser.text_field(name: 'new_user_species')).not_to be_enabled
183
+ end
184
+
185
+ it "raises UnknownObjectException if the text field doesn't exist" do
186
+ expect { browser.text_field(id: 'no_such_id').enabled? }.to raise_unknown_object_exception
187
+ end
188
+ end
189
+
190
+ describe '#disabled?' do
191
+ it 'returns true if the text field is disabled' do
192
+ expect(browser.text_field(id: 'new_user_species')).to be_disabled
193
+ end
194
+
195
+ it 'returns false if the text field is enabled' do
196
+ expect(browser.text_field(index: 0)).not_to be_disabled
197
+ end
198
+
199
+ it "raises UnknownObjectException if the text field doesn't exist" do
200
+ expect { browser.text_field(index: 1337).disabled? }.to raise_unknown_object_exception
201
+ end
202
+ end
203
+
204
+ describe '#readonly?' do
205
+ it 'returns true for read-only text fields' do
206
+ expect(browser.text_field(name: 'new_user_code')).to be_readonly
207
+ expect(browser.text_field(id: 'new_user_code')).to be_readonly
208
+ end
209
+
210
+ it 'returns false for writable text fields' do
211
+ expect(browser.text_field(name: 'new_user_email')).not_to be_readonly
212
+ end
213
+
214
+ it "raises UnknownObjectException if the text field doesn't exist" do
215
+ expect { browser.text_field(id: 'no_such_id').readonly? }.to raise_unknown_object_exception
216
+ end
217
+
218
+ it 'raises UnknownReadOnlyException if sending keys to readonly element' do
219
+ expect { browser.text_field(id: 'new_user_code').set 'foo' }.to raise_object_read_only_exception
220
+ end
221
+ end
222
+ end
223
+ end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'watirspec_helper'
4
+
5
+ module Watir
6
+ describe TextFieldCollection do
7
+ before do
8
+ browser.goto(WatirSpec.url_for('forms_with_input_elements.html'))
9
+ end
10
+
11
+ describe 'with selectors' do
12
+ it 'returns the matching elements' do
13
+ expect(browser.text_fields(name: 'new_user_email').to_a).to eq [browser.text_field(name: 'new_user_email')]
14
+ end
15
+ end
16
+
17
+ describe '#length' do
18
+ it 'returns the number of text fields' do
19
+ expect(browser.text_fields.length).to eq 19
20
+ end
21
+ end
22
+
23
+ describe '#[]' do
24
+ it 'returns the text field at the given index' do
25
+ expect(browser.text_fields[0].id).to eq 'new_user_first_name'
26
+ expect(browser.text_fields[1].id).to eq 'new_user_last_name'
27
+ expect(browser.text_fields[2].id).to eq 'new_user_email'
28
+ end
29
+ end
30
+
31
+ describe '#each' do
32
+ it 'iterates through text fields correctly' do
33
+ count = 0
34
+
35
+ browser.text_fields.each_with_index do |r, index|
36
+ expect(r.name).to eq browser.text_field(index: index).name
37
+ expect(r.id).to eq browser.text_field(index: index).id
38
+ expect(r.value).to eq browser.text_field(index: index).value
39
+
40
+ count += 1
41
+ end
42
+
43
+ expect(count).to be > 0
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'watirspec_helper'
4
+
5
+ module Watir
6
+ describe TextArea do
7
+ before do
8
+ browser.goto WatirSpec.url_for('forms_with_input_elements.html')
9
+ end
10
+
11
+ let(:textarea) { browser.textarea }
12
+
13
+ it 'can set a value' do
14
+ textarea.set 'foo'
15
+ expect(textarea.value).to eq 'foo'
16
+ end
17
+
18
+ it 'can clear a value' do
19
+ textarea.set 'foo'
20
+ textarea.clear
21
+ expect(textarea.value).to eq ''
22
+ end
23
+
24
+ it 'locates textarea by value' do
25
+ browser.textarea.set 'foo'
26
+ expect(browser.textarea(value: /foo/)).to exist
27
+ expect(browser.textarea(value: 'foo')).to exist
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'watirspec_helper'
4
+
5
+ module Watir
6
+ describe TextAreaCollection do
7
+ before do
8
+ browser.goto WatirSpec.url_for('forms_with_input_elements.html')
9
+ end
10
+
11
+ context 'when locating by :value' do
12
+ before do
13
+ browser.textarea(index: 0).set 'foo1'
14
+ browser.textarea(index: 1).set 'foo2'
15
+ end
16
+
17
+ it 'finds textareas by string' do
18
+ expect(browser.textareas(value: 'foo1').map(&:id)).to eq [browser.textarea(index: 0).id]
19
+ expect(browser.textareas(value: 'foo2').map(&:id)).to eq [browser.textarea(index: 1).id]
20
+ end
21
+
22
+ it 'finds textareas by regexp' do
23
+ expect(browser.textareas(value: /foo/)[0].id).to eq browser.textarea(index: 0).id
24
+ expect(browser.textareas(value: /foo/)[1].id).to eq browser.textarea(index: 1).id
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,89 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'watirspec_helper'
4
+
5
+ module Watir
6
+ describe 'TableFooter' do
7
+ before do
8
+ browser.goto(WatirSpec.url_for('tables.html'))
9
+ end
10
+
11
+ describe '#exists?' do
12
+ it 'returns true if the table tfoot exists (page context)' do
13
+ expect(browser.tfoot(id: 'tax_totals')).to exist
14
+ expect(browser.tfoot(id: /tax_totals/)).to exist
15
+ expect(browser.tfoot(index: 0)).to exist
16
+ expect(browser.tfoot(xpath: "//tfoot[@id='tax_totals']")).to exist
17
+ end
18
+
19
+ it 'returns true if the table tfoot exists (table context)' do
20
+ expect(browser.table(index: 0).tfoot(id: 'tax_totals')).to exist
21
+ expect(browser.table(index: 0).tfoot(id: /tax_totals/)).to exist
22
+ expect(browser.table(index: 0).tfoot(index: 0)).to exist
23
+ expect(browser.table(index: 0).tfoot(xpath: "//tfoot[@id='tax_totals']")).to exist
24
+ end
25
+
26
+ it 'returns the first tfoot if given no args' do
27
+ expect(browser.tfoot).to exist
28
+ end
29
+
30
+ it "returns false if the table tfoot doesn't exist (page context)" do
31
+ expect(browser.tfoot(id: 'no_such_id')).not_to exist
32
+ expect(browser.tfoot(id: /no_such_id/)).not_to exist
33
+ expect(browser.tfoot(index: 1337)).not_to exist
34
+ expect(browser.tfoot(xpath: "//tfoot[@id='no_such_id']")).not_to exist
35
+ end
36
+
37
+ it "returns false if the table tfoot doesn't exist (table context)" do
38
+ expect(browser.table(index: 0).tfoot(id: 'no_such_id')).not_to exist
39
+ expect(browser.table(index: 0).tfoot(id: /no_such_id/)).not_to exist
40
+ expect(browser.table(index: 0).tfoot(index: 1337)).not_to exist
41
+ expect(browser.table(index: 0).tfoot(xpath: "//tfoot[@id='no_such_id']")).not_to exist
42
+ end
43
+
44
+ it "raises TypeError when 'what' argument is invalid" do
45
+ expect { browser.tfoot(id: 3.14).exists? }.to raise_error(TypeError)
46
+ expect { browser.table(index: 0).tfoot(id: 3.14).exists? }.to raise_error(TypeError)
47
+ end
48
+ end
49
+
50
+ describe '#[]' do
51
+ it 'returns the row at the given index (page context)' do
52
+ expect(browser.tfoot(id: 'tax_totals')[0].id).to eq 'tfoot_row_1'
53
+ expect(browser.tfoot(id: 'tax_totals')[0][1].text).to eq '24 349'
54
+ expect(browser.tfoot(id: 'tax_totals')[0][2].text).to eq '5 577'
55
+ end
56
+
57
+ it 'returns the row at the given index (table context)' do
58
+ expect(browser.table(index: 0).tfoot(id: 'tax_totals')[0].id).to eq 'tfoot_row_1'
59
+ expect(browser.table(index: 0).tfoot(id: 'tax_totals')[0][1].text).to eq '24 349'
60
+ expect(browser.table(index: 0).tfoot(id: 'tax_totals')[0][2].text).to eq '5 577'
61
+ end
62
+ end
63
+
64
+ describe '#row' do
65
+ it 'finds the first row matching the selector' do
66
+ row = browser.tfoot(id: 'tax_totals').row(id: 'tfoot_row_1')
67
+
68
+ expect(row.id).to eq 'tfoot_row_1'
69
+ end
70
+ end
71
+
72
+ describe '#rows' do
73
+ it 'finds rows matching the selector' do
74
+ rows = browser.tfoot(id: 'tax_totals').rows(id: 'tfoot_row_1')
75
+
76
+ expect(rows.size).to eq 1
77
+ expect(rows.first.id).to eq 'tfoot_row_1'
78
+ end
79
+ end
80
+
81
+ describe '#strings' do
82
+ it 'returns the text of child cells' do
83
+ expect(browser.tfoot(id: 'tax_totals').strings).to eq [
84
+ ['Sum', '24 349', '5 577', '18 722']
85
+ ]
86
+ end
87
+ end
88
+ end
89
+ end