watir 1.4.1 → 1.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/watir-console +1 -0
- data/changes.rb +119 -0
- data/license.rb +37 -0
- data/readme.rb +55 -120
- data/unittests/buttons_test.rb +107 -104
- data/unittests/buttons_xpath_test.rb +69 -0
- data/unittests/checkbox_test.rb +154 -141
- data/unittests/checkbox_xpath_test.rb +107 -0
- data/unittests/core_tests.rb +6 -2
- data/unittests/css_test.rb +50 -50
- data/unittests/defer_test.rb +47 -0
- data/unittests/dialog_test.rb +78 -0
- data/unittests/div2_xpath_test.rb +22 -0
- data/unittests/div_test.rb +159 -159
- data/unittests/div_xpath_test.rb +96 -0
- data/unittests/errorchecker_test.rb +22 -22
- data/unittests/filefield_test.rb +30 -23
- data/unittests/filefield_xpath_test.rb +35 -0
- data/unittests/form_test.rb +250 -229
- data/unittests/form_xpath_test.rb +253 -0
- data/unittests/frame_test.rb +123 -108
- data/unittests/google_form_test.rb +17 -0
- data/unittests/html/JavascriptClick.html +39 -0
- data/unittests/html/buttons1.html +3 -2
- data/unittests/html/checkboxes1.html +32 -14
- data/unittests/html/complex_table.html +1 -1
- data/unittests/html/depot_store.html +59 -0
- data/unittests/html/div.html +3 -21
- data/unittests/html/div_xml.html +21 -0
- data/unittests/html/fileupload.html +2 -2
- data/unittests/html/forms2.html +3 -3
- data/unittests/html/forms3.html +2 -2
- data/unittests/html/frame_links.html +2 -2
- data/unittests/html/google_india.html +119 -0
- data/unittests/html/iframeTest.html +2 -2
- data/unittests/html/images/map.GIF +0 -0
- data/unittests/html/images/map2.gif +0 -0
- data/unittests/html/images1.html +17 -2
- data/unittests/html/javascriptevents.html +3 -7
- data/unittests/html/links1.html +9 -8
- data/unittests/html/links_multi.html +14 -0
- data/unittests/html/list_matters.html +720 -0
- data/unittests/html/lists.html +18 -0
- data/unittests/html/map_test.html +31 -0
- data/unittests/html/modal_dialog.html +10 -0
- data/unittests/html/modal_dialog_launcher.html +12 -0
- data/unittests/html/new_browser.html +17 -0
- data/unittests/html/pass.html +3 -0
- data/unittests/html/popups1.html +1 -1
- data/unittests/html/pre.html +28 -0
- data/unittests/html/radioButtons1.html +6 -5
- data/unittests/html/selectboxes1.html +12 -11
- data/unittests/html/simple_table.html +1 -1
- data/unittests/html/simple_table_columns.html +1 -1
- data/unittests/html/table1.html +1 -1
- data/unittests/html/tableCell_using_xpath.html +19 -0
- data/unittests/html/textfields1.html +6 -4
- data/unittests/html/xpath_nbsp.html +12 -0
- data/unittests/ie_exists_test.rb +32 -0
- data/unittests/ie_mock.rb +78 -79
- data/unittests/ie_test.rb +39 -39
- data/unittests/images_test.rb +132 -155
- data/unittests/images_xpath_test.rb +91 -0
- data/unittests/links_multi_test.rb +36 -0
- data/unittests/links_test.rb +158 -152
- data/unittests/links_xpath_test.rb +40 -0
- data/unittests/lists_test.rb +29 -0
- data/unittests/map_test.rb +99 -0
- data/unittests/minmax_test.rb +23 -23
- data/unittests/navigate_test.rb +43 -51
- data/unittests/nbsp_xpath_test.rb +18 -0
- data/unittests/other/WindowLogonExample.rb +28 -0
- data/unittests/{WindowLogonExtra.rb → other/WindowLogonExtra.rb} +0 -0
- data/unittests/{all_tests_concurrent.rb → other/all_tests_concurrent.rb} +23 -23
- data/unittests/other/navigate_exception_test.rb +14 -0
- data/unittests/other/rexml_unit_test.rb +24 -0
- data/unittests/other/testcase_method_order_test.rb +36 -0
- data/unittests/other/testcase_verify_test.rb +25 -0
- data/unittests/other/wait_until_test.rb +99 -0
- data/unittests/pagecontainstext_test.rb +56 -37
- data/unittests/parent_child_test.rb +55 -0
- data/unittests/popups_test.rb +37 -37
- data/unittests/pre_test.rb +52 -0
- data/unittests/radios_test.rb +186 -155
- data/unittests/radios_xpath_test.rb +101 -0
- data/unittests/screen_capture_test.rb +41 -41
- data/unittests/selectbox_test.rb +223 -181
- data/unittests/selectbox_xpath_test.rb +113 -0
- data/unittests/setup.rb +29 -25
- data/unittests/speed_settings_test.rb +22 -0
- data/unittests/table_cell_using_xpath_test.rb +40 -0
- data/unittests/table_test.rb +315 -284
- data/unittests/table_xpath_test.rb +114 -0
- data/unittests/textarea_test.rb +81 -0
- data/unittests/textarea_xpath_test.rb +82 -0
- data/unittests/textfields_test.rb +205 -229
- data/unittests/textfields_xpath_test.rb +111 -0
- data/unittests/window_tests.rb +7 -0
- data/unittests/windows/attach_to_existing_window_test.rb +52 -0
- data/unittests/windows/attach_to_new_window_test.rb +82 -0
- data/unittests/windows/close_window_test.rb +22 -0
- data/unittests/windows/frame_links_test.rb +25 -0
- data/unittests/windows/ie-each_test.rb +48 -0
- data/unittests/windows/iedialog_test.rb +55 -0
- data/unittests/windows/js_events_test.rb +57 -0
- data/unittests/windows/jscriptExtraAlert.rb +6 -0
- data/unittests/windows/jscriptExtraConfirmCancel.rb +7 -0
- data/unittests/windows/jscriptExtraConfirmOk.rb +7 -0
- data/unittests/{jscriptPushButton.rb → windows/jscriptPushButton.rb} +1 -1
- data/unittests/windows/jscript_test.rb +64 -0
- data/unittests/windows/modal_dialog_test.rb +127 -0
- data/unittests/windows/new.rb +56 -0
- data/unittests/windows/open_close_test.rb +22 -0
- data/unittests/windows/send_keys_test.rb +34 -0
- data/unittests/xpath_tests.rb +10 -0
- data/watir.rb +4344 -3565
- data/watir/IEDialog/Release/IEDialog.dll +0 -0
- data/watir/WindowHelper.rb +13 -11
- data/watir/assertions.rb +36 -0
- data/watir/camel_case.rb +14 -5
- data/watir/close_all.rb +38 -0
- data/watir/contrib/enabled_popup.rb +21 -0
- data/watir/contrib/ie-new-process.rb +27 -0
- data/watir/contrib/page_checker.rb +29 -0
- data/watir/contrib/visible.rb +47 -0
- data/watir/cookiemanager.rb +4 -4
- data/watir/datahandler.rb +107 -0
- data/watir/dialog.rb +46 -0
- data/watir/elements.rb +65 -0
- data/watir/exceptions.rb +18 -36
- data/watir/ie-process.rb +40 -0
- data/watir/irb-history.rb +31 -0
- data/watir/process.rb +20 -0
- data/watir/testUnitAddons.rb +3 -42
- data/watir/testcase.rb +58 -0
- data/watir/utils.rb +20 -0
- data/watir/waiter.rb +88 -0
- data/watir/watir_simple.rb +4 -4
- data/watir/win32ole.rb +8 -0
- data/watir/win32ole/win32ole.so +0 -0
- data/watir/winClicker.rb +374 -400
- metadata +209 -128
- data/unittests/WindowLogonExample.rb +0 -30
- data/unittests/attachToExistingWindow_test.rb +0 -40
- 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/jscript_test.rb +0 -57
- data/unittests/send_keys_test.rb +0 -29
- data/unittests/textAreafields_test.rb +0 -81
data/unittests/jscript_test.rb
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
# feature tests for AutoIt wrapper
|
|
2
|
-
# revision: $Revision: 1.8 $
|
|
3
|
-
|
|
4
|
-
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
|
|
5
|
-
require 'unittests/setup'
|
|
6
|
-
require 'watir/WindowHelper'
|
|
7
|
-
|
|
8
|
-
$mydir = File.expand_path(File.dirname(__FILE__)).gsub('/', '\\')
|
|
9
|
-
|
|
10
|
-
class TC_JavaScript_Test < Test::Unit::TestCase
|
|
11
|
-
include Watir
|
|
12
|
-
@@attach = true
|
|
13
|
-
@@javascript_page_title = 'Alert Test'
|
|
14
|
-
@@javascript_page = $htmlRoot + 'JavascriptClick.htm'
|
|
15
|
-
|
|
16
|
-
def setup
|
|
17
|
-
begin
|
|
18
|
-
WindowHelper.check_autoit_installed
|
|
19
|
-
rescue Watir::Exception::WatirException
|
|
20
|
-
puts "Problem with Autoit - is it installed?."
|
|
21
|
-
exit
|
|
22
|
-
rescue
|
|
23
|
-
puts "There is a Problem with Autoit - is it installed?."
|
|
24
|
-
exit
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def goto_javascript_page()
|
|
29
|
-
$ie.goto(@@javascript_page)
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def check_dialog(extra_file, expected_result, &block)
|
|
33
|
-
goto_javascript_page()
|
|
34
|
-
Thread.new { system("rubyw \"#{$mydir}\\#{extra_file}.rb\"") }
|
|
35
|
-
|
|
36
|
-
block.call
|
|
37
|
-
testResult = $ie.text_field(:id, "testResult").value
|
|
38
|
-
assert_match( expected_result, testResult )
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
def test_alert_button()
|
|
42
|
-
check_dialog('jscriptExtraAlert', /Alert OK/){ $ie.button(:id, 'btnAlert').click }
|
|
43
|
-
end
|
|
44
|
-
def test_alert_button2()
|
|
45
|
-
check_dialog('jscriptPushButton', /Alert OK/){ sleep 0.1; WindowHelper.new.push_alert_button }
|
|
46
|
-
end
|
|
47
|
-
def test_confirm_button_ok()
|
|
48
|
-
check_dialog('jscriptExtraConfirmOk', /Confirm OK/){ push_confirm_button }
|
|
49
|
-
end
|
|
50
|
-
def test_confirm_button_Cancel()
|
|
51
|
-
check_dialog('jscriptExtraConfirmCancel', /Confirm Cancel/){push_confirm_button}
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
def push_confirm_button
|
|
55
|
-
$ie.button(:id, 'btnInformation').click
|
|
56
|
-
end
|
|
57
|
-
end
|
data/unittests/send_keys_test.rb
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
# feature tests for IE#send_keys
|
|
2
|
-
# revision: $Revision: 1.2 $
|
|
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_tabbing
|
|
15
|
-
$ie.text_field(:name, 'text1').focus
|
|
16
|
-
$ie.send_keys('{tab}')
|
|
17
|
-
$ie.send_keys('Scooby')
|
|
18
|
-
assert('Scooby', $ie.text_field(:name, 'beforetest').value)
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def test_enter
|
|
22
|
-
$ie.text_field(:name, 'text1').focus
|
|
23
|
-
$ie.send_keys('{tab}{tab}{tab}{tab}')
|
|
24
|
-
$ie.send_keys('Dooby{enter}')
|
|
25
|
-
assert($ie.contains_text('PASS'))
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
end
|
|
29
|
-
|
|
@@ -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
|