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.
- checksums.yaml +7 -0
- data/.document +4 -0
- data/.github/ISSUE_TEMPLATE.md +16 -0
- data/.github/workflows/chrome.yml +55 -0
- data/.github/workflows/edge.yml +44 -0
- data/.github/workflows/firefox.yml +55 -0
- data/.github/workflows/ie.yml +30 -0
- data/.github/workflows/safari.yml +38 -0
- data/.github/workflows/unit.yml +60 -0
- data/.gitignore +21 -0
- data/.rubocop.yml +114 -0
- data/.rubocop_todo.yml +17 -0
- data/CHANGES.md +2212 -0
- data/Gemfile +15 -0
- data/LICENSE +24 -0
- data/README.md +113 -0
- data/Rakefile +173 -0
- data/lib/watir/adjacent.rb +128 -0
- data/lib/watir/after_hooks.rb +135 -0
- data/lib/watir/alert.rb +113 -0
- data/lib/watir/aliases.rb +8 -0
- data/lib/watir/attribute_helper.rb +97 -0
- data/lib/watir/browser.rb +323 -0
- data/lib/watir/capabilities.rb +179 -0
- data/lib/watir/cell_container.rb +25 -0
- data/lib/watir/container.rb +33 -0
- data/lib/watir/cookies.rb +130 -0
- data/lib/watir/element_collection.rb +223 -0
- data/lib/watir/elements/button.rb +28 -0
- data/lib/watir/elements/cell.rb +18 -0
- data/lib/watir/elements/checkbox.rb +56 -0
- data/lib/watir/elements/date_field.rb +42 -0
- data/lib/watir/elements/date_time_field.rb +42 -0
- data/lib/watir/elements/dlist.rb +12 -0
- data/lib/watir/elements/element.rb +807 -0
- data/lib/watir/elements/file_field.rb +43 -0
- data/lib/watir/elements/font.rb +26 -0
- data/lib/watir/elements/form.rb +16 -0
- data/lib/watir/elements/hidden.rb +26 -0
- data/lib/watir/elements/html_elements.rb +1981 -0
- data/lib/watir/elements/iframe.rb +156 -0
- data/lib/watir/elements/image.rb +22 -0
- data/lib/watir/elements/input.rb +15 -0
- data/lib/watir/elements/link.rb +8 -0
- data/lib/watir/elements/list.rb +51 -0
- data/lib/watir/elements/option.rb +60 -0
- data/lib/watir/elements/radio.rb +65 -0
- data/lib/watir/elements/row.rb +18 -0
- data/lib/watir/elements/select.rb +214 -0
- data/lib/watir/elements/svg_elements.rb +497 -0
- data/lib/watir/elements/table.rb +77 -0
- data/lib/watir/elements/table_cell.rb +32 -0
- data/lib/watir/elements/table_row.rb +34 -0
- data/lib/watir/elements/table_section.rb +17 -0
- data/lib/watir/elements/text_area.rb +7 -0
- data/lib/watir/elements/text_field.rb +39 -0
- data/lib/watir/exception.rb +16 -0
- data/lib/watir/extensions/nokogiri.rb +14 -0
- data/lib/watir/generator/base/generator.rb +114 -0
- data/lib/watir/generator/base/idl_sorter.rb +51 -0
- data/lib/watir/generator/base/spec_extractor.rb +158 -0
- data/lib/watir/generator/base/util.rb +21 -0
- data/lib/watir/generator/base/visitor.rb +133 -0
- data/lib/watir/generator/base.rb +12 -0
- data/lib/watir/generator/html/generator.rb +36 -0
- data/lib/watir/generator/html/spec_extractor.rb +52 -0
- data/lib/watir/generator/html/visitor.rb +23 -0
- data/lib/watir/generator/html.rb +17 -0
- data/lib/watir/generator/svg/generator.rb +38 -0
- data/lib/watir/generator/svg/spec_extractor.rb +55 -0
- data/lib/watir/generator/svg/visitor.rb +23 -0
- data/lib/watir/generator/svg.rb +9 -0
- data/lib/watir/generator.rb +5 -0
- data/lib/watir/has_window.rb +72 -0
- data/lib/watir/http_client.rb +11 -0
- data/lib/watir/js_execution.rb +165 -0
- data/lib/watir/js_snippets/attributeValues.js +11 -0
- data/lib/watir/js_snippets/backgroundColor.js +7 -0
- data/lib/watir/js_snippets/elementObscured.js +14 -0
- data/lib/watir/js_snippets/fireEvent.js +31 -0
- data/lib/watir/js_snippets/focus.js +3 -0
- data/lib/watir/js_snippets/getElementTags.js +3 -0
- data/lib/watir/js_snippets/getInnerHtml.js +19 -0
- data/lib/watir/js_snippets/getInnerText.js +19 -0
- data/lib/watir/js_snippets/getOuterHtml.js +20 -0
- data/lib/watir/js_snippets/getTextContent.js +19 -0
- data/lib/watir/js_snippets/isElementInViewport.js +20 -0
- data/lib/watir/js_snippets/isImageLoaded.js +3 -0
- data/lib/watir/js_snippets/selectOptionsLabel.js +10 -0
- data/lib/watir/js_snippets/selectOptionsText.js +10 -0
- data/lib/watir/js_snippets/selectOptionsValue.js +10 -0
- data/lib/watir/js_snippets/selectText.js +64 -0
- data/lib/watir/js_snippets/selectedOptions.js +11 -0
- data/lib/watir/js_snippets/selectedText.js +17 -0
- data/lib/watir/js_snippets/setText.js +3 -0
- data/lib/watir/js_snippets/setValue.js +3 -0
- data/lib/watir/js_snippets.rb +18 -0
- data/lib/watir/locators/anchor/selector_builder.rb +43 -0
- data/lib/watir/locators/button/matcher.rb +19 -0
- data/lib/watir/locators/button/selector_builder/xpath.rb +69 -0
- data/lib/watir/locators/button/selector_builder.rb +10 -0
- data/lib/watir/locators/cell/selector_builder/xpath.rb +23 -0
- data/lib/watir/locators/cell/selector_builder.rb +13 -0
- data/lib/watir/locators/element/locator.rb +81 -0
- data/lib/watir/locators/element/matcher.rb +118 -0
- data/lib/watir/locators/element/selector_builder/regexp_disassembler.rb +69 -0
- data/lib/watir/locators/element/selector_builder/xpath.rb +268 -0
- data/lib/watir/locators/element/selector_builder/xpath_support.rb +29 -0
- data/lib/watir/locators/element/selector_builder.rb +164 -0
- data/lib/watir/locators/option/matcher.rb +26 -0
- data/lib/watir/locators/option/selector_builder/xpath.rb +39 -0
- data/lib/watir/locators/option/selector_builder.rb +10 -0
- data/lib/watir/locators/row/selector_builder/xpath.rb +53 -0
- data/lib/watir/locators/row/selector_builder.rb +18 -0
- data/lib/watir/locators/text_area/selector_builder/xpath.rb +21 -0
- data/lib/watir/locators/text_area/selector_builder.rb +10 -0
- data/lib/watir/locators/text_field/matcher.rb +37 -0
- data/lib/watir/locators/text_field/selector_builder/xpath.rb +50 -0
- data/lib/watir/locators/text_field/selector_builder.rb +10 -0
- data/lib/watir/locators.rb +77 -0
- data/lib/watir/logger.rb +30 -0
- data/lib/watir/navigation.rb +51 -0
- data/lib/watir/radio_set.rb +230 -0
- data/lib/watir/row_container.rb +36 -0
- data/lib/watir/screenshot.rb +51 -0
- data/lib/watir/scroll.rb +95 -0
- data/lib/watir/search_context.rb +96 -0
- data/lib/watir/shadow_root.rb +60 -0
- data/lib/watir/user_editable.rb +85 -0
- data/lib/watir/version.rb +5 -0
- data/lib/watir/wait/timer.rb +52 -0
- data/lib/watir/wait.rb +171 -0
- data/lib/watir/window.rb +276 -0
- data/lib/watir/window_collection.rb +82 -0
- data/lib/watir.rb +108 -0
- data/lib/watirspec/guards.rb +65 -0
- data/lib/watirspec/implementation.rb +56 -0
- data/lib/watirspec/rake_tasks.rb +118 -0
- data/lib/watirspec/remote_server.rb +39 -0
- data/lib/watirspec/runner.rb +64 -0
- data/lib/watirspec/server/app.rb +86 -0
- data/lib/watirspec/server.rb +104 -0
- data/lib/watirspec.rb +93 -0
- data/spec/locator_spec_helper.rb +88 -0
- data/spec/spec_helper.rb +24 -0
- data/spec/unit/capabilities_spec.rb +670 -0
- data/spec/unit/element_locator_spec.rb +97 -0
- data/spec/unit/match_elements/button_spec.rb +76 -0
- data/spec/unit/match_elements/element_spec.rb +424 -0
- data/spec/unit/match_elements/text_field_spec.rb +84 -0
- data/spec/unit/selector_builder/anchor_spec.rb +59 -0
- data/spec/unit/selector_builder/button_spec.rb +217 -0
- data/spec/unit/selector_builder/cell_spec.rb +71 -0
- data/spec/unit/selector_builder/element_spec.rb +804 -0
- data/spec/unit/selector_builder/row_spec.rb +128 -0
- data/spec/unit/selector_builder/text_field_spec.rb +203 -0
- data/spec/unit/selector_builder/textarea_spec.rb +35 -0
- data/spec/unit/unit_helper.rb +4 -0
- data/spec/unit/wait_spec.rb +99 -0
- data/spec/watirspec/adjacent_spec.rb +256 -0
- data/spec/watirspec/after_hooks_spec.rb +204 -0
- data/spec/watirspec/alert_spec.rb +89 -0
- data/spec/watirspec/browser_spec.rb +536 -0
- data/spec/watirspec/capabilities_spec.rb +556 -0
- data/spec/watirspec/cookies_spec.rb +196 -0
- data/spec/watirspec/drag_and_drop_spec.rb +38 -0
- data/spec/watirspec/element_hidden_spec.rb +86 -0
- data/spec/watirspec/elements/area_spec.rb +69 -0
- data/spec/watirspec/elements/areas_spec.rb +44 -0
- data/spec/watirspec/elements/button_spec.rb +265 -0
- data/spec/watirspec/elements/buttons_spec.rb +57 -0
- data/spec/watirspec/elements/checkbox_spec.rb +290 -0
- data/spec/watirspec/elements/checkboxes_spec.rb +46 -0
- data/spec/watirspec/elements/collections_spec.rb +132 -0
- data/spec/watirspec/elements/date_field_spec.rb +209 -0
- data/spec/watirspec/elements/date_fields_spec.rb +46 -0
- data/spec/watirspec/elements/date_time_field_spec.rb +223 -0
- data/spec/watirspec/elements/date_time_fields_spec.rb +47 -0
- data/spec/watirspec/elements/dd_spec.rb +108 -0
- data/spec/watirspec/elements/dds_spec.rb +44 -0
- data/spec/watirspec/elements/del_spec.rb +113 -0
- data/spec/watirspec/elements/dels_spec.rb +42 -0
- data/spec/watirspec/elements/div_spec.rb +232 -0
- data/spec/watirspec/elements/divs_spec.rb +56 -0
- data/spec/watirspec/elements/dl_spec.rb +117 -0
- data/spec/watirspec/elements/dls_spec.rb +45 -0
- data/spec/watirspec/elements/dt_spec.rb +107 -0
- data/spec/watirspec/elements/dts_spec.rb +44 -0
- data/spec/watirspec/elements/element_spec.rb +1069 -0
- data/spec/watirspec/elements/elements_spec.rb +60 -0
- data/spec/watirspec/elements/em_spec.rb +85 -0
- data/spec/watirspec/elements/ems_spec.rb +45 -0
- data/spec/watirspec/elements/filefield_spec.rb +135 -0
- data/spec/watirspec/elements/filefields_spec.rb +45 -0
- data/spec/watirspec/elements/font_spec.rb +31 -0
- data/spec/watirspec/elements/form_spec.rb +70 -0
- data/spec/watirspec/elements/forms_spec.rb +46 -0
- data/spec/watirspec/elements/frame_spec.rb +117 -0
- data/spec/watirspec/elements/frames_spec.rb +43 -0
- data/spec/watirspec/elements/hidden_spec.rb +106 -0
- data/spec/watirspec/elements/hiddens_spec.rb +45 -0
- data/spec/watirspec/elements/hn_spec.rb +80 -0
- data/spec/watirspec/elements/hns_spec.rb +42 -0
- data/spec/watirspec/elements/iframe_spec.rb +244 -0
- data/spec/watirspec/elements/iframes_spec.rb +49 -0
- data/spec/watirspec/elements/image_spec.rb +160 -0
- data/spec/watirspec/elements/images_spec.rb +42 -0
- data/spec/watirspec/elements/input_spec.rb +17 -0
- data/spec/watirspec/elements/ins_spec.rb +113 -0
- data/spec/watirspec/elements/inses_spec.rb +42 -0
- data/spec/watirspec/elements/label_spec.rb +77 -0
- data/spec/watirspec/elements/labels_spec.rb +42 -0
- data/spec/watirspec/elements/li_spec.rb +99 -0
- data/spec/watirspec/elements/link_spec.rb +180 -0
- data/spec/watirspec/elements/links_spec.rb +66 -0
- data/spec/watirspec/elements/lis_spec.rb +44 -0
- data/spec/watirspec/elements/list_spec.rb +50 -0
- data/spec/watirspec/elements/map_spec.rb +78 -0
- data/spec/watirspec/elements/maps_spec.rb +43 -0
- data/spec/watirspec/elements/meta_spec.rb +27 -0
- data/spec/watirspec/elements/metas_spec.rb +42 -0
- data/spec/watirspec/elements/ol_spec.rb +63 -0
- data/spec/watirspec/elements/ols_spec.rb +42 -0
- data/spec/watirspec/elements/option_spec.rb +113 -0
- data/spec/watirspec/elements/p_spec.rb +102 -0
- data/spec/watirspec/elements/pre_spec.rb +100 -0
- data/spec/watirspec/elements/pres_spec.rb +42 -0
- data/spec/watirspec/elements/ps_spec.rb +42 -0
- data/spec/watirspec/elements/radio_spec.rb +259 -0
- data/spec/watirspec/elements/radios_spec.rb +45 -0
- data/spec/watirspec/elements/select_list_spec.rb +701 -0
- data/spec/watirspec/elements/select_lists_spec.rb +49 -0
- data/spec/watirspec/elements/span_spec.rb +119 -0
- data/spec/watirspec/elements/spans_spec.rb +42 -0
- data/spec/watirspec/elements/strong_spec.rb +78 -0
- data/spec/watirspec/elements/strongs_spec.rb +45 -0
- data/spec/watirspec/elements/table_spec.rb +210 -0
- data/spec/watirspec/elements/tables_spec.rb +44 -0
- data/spec/watirspec/elements/tbody_spec.rb +94 -0
- data/spec/watirspec/elements/tbodys_spec.rb +64 -0
- data/spec/watirspec/elements/td_spec.rb +92 -0
- data/spec/watirspec/elements/tds_spec.rb +55 -0
- data/spec/watirspec/elements/text_field_spec.rb +223 -0
- data/spec/watirspec/elements/text_fields_spec.rb +47 -0
- data/spec/watirspec/elements/textarea_spec.rb +30 -0
- data/spec/watirspec/elements/textareas_spec.rb +28 -0
- data/spec/watirspec/elements/tfoot_spec.rb +89 -0
- data/spec/watirspec/elements/tfoots_spec.rb +72 -0
- data/spec/watirspec/elements/thead_spec.rb +88 -0
- data/spec/watirspec/elements/theads_spec.rb +72 -0
- data/spec/watirspec/elements/tr_spec.rb +69 -0
- data/spec/watirspec/elements/trs_spec.rb +63 -0
- data/spec/watirspec/elements/ul_spec.rb +63 -0
- data/spec/watirspec/elements/uls_spec.rb +42 -0
- data/spec/watirspec/html/alerts.html +12 -0
- data/spec/watirspec/html/aria_attributes.html +9 -0
- data/spec/watirspec/html/child_frame.html +29 -0
- data/spec/watirspec/html/class_locator.html +11 -0
- data/spec/watirspec/html/clicks.html +19 -0
- data/spec/watirspec/html/closeable.html +21 -0
- data/spec/watirspec/html/collections.html +15 -0
- data/spec/watirspec/html/css/jquery-ui-1.8.17.custom.css +287 -0
- data/spec/watirspec/html/data_attributes.html +10 -0
- data/spec/watirspec/html/definition_lists.html +48 -0
- data/spec/watirspec/html/drag_and_drop.html +106 -0
- data/spec/watirspec/html/font.html +10 -0
- data/spec/watirspec/html/forms_with_input_elements.html +194 -0
- data/spec/watirspec/html/frame_1.html +22 -0
- data/spec/watirspec/html/frame_2.html +16 -0
- data/spec/watirspec/html/frames.html +11 -0
- data/spec/watirspec/html/iframe_1.html +22 -0
- data/spec/watirspec/html/iframes.html +15 -0
- data/spec/watirspec/html/images/button.png +0 -0
- data/spec/watirspec/html/images/circle.png +0 -0
- data/spec/watirspec/html/images/map.gif +0 -0
- data/spec/watirspec/html/images/map2.gif +0 -0
- data/spec/watirspec/html/images/originaltriangle.png +0 -0
- data/spec/watirspec/html/images/square.png +0 -0
- data/spec/watirspec/html/images/triangle.png +0 -0
- data/spec/watirspec/html/images.html +28 -0
- data/spec/watirspec/html/inner_outer.html +5 -0
- data/spec/watirspec/html/javascript/angular.min.js +332 -0
- data/spec/watirspec/html/javascript/helpers.js +16 -0
- data/spec/watirspec/html/javascript/jquery-1.7.1.min.js +4 -0
- data/spec/watirspec/html/javascript/jquery-ui-1.8.17.custom.min.js +68 -0
- data/spec/watirspec/html/keylogger.html +15 -0
- data/spec/watirspec/html/modal_dialog.html +9 -0
- data/spec/watirspec/html/multiple_ids.html +15 -0
- data/spec/watirspec/html/nested_elements.html +44 -0
- data/spec/watirspec/html/nested_frame_1.html +1 -0
- data/spec/watirspec/html/nested_frame_2.html +9 -0
- data/spec/watirspec/html/nested_frame_3.html +14 -0
- data/spec/watirspec/html/nested_frames.html +10 -0
- data/spec/watirspec/html/nested_iframe_2.html +12 -0
- data/spec/watirspec/html/nested_iframes.html +13 -0
- data/spec/watirspec/html/nested_tables.html +203 -0
- data/spec/watirspec/html/non_control_elements.html +145 -0
- data/spec/watirspec/html/obscured.html +36 -0
- data/spec/watirspec/html/removed_element.html +24 -0
- data/spec/watirspec/html/right_click.html +23 -0
- data/spec/watirspec/html/scroll.html +15 -0
- data/spec/watirspec/html/scroll_nested.html +17 -0
- data/spec/watirspec/html/scroll_nested_offscreen.html +18 -0
- data/spec/watirspec/html/shadow_dom.html +28 -0
- data/spec/watirspec/html/special_chars.html +15 -0
- data/spec/watirspec/html/sticky_elements.html +10 -0
- data/spec/watirspec/html/tables.html +121 -0
- data/spec/watirspec/html/timeout_window_location.html +19 -0
- data/spec/watirspec/html/uneven_table.html +20 -0
- data/spec/watirspec/html/wait.html +99 -0
- data/spec/watirspec/html/watirspec.css +0 -0
- data/spec/watirspec/html/window_switching.html +22 -0
- data/spec/watirspec/radio_set_spec.rb +346 -0
- data/spec/watirspec/screenshot_spec.rb +33 -0
- data/spec/watirspec/scroll_spec.rb +208 -0
- data/spec/watirspec/shadow_root_spec.rb +108 -0
- data/spec/watirspec/support/rspec_matchers.rb +161 -0
- data/spec/watirspec/user_editable_spec.rb +207 -0
- data/spec/watirspec/wait_spec.rb +345 -0
- data/spec/watirspec/window_switching_spec.rb +580 -0
- data/spec/watirspec_helper.rb +163 -0
- data/support/doctest_helper.rb +101 -0
- data/support/version_differ.rb +60 -0
- data/watir.gemspec +50 -0
- metadata +652 -148
- data/readme.rb +0 -211
- data/unittests/WindowLogonExample.rb +0 -30
- data/unittests/WindowLogonExtra.rb +0 -7
- data/unittests/all_tests.rb +0 -10
- data/unittests/all_tests_concurrent.rb +0 -57
- data/unittests/attachToExistingWindow_test.rb +0 -40
- data/unittests/buttons_test.rb +0 -131
- data/unittests/checkbox_test.rb +0 -149
- data/unittests/core_tests.rb +0 -9
- data/unittests/css_test.rb +0 -60
- data/unittests/div_test.rb +0 -179
- data/unittests/errorchecker_test.rb +0 -29
- data/unittests/filefield_test.rb +0 -35
- data/unittests/form_test.rb +0 -279
- data/unittests/frame_test.rb +0 -141
- data/unittests/html/blankpage.html +0 -12
- data/unittests/html/buttons1.html +0 -40
- data/unittests/html/checkboxes1.html +0 -69
- data/unittests/html/complex_table.html +0 -36
- data/unittests/html/cssTest.html +0 -42
- data/unittests/html/div.html +0 -105
- data/unittests/html/fileupload.html +0 -45
- data/unittests/html/formTest1.html +0 -39
- data/unittests/html/forms2.html +0 -45
- data/unittests/html/forms3.html +0 -132
- data/unittests/html/forms4.html +0 -27
- data/unittests/html/frame_buttons.html +0 -4
- data/unittests/html/frame_links.html +0 -4
- data/unittests/html/frame_multi.html +0 -5
- data/unittests/html/iframeTest.html +0 -13
- data/unittests/html/iframeTest1.html +0 -7
- data/unittests/html/iframeTest2.html +0 -6
- data/unittests/html/images/button.jpg +0 -0
- data/unittests/html/images/circle.jpg +0 -0
- data/unittests/html/images/originaltriangle.jpg +0 -0
- data/unittests/html/images/square.jpg +0 -0
- data/unittests/html/images/triangle.jpg +0 -0
- data/unittests/html/images1.html +0 -52
- data/unittests/html/javascriptevents.html +0 -39
- data/unittests/html/link_pass.html +0 -11
- data/unittests/html/links1.html +0 -37
- data/unittests/html/links2.html +0 -11
- data/unittests/html/nestedFrames.html +0 -6
- data/unittests/html/pass.html +0 -10
- data/unittests/html/popups1.html +0 -60
- data/unittests/html/radioButtons1.html +0 -71
- data/unittests/html/select_tealeaf.html +0 -54
- data/unittests/html/selectboxes1.html +0 -55
- data/unittests/html/simple_table.html +0 -26
- data/unittests/html/simple_table_buttons.html +0 -104
- data/unittests/html/simple_table_columns.html +0 -76
- data/unittests/html/table1.html +0 -142
- data/unittests/html/textarea.html +0 -30
- data/unittests/html/textfields1.html +0 -87
- data/unittests/html/textsearch.html +0 -44
- data/unittests/ie_mock.rb +0 -93
- data/unittests/ie_test.rb +0 -50
- data/unittests/images_test.rb +0 -179
- data/unittests/iostring.rb +0 -30
- data/unittests/iostring_test.rb +0 -48
- data/unittests/js_events_test.rb +0 -77
- data/unittests/jscriptExtraAlert.rb +0 -6
- data/unittests/jscriptExtraConfirmCancel.rb +0 -7
- data/unittests/jscriptExtraConfirmOk.rb +0 -7
- data/unittests/jscriptPushButton.rb +0 -5
- data/unittests/jscript_test.rb +0 -57
- data/unittests/links_test.rb +0 -169
- data/unittests/minmax_test.rb +0 -31
- data/unittests/navigate_test.rb +0 -56
- data/unittests/non_core_tests.rb +0 -9
- data/unittests/pagecontainstext_test.rb +0 -49
- data/unittests/popups_test.rb +0 -44
- data/unittests/radios_test.rb +0 -164
- data/unittests/screen_capture_test.rb +0 -53
- data/unittests/selectbox_test.rb +0 -197
- data/unittests/send_keys_test.rb +0 -29
- data/unittests/setup.rb +0 -47
- data/unittests/table_test.rb +0 -306
- data/unittests/textAreafields_test.rb +0 -81
- data/unittests/textfields_test.rb +0 -239
- data/watir/AutoItX3.dll +0 -0
- data/watir/WindowHelper.rb +0 -47
- data/watir/camel_case.rb +0 -37
- data/watir/clickJSDialog.rb +0 -19
- data/watir/cookiemanager.rb +0 -53
- data/watir/exceptions.rb +0 -60
- data/watir/screen_capture.rb +0 -115
- data/watir/setFileDialog.rb +0 -16
- data/watir/testUnitAddons.rb +0 -47
- data/watir/watir_simple.rb +0 -475
- data/watir/winClicker.rb +0 -505
- data/watir.rb +0 -3744
- /data/{unittests → spec/watirspec}/html/images/1.gif +0 -0
- /data/{unittests/html/images/2.GIF → spec/watirspec/html/images/2.gif} +0 -0
- /data/{unittests/html/images/3.GIF → spec/watirspec/html/images/3.gif} +0 -0
- /data/{unittests/html/images/minus.GIF → spec/watirspec/html/images/minus.gif} +0 -0
- /data/{unittests → spec/watirspec}/html/images/plus.gif +0 -0
data/unittests/table_test.rb
DELETED
|
@@ -1,306 +0,0 @@
|
|
|
1
|
-
# feature tests for Tables
|
|
2
|
-
# revision: $Revision: 1.29 $
|
|
3
|
-
|
|
4
|
-
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
|
|
5
|
-
require 'unittests/setup'
|
|
6
|
-
|
|
7
|
-
class TC_Tables < Test::Unit::TestCase
|
|
8
|
-
include Watir
|
|
9
|
-
|
|
10
|
-
def setup
|
|
11
|
-
gotoTablePage
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def gotoTablePage()
|
|
15
|
-
$ie.goto($htmlRoot + "table1.html")
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def test_Table_Exists
|
|
19
|
-
assert_false($ie.table(:id , 'missingTable').exists? )
|
|
20
|
-
assert_false($ie.table(:index, 33).exists? )
|
|
21
|
-
|
|
22
|
-
assert($ie.table(:id, 't1').exists? )
|
|
23
|
-
assert($ie.table(:id, /t/).exists? )
|
|
24
|
-
assert_false($ie.table(:id , /missing_table/).exists? )
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
assert($ie.table(:index, 1).exists? )
|
|
28
|
-
assert($ie.table(:index, 2).exists? )
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def test_rows
|
|
32
|
-
assert_raises( UnknownTableException ){ $ie.table(:id , 'missingTable').row_count }
|
|
33
|
-
assert_raises( UnknownTableException ){ $ie.table(:index , 66).row_count }
|
|
34
|
-
|
|
35
|
-
assert_equal( 2 , $ie.table(:index , 1).row_count)
|
|
36
|
-
assert_equal( 5 , $ie.table(:id, 't1').row_count) # 4 rows and a header
|
|
37
|
-
assert_equal( 5 , $ie.table(:index, 2).row_count) # same table as above, just accessed by index
|
|
38
|
-
|
|
39
|
-
# test the each iterator on rows - ie, go through each cell
|
|
40
|
-
row = $ie.table(:index, 2)[2]
|
|
41
|
-
count=1
|
|
42
|
-
row.each do |cell|
|
|
43
|
-
# cell.flash # this line commented out to speed up the test
|
|
44
|
-
if count == 1
|
|
45
|
-
assert_equal('Row 1 Col1' , cell.to_s.strip )
|
|
46
|
-
elsif count==2
|
|
47
|
-
assert_equal('Row 1 Col2' , cell.to_s.strip )
|
|
48
|
-
end
|
|
49
|
-
count+=1
|
|
50
|
-
end
|
|
51
|
-
assert_equal(2, count -1)
|
|
52
|
-
assert_equal(2, $ie.table(:index, 2)[2].column_count)
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
def test_dynamic_tables
|
|
56
|
-
t = $ie.table(:id, 't1')
|
|
57
|
-
assert_equal( 5, t.row_count)
|
|
58
|
-
|
|
59
|
-
$ie.button(:value , 'add row').click
|
|
60
|
-
assert_equal( 6, t.row_count)
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
def test_columns
|
|
64
|
-
|
|
65
|
-
assert_raises( UnknownTableException ){ $ie.table(:id , 'missingTable').column_count }
|
|
66
|
-
assert_raises( UnknownTableException ){ $ie.table(:index , 77).column_count }
|
|
67
|
-
assert_equal( 2 , $ie.table(:index , 1).column_count)
|
|
68
|
-
assert_equal( 1 , $ie.table(:id, 't1').column_count) # row one has 1 cell with a colspan of 2
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
def test_to_a
|
|
72
|
-
table1Expected = [ ["Row 1 Col1" , "Row 1 Col2"] ,[ "Row 2 Col1" , "Row 2 Col2"] ]
|
|
73
|
-
assert_arrayEquals(table1Expected, $ie.table(:index , 1).to_a )
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
def test_simple_table_access
|
|
77
|
-
$ie.goto($htmlRoot + "simple_table.html")
|
|
78
|
-
|
|
79
|
-
table = $ie.table(:index,1)
|
|
80
|
-
|
|
81
|
-
assert_equal("Row 3 Col1",table[3][1].text.strip)
|
|
82
|
-
assert_equal("Row 1 Col1",table[1][1].text.strip)
|
|
83
|
-
assert_equal("Row 3 Col2",table[3][2].text.strip)
|
|
84
|
-
assert_equal(2,table.column_count)
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
def test_simple_table_buttons
|
|
88
|
-
$ie.goto($htmlRoot + "simple_table_buttons.html")
|
|
89
|
-
|
|
90
|
-
table = $ie.table(:index,1)
|
|
91
|
-
|
|
92
|
-
table[1][1].button(:index,1).click
|
|
93
|
-
assert($ie.textField(:name,"confirmtext").verify_contains(/CLICK1/i))
|
|
94
|
-
table[2][1].button(:index,1).click
|
|
95
|
-
assert($ie.textField(:name,"confirmtext").verify_contains(/CLICK2/i))
|
|
96
|
-
|
|
97
|
-
table[1][1].button(:id,'b1').click
|
|
98
|
-
assert($ie.textField(:name,"confirmtext").verify_contains(/CLICK1/i))
|
|
99
|
-
|
|
100
|
-
assert_raises(UnknownObjectException ) { table[1][1].button(:id,'b_missing').click }
|
|
101
|
-
|
|
102
|
-
table[3][1].button(:index,2).click
|
|
103
|
-
assert($ie.textField(:name,"confirmtext").verify_contains(/TOO/i))
|
|
104
|
-
|
|
105
|
-
table[3][1].button(:value ,"Click too").click
|
|
106
|
-
assert($ie.textField(:name,"confirmtext").verify_contains(/TOO/i))
|
|
107
|
-
|
|
108
|
-
$ie.table(:index,1)[4][1].text_field(:index,1).set("123")
|
|
109
|
-
assert($ie.text_field(:index,2).verify_contains("123"))
|
|
110
|
-
|
|
111
|
-
# check when a cell contains 2 objects
|
|
112
|
-
|
|
113
|
-
# if there were 2 different html objects in the same cell, some weird things happened ( button caption could change for example)
|
|
114
|
-
assert_equal( 'Click ->' , $ie.table(:index,1)[5][1].text_field(:index,1).value )
|
|
115
|
-
$ie.table(:index,1)[5][1].text_field(:index,1).click
|
|
116
|
-
assert_equal( 'Click ->' , $ie.table(:index,1)[5][1].text_field(:index,1).value )
|
|
117
|
-
|
|
118
|
-
$ie.table(:index,1)[5][1].button(:index,1).click
|
|
119
|
-
assert_equal( '' , $ie.table(:index,1)[5][1].text_field(:index,1).value )
|
|
120
|
-
end
|
|
121
|
-
|
|
122
|
-
def test_simple_table_gif
|
|
123
|
-
$ie.goto($htmlRoot + "simple_table_buttons.html")
|
|
124
|
-
|
|
125
|
-
table = $ie.table(:index,2)
|
|
126
|
-
|
|
127
|
-
assert_match( /1\.gif/ , table[1][1].image( :index,1).src )
|
|
128
|
-
assert_match( /2\.gif/ , table[1][2].image( :index ,1).src )
|
|
129
|
-
assert_match( /3\.gif/ , table[1][3].image( :index ,1).src )
|
|
130
|
-
|
|
131
|
-
assert_match( /1\.gif/ , table[3][1].image( :index ,1).src )
|
|
132
|
-
assert_match( /2\.gif/ , table[3][2].image( :index ,1).src )
|
|
133
|
-
assert_match( /3\.gif/ , table[3][3].image( :index ,1).src )
|
|
134
|
-
|
|
135
|
-
table = $ie.table(:index,3)
|
|
136
|
-
assert_match( /1\.gif/ , table[1][1].image( :index ,1).src )
|
|
137
|
-
assert_match( /2\.gif/ , table[1][1].image( :index ,2).src )
|
|
138
|
-
assert_match( /3\.gif/ , table[1][1].image( :index ,3).src )
|
|
139
|
-
|
|
140
|
-
assert_match( /1\.gif/ , table[3][1].image( :index ,1).src )
|
|
141
|
-
assert_match( /2\.gif/ , table[3][1].image( :index ,2).src )
|
|
142
|
-
assert_match( /3\.gif/ , table[3][1].image( :index ,3).src )
|
|
143
|
-
end
|
|
144
|
-
|
|
145
|
-
def test_table_with_hidden_or_visible_rows
|
|
146
|
-
$ie.goto($htmlRoot + "simple_table_buttons.html")
|
|
147
|
-
t = $ie.table(:id , 'show_hide')
|
|
148
|
-
|
|
149
|
-
# expand the table
|
|
150
|
-
t.each do |r|
|
|
151
|
-
r[1].image(:src, /plus/).click if r[1].image(:src, /plus/).exists?
|
|
152
|
-
end
|
|
153
|
-
|
|
154
|
-
# shrink rows 1,2,3
|
|
155
|
-
count=1
|
|
156
|
-
t.each do |r|
|
|
157
|
-
r[1].image(:src, /minus/).click if r[1].image(:src, /minus/).exists? and (1..3) === count
|
|
158
|
-
count=2
|
|
159
|
-
end
|
|
160
|
-
end
|
|
161
|
-
|
|
162
|
-
def test_links_and_images_in_table
|
|
163
|
-
table = $ie.table(:id, 'pic_table')
|
|
164
|
-
image = table[1][2].image(:index,1)
|
|
165
|
-
assert_equal("106", image.width)
|
|
166
|
-
|
|
167
|
-
link = table[1][4].link(:index,1)
|
|
168
|
-
assert_equal("Google", link.innerText)
|
|
169
|
-
end
|
|
170
|
-
|
|
171
|
-
def test_table_from_element
|
|
172
|
-
$ie.goto($htmlRoot + "simple_table_buttons.html")
|
|
173
|
-
|
|
174
|
-
button = $ie.button(:id,"b1")
|
|
175
|
-
table = Table.create_from_element($ie,button)
|
|
176
|
-
|
|
177
|
-
table[2][1].button(:index,1).click
|
|
178
|
-
assert($ie.textField(:name,"confirmtext").verify_contains(/CLICK2/i))
|
|
179
|
-
end
|
|
180
|
-
|
|
181
|
-
def test_complex_table_access
|
|
182
|
-
$ie.goto($htmlRoot + "complex_table.html")
|
|
183
|
-
|
|
184
|
-
table = $ie.table(:index,1)
|
|
185
|
-
|
|
186
|
-
assert_equal("subtable1 Row 1 Col1",table[1][1].table(:index,1)[1][1].text.strip)
|
|
187
|
-
assert_equal("subtable1 Row 1 Col2",table[1][1].table(:index,1)[1][2].text.strip)
|
|
188
|
-
assert_equal("subtable2 Row 1 Col2",table[2][1].table(:index,1)[1][2].text.strip)
|
|
189
|
-
assert_equal("subtable2 Row 1 Col1",table[2][1].table(:index,1)[1][1].text.strip)
|
|
190
|
-
end
|
|
191
|
-
|
|
192
|
-
def test_cell_directly
|
|
193
|
-
|
|
194
|
-
assert( $ie.cell(:id, 'cell1').exists? )
|
|
195
|
-
assert_false( $ie.cell(:id, 'no_exist').exists? )
|
|
196
|
-
assert_equal( "Row 1 Col1", $ie.cell(:id, 'cell1').to_s.strip )
|
|
197
|
-
|
|
198
|
-
# not really cell directly, but just to show another way of geting the cell
|
|
199
|
-
assert_equal( "Row 1 Col1", $ie.table(:index,1)[1][1].to_s.strip )
|
|
200
|
-
end
|
|
201
|
-
|
|
202
|
-
def test_row_directly
|
|
203
|
-
assert( $ie.row(:id, 'row1').exists? )
|
|
204
|
-
assert_false( $ie.row(:id, 'no_exist').exists? )
|
|
205
|
-
|
|
206
|
-
assert_equal('Row 2 Col1' , $ie.row(:id, 'row1')[1].to_s.strip )
|
|
207
|
-
end
|
|
208
|
-
|
|
209
|
-
def test_row_iterator
|
|
210
|
-
t = $ie.table(:index,1)
|
|
211
|
-
count =1
|
|
212
|
-
t.each do |row|
|
|
213
|
-
if count==1
|
|
214
|
-
assert( "Row 1 Col1" , row[1].text )
|
|
215
|
-
assert( "Row 1 Col2" , row[2].text )
|
|
216
|
-
elsif count==2
|
|
217
|
-
assert( "Row 2 Col1" , row[1].text )
|
|
218
|
-
assert( "Row 2 Col2" , row[2].text )
|
|
219
|
-
end
|
|
220
|
-
end
|
|
221
|
-
end
|
|
222
|
-
|
|
223
|
-
def test_table_body
|
|
224
|
-
assert_equal( 1, $ie.table(:index,1).bodies.length )
|
|
225
|
-
assert_equal( 3, $ie.table(:id, 'body_test' ).bodies.length )
|
|
226
|
-
|
|
227
|
-
count = 1
|
|
228
|
-
$ie.table(:id, 'body_test' ).bodies.each do |n|
|
|
229
|
-
|
|
230
|
-
# do something better here!
|
|
231
|
-
# n.flash # this line commented out to speed up the test
|
|
232
|
-
|
|
233
|
-
case count
|
|
234
|
-
when 1
|
|
235
|
-
compare_text = "This text is in the FRST TBODY."
|
|
236
|
-
when 2
|
|
237
|
-
compare_text = "This text is in the SECOND TBODY."
|
|
238
|
-
when 3
|
|
239
|
-
compare_text = "This text is in the THIRD TBODY."
|
|
240
|
-
end
|
|
241
|
-
|
|
242
|
-
assert_equal( compare_text , n[1][1].to_s.strip ) # this is the 1st cell of the first row of this particular body
|
|
243
|
-
|
|
244
|
-
count +=1
|
|
245
|
-
end
|
|
246
|
-
assert_equal( count-1, $ie.table(:id, 'body_test' ).bodies.length )
|
|
247
|
-
|
|
248
|
-
assert_equal( "This text is in the THIRD TBODY." ,$ie.table(:id, 'body_test' ).body(:index,3)[1][1].to_s.strip )
|
|
249
|
-
|
|
250
|
-
# iterate through all the rows in a table body
|
|
251
|
-
count = 1
|
|
252
|
-
$ie.table(:id, 'body_test' ).body(:index,2).each do | row |
|
|
253
|
-
# row.flash # this line commented out, to speed up the tests
|
|
254
|
-
if count == 1
|
|
255
|
-
assert_equal('This text is in the SECOND TBODY.' , row[1].text.strip )
|
|
256
|
-
elsif count == 1
|
|
257
|
-
assert_equal('This text is also in the SECOND TBODY.' , row[1].text.strip )
|
|
258
|
-
end
|
|
259
|
-
count+=1
|
|
260
|
-
end
|
|
261
|
-
end
|
|
262
|
-
|
|
263
|
-
def test_get_columnvalues_single_column
|
|
264
|
-
$ie.goto($htmlRoot + "simple_table_columns.html")
|
|
265
|
-
assert_equal(["R1C1", "R2C1", "R3C1"], $ie.table(:index, 1).column_values(1))
|
|
266
|
-
end
|
|
267
|
-
|
|
268
|
-
def test_colspan
|
|
269
|
-
$ie.goto($htmlRoot + "simple_table_columns.html")
|
|
270
|
-
assert_equal(2, $ie.table(:index, 3)[2][1].colspan)
|
|
271
|
-
assert_equal(1, $ie.table(:index, 3)[1][1].colspan)
|
|
272
|
-
assert_equal(3, $ie.table(:index, 3)[4][1].colspan)
|
|
273
|
-
|
|
274
|
-
end
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
def test_get_columnvalues_multiple_column
|
|
280
|
-
$ie.goto($htmlRoot + "simple_table_columns.html")
|
|
281
|
-
assert_equal(["R1C1", "R2C1", "R3C1"], $ie.table(:index, 2).column_values(1))
|
|
282
|
-
assert_equal(["R1C3", "R2C3", "R3C3"], $ie.table(:index, 2).column_values(3))
|
|
283
|
-
end
|
|
284
|
-
|
|
285
|
-
def test_get_columnvalues_with_colspan
|
|
286
|
-
$ie.goto($htmlRoot + "simple_table_columns.html")
|
|
287
|
-
assert_equal(["R1C1", "R2C1", "R3C1", "R4C1", "R5C1", "R6C2"], $ie.table(:index, 3).column_values(1))
|
|
288
|
-
(2..4).each{|x|assert_raises(UnknownCellException){$ie.table(:index, 3).column_values(x)}}
|
|
289
|
-
end
|
|
290
|
-
|
|
291
|
-
def test_get_rowvalues_full_row
|
|
292
|
-
$ie.goto($htmlRoot + "simple_table_columns.html")
|
|
293
|
-
assert_equal(["R1C1", "R1C2", "R1C3"], $ie.table(:index, 3).row_values(1))
|
|
294
|
-
end
|
|
295
|
-
|
|
296
|
-
def test_get_rowvalues_with_colspan
|
|
297
|
-
$ie.goto($htmlRoot + "simple_table_columns.html")
|
|
298
|
-
assert_equal(["R2C1", "R2C2"], $ie.table(:index, 3).row_values(2))
|
|
299
|
-
end
|
|
300
|
-
|
|
301
|
-
def test_getrowvalues_with_rowspan
|
|
302
|
-
$ie.goto($htmlRoot + "simple_table_columns.html")
|
|
303
|
-
assert_equal(["R5C1", "R5C2", "R5C3"], $ie.table(:index, 3).row_values(5))
|
|
304
|
-
assert_equal(["R6C2", "R6C3"], $ie.table(:index, 3).row_values(6))
|
|
305
|
-
end
|
|
306
|
-
end
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
# feature tests for TextArea Fields
|
|
2
|
-
# revision: $Revision: 1.10 $
|
|
3
|
-
|
|
4
|
-
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
|
|
5
|
-
require 'unittests/setup'
|
|
6
|
-
|
|
7
|
-
class TC_TextArea < Test::Unit::TestCase
|
|
8
|
-
include Watir
|
|
9
|
-
|
|
10
|
-
def gotoPage()
|
|
11
|
-
$ie.goto($htmlRoot + "textArea.html")
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def test_textarea_field_exists
|
|
15
|
-
gotoPage()
|
|
16
|
-
#test for existance of 4 text area
|
|
17
|
-
assert($ie.text_field(:name,"txtMultiLine1").exists?)
|
|
18
|
-
assert($ie.text_field(:name,"txtMultiLine2").exists?)
|
|
19
|
-
assert($ie.text_field(:name,"txtMultiLine3").exists?)
|
|
20
|
-
assert($ie.text_field(:name,"txtReadOnly").exists?)
|
|
21
|
-
|
|
22
|
-
assert($ie.text_field(:id,"txtMultiLine1").exists?)
|
|
23
|
-
assert($ie.text_field(:id,"txtMultiLine2").exists?)
|
|
24
|
-
assert($ie.text_field(:id,"txtMultiLine3").exists?)
|
|
25
|
-
assert($ie.text_field(:id,"txtReadOnly").exists?)
|
|
26
|
-
#test for missing
|
|
27
|
-
assert_false($ie.text_field(:name, "missing").exists?)
|
|
28
|
-
assert_false($ie.text_field(:name,"txtMultiLine4").exists?)
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def test_textarea_to_s
|
|
32
|
-
# bug reported by Zeljko Filipin
|
|
33
|
-
assert_nothing_raised() { $ie.text_field(:id,"txtMultiLine3").to_s }
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def test_textarea_field
|
|
37
|
-
gotoPage()
|
|
38
|
-
|
|
39
|
-
# test for read only method
|
|
40
|
-
assert_false($ie.text_field(:name, "txtMultiLine1").readonly? )
|
|
41
|
-
assert($ie.text_field(:name,"txtReadOnly").readonly?)
|
|
42
|
-
|
|
43
|
-
# test for enabled? method
|
|
44
|
-
assert_false($ie.text_field(:name, "txtDisabled").enabled? )
|
|
45
|
-
assert($ie.text_field(:id, "txtMultiLine1").enabled? )
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
t1 = $ie.text_field(:name, "txtMultiLine1")
|
|
49
|
-
assert(t1.verify_contains("Hello World") )
|
|
50
|
-
assert(t1.verify_contains(/el/) )
|
|
51
|
-
t2 = $ie.text_field(:name, "txtMultiLine2")
|
|
52
|
-
assert(t2.verify_contains(/IE/))
|
|
53
|
-
assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.text_field(:name, "NoName").verify_contains("No field to get a value of") }
|
|
54
|
-
assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.text_field(:id, "noID").verify_contains("No field to get a value of") }
|
|
55
|
-
|
|
56
|
-
assert_raises(UnknownObjectException , "ObjectReadOnlyException was supposed to be thrown" ) { $ie.text_field(:name, "txtNone").append("Some Text") }
|
|
57
|
-
|
|
58
|
-
assert_raises(ObjectReadOnlyException , "ObjectReadOnlyException was supposed to be thrown" ) { $ie.text_field(:id, "txtReadOnly").append("Some Text") }
|
|
59
|
-
assert_raises(ObjectDisabledException , "ObjectDisabledException was supposed to be thrown" ) { $ie.text_field(:name, "txtDisabled").append("Some Text") }
|
|
60
|
-
assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.text_field(:name, "missing_field").append("Some Text") }
|
|
61
|
-
|
|
62
|
-
$ie.text_field(:name, "txtMultiLine1").append(" Some Text")
|
|
63
|
-
assert_equal( "Hello World Some Text" , $ie.text_field(:name, "txtMultiLine1").getContents )
|
|
64
|
-
|
|
65
|
-
assert_raises(ObjectReadOnlyException , "ObjectReadOnlyException was supposed to be thrown" ) { $ie.text_field(:id, "txtReadOnly").append("Some Text") }
|
|
66
|
-
assert_raises(ObjectDisabledException , "ObjectReadOnlyException was supposed to be thrown" ) { $ie.text_field(:name, "txtDisabled").append("Some Text") }
|
|
67
|
-
assert_raises(UnknownObjectException , "ObjectReadOnlyException was supposed to be thrown" ) { $ie.text_field(:name, "missing_field").append("Some Text") }
|
|
68
|
-
|
|
69
|
-
$ie.text_field(:name, "txtMultiLine1").set("watir IE Controller")
|
|
70
|
-
assert_equal( "watir IE Controller" , $ie.text_field(:name, "txtMultiLine1").getContents )
|
|
71
|
-
|
|
72
|
-
assert_raises(ObjectReadOnlyException , "ObjectReadOnlyException was supposed to be thrown" ) { $ie.text_field(:id, "txtReadOnly").append("Some Text") }
|
|
73
|
-
assert_raises(ObjectDisabledException , "ObjectReadOnlyException was supposed to be thrown" ) { $ie.text_field(:name, "txtDisabled").append("Some Text") }
|
|
74
|
-
assert_raises(UnknownObjectException , "ObjectReadOnlyException was supposed to be thrown" ) { $ie.text_field(:name, "missing_field").append("Some Text") }
|
|
75
|
-
|
|
76
|
-
$ie.text_field(:name, "txtMultiLine2").clear()
|
|
77
|
-
assert_equal( "" , $ie.text_field(:name, "txtMultiLine2").getContents )
|
|
78
|
-
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
end
|
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
# feature tests for Text Fields
|
|
2
|
-
# revision: $Revision: 1.31 $
|
|
3
|
-
|
|
4
|
-
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
|
|
5
|
-
require 'unittests/setup'
|
|
6
|
-
|
|
7
|
-
class TC_Fields < Test::Unit::TestCase
|
|
8
|
-
include Watir
|
|
9
|
-
|
|
10
|
-
def setup()
|
|
11
|
-
$ie.goto($htmlRoot + "textfields1.html")
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def test_text_field_exists
|
|
15
|
-
assert($ie.text_field(:name, "text1").exists?)
|
|
16
|
-
assert_false($ie.text_field(:name, "missing").exists?)
|
|
17
|
-
|
|
18
|
-
assert($ie.text_field(:id, "text2").exists?)
|
|
19
|
-
assert_false($ie.text_field(:id, "alsomissing").exists?)
|
|
20
|
-
|
|
21
|
-
assert($ie.text_field(:beforeText , "This Text After").exists? )
|
|
22
|
-
assert($ie.text_field(:afterText , "This Text Before").exists? )
|
|
23
|
-
|
|
24
|
-
assert($ie.text_field(:beforeText , /after/i).exists? )
|
|
25
|
-
assert($ie.text_field(:afterText , /before/i).exists? )
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def test_text_field_dragContentsTo
|
|
29
|
-
$ie.text_field(:name, "text1").dragContentsTo(:id, "text2")
|
|
30
|
-
assert_equal($ie.text_field(:name, "text1").getContents, "" )
|
|
31
|
-
assert_equal($ie.text_field(:id, "text2").getContents, "goodbye allHello World" )
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
def test_text_field_VerifyContents
|
|
35
|
-
assert($ie.text_field(:name, "text1").verify_contains("Hello World") )
|
|
36
|
-
assert($ie.text_field(:name, "text1").verify_contains(/Hello\sW/ ) )
|
|
37
|
-
assert_false($ie.text_field(:name, "text1").verify_contains("Ruby") )
|
|
38
|
-
assert_false($ie.text_field(:name, "text1").verify_contains(/R/) )
|
|
39
|
-
assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.text_field(:name, "NoName").verify_contains("No field to get a value of") }
|
|
40
|
-
|
|
41
|
-
assert($ie.text_field(:id, "text2").verify_contains("goodbye all") )
|
|
42
|
-
assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.text_field(:id, "noID").verify_contains("No field to get a value of") }
|
|
43
|
-
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
def test_text_field_enabled
|
|
47
|
-
assert_false($ie.text_field(:name, "disabled").enabled? )
|
|
48
|
-
assert($ie.text_field(:name, "text1").enabled? )
|
|
49
|
-
assert($ie.text_field(:id, "text2").enabled? )
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
def test_text_field_readOnly
|
|
53
|
-
assert_false($ie.text_field(:name, "disabled").readonly? )
|
|
54
|
-
assert($ie.text_field(:name, "readOnly").readonly? )
|
|
55
|
-
assert($ie.text_field(:id, "readOnly2").readonly? )
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
def test_text_field_getContents()
|
|
59
|
-
assert_raises(UnknownObjectException , "ObjectReadOnlyException was supposed to be thrown" ) { $ie.text_field(:name, "missing_field").append("Some Text") }
|
|
60
|
-
assert_equal( "Hello World" , $ie.text_field(:name, "text1").getContents )
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
def test_TextField_to_s
|
|
64
|
-
expected = [build_to_s_regex("type", "text"),
|
|
65
|
-
build_to_s_regex("id", ""),
|
|
66
|
-
build_to_s_regex("name", "text1"),
|
|
67
|
-
build_to_s_regex("value", "Hello World"),
|
|
68
|
-
build_to_s_regex("disabled", "false"),
|
|
69
|
-
build_to_s_regex("length", "20"),
|
|
70
|
-
build_to_s_regex("max length", "2147483647"),
|
|
71
|
-
build_to_s_regex("read only", "false")]
|
|
72
|
-
items = $ie.text_field(:index, 1).to_s.split(/\n/)
|
|
73
|
-
expected.each_with_index{|regex, x| assert(regex =~ items[x]) }
|
|
74
|
-
expected[1] = build_to_s_regex("id", "text2")
|
|
75
|
-
expected[2] = build_to_s_regex("name", "")
|
|
76
|
-
expected[3] = build_to_s_regex("value", "goodbye all")
|
|
77
|
-
items = $ie.text_field(:index, 2).to_s.split(/\n/)
|
|
78
|
-
expected.each_with_index{|regex, x| assert(regex =~ items[x]) }
|
|
79
|
-
assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.text_field(:index, 999 ).to_s}
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
def build_to_s_regex(lhs, rhs)
|
|
83
|
-
Regexp.new("^#{lhs}: +#{rhs}$")
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
def test_text_field_Append
|
|
87
|
-
assert_raises(ObjectReadOnlyException , "ObjectReadOnlyException was supposed to be thrown" ) { $ie.text_field(:id, "readOnly2").append("Some Text") }
|
|
88
|
-
assert_raises(ObjectDisabledException , "ObjectDisabledException was supposed to be thrown" ) { $ie.text_field(:name, "disabled").append("Some Text") }
|
|
89
|
-
assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.text_field(:name, "missing_field").append("Some Text") }
|
|
90
|
-
|
|
91
|
-
$ie.text_field(:name, "text1").append(" Some Text")
|
|
92
|
-
assert_equal( "Hello World Some Text" , $ie.text_field(:name, "text1").getContents )
|
|
93
|
-
|
|
94
|
-
# may need this to see that it really happened
|
|
95
|
-
#puts "press return to continue"
|
|
96
|
-
#gets
|
|
97
|
-
|
|
98
|
-
end
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
def test_text_field_Clear
|
|
102
|
-
assert_raises(ObjectReadOnlyException , "ObjectReadOnlyException was supposed to be thrown" ) { $ie.text_field(:id, "readOnly2").append("Some Text") }
|
|
103
|
-
assert_raises(ObjectDisabledException , "ObjectReadOnlyException was supposed to be thrown" ) { $ie.text_field(:name, "disabled").append("Some Text") }
|
|
104
|
-
assert_raises(UnknownObjectException , "ObjectReadOnlyException was supposed to be thrown" ) { $ie.text_field(:name, "missing_field").append("Some Text") }
|
|
105
|
-
|
|
106
|
-
$ie.text_field(:name, "text1").clear()
|
|
107
|
-
assert_equal( "" , $ie.text_field(:name, "text1").getContents )
|
|
108
|
-
|
|
109
|
-
# may need this to see that it really happened
|
|
110
|
-
#puts "press return to continue"
|
|
111
|
-
#gets
|
|
112
|
-
|
|
113
|
-
end
|
|
114
|
-
|
|
115
|
-
def test_text_field_Set
|
|
116
|
-
assert_raises(ObjectReadOnlyException , "ObjectReadOnlyException was supposed to be thrown" ) { $ie.text_field(:id, "readOnly2").append("Some Text") }
|
|
117
|
-
assert_raises(ObjectDisabledException , "ObjectReadOnlyException was supposed to be thrown" ) { $ie.text_field(:name, "disabled").append("Some Text") }
|
|
118
|
-
assert_raises(UnknownObjectException , "ObjectReadOnlyException was supposed to be thrown" ) { $ie.text_field(:name, "missing_field").append("Some Text") }
|
|
119
|
-
|
|
120
|
-
$ie.text_field(:name, "text1").set("watir IE Controller")
|
|
121
|
-
assert_equal( "watir IE Controller" , $ie.text_field(:name, "text1").getContents )
|
|
122
|
-
|
|
123
|
-
# may need this to see that it really happened
|
|
124
|
-
#puts "press return to continue"
|
|
125
|
-
#gets
|
|
126
|
-
end
|
|
127
|
-
|
|
128
|
-
def test_text_field_properties
|
|
129
|
-
|
|
130
|
-
assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.text_field(:index, 199).value}
|
|
131
|
-
assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.text_field(:index, 199).name }
|
|
132
|
-
assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.text_field(:index, 199).id }
|
|
133
|
-
assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.text_field(:index, 199).disabled }
|
|
134
|
-
assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { $ie.text_field(:index, 199).type }
|
|
135
|
-
|
|
136
|
-
assert_equal( "Hello World" , $ie.text_field(:index, 1).value )
|
|
137
|
-
assert_equal( "text" , $ie.text_field(:index, 1).type)
|
|
138
|
-
assert_equal( "text1" , $ie.text_field(:index, 1).name )
|
|
139
|
-
assert_equal( "" , $ie.text_field(:index, 1).id )
|
|
140
|
-
assert_equal( false , $ie.text_field(:index, 1).disabled )
|
|
141
|
-
|
|
142
|
-
assert_equal( "" , $ie.text_field(:index, 2).name )
|
|
143
|
-
assert_equal( "text2" , $ie.text_field(:index, 2).id )
|
|
144
|
-
|
|
145
|
-
assert( $ie.text_field(:index, 3).disabled )
|
|
146
|
-
|
|
147
|
-
assert_equal( "This used to test :afterText" , $ie.text_field(:name, "aftertest" ).title )
|
|
148
|
-
assert_equal( "" , $ie.text_field(:index, 1 ).title )
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
end
|
|
152
|
-
|
|
153
|
-
def test_text_field_iterators
|
|
154
|
-
|
|
155
|
-
assert_equal( 12 , $ie.text_fields.length )
|
|
156
|
-
|
|
157
|
-
# watir is 1 based, so this is the first text field
|
|
158
|
-
assert_equal( "Hello World" , $ie.text_fields[1].value )
|
|
159
|
-
assert_equal( "text1" , $ie.text_fields[1].name )
|
|
160
|
-
|
|
161
|
-
assert_equal( "password" , $ie.text_fields[ $ie.text_fields.length ].type)
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
index = 1
|
|
165
|
-
$ie.text_fields.each do |t|
|
|
166
|
-
assert_equal( $ie.text_field(:index, index).value, t.value )
|
|
167
|
-
assert_equal( $ie.text_field(:index, index).id, t.id )
|
|
168
|
-
assert_equal( $ie.text_field(:index, index).name, t.name )
|
|
169
|
-
index +=1
|
|
170
|
-
end
|
|
171
|
-
assert_equal( index-1, $ie.text_fields.length)
|
|
172
|
-
|
|
173
|
-
end
|
|
174
|
-
|
|
175
|
-
def test_JS_Events
|
|
176
|
-
$ie.text_field(:name , 'events_tester').set('p')
|
|
177
|
-
|
|
178
|
-
# the following line has an extra keypress at the begining, as we mimic the delete key being pressed
|
|
179
|
-
assert_equal( "keypresskeydownkeypresskeyup" , $ie.text_field(:name , 'events_text').value.gsub("\r\n" , "") )
|
|
180
|
-
$ie.button(:value , "Clear Events Box").click
|
|
181
|
-
$ie.text_field(:name , 'events_tester').set('ab')
|
|
182
|
-
|
|
183
|
-
# the following line has an extra keypress at the begining, as we mimic the delete key being pressed
|
|
184
|
-
assert_equal( "keypresskeydownkeypresskeyupkeydownkeypresskeyup" , $ie.text_field(:name , 'events_text').value.gsub("\r\n" , "") )
|
|
185
|
-
|
|
186
|
-
end
|
|
187
|
-
|
|
188
|
-
def test_password
|
|
189
|
-
|
|
190
|
-
$ie.text_field(:name , "password1").set("secret")
|
|
191
|
-
assert( 'secret' , $ie.text_field(:name , "password1").value )
|
|
192
|
-
|
|
193
|
-
$ie.text_field(:id , "password1").set("top_secret")
|
|
194
|
-
assert( 'top_secret' , $ie.text_field(:id, "password1").value )
|
|
195
|
-
end
|
|
196
|
-
|
|
197
|
-
def test_labels_iterator
|
|
198
|
-
|
|
199
|
-
assert_equal(3, $ie.labels.length)
|
|
200
|
-
assert_equal('Label For this Field' , $ie.labels[1].innerText.strip )
|
|
201
|
-
assert_equal('Password With ID ( the text here is a label for it )' , $ie.labels[3].innerText )
|
|
202
|
-
|
|
203
|
-
count=0
|
|
204
|
-
$ie.labels.each do |l|
|
|
205
|
-
count +=1
|
|
206
|
-
end
|
|
207
|
-
assert_equal(count, $ie.labels.length)
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
end
|
|
211
|
-
|
|
212
|
-
def test_label_properties
|
|
213
|
-
assert_raises(UnknownObjectException ) { $ie.label(:index,20).innerText }
|
|
214
|
-
assert_raises(UnknownObjectException ) { $ie.label(:index,20).for }
|
|
215
|
-
assert_raises(UnknownObjectException ) { $ie.label(:index,20).name }
|
|
216
|
-
assert_raises(UnknownObjectException ) { $ie.label(:index,20).type }
|
|
217
|
-
assert_raises(UnknownObjectException ) { $ie.label(:index,20).id }
|
|
218
|
-
|
|
219
|
-
assert_false( $ie.label(:index,10).exists? )
|
|
220
|
-
assert_false( $ie.label(:id,'missing').exists? )
|
|
221
|
-
assert( $ie.label(:index,1).exists? )
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
assert_equal( "" , $ie.label(:index,1).id )
|
|
225
|
-
assert_false( $ie.label(:index,1).disabled )
|
|
226
|
-
assert( $ie.label(:index,1).enabled?)
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
assert_equal( "label2" , $ie.label(:index,2).id )
|
|
230
|
-
assert_equal( "Label" , $ie.label(:index,2).type )
|
|
231
|
-
|
|
232
|
-
assert_equal( "Password With ID ( the text here is a label for it )" , $ie.label(:index,3).innerText)
|
|
233
|
-
assert_equal( "password1" , $ie.label(:index,3).for)
|
|
234
|
-
end
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
end
|
data/watir/AutoItX3.dll
DELETED
|
Binary file
|
data/watir/WindowHelper.rb
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
require 'win32ole'
|
|
2
|
-
|
|
3
|
-
class WindowHelper
|
|
4
|
-
def initialize( )
|
|
5
|
-
@autoit = WIN32OLE.new('AutoItX3.Control')
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
def push_alert_button()
|
|
9
|
-
@autoit.WinWait "Microsoft Internet Explorer", ""
|
|
10
|
-
@autoit.Send "{ENTER}"
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def push_confirm_button_ok()
|
|
14
|
-
@autoit.WinWait "Microsoft Internet Explorer", ""
|
|
15
|
-
@autoit.Send "{ENTER}"
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def push_confirm_button_cancel()
|
|
19
|
-
@autoit.WinWait "Microsoft Internet Explorer", ""
|
|
20
|
-
@autoit.Send "{ESCAPE}"
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def push_security_alert_yes()
|
|
24
|
-
@autoit.WinWait "Security Alert", ""
|
|
25
|
-
@autoit.Send "{TAB}"
|
|
26
|
-
@autoit.Send "{TAB}"
|
|
27
|
-
@autoit.Send "{SPACE}"
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def logon(title,name = 'john doe',password = 'john doe')
|
|
31
|
-
@autoit.WinWait title, ""
|
|
32
|
-
@autoit.Send name
|
|
33
|
-
@autoit.Send "{TAB}"
|
|
34
|
-
@autoit.Send password
|
|
35
|
-
@autoit.Send "{ENTER}"
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
def WindowHelper.check_autoit_installed
|
|
39
|
-
begin
|
|
40
|
-
WIN32OLE.new('AutoItX3.Control')
|
|
41
|
-
rescue
|
|
42
|
-
raise Watir::Exception::WatirException, "The AutoIt dll must be correctly registered for this feature to work properly"
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
|