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
@@ -1,475 +0,0 @@
1
- =begin
2
- license
3
- ---------------------------------------------------------------------------
4
- Copyright (c) 2004-2005, Atomic Object LLC
5
- All rights reserved.
6
-
7
- Redistribution and use in source and binary forms, with or without
8
- modification, are permitted provided that the following conditions are met:
9
-
10
- 1. Redistributions of source code must retain the above copyright notice,
11
- this list of conditions and the following disclaimer.
12
-
13
- 2. Redistributions in binary form must reproduce the above copyright
14
- notice, this list of conditions and the following disclaimer in the
15
- documentation and/or other materials provided with the distribution.
16
-
17
- 3. Neither the name "Atomic Object LLC" nor the names of contributors to
18
- this software may be used to endorse or promote products derived from this
19
- software without specific prior written permission.
20
-
21
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
22
- IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23
- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24
- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
25
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
28
- OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29
- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
30
- OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
31
- ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
- --------------------------------------------------------------------------
33
- (based on BSD Open Source License)
34
- =end
35
-
36
- require 'test/unit/assertions'
37
- require 'watir'
38
-
39
- module Watir
40
- # = Description
41
- # Watir::Simple is a simple wrapper around the Watir module. It provides a
42
- # similar set of operations while simplifying them and removing as much syntax
43
- # and test-framework context code as possible.
44
- # The goal is to allow toolsmiths to write domain-language frameworks on top of
45
- # Watir, using Watir::Simple as an easier, lightweight interface to the power
46
- # of Watir.
47
- #
48
- # = Note
49
- # Most action methods in Watir::Simple will automatically wait for the browser
50
- # not to be busy before and after they perform the specified action.
51
- #
52
- # revision: $Revision: 1.1 $
53
- module Simple
54
-
55
- # Open up a browser and point it at a certain URL.
56
- def new_browser_at(url)
57
- @@browser = IE.new
58
- @@browser.typingspeed = 0
59
- @@browser.goto url
60
- end
61
-
62
-
63
- # Tell the browser to load a particular URL.
64
- def navigate_to(url)
65
- @@browser.goto url
66
- end
67
-
68
-
69
- # Much like click_link_with_url but navigates to link instead of clicking it,
70
- # thereby not invoking OnClick for links.
71
- def navigate_to_link_with_url(url)
72
- # FIXME: this should be moved into Watir!
73
- wait_before_and_after do
74
- doc = @@browser.getDocument()
75
- links = doc.links
76
- link = nil
77
- links.each do |n|
78
- match = false
79
- case url
80
- when Regexp
81
- match = (n.invoke("href") =~ url)
82
- when String
83
- match = (n.invoke("href") == url)
84
- end
85
- if match
86
- link = n
87
- break
88
- end
89
- end
90
- raise "Couldn't find link with url #{url}" unless link
91
- @@browser.goto link
92
- end
93
- end
94
-
95
- # Much like click_link_with_id but navigates to link instead of clicking it,
96
- # thereby not invoking OnClick for links.
97
- def navigate_to_link_with_id(id)
98
- # FIXME: this should be moved into Watir!
99
- wait_before_and_after do
100
- doc = @@browser.getDocument()
101
- links = doc.links
102
- link = nil
103
- links.each do |n|
104
- match = false
105
- case id
106
- when Regexp
107
- match = (n.invoke("id") =~ id)
108
- when String
109
- match = (n.invoke("id") == id)
110
- end
111
- if match
112
- link = n
113
- break
114
- end
115
- end
116
- raise "Couldn't find link with id #{id}" unless link
117
- @@browser.goto link
118
- end
119
- end
120
-
121
- # Tell the browser to click on the first link with the specified URL.
122
- # This takes the address of the link instead of the text displayed.
123
- # * url - can be a string to match exactly, or a regular expression.
124
- #
125
- # Example:
126
- # click_link_with_url "http://google.com"
127
- # or:
128
- # click_link_with_url /goo*/
129
- def click_link_with_url(url)
130
- wait_before_and_after { @@browser.link(:url, url).click }
131
- end
132
-
133
-
134
- # Tell the browser to click on the first link with the specified id attribute
135
- # (the preferred method.)
136
- def click_link_with_id(id)
137
- wait_before_and_after { @@browser.link(:id, id).click }
138
- end
139
-
140
-
141
- # Tell the browser to click on the first link with the specified name attribute
142
- def click_link_with_name(name)
143
- wait_before_and_after { @@browser.link(:name, name).click }
144
- end
145
-
146
-
147
- # Tell the browser to click on the specified link as determined by the
148
- # sequential ordering of links on the document.
149
- def click_link_with_index(index)
150
- wait_before_and_after { @@browser.link(:index, index).click }
151
- end
152
-
153
-
154
- # Tell the browser to click on the first link with the specified text in the
155
- # link body.
156
- def click_link_with_text(text)
157
- wait_before_and_after { @@browser.link(:text, text).click }
158
- end
159
-
160
-
161
- # Set the text of the field with a given name (the preferred method.)
162
- # This only types characters into the field and does not submit the form.
163
- def enter_text_into_field_with_name(name, text)
164
- wait_before_and_after { @@browser.textField(:name, name).set(text) }
165
- end
166
-
167
-
168
- # Set the text of the field with a given id attribute (the preferred method.)
169
- # This only types characters into the field and does not submit the form.
170
- def enter_text_into_field_with_id(id, text)
171
- wait_before_and_after { @@browser.textField(:id, id).set(text) }
172
- end
173
-
174
-
175
- # Set the text of the indexed field. This only types characters
176
- # into the field and does not submit the form.
177
- def enter_text_into_field_with_index(index, text)
178
- wait_before_and_after { @@browser.textField(:index, index).set(text) }
179
- end
180
-
181
-
182
- # Select an item from a selectbox (a.k.a "combo box", or "pulldown")
183
- # The selectbox is chose by matching its name attribute.
184
- # The item is selected based on the text content of <OPTION> tags.
185
- def select_from_combobox_with_name(name, text)
186
- wait_before_and_after { @@browser.selectBox(:name, name).select(text) }
187
- end
188
-
189
-
190
- # Select an item from a selectbox (a.k.a "combo box", or "pulldown")
191
- # The selectbox is chose by matching its id attribute.
192
- # The item is selected based on the text content of <OPTION> tags.
193
- def select_from_combobox_with_id(id, text)
194
- wait_before_and_after { @@browser.selectBox(:id, id).select(text) }
195
- end
196
-
197
-
198
- # Select an item from a selectbox (a.k.a "combo box", or "pulldown")
199
- # The selectbox is chose by matching its order of appearance in the
200
- # document.
201
- # The item is selected based on the text content of <OPTION> tags.
202
- def select_from_combobox_with_index(index, text)
203
- wait_before_and_after { @@browser.selectBox(:index, index).select(text) }
204
- end
205
-
206
-
207
- # Select an item (+value+) from the radio button collection with +name+.
208
- def select_radio_button_with_name(name, value)
209
- wait_before_and_after { @@browser.radio(:name, name, value).click }
210
- end
211
-
212
-
213
- # Select an item (+value+) from the +index+'th radio button collection.
214
- def select_radio_button_with_name(index, value)
215
- wait_before_and_after { @@browser.radio(:index, index, value).click }
216
- end
217
-
218
-
219
- # Select an item (+value+) from the radio button collection with a matching
220
- # +id+ attribute.
221
- def select_radio_button_with_id(id, value)
222
- wait_before_and_after { @@browser.radio(:id, id, value).click }
223
- end
224
-
225
-
226
- # Tell the browser to click on a form button with +name+.
227
- def click_button_with_name(name)
228
- wait_before_and_after { @@browser.button(:name, name).click }
229
- end
230
-
231
-
232
- # Tell the browser to click on a form button with the specified id attribute.
233
- def click_button_with_id(id)
234
- wait_before_and_after { @@browser.button(:id, id).click }
235
- end
236
-
237
-
238
- # Tell the browser to click on a form button with the specified value attribute.
239
- def click_button_with_value(value)
240
- wait_before_and_after { @@browser.button(:value, value).click }
241
- end
242
-
243
-
244
- # Tell the browser to click on a form button with the specified caption text.
245
- def click_button_with_caption(caption)
246
- wait_before_and_after { @@browser.button(:caption, caption).click }
247
- end
248
-
249
-
250
- # Tell the browser to click on the +index+'th form button on the page.
251
- def click_button_with_index(index)
252
- wait_before_and_after { @@browser.button(:index, index).click }
253
- end
254
-
255
-
256
- # Make a Test::Unit assertion that the given +text+ does not appear in the text
257
- # body.
258
- #
259
- # * mesg - An assertion-failed message.
260
- def assert_text_not_in_body(text,mesg=nil)
261
- if mesg.nil? then
262
- assert(! @@browser.pageContainsText(text), "couldn't find in body: [#{text}]")
263
- else
264
- assert(! @@browser.pageContainsText(text), mesg)
265
- end
266
- end
267
-
268
-
269
- # Make a Test::Unit assertion that the given +text+ appears in the text
270
- # body.
271
- #
272
- # * text - +String+ or +RegExp+ - The text or regular expression to search for.
273
- # * mesg - +String+ - An optional assertion-failed message.
274
- def assert_text_in_body(text,mesg=nil)
275
- if mesg.nil? then
276
- assert(@@browser.pageContainsText(text), "couldn't find in body: [#{text}]")
277
- else
278
- assert(@@browser.pageContainsText(text), mesg)
279
- end
280
- end
281
-
282
-
283
- # This method returns true|false if the text/reg exp supplied is in a the text field "name".
284
- #
285
- # * name - +String+ - Name of field to examine.
286
- # * text - +String+ or +RegExp+ - The text or regular expression to search for.
287
- # * mesg - +String+ - An optional assertion-failed message.
288
- def assert_text_in_field(name, text, mesg=nil)
289
- if mesg.nil? then
290
- assert(@@browser.textField(:name, name).verify_contains(text), "couldn't find in field #{name}: [#{text}]")
291
- else
292
- assert(@@browser.textField(:name, name).verify_contains(text), mesg)
293
- end
294
- end
295
-
296
- #
297
- # * how - symbol - the way we look for the object. Supported values are
298
- # - :name
299
- # - :id
300
- # - :index
301
- # * what - string - What field, id or name to examine.
302
- # * text - string/Array of Strings - The string or array of strings to search for.
303
- # * mesg - Optional! string - Set this if you want to supply your own error message
304
- def assert_text_in_combobox_wrapper(how, what, text, mesg=nil)
305
- assert(@@browser.selectBox(how, what), "could not find a combobox with what: #{what} and how: #{how}")
306
- selectedItems = @@browser.selectBox(how, what).getSelectedItems
307
-
308
- if text.kind_of? String
309
- if mesg.nil? then
310
- assert(selectedItems[0] == text, "couldn't find text in combobox with #{how}: #{what} - [#{text}], had [#{selectedItems[0]}]")
311
- else
312
- assert(selectedItems[0] == text, mesg)
313
- end
314
-
315
- elsif text.kind_of? Array
316
- if mesg.nil? then
317
- text.each do |item|
318
- assert(selectedItems.include?(item), "couldn't find text in combobox with #{how}: #{what} - [#{text}], had [#{selectedItems}]")
319
- end
320
- else
321
- text.each do |item|
322
- assert(selectedItems.include?(item), mesg)
323
- end
324
- end
325
- end
326
- end
327
-
328
-
329
- # This method returns true|false if the text is selected in the combobox
330
- # with the supplied name.
331
- #
332
- # * name - string - Name of field to examine.
333
- # * text - string/Array of Strings - The string or array of strings to search for.
334
- # * mesg - Optional! string - Set this if you want to supply your own error message
335
- def assert_text_in_combobox_by_name(name, text, mesg=nil)
336
- assert_text_in_combobox_wrapper(:name, name, text, mesg)
337
- end
338
-
339
- # FIXME: how to use?
340
- # This method returns true|false if the text is selected in the combobox
341
- # with the supplied index.
342
- #
343
- # * index - string - Index of field to examine.
344
- # * text - string/Array of Strings - The string or array of strings to search for.
345
- # * mesg - Optional! string - Set this if you want to supply your own error message
346
- #def assert_text_in_combobox_by_index(index, text, mesg=nil)
347
- # assert_text_in_combobox_wrapper(:index, name, text, mesg)
348
- #end
349
-
350
- # This method returns true|false if the text is selected in the combobox
351
- # with the supplied id.
352
- #
353
- # * id - string - Id of field to examine.
354
- # * text - string/Array of Strings - The string or array of strings to search for.
355
- # * mesg - Optional! string - Set this if you want to supply your own error message
356
- def assert_text_in_combobox_by_id(id, text, mesg=nil)
357
- assert_text_in_combobox_wrapper(:id, name, text, mesg)
358
- end
359
-
360
-
361
-
362
- # Close the browser window. Useful for automated test suites to reduce
363
- # test interaction.
364
- def close_browser
365
- @@browser.getIE.quit
366
- sleep 2
367
- end
368
-
369
-
370
- # Tell the browser to cick the Back button.
371
- def go_back
372
- @@browser.back
373
- end
374
-
375
-
376
- # Tell the browser to cick the Forward button.
377
- def go_forward
378
- @@browser.forward
379
- end
380
-
381
-
382
- # Fill a series of text fields. This takes a hash of textfield names to
383
- # values for those fields.
384
- #
385
- # Example:
386
- #
387
- # fill_text_fields {
388
- # 'username' => 'joe',
389
- # 'password' => 'blahblah',
390
- # 'email' => 'joe@blahblah.com',
391
- # 'favorite_num' => 42
392
- # }
393
- def fill_text_fields(data)
394
- data.each do |field, value|
395
- @@browser.textField(:name, field).set(value)
396
- end
397
- end
398
-
399
-
400
- # Fill a single textfield with a value
401
- def fill_text_field(field_name, text)
402
- @@browser.textField(:name, field_name).set(text)
403
- end
404
-
405
-
406
- # Some browsers (i.e. IE) need to be waited on before more actions can be
407
- # performed. Most action methods in Watir::Simple already call this before
408
- # and after.
409
- def wait_for_browser
410
- @@browser.waitForIE
411
- end
412
-
413
-
414
- def combobox_default_selection(name)
415
- # FIXME _where_ is this used?
416
- @@browser.selectBox(:name, name).value
417
- end
418
-
419
-
420
- # Returns the number of times +text+ appears in the body text of the page.
421
- def count_instances_of(text)
422
- @@browser.getDocument.body.innerText.scan(text).size
423
- end
424
-
425
-
426
- # Make a Test::Unit assertion that an image exists on the page with the given
427
- # +src+ attribute.
428
- #
429
- # * mesg - +String+ - An optional assertion-failed message.
430
- def assert_image_with_src(src, mesg=nil)
431
- if mesg.nil? then
432
- assert( get_image_with_src(src) != nil, "image with src: [#{src}] is not present")
433
- else
434
- assert( get_image_with_src(src) != nil, mesg)
435
- end
436
- end
437
-
438
-
439
- # Make a Test::Unit assertion that an image exists on the page with the given
440
- # +id+ attribute. (Preferred method)
441
- #
442
- # * mesg - +String+ - An optional assertion-failed message.
443
- def assert_image_with_id(id, mesg=nil)
444
- if mesg.nil? then
445
- assert( get_image_with_id(id) != nil, "image with id: [#{id}] is not present")
446
- else
447
- assert( get_image_with_id(id) != nil, mesg)
448
- end
449
- end
450
-
451
-
452
- # A convenience method to wait at both ends of an operation for the browser
453
- # to catch up.
454
- def wait_before_and_after
455
- wait_for_browser
456
- yield
457
- wait_for_browser
458
- end
459
-
460
-
461
- #### PRIVATE METHODS BEYOND THIS POINT
462
- private
463
- ####
464
-
465
- def get_image_with_src(src)
466
- @@browser.image(:src, src)
467
- end
468
-
469
-
470
- def get_image_with_id(id)
471
- @@browser.image(:id, id)
472
- end
473
-
474
- end
475
- end