watir 1.5.6 → 1.6.2
Sign up to get free protection for your applications and to get access to all the features.
- data/{changes.rb → CHANGES} +12 -3
- data/bin/watir-console +7 -1
- data/lib/changes.rb +3 -0
- data/{license.rb → lib/license.rb} +2 -1
- data/{readme.rb → lib/readme.rb} +4 -6
- data/{watir → lib/watir}/AutoItX3.dll +0 -0
- data/{watir → lib/watir}/IEDialog/Release/IEDialog.dll +0 -0
- data/{watir → lib/watir}/WindowHelper.rb +1 -1
- data/{watir → lib/watir}/camel_case.rb +0 -0
- data/{watir → lib/watir}/clickJSDialog.rb +0 -0
- data/{watir → lib/watir}/close_all.rb +1 -1
- data/{watir → lib/watir}/collections.rb +1 -1
- data/{watir → lib/watir}/container.rb +17 -8
- data/{watir → lib/watir}/contrib/enabled_popup.rb +0 -0
- data/{watir → lib/watir}/contrib/ie-new-process.rb +0 -0
- data/{watir → lib/watir}/contrib/page_checker.rb +0 -0
- data/{watir → lib/watir}/contrib/visible.rb +2 -2
- data/{watir → lib/watir}/cookiemanager.rb +0 -0
- data/{watir → lib/watir}/datahandler.rb +0 -0
- data/{watir → lib/watir}/dialog.rb +1 -1
- data/{watir → lib/watir}/element.rb +3 -7
- data/{watir → lib/watir}/element_collections.rb +0 -0
- data/{watir → lib/watir}/form.rb +31 -11
- data/{watir → lib/watir}/frame.rb +0 -0
- data/{watir/ie.rb → lib/watir/ie-class.rb} +22 -22
- data/{watir → lib/watir}/ie-process.rb +0 -0
- data/{watir.rb → lib/watir/ie.rb} +11 -27
- data/{watir → lib/watir}/image.rb +0 -0
- data/{watir → lib/watir}/input_elements.rb +33 -44
- data/{watir → lib/watir}/irb-history.rb +0 -0
- data/{watir → lib/watir}/link.rb +0 -0
- data/{watir → lib/watir}/locator.rb +56 -43
- data/{watir → lib/watir}/logger.rb +0 -0
- data/{watir → lib/watir}/modal_dialog.rb +0 -0
- data/{watir → lib/watir}/non_control_elements.rb +0 -0
- data/{watir → lib/watir}/page-container.rb +2 -2
- data/{watir → lib/watir}/popup.rb +0 -0
- data/{watir → lib/watir}/process.rb +0 -0
- data/{watir → lib/watir}/screen_capture.rb +0 -0
- data/{watir → lib/watir}/setFileDialog.rb +0 -0
- data/{watir → lib/watir}/table.rb +7 -2
- data/{watir → lib/watir}/utils.rb +0 -0
- data/lib/watir/version.rb +5 -0
- data/{watir → lib/watir}/watir_simple.rb +3 -3
- data/{watir → lib/watir}/win32.rb +0 -0
- data/lib/watir/win32ole.rb +6 -0
- data/lib/watir/win32ole/win32ole.so +0 -0
- data/{watir → lib/watir}/winClicker.rb +0 -0
- data/unittests/buttons_xpath_test.rb +32 -32
- data/unittests/checkbox_test.rb +113 -99
- data/unittests/checkbox_xpath_test.rb +57 -57
- data/unittests/core_tests.rb +10 -7
- data/unittests/css_test.rb +12 -32
- data/unittests/defer_test.rb +22 -22
- data/unittests/dialog_test.rb +13 -13
- data/unittests/div2_xpath_test.rb +3 -3
- data/unittests/div_test.rb +23 -19
- data/unittests/div_xpath_test.rb +50 -50
- data/unittests/errorchecker_test.rb +7 -9
- data/unittests/filefield_test.rb +12 -11
- data/unittests/filefield_xpath_test.rb +10 -10
- data/unittests/form_test.rb +144 -151
- data/unittests/form_xpath_test.rb +99 -99
- data/unittests/frame_test.rb +46 -44
- data/unittests/google_form_test.rb +2 -2
- data/unittests/html/checkboxes1.html +19 -16
- data/unittests/html/forms3.html +2 -2
- data/unittests/html/wallofcheckboxes.html +1003 -0
- data/unittests/ie_exists_test.rb +5 -3
- data/unittests/ie_test.rb +2 -2
- data/unittests/images_test.rb +83 -82
- data/unittests/images_xpath_test.rb +40 -40
- data/unittests/iostring_test.rb +1 -1
- data/unittests/links_multi_test.rb +7 -8
- data/unittests/links_test.rb +73 -71
- data/unittests/links_xpath_test.rb +15 -15
- data/unittests/lists_test.rb +10 -10
- data/unittests/map_test.rb +65 -65
- data/unittests/minmax_test.rb +10 -9
- data/unittests/navigate_test.rb +19 -23
- data/unittests/nbsp_xpath_test.rb +2 -2
- data/unittests/non_core_tests.rb +5 -2
- data/unittests/other/WindowLogonExample.rb +2 -2
- data/unittests/other/WindowLogonExtra.rb +1 -1
- data/unittests/other/navigate_exception_test.rb +14 -3
- data/unittests/other/screen_capture_test.rb +3 -2
- data/unittests/other/testcase_method_order_test.rb +1 -1
- data/unittests/pagecontainstext_test.rb +17 -14
- data/unittests/parent_child_test.rb +11 -7
- data/unittests/perf_test.rb +20 -0
- data/unittests/popups_test.rb +13 -14
- data/unittests/pre_test.rb +30 -28
- data/unittests/radios_test.rb +128 -107
- data/unittests/radios_xpath_test.rb +47 -47
- data/unittests/security_setting_test.rb +24 -0
- data/unittests/selectbox_test.rb +65 -157
- data/unittests/selectbox_xpath_test.rb +51 -51
- data/unittests/setup.rb +52 -48
- data/unittests/speed_settings_test.rb +31 -20
- data/unittests/table_cell_using_xpath_test.rb +12 -12
- data/unittests/table_test.rb +30 -16
- data/unittests/table_xpath_test.rb +25 -25
- data/unittests/test_tests.rb +9 -0
- data/unittests/textarea_test.rb +33 -33
- data/unittests/textarea_xpath_test.rb +37 -37
- data/unittests/textfield_for_ch_char_test.rb +9 -9
- data/unittests/textfields_test.rb +103 -98
- data/unittests/textfields_xpath_test.rb +50 -50
- data/unittests/windows/attach_to_existing_window_test.rb +2 -2
- data/unittests/windows/attach_to_new_window_test.rb +10 -10
- data/unittests/windows/close_window_test.rb +2 -2
- data/unittests/windows/frame_links_test.rb +6 -6
- data/unittests/windows/ie-each_test.rb +1 -1
- data/unittests/windows/iedialog_test.rb +4 -5
- data/unittests/windows/js_events_test.rb +14 -14
- data/unittests/windows/jscriptExtraAlert.rb +2 -1
- data/unittests/windows/jscriptExtraConfirmCancel.rb +1 -1
- data/unittests/windows/jscriptExtraConfirmOk.rb +1 -1
- data/unittests/windows/jscriptPushButton.rb +2 -1
- data/unittests/windows/jscript_test.rb +7 -7
- data/unittests/windows/modal_dialog_test.rb +28 -29
- data/unittests/windows/{new.rb → new_test.rb} +1 -1
- data/unittests/windows/open_close_test.rb +4 -7
- data/unittests/windows/send_keys_test.rb +11 -11
- data/unittests/xpath_tests.rb +4 -3
- metadata +82 -58
- data/unittests/buttons_test.rb +0 -107
- data/watir/assertions.rb +0 -44
- data/watir/exceptions.rb +0 -42
- data/watir/testcase.rb +0 -58
- data/watir/waiter.rb +0 -88
- data/watir/win32ole.rb +0 -8
- data/watir/win32ole/win32ole.so +0 -0
@@ -1,7 +1,7 @@
|
|
1
1
|
# feature tests for Text Fields
|
2
|
-
# revision: $Revision:
|
2
|
+
# revision: $Revision: 1544 $
|
3
3
|
|
4
|
-
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..')
|
4
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
|
5
5
|
require 'unittests/setup'
|
6
6
|
|
7
7
|
class TC_Fields_XPath < Test::Unit::TestCase
|
@@ -12,48 +12,48 @@ class TC_Fields_XPath < Test::Unit::TestCase
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def test_text_field_exists
|
15
|
-
assert(
|
16
|
-
|
15
|
+
assert(browser.text_field(:xpath , "//input[@name='text1']/").exists?)
|
16
|
+
assert_false(browser.text_field(:xpath , "//input[@name='missing']/").exists?)
|
17
17
|
|
18
|
-
assert(
|
19
|
-
|
18
|
+
assert(browser.text_field(:xpath , "//input[@id='text2']/").exists?)
|
19
|
+
assert_false(browser.text_field(:xpath , "//input[@id='alsomissing']/").exists?)
|
20
20
|
|
21
|
-
#assert(
|
22
|
-
#assert(
|
21
|
+
#assert(browser.text_field(:xpath , "//input[@beforeText='This Text After']/").exists? )
|
22
|
+
#assert(browser.text_field(:xpath , "//input[@afterText='This Text Before']/").exists? )
|
23
23
|
end
|
24
24
|
|
25
25
|
def test_text_field_dragContentsTo
|
26
|
-
|
27
|
-
assert_equal(
|
28
|
-
assert_equal(
|
26
|
+
browser.text_field(:xpath , "//input[@name='text1']/").dragContentsTo(:xpath , "//input[@id='text2']/")
|
27
|
+
assert_equal(browser.text_field(:xpath , "//input[@name='text1']/").value, "" )
|
28
|
+
assert_equal(browser.text_field(:xpath , "//input[@id='text2']/").value, "goodbye allHello World" )
|
29
29
|
end
|
30
30
|
|
31
31
|
def test_text_field_VerifyContents
|
32
|
-
assert(
|
33
|
-
assert(
|
34
|
-
|
35
|
-
|
36
|
-
assert_raises(UnknownObjectException
|
32
|
+
assert(browser.text_field(:xpath , "//input[@name='text1']/").verify_contains("Hello World") )
|
33
|
+
assert(browser.text_field(:xpath , "//input[@name='text1']/").verify_contains(/Hello\sW/ ) )
|
34
|
+
assert_false(browser.text_field(:xpath , "//input[@name='text1']/").verify_contains("Ruby") )
|
35
|
+
assert_false(browser.text_field(:xpath , "//input[@name='text1']/").verify_contains(/R/) )
|
36
|
+
assert_raises(UnknownObjectException) { browser.text_field(:xpath , "//input[@name='NoName']/").verify_contains("No field to get a value of") }
|
37
37
|
|
38
|
-
assert(
|
39
|
-
assert_raises(UnknownObjectException
|
38
|
+
assert(browser.text_field(:xpath , "//input[@id='text2']/").verify_contains("goodbye all") )
|
39
|
+
assert_raises(UnknownObjectException) { browser.text_field(:xpath , "//input[@id='noID']/").verify_contains("No field to get a value of") }
|
40
40
|
end
|
41
41
|
|
42
42
|
def test_text_field_enabled
|
43
|
-
|
44
|
-
assert(
|
45
|
-
assert(
|
43
|
+
assert_false(browser.text_field(:xpath , "//input[@name='disabled']/").enabled? )
|
44
|
+
assert(browser.text_field(:xpath , "//input[@name='text1']/").enabled? )
|
45
|
+
assert(browser.text_field(:xpath , "//input[@id='text2']/").enabled? )
|
46
46
|
end
|
47
47
|
|
48
48
|
def test_text_field_readOnly
|
49
|
-
|
50
|
-
assert(
|
51
|
-
assert(
|
49
|
+
assert_false(browser.text_field(:xpath , "//input[@name='disabled']/").readonly? )
|
50
|
+
assert(browser.text_field(:xpath , "//input[@name='readOnly']/").readonly? )
|
51
|
+
assert(browser.text_field(:xpath , "//input[@id='readOnly2']/").readonly? )
|
52
52
|
end
|
53
53
|
|
54
54
|
def test_text_field_value
|
55
|
-
assert_raises(UnknownObjectException , "ObjectReadOnlyException was supposed to be thrown" ) {
|
56
|
-
assert_equal( "Hello World" ,
|
55
|
+
assert_raises(UnknownObjectException , "ObjectReadOnlyException was supposed to be thrown" ) { browser.text_field(:xpath , "//input[@name='missing_field']/").append("Some Text") }
|
56
|
+
assert_equal( "Hello World" , browser.text_field(:xpath , "//input[@name='text1']/").value )
|
57
57
|
end
|
58
58
|
|
59
59
|
def build_to_s_regex(lhs, rhs)
|
@@ -61,51 +61,51 @@ class TC_Fields_XPath < Test::Unit::TestCase
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def test_text_field_Append
|
64
|
-
assert_raises(ObjectReadOnlyException , "ObjectReadOnlyException was supposed to be thrown" ) {
|
65
|
-
assert_raises(ObjectDisabledException , "ObjectDisabledException was supposed to be thrown" ) {
|
66
|
-
assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) {
|
64
|
+
assert_raises(ObjectReadOnlyException , "ObjectReadOnlyException was supposed to be thrown" ) { browser.text_field(:xpath , "//input[@id='readOnly2']/").append("Some Text") }
|
65
|
+
assert_raises(ObjectDisabledException , "ObjectDisabledException was supposed to be thrown" ) { browser.text_field(:xpath , "//input[@name='disabled']/").append("Some Text") }
|
66
|
+
assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { browser.text_field(:xpath , "//input[@name='missing_field']/").append("Some Text") }
|
67
67
|
|
68
|
-
|
69
|
-
assert_equal( "Hello World Some Text" ,
|
68
|
+
browser.text_field(:xpath , "//input[@name='text1']/").append(" Some Text")
|
69
|
+
assert_equal( "Hello World Some Text" , browser.text_field(:xpath , "//input[@name='text1']/").value )
|
70
70
|
end
|
71
71
|
|
72
72
|
|
73
73
|
def test_text_field_Clear
|
74
|
-
assert_raises(ObjectReadOnlyException , "ObjectReadOnlyException was supposed to be thrown" ) {
|
75
|
-
assert_raises(ObjectDisabledException , "ObjectReadOnlyException was supposed to be thrown" ) {
|
76
|
-
assert_raises(UnknownObjectException , "ObjectReadOnlyException was supposed to be thrown" ) {
|
74
|
+
assert_raises(ObjectReadOnlyException , "ObjectReadOnlyException was supposed to be thrown" ) { browser.text_field(:xpath , "//input[@id='readOnly2']/").append("Some Text") }
|
75
|
+
assert_raises(ObjectDisabledException , "ObjectReadOnlyException was supposed to be thrown" ) { browser.text_field(:xpath , "//input[@name='disabled']/").append("Some Text") }
|
76
|
+
assert_raises(UnknownObjectException , "ObjectReadOnlyException was supposed to be thrown" ) { browser.text_field(:xpath , "//input[@name='missing_field']/").append("Some Text") }
|
77
77
|
|
78
|
-
|
79
|
-
assert_equal( "" ,
|
78
|
+
browser.text_field(:xpath , "//input[@name='text1']/").clear
|
79
|
+
assert_equal( "" , browser.text_field(:xpath , "//input[@name='text1']/").value )
|
80
80
|
end
|
81
81
|
|
82
82
|
def test_text_field_Set
|
83
|
-
assert_raises(ObjectReadOnlyException , "ObjectReadOnlyException was supposed to be thrown" ) {
|
84
|
-
assert_raises(ObjectDisabledException , "ObjectReadOnlyException was supposed to be thrown" ) {
|
85
|
-
assert_raises(UnknownObjectException , "ObjectReadOnlyException was supposed to be thrown" ) {
|
83
|
+
assert_raises(ObjectReadOnlyException , "ObjectReadOnlyException was supposed to be thrown" ) { browser.text_field(:xpath , "//input[@id='readOnly2']/").append("Some Text") }
|
84
|
+
assert_raises(ObjectDisabledException , "ObjectReadOnlyException was supposed to be thrown" ) { browser.text_field(:xpath , "//input[@name='disabled']/").append("Some Text") }
|
85
|
+
assert_raises(UnknownObjectException , "ObjectReadOnlyException was supposed to be thrown" ) { browser.text_field(:xpath , "//input[@name='missing_field']/").append("Some Text") }
|
86
86
|
|
87
|
-
|
88
|
-
assert_equal( "watir IE Controller" ,
|
87
|
+
browser.text_field(:xpath , "//input[@name='text1']/").set("watir IE Controller")
|
88
|
+
assert_equal( "watir IE Controller" , browser.text_field(:xpath , "//input[@name='text1']/").value )
|
89
89
|
end
|
90
90
|
|
91
91
|
def test_JS_Events
|
92
|
-
|
92
|
+
browser.text_field(:xpath , "//input[@name='events_tester']/").set('p')
|
93
93
|
|
94
94
|
# the following line has an extra keypress at the begining, as we mimic the delete key being pressed
|
95
|
-
assert_equal( "keypresskeydownkeypresskeyup" ,
|
96
|
-
|
97
|
-
|
95
|
+
assert_equal( "keypresskeydownkeypresskeyup" , browser.text_field(:xpath , "//textarea[@name='events_text']/").value.gsub("\r\n" , "") )
|
96
|
+
browser.button(:value , "Clear Events Box").click
|
97
|
+
browser.text_field(:xpath , "//input[@name='events_tester']/").set('ab')
|
98
98
|
|
99
99
|
# the following line has an extra keypress at the begining, as we mimic the delete key being pressed
|
100
|
-
assert_equal( "keypresskeydownkeypresskeyupkeydownkeypresskeyup" ,
|
100
|
+
assert_equal( "keypresskeydownkeypresskeyupkeydownkeypresskeyup" , browser.text_field(:xpath , "//textarea[@name='events_text']/").value.gsub("\r\n" , "") )
|
101
101
|
end
|
102
102
|
|
103
103
|
def test_password
|
104
|
-
|
105
|
-
assert( 'secret' ,
|
104
|
+
browser.text_field(:xpath , "//input[@name='password1']/").set("secret")
|
105
|
+
assert( 'secret' , browser.text_field(:xpath , "//input[@name='password1']/").value )
|
106
106
|
|
107
|
-
|
108
|
-
assert( 'top_secret' ,
|
107
|
+
browser.text_field(:xpath , "//input[@id='password1']/").set("top_secret")
|
108
|
+
assert( 'top_secret' , browser.text_field(:xpath , "//input[@id='password1']/").value )
|
109
109
|
end
|
110
110
|
|
111
111
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# feature tests for attaching to existing IE windows
|
2
|
-
# revision: $Revision:
|
2
|
+
# revision: $Revision: 1417 $
|
3
3
|
|
4
|
-
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..')
|
4
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..') unless $SETUP_LOADED
|
5
5
|
require 'unittests/setup'
|
6
6
|
|
7
7
|
class TC_ExistingWindow< Test::Unit::TestCase
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# feature tests for attaching to new IE windows
|
2
|
-
# revision: $Revision:
|
2
|
+
# revision: $Revision: 1544 $
|
3
3
|
|
4
|
-
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..')
|
4
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..') unless $SETUP_LOADED
|
5
5
|
require 'unittests/setup'
|
6
6
|
require 'watir/testcase'
|
7
7
|
|
@@ -17,14 +17,14 @@ class TC_NewWindow< Watir::TestCase
|
|
17
17
|
|
18
18
|
def test_simply_attach_to_new_window
|
19
19
|
IE.attach_timeout = 0.2
|
20
|
-
|
20
|
+
browser.link(:text, 'New Window').click
|
21
21
|
ie_new = IE.attach(:title, 'Pass Page')
|
22
22
|
assert(ie_new.text.include?('PASS'))
|
23
23
|
ie_new.close
|
24
24
|
end
|
25
25
|
|
26
26
|
def test_attach_to_new_window_using_separate_process
|
27
|
-
|
27
|
+
browser.eval_in_spawned_process "link(:text, 'New Window').click"
|
28
28
|
IE.attach_timeout = 6.0
|
29
29
|
ie_new = IE.attach(:title, 'Pass Page')
|
30
30
|
assert(ie_new.text.include?('PASS'))
|
@@ -35,7 +35,7 @@ class TC_NewWindow< Watir::TestCase
|
|
35
35
|
# this test is sometimes failing with a "Canvas does not allow drawing" error
|
36
36
|
# this is with IE7. I think the problem could be with the highlighting of the
|
37
37
|
# button from the separate process.
|
38
|
-
|
38
|
+
browser.link(:text, 'New Window').click_no_wait
|
39
39
|
IE.attach_timeout = 6.0
|
40
40
|
ie_new = IE.attach(:title, 'Pass Page')
|
41
41
|
assert(ie_new.text.include?('PASS'))
|
@@ -43,7 +43,7 @@ class TC_NewWindow< Watir::TestCase
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def test_click_no_wait_works_in_a_container
|
46
|
-
|
46
|
+
browser.p(:index, 1).link(:text, 'New Window').click_no_wait
|
47
47
|
IE.attach_timeout = 6.0
|
48
48
|
ie_new = IE.attach(:title, 'Pass Page')
|
49
49
|
assert(ie_new.text.include?('PASS'))
|
@@ -51,7 +51,7 @@ class TC_NewWindow< Watir::TestCase
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def test_attach_to_slow_window_works_with_delay
|
54
|
-
|
54
|
+
browser.span(:text, 'New Window Slowly').click
|
55
55
|
IE.attach_timeout = 4.0
|
56
56
|
sleep 1.0
|
57
57
|
ie_new = IE.attach(:title, 'Test page for buttons')
|
@@ -60,7 +60,7 @@ class TC_NewWindow< Watir::TestCase
|
|
60
60
|
end
|
61
61
|
|
62
62
|
def test_attach_to_slow_window_works_without_waiting
|
63
|
-
|
63
|
+
browser.span(:text, 'New Window Slowly').click
|
64
64
|
IE.attach_timeout = 3.0
|
65
65
|
ie_new = IE.attach(:title, 'Test page for buttons')
|
66
66
|
assert(ie_new.text.include?('Blank page to fill in the frames'))
|
@@ -69,8 +69,8 @@ class TC_NewWindow< Watir::TestCase
|
|
69
69
|
|
70
70
|
def test_attach_timesout_when_window_takes_too_long
|
71
71
|
IE.attach_timeout = 0.2
|
72
|
-
|
73
|
-
|
72
|
+
browser.text_field(:name, 'delay').set('2')
|
73
|
+
browser.span(:text, 'New Window Slowly').click
|
74
74
|
assert_raise(Watir::Exception::NoMatchingWindowFoundException) do
|
75
75
|
IE.attach(:title, 'Test page for buttons')
|
76
76
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# feature tests for closed windows
|
2
2
|
# revision: $Revision: 958 $
|
3
3
|
|
4
|
-
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..')
|
4
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..') unless $SETUP_LOADED
|
5
5
|
require 'unittests/setup'
|
6
6
|
|
7
7
|
class TC_CloseWindow < Watir::TestCase
|
@@ -13,7 +13,7 @@ class TC_CloseWindow < Watir::TestCase
|
|
13
13
|
|
14
14
|
# reproduces defect http://jira.openqa.org/browse/WTR-16
|
15
15
|
def test_close_window_with_button
|
16
|
-
|
16
|
+
browser.link(:text, 'New Window').click
|
17
17
|
ie_new = Watir::IE.attach(:title, 'Pass Page')
|
18
18
|
assert(ie_new.text.include?('PASS'))
|
19
19
|
assert_nothing_raised {ie_new.close}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# tests of click_no_wait for links in frames
|
2
2
|
# revision: $Revision: 1078 $
|
3
3
|
|
4
|
-
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..')
|
4
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..') unless $SETUP_LOADED
|
5
5
|
require 'unittests/setup'
|
6
6
|
|
7
7
|
class TC_Frame_Links < Test::Unit::TestCase
|
@@ -12,14 +12,14 @@ class TC_Frame_Links < Test::Unit::TestCase
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def test_click_in_a_frame
|
15
|
-
|
16
|
-
assert(
|
15
|
+
browser.frame('linkFrame').link(:text, 'test1').click
|
16
|
+
assert(browser.frame('linkFrame').text.include?('Links2-Pass'))
|
17
17
|
end
|
18
18
|
|
19
19
|
def test_click_no_wait_in_a_frame
|
20
|
-
|
21
|
-
wait_until(2){
|
22
|
-
assert(
|
20
|
+
browser.frame('linkFrame').link(:text, 'test1').click_no_wait
|
21
|
+
wait_until(2){browser.frame('linkFrame').text.include?('Links2-Pass')}
|
22
|
+
assert(browser.frame('linkFrame').text.include?('Links2-Pass'))
|
23
23
|
end
|
24
24
|
|
25
25
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# Not intended to be run as part of a larger suite.
|
2
2
|
|
3
|
-
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..')
|
3
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..') unless $SETUP_LOADED
|
4
4
|
require 'test/unit'
|
5
5
|
require 'watir'
|
6
6
|
require 'watir/process'
|
@@ -1,16 +1,15 @@
|
|
1
1
|
# unit tests for iedialog.dll and customized win32ole.so
|
2
|
-
# revision: $Revision:
|
2
|
+
# revision: $Revision: 1541 $
|
3
3
|
|
4
|
-
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..')
|
4
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..') unless $SETUP_LOADED
|
5
5
|
require 'unittests/setup'
|
6
6
|
require 'Win32API'
|
7
7
|
|
8
|
-
if VERSION == '1.8.2'
|
9
8
|
class TC_IEDialog < Test::Unit::TestCase
|
10
9
|
include Watir
|
11
10
|
|
12
11
|
# this will find the IEDialog.dll file in its build location
|
13
|
-
@@iedialog_file = (File.expand_path(File.dirname(__FILE__)) + "/../../watir/IEDialog/Release/IEDialog.dll").gsub('/', '\\')
|
12
|
+
@@iedialog_file = (File.expand_path(File.dirname(__FILE__)) + "/../../lib/watir/IEDialog/Release/IEDialog.dll").gsub('/', '\\')
|
14
13
|
|
15
14
|
# commented out because it currently requires a manual click
|
16
15
|
# a better idea would be to automate the click...
|
@@ -52,4 +51,4 @@ class TC_IEDialog < Test::Unit::TestCase
|
|
52
51
|
assert_match(/^PASS/, body.innerHTML.strip)
|
53
52
|
end
|
54
53
|
end
|
55
|
-
|
54
|
+
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# feature tests for JavaScript events
|
2
|
-
# revision: $Revision:
|
2
|
+
# revision: $Revision: 1544 $
|
3
3
|
|
4
|
-
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..')
|
4
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..') unless $SETUP_LOADED
|
5
5
|
require 'unittests/setup'
|
6
6
|
|
7
7
|
class TC_JSEvents < Test::Unit::TestCase
|
@@ -10,27 +10,27 @@ class TC_JSEvents < Test::Unit::TestCase
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def test_Button_disabled
|
13
|
-
|
13
|
+
assert_false( browser.button(:caption, "Button 1").enabled?)
|
14
14
|
end
|
15
15
|
|
16
16
|
def test_Button_Enabled
|
17
|
-
|
18
|
-
assert(
|
17
|
+
browser.text_field(:name, "entertext").fire_event("onkeyup")
|
18
|
+
assert(browser.button(:caption, "Button 1").enabled?)
|
19
19
|
end
|
20
20
|
|
21
21
|
def test_Button_click
|
22
22
|
# Firing event to make button enabled
|
23
|
-
|
23
|
+
browser.text_field(:name, "entertext").fire_event("onKeyUp")
|
24
24
|
# Clicking the button
|
25
|
-
|
26
|
-
assert(
|
25
|
+
browser.button(:caption, "Button 1").click
|
26
|
+
assert(browser.text.include?("PASS") )
|
27
27
|
end
|
28
28
|
|
29
29
|
#onMouseOver tests
|
30
30
|
#window status
|
31
31
|
|
32
32
|
def test_no_status_bar_exception
|
33
|
-
|
33
|
+
browser.link(:text, "New Window No Status Bar").click
|
34
34
|
status_bar_test_win = nil
|
35
35
|
# Note: this test will fail if the Google toolbar popup blocker is turned on
|
36
36
|
assert_nothing_raised { status_bar_test_win = Watir::IE.attach(:title, "Pass Page") }
|
@@ -40,16 +40,16 @@ class TC_JSEvents < Test::Unit::TestCase
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def test_page_nostatus
|
43
|
-
assert_equal("Done",
|
43
|
+
assert_equal("Done", browser.status)
|
44
44
|
end
|
45
45
|
|
46
46
|
def test_set_page_status
|
47
|
-
|
48
|
-
assert_equal("It worked",
|
47
|
+
browser.link(:text, "Check the Status").fire_event("onMouseOver")
|
48
|
+
assert_equal("It worked", browser.status)
|
49
49
|
end
|
50
50
|
|
51
51
|
def test_clear_page_status
|
52
|
-
|
53
|
-
assert_equal("Done",
|
52
|
+
browser.link(:text, "Clear the Status").fire_event("onMouseOver")
|
53
|
+
assert_equal("Done", browser.status)
|
54
54
|
end
|
55
55
|
end
|
@@ -1,4 +1,5 @@
|
|
1
|
-
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..')
|
1
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib')
|
2
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..', '..', 'watir-common', 'lib')
|
2
3
|
|
3
4
|
require 'watir/WindowHelper'
|
4
5
|
|
@@ -1,4 +1,5 @@
|
|
1
|
-
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..')
|
1
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib')
|
2
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..', '..', 'watir-common', 'lib')
|
2
3
|
require 'watir'
|
3
4
|
|
4
5
|
ie = Watir::IE.attach(:title, 'Alert Test')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# feature tests for AutoIt wrapper
|
2
|
-
# revision: $Revision:
|
2
|
+
# revision: $Revision: 1544 $
|
3
3
|
|
4
|
-
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..')
|
4
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..') unless $SETUP_LOADED
|
5
5
|
require 'unittests/setup'
|
6
6
|
require 'watir/WindowHelper'
|
7
7
|
require 'watir/process'
|
@@ -29,17 +29,17 @@ class TC_JavaScript_Test < Test::Unit::TestCase
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def check_dialog(extra_file, expected_result, &block)
|
32
|
-
|
32
|
+
browser.goto(@@javascript_page)
|
33
33
|
Thread.new { system("rubyw \"#{$mydir}\\#{extra_file}.rb\"") }
|
34
34
|
|
35
35
|
block.call
|
36
|
-
testResult =
|
36
|
+
testResult = browser.text_field(:id, "testResult").value
|
37
37
|
assert_match( expected_result, testResult )
|
38
38
|
end
|
39
39
|
|
40
40
|
def test_alert_button
|
41
41
|
check_dialog('jscriptExtraAlert', /Alert button!/) do
|
42
|
-
|
42
|
+
browser.button(:id, 'btnAlert').click
|
43
43
|
end
|
44
44
|
|
45
45
|
end
|
@@ -52,12 +52,12 @@ class TC_JavaScript_Test < Test::Unit::TestCase
|
|
52
52
|
end
|
53
53
|
def test_confirm_button_ok
|
54
54
|
check_dialog('jscriptExtraConfirmOk', /Confirm and OK button!/) do
|
55
|
-
|
55
|
+
browser.button(:id, 'btnConfirm').click
|
56
56
|
end
|
57
57
|
end
|
58
58
|
def test_confirm_button_Cancel
|
59
59
|
check_dialog('jscriptExtraConfirmCancel', /Confirm and Cancel button!/) do
|
60
|
-
|
60
|
+
browser.button(:id, 'btnConfirm').click
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|