watir-classic 3.0.0 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +7 -0
- data/.gitmodules +3 -0
- data/.rspec +1 -0
- data/.yardopts +5 -0
- data/CHANGES +20 -10
- data/CONTRIBUTORS.txt +55 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +78 -0
- data/README.rdoc +8 -14
- data/Rakefile +32 -0
- data/VERSION +1 -1
- data/lib/watir-classic.rb +0 -1
- data/lib/watir-classic/IEDialog/IEDialog.cpp +225 -0
- data/lib/watir-classic/IEDialog/IEDialog.h +15 -0
- data/lib/watir-classic/IEDialog/IEDialog.vcproj +159 -0
- data/lib/watir-classic/IEDialog/ReadMe.txt +40 -0
- data/lib/watir-classic/IEDialog/stdafx.cpp +8 -0
- data/lib/watir-classic/IEDialog/stdafx.h +21 -0
- data/lib/watir-classic/browser.rb +1 -1
- data/lib/watir-classic/container.rb +4 -33
- data/lib/watir-classic/core.rb +1 -3
- data/lib/watir-classic/dialogs/alert.rb +46 -0
- data/lib/watir-classic/dialogs/file_field.rb +1 -0
- data/lib/watir-classic/drag_and_drop_helper.rb +18 -6
- data/lib/watir-classic/element.rb +0 -2
- data/lib/watir-classic/ext/json2.js +487 -0
- data/lib/watir-classic/ie-class.rb +10 -164
- data/lib/watir-classic/ie.rb +2 -0
- data/lib/watir-classic/input_elements.rb +1 -1
- data/lib/watir-classic/modal_dialog.rb +1 -7
- data/lib/watir-classic/module.rb +1 -10
- data/lib/watir-classic/non_control_elements.rb +11 -0
- data/lib/watir-classic/page-container.rb +22 -24
- data/lib/watir-classic/screenshot.rb +33 -0
- data/lib/watir-classic/win32ole/1.8.7/win32ole.patch +56 -0
- data/lib/watir-classic/win32ole/1.9.3/win32ole.patch +63 -0
- data/lib/watir-classic/win32ole/build_notes.txt +18 -0
- data/lib/watir-classic/win32ole/history.txt +88 -0
- data/spec/browser_spec.rb +34 -0
- data/spec/implementation.rb +18 -0
- data/watir-classic.gemspec +40 -0
- data/watir.gif +0 -0
- metadata +159 -192
- data/bin/watir-console +0 -5
- data/lib/watir-classic/assertions.rb +0 -44
- data/lib/watir-classic/dialogs/javascript.rb +0 -43
- data/lib/watir-classic/irb-history.rb +0 -31
- data/lib/watir-classic/logger.rb +0 -19
- data/lib/watir-classic/screen_capture.rb +0 -115
- data/lib/watir-classic/testcase.rb +0 -97
- data/lib/watir-classic/waiter.rb +0 -98
- data/rakefile.rb +0 -54
- data/unittests/all_tests.rb +0 -10
- data/unittests/buttons_xpath_test.rb +0 -68
- data/unittests/checkbox_test.rb +0 -163
- data/unittests/checkbox_xpath_test.rb +0 -106
- data/unittests/click_no_wait_test.rb +0 -23
- data/unittests/close_all_test.rb +0 -17
- data/unittests/core_tests.rb +0 -17
- data/unittests/css_selector_test.rb +0 -44
- data/unittests/css_test.rb +0 -38
- data/unittests/dialog_test.rb +0 -64
- data/unittests/div2_xpath_test.rb +0 -21
- data/unittests/div_test.rb +0 -170
- data/unittests/div_xpath_test.rb +0 -95
- data/unittests/document_standards.rb +0 -63
- data/unittests/element_collection_indexes_test.rb +0 -57
- data/unittests/element_collections_test.rb +0 -100
- data/unittests/element_test.rb +0 -47
- data/unittests/errorchecker_test.rb +0 -31
- data/unittests/filefield_test.rb +0 -43
- data/unittests/filefield_xpath_test.rb +0 -35
- data/unittests/form_test.rb +0 -282
- data/unittests/form_xpath_test.rb +0 -254
- data/unittests/frame_test.rb +0 -165
- data/unittests/google_form_test.rb +0 -15
- data/unittests/html/JavascriptClick.html +0 -39
- data/unittests/html/blankpage.html +0 -11
- data/unittests/html/buttons1.html +0 -40
- data/unittests/html/checkboxes1.html +0 -89
- data/unittests/html/click_no_wait.html +0 -14
- data/unittests/html/complex_table.html +0 -35
- data/unittests/html/cssTest.html +0 -42
- data/unittests/html/depot_store.html +0 -59
- data/unittests/html/div.html +0 -92
- data/unittests/html/div_xml.html +0 -21
- data/unittests/html/fileupload.html +0 -44
- data/unittests/html/formTest1.html +0 -38
- data/unittests/html/forms2.html +0 -44
- data/unittests/html/forms3.html +0 -131
- data/unittests/html/forms4.html +0 -26
- 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/google_india.html +0 -119
- data/unittests/html/ie7_document_standards.html +0 -9
- data/unittests/html/ie8_document_standards.html +0 -9
- data/unittests/html/ie9_document_standards.html +0 -9
- data/unittests/html/iframe.html +0 -3
- data/unittests/html/iframeTest.html +0 -17
- data/unittests/html/iframeTest1.html +0 -7
- data/unittests/html/iframeTest2.html +0 -5
- data/unittests/html/images/1.gif +0 -0
- data/unittests/html/images/2.GIF +0 -0
- data/unittests/html/images/3.GIF +0 -0
- data/unittests/html/images/button.jpg +0 -0
- data/unittests/html/images/circle.jpg +0 -0
- data/unittests/html/images/map.GIF +0 -0
- data/unittests/html/images/map2.gif +0 -0
- data/unittests/html/images/minus.GIF +0 -0
- data/unittests/html/images/originaltriangle.jpg +0 -0
- data/unittests/html/images/plus.gif +0 -0
- data/unittests/html/images/square.jpg +0 -0
- data/unittests/html/images/triangle.jpg +0 -0
- data/unittests/html/images1.html +0 -65
- data/unittests/html/javascriptevents.html +0 -33
- 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/links_multi.html +0 -12
- data/unittests/html/list_matters.html +0 -720
- data/unittests/html/lists.html +0 -18
- data/unittests/html/map_test.html +0 -30
- data/unittests/html/modal_dialog.html +0 -10
- data/unittests/html/modal_dialog_launcher.html +0 -12
- data/unittests/html/multiple_specifiers.html +0 -64
- data/unittests/html/nestedFrames.html +0 -6
- data/unittests/html/new_browser.html +0 -17
- data/unittests/html/pass.html +0 -13
- data/unittests/html/popups1.html +0 -59
- data/unittests/html/pre.html +0 -29
- data/unittests/html/quirks_document_standards.html +0 -8
- data/unittests/html/radioButtons1.html +0 -71
- data/unittests/html/select_tealeaf.html +0 -54
- data/unittests/html/selectboxes1.html +0 -52
- data/unittests/html/simple_table.html +0 -25
- data/unittests/html/simple_table_buttons.html +0 -104
- data/unittests/html/simple_table_columns.html +0 -75
- data/unittests/html/table1.html +0 -179
- data/unittests/html/tableCell_using_xpath.html +0 -19
- data/unittests/html/table_and_tablerow_to_a.html +0 -174
- data/unittests/html/textarea.html +0 -30
- data/unittests/html/textfields1.html +0 -100
- data/unittests/html/textsearch.html +0 -44
- data/unittests/html/wallofcheckboxes.html +0 -1003
- data/unittests/html/xpath_nbsp.html +0 -11
- data/unittests/html/zeroindex.html +0 -11
- data/unittests/ie_exists_test.rb +0 -16
- data/unittests/ie_mock.rb +0 -94
- data/unittests/ie_test.rb +0 -54
- data/unittests/images_test.rb +0 -156
- data/unittests/images_xpath_test.rb +0 -90
- data/unittests/index_specifier_test.rb +0 -31
- data/unittests/js_events_test.rb +0 -31
- data/unittests/links_multi_test.rb +0 -34
- data/unittests/links_test.rb +0 -131
- data/unittests/links_xpath_test.rb +0 -38
- data/unittests/lists_test.rb +0 -23
- data/unittests/map_test.rb +0 -98
- data/unittests/minmax_test.rb +0 -37
- data/unittests/navigate_test.rb +0 -38
- data/unittests/nbsp_xpath_test.rb +0 -16
- data/unittests/no_wait_test.rb +0 -28
- data/unittests/non_core_tests.rb +0 -12
- data/unittests/other/all_tests_concurrent.rb +0 -57
- data/unittests/other/navigate_exception_test.rb +0 -24
- data/unittests/other/rexml_unit_test.rb +0 -27
- data/unittests/other/screen_capture_test.rb +0 -53
- data/unittests/other/testcase_method_order_test.rb +0 -36
- data/unittests/other/testcase_verify_test.rb +0 -25
- data/unittests/other/wait_until_test.rb +0 -102
- data/unittests/pagecontainstext_test.rb +0 -69
- data/unittests/parent_child_test.rb +0 -27
- data/unittests/perf_test.rb +0 -20
- data/unittests/pre_test.rb +0 -49
- data/unittests/radios_test.rb +0 -181
- data/unittests/radios_xpath_test.rb +0 -100
- data/unittests/security_setting_test.rb +0 -24
- data/unittests/selectbox_test.rb +0 -144
- data/unittests/selectbox_xpath_test.rb +0 -102
- data/unittests/setup.rb +0 -69
- data/unittests/speed_settings_test.rb +0 -67
- data/unittests/table_cell_using_xpath_test.rb +0 -34
- data/unittests/table_test.rb +0 -296
- data/unittests/table_xpath_test.rb +0 -109
- data/unittests/test_tests.rb +0 -9
- data/unittests/textarea_test.rb +0 -92
- data/unittests/textarea_xpath_test.rb +0 -77
- data/unittests/textfield_for_ch_char_test.rb +0 -32
- data/unittests/textfields_test.rb +0 -184
- data/unittests/textfields_xpath_test.rb +0 -110
- data/unittests/version_test.rb +0 -15
- data/unittests/win32ole_so_test.rb +0 -35
- data/unittests/window_tests.rb +0 -10
- data/unittests/windows/attach_to_existing_window_test.rb +0 -52
- data/unittests/windows/attach_to_new_window_test.rb +0 -74
- data/unittests/windows/close_window_test.rb +0 -20
- data/unittests/windows/frame_links_test.rb +0 -23
- data/unittests/windows/ie-each_test.rb +0 -46
- data/unittests/windows/modal_dialog_test.rb +0 -95
- data/unittests/windows/new_process_test.rb +0 -24
- data/unittests/windows/new_test.rb +0 -58
- data/unittests/windows/open_close_test.rb +0 -19
- data/unittests/windows/send_keys_test.rb +0 -26
- data/unittests/xpath_tests.rb +0 -11
- data/watir-rdoc.rb +0 -7
@@ -1,109 +0,0 @@
|
|
1
|
-
# feature tests for Tables
|
2
|
-
|
3
|
-
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
|
4
|
-
require 'unittests/setup'
|
5
|
-
|
6
|
-
class TC_Tables_XPath < Test::Unit::TestCase
|
7
|
-
include Watir::Exception
|
8
|
-
|
9
|
-
def setup
|
10
|
-
goto_page "table1.html"
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_Table_Exists
|
14
|
-
assert_false(browser.table(:xpath , "//table[@id='missingTable']/").exists? )
|
15
|
-
assert(browser.table(:xpath , "//table[@id='t1']/").exists? )
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_rows
|
19
|
-
assert_raises( UnknownObjectException ){ browser.table(:xpath , "//table[@id='missingTable']/").row_count }
|
20
|
-
assert_equal( 5 , browser.table(:xpath , "//table[@id='t1']/").row_count) # 4 rows and a header
|
21
|
-
end
|
22
|
-
|
23
|
-
def test_dynamic_tables
|
24
|
-
t = browser.table(:xpath , "//table[@id='t1']/")
|
25
|
-
assert_equal( 5, t.row_count)
|
26
|
-
|
27
|
-
browser.button(:xpath,"//input[@value='add row']/").click
|
28
|
-
assert_equal( 6, t.row_count)
|
29
|
-
end
|
30
|
-
|
31
|
-
def test_columns
|
32
|
-
assert_raises( UnknownObjectException ){ browser.table(:xpath , "//table[@id='missingTable']/").column_count }
|
33
|
-
assert_equal( 1 , browser.table(:xpath , "//table[@id='t1']/").column_count) # row one has 1 cell with a colspan of 2
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_links_and_images_in_table
|
37
|
-
table = browser.table(:xpath , "//table[@id='pic_table']/")
|
38
|
-
image = table[0][1].image(:index,0)
|
39
|
-
assert_equal("106", image.width)
|
40
|
-
|
41
|
-
link = table[0][3].link(:index,0)
|
42
|
-
assert_equal("Google", link.innerText)
|
43
|
-
end
|
44
|
-
|
45
|
-
def test_table_from_element
|
46
|
-
goto_page "simple_table_buttons.html"
|
47
|
-
|
48
|
-
button = browser.button(:xpath , "//input[@id='b1']/")
|
49
|
-
table = Watir::Table.create_from_element(browser,button)
|
50
|
-
|
51
|
-
table[1][0].button(:index,0).click
|
52
|
-
assert(browser.text_field(:name,"confirmtext").verify_contains(/CLICK2/i))
|
53
|
-
end
|
54
|
-
|
55
|
-
def test_cell_directly
|
56
|
-
|
57
|
-
assert( browser.cell(:xpath , "//td[@id='cell1']/").exists? )
|
58
|
-
assert_false( browser.cell(:xpath , "//td[@id='no_exist']/").exists? )
|
59
|
-
assert_equal( "Row 1 Col1", browser.cell(:xpath , "//td[@id='cell1']/").to_s.strip )
|
60
|
-
end
|
61
|
-
|
62
|
-
def test_row_directly
|
63
|
-
assert( browser.row(:xpath , "//tr[@id='row1']/").exists? )
|
64
|
-
assert_false( browser.row(:xpath , "//tr[@id='no_exist']/").exists? )
|
65
|
-
|
66
|
-
assert_equal('Row 2 Col1' , browser.row(:xpath , "//tr[@id='row1']/")[0].to_s.strip )
|
67
|
-
end
|
68
|
-
|
69
|
-
|
70
|
-
def test_table_body
|
71
|
-
assert_equal( 3, browser.table(:xpath , "//table[@id='body_test']/").bodies.length )
|
72
|
-
|
73
|
-
count = 1
|
74
|
-
browser.table(:xpath , "//table[@id='body_test']/").bodies.each do |n|
|
75
|
-
|
76
|
-
# do something better here!
|
77
|
-
# n.flash # this line commented out to speed up the test
|
78
|
-
|
79
|
-
case count
|
80
|
-
when 1
|
81
|
-
compare_text = "This text is in the FRST TBODY."
|
82
|
-
when 2
|
83
|
-
compare_text = "This text is in the SECOND TBODY."
|
84
|
-
when 3
|
85
|
-
compare_text = "This text is in the THIRD TBODY."
|
86
|
-
end
|
87
|
-
|
88
|
-
assert_equal( compare_text , n[0][0].to_s.strip ) # this is the 1st cell of the first row of this particular body
|
89
|
-
|
90
|
-
count +=1
|
91
|
-
end
|
92
|
-
assert_equal( count-1, browser.table(:xpath , "//table[@id='body_test']/").bodies.length )
|
93
|
-
|
94
|
-
assert_equal( "This text is in the THIRD TBODY." ,browser.table(:xpath , "//table[@id='body_test']/").body(:index,2)[0][0].to_s.strip )
|
95
|
-
|
96
|
-
# iterate through all the rows in a table body
|
97
|
-
count = 1
|
98
|
-
browser.table(:xpath , "//table[@id='body_test']/").body(:index,1).each do | row |
|
99
|
-
# row.flash # this line commented out, to speed up the tests
|
100
|
-
if count == 1
|
101
|
-
assert_equal('This text is in the SECOND TBODY.' , row[0].text.strip )
|
102
|
-
elsif count == 1
|
103
|
-
assert_equal('This text is also in the SECOND TBODY.' , row[0].text.strip )
|
104
|
-
end
|
105
|
-
count+=1
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
end
|
data/unittests/test_tests.rb
DELETED
data/unittests/textarea_test.rb
DELETED
@@ -1,92 +0,0 @@
|
|
1
|
-
# tests for textarea elements
|
2
|
-
|
3
|
-
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
|
4
|
-
require 'unittests/setup'
|
5
|
-
|
6
|
-
class TC_TextArea < Test::Unit::TestCase
|
7
|
-
include Watir::Exception
|
8
|
-
|
9
|
-
def setup
|
10
|
-
goto_page 'textarea.html'
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_elements_exist_or_not
|
14
|
-
assert(browser.text_field(:name,"txtMultiLine1").exists?)
|
15
|
-
assert(browser.text_field(:name,"txtMultiLine2").exists?)
|
16
|
-
assert(browser.text_field(:name,"txtMultiLine3").exists?)
|
17
|
-
assert(browser.text_field(:name,"txtReadOnly").exists?)
|
18
|
-
|
19
|
-
assert(browser.text_field(:id,"txtMultiLine1").exists?)
|
20
|
-
assert(browser.text_field(:id,"txtMultiLine2").exists?)
|
21
|
-
assert(browser.text_field(:id,"txtMultiLine3").exists?)
|
22
|
-
assert(browser.text_field(:id,"txtReadOnly").exists?)
|
23
|
-
|
24
|
-
assert_false(browser.text_field(:name, "missing").exists?)
|
25
|
-
assert_false(browser.text_field(:name,"txtMultiLine4").exists?)
|
26
|
-
end
|
27
|
-
|
28
|
-
def test_to_s_bug
|
29
|
-
# from a bug reported by Zeljko Filipin
|
30
|
-
assert_nothing_raised { browser.text_field(:id,"txtMultiLine3").to_s }
|
31
|
-
end
|
32
|
-
|
33
|
-
def test_maxlength_bug
|
34
|
-
# from another bug
|
35
|
-
assert_nothing_raised { browser.text_field(:id,"txtMultiLine3").append('foo')}
|
36
|
-
end
|
37
|
-
|
38
|
-
def test_readonly_and_enabled
|
39
|
-
assert_false(browser.text_field(:name, "txtMultiLine1").readonly? )
|
40
|
-
assert(browser.text_field(:name,"txtReadOnly").readonly?)
|
41
|
-
|
42
|
-
assert_false(browser.text_field(:name, "txtDisabled").enabled? )
|
43
|
-
assert(browser.text_field(:id, "txtMultiLine1").enabled? )
|
44
|
-
end
|
45
|
-
|
46
|
-
def test_verify_contains
|
47
|
-
t1 = browser.text_field(:name, "txtMultiLine1")
|
48
|
-
assert(t1.verify_contains("Hello World") )
|
49
|
-
assert(t1.verify_contains(/el/) )
|
50
|
-
assert(browser.text_field(:name, "txtMultiLine2").verify_contains(/IE/))
|
51
|
-
end
|
52
|
-
|
53
|
-
def test_no_such_element
|
54
|
-
assert_raises(UnknownObjectException) do
|
55
|
-
browser.text_field(:name, "NoName").verify_contains("de nada")
|
56
|
-
end
|
57
|
-
assert_raises(UnknownObjectException) do
|
58
|
-
browser.text_field(:id, "noID").verify_contains("de nada")
|
59
|
-
end
|
60
|
-
assert_raises(UnknownObjectException) do
|
61
|
-
browser.text_field(:name, "txtNone").append("de nada")
|
62
|
-
end
|
63
|
-
end
|
64
|
-
def test_readonly_and_disabled_errors
|
65
|
-
assert_raises(ObjectReadOnlyException) do
|
66
|
-
browser.text_field(:id, "txtReadOnly").append("de nada")
|
67
|
-
end
|
68
|
-
assert_raises(ObjectDisabledException) do
|
69
|
-
browser.text_field(:name, "txtDisabled").append("de nada")
|
70
|
-
end
|
71
|
-
assert_raises(ObjectReadOnlyException) do
|
72
|
-
browser.text_field(:id, "txtReadOnly").append("Some Text")
|
73
|
-
end
|
74
|
-
assert_raises(ObjectDisabledException) do
|
75
|
-
browser.text_field(:name, "txtDisabled").append("Some Text")
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
def test_append_set_and_clear
|
80
|
-
browser.text_field(:name, "txtMultiLine1").append(" Some Text")
|
81
|
-
assert_equal("Hello World Some Text",
|
82
|
-
browser.text_field(:name, "txtMultiLine1").value )
|
83
|
-
|
84
|
-
browser.text_field(:name, "txtMultiLine1").set("watir IE Controller")
|
85
|
-
assert_equal("watir IE Controller",
|
86
|
-
browser.text_field(:name, "txtMultiLine1").value )
|
87
|
-
|
88
|
-
browser.text_field(:name, "txtMultiLine2").clear
|
89
|
-
assert_equal("" , browser.text_field(:name, "txtMultiLine2").value )
|
90
|
-
end
|
91
|
-
|
92
|
-
end
|
@@ -1,77 +0,0 @@
|
|
1
|
-
# feature tests for TextArea Fields
|
2
|
-
|
3
|
-
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
|
4
|
-
require 'unittests/setup'
|
5
|
-
|
6
|
-
class TC_TextArea_XPath < Test::Unit::TestCase
|
7
|
-
include Watir::Exception
|
8
|
-
|
9
|
-
def setup
|
10
|
-
goto_page "textArea.html"
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_textarea_field_exists
|
14
|
-
#test for existance of 4 text area
|
15
|
-
assert(browser.text_field(:xpath , "//textarea[@name='txtMultiLine1']/").exists?)
|
16
|
-
assert(browser.text_field(:xpath , "//textarea[@name='txtMultiLine2']/").exists?)
|
17
|
-
assert(browser.text_field(:xpath , "//textarea[@name='txtMultiLine3']/").exists?)
|
18
|
-
assert(browser.text_field(:xpath , "//textarea[@name='txtReadOnly']/").exists?)
|
19
|
-
|
20
|
-
assert(browser.text_field(:xpath , "//textarea[@id='txtMultiLine1']/").exists?)
|
21
|
-
assert(browser.text_field(:xpath , "//textarea[@id='txtMultiLine2']/").exists?)
|
22
|
-
assert(browser.text_field(:xpath , "//textarea[@id='txtMultiLine3']/").exists?)
|
23
|
-
assert(browser.text_field(:xpath , "//textarea[@id='txtReadOnly']/").exists?)
|
24
|
-
#test for missing
|
25
|
-
assert_false(browser.text_field(:xpath , "//textarea[@name='missing']/").exists?)
|
26
|
-
assert_false(browser.text_field(:xpath , "//textarea[@name='txtMultiLine4']/").exists?)
|
27
|
-
end
|
28
|
-
|
29
|
-
def xtest_textarea_to_s
|
30
|
-
# bug reported by Zeljko Filipin
|
31
|
-
# assert_nothing_raised { browser.text_field(:xpath , "//textarea[@id='txtMultiLine3']/").to_s }
|
32
|
-
# The above assertion fails. No property or method called maxlength
|
33
|
-
end
|
34
|
-
|
35
|
-
def test_textarea_field
|
36
|
-
# test for read only method
|
37
|
-
assert_false(browser.text_field(:xpath , "//textarea[@name='txtMultiLine1']/").readonly? )
|
38
|
-
assert(browser.text_field(:xpath , "//textarea[@name='txtReadOnly']/").readonly?)
|
39
|
-
|
40
|
-
# test for enabled? method
|
41
|
-
assert_false(browser.text_field(:xpath , "//textarea[@name='txtDisabled']/").enabled? )
|
42
|
-
assert(browser.text_field(:xpath , "//textarea[@id='txtMultiLine1']/").enabled? )
|
43
|
-
|
44
|
-
|
45
|
-
t1 = browser.text_field(:xpath , "//textarea[@name='txtMultiLine1']/")
|
46
|
-
assert(t1.verify_contains("Hello World") )
|
47
|
-
assert(t1.verify_contains(/el/) )
|
48
|
-
t2 = browser.text_field(:xpath , "//textarea[@name='txtMultiLine2']/")
|
49
|
-
assert(t2.verify_contains(/IE/))
|
50
|
-
assert_raises(UnknownObjectException) { browser.text_field(:xpath , "//textarea[@name='NoName']/").verify_contains("No field to get a value of") }
|
51
|
-
assert_raises(UnknownObjectException) { browser.text_field(:xpath , "//textarea[@id='noID']/").verify_contains("No field to get a value of") }
|
52
|
-
|
53
|
-
assert_raises(UnknownObjectException , "ObjectReadOnlyException was supposed to be thrown" ) { browser.text_field(:xpath , "//textarea[@name='txtNone']/").append("Some Text") }
|
54
|
-
|
55
|
-
assert_raises(ObjectReadOnlyException , "ObjectReadOnlyException was supposed to be thrown" ) { browser.text_field(:xpath , "//textarea[@id='txtReadOnly']/").append("Some Text") }
|
56
|
-
assert_raises(ObjectDisabledException , "ObjectDisabledException was supposed to be thrown" ) { browser.text_field(:xpath , "//textarea[@name='txtDisabled']/").append("Some Text") }
|
57
|
-
assert_raises(UnknownObjectException , "UnknownObjectException was supposed to be thrown" ) { browser.text_field(:xpath , "//textarea[@name='missing_field']/").append("Some Text") }
|
58
|
-
|
59
|
-
browser.text_field(:xpath , "//textarea[@name='txtMultiLine1']/").append(" Some Text")
|
60
|
-
assert_equal( "Hello World Some Text" , browser.text_field(:xpath , "//textarea[@name='txtMultiLine1']/").value)
|
61
|
-
|
62
|
-
assert_raises(ObjectReadOnlyException , "ObjectReadOnlyException was supposed to be thrown" ) { browser.text_field(:xpath , "//textarea[@id='txtReadOnly']/").append("Some Text") }
|
63
|
-
assert_raises(ObjectDisabledException , "ObjectReadOnlyException was supposed to be thrown" ) { browser.text_field(:xpath , "//textarea[@name='txtDisabled']/").append("Some Text") }
|
64
|
-
assert_raises(UnknownObjectException , "ObjectReadOnlyException was supposed to be thrown" ) { browser.text_field(:xpath , "//textarea[@name='missing_field']/").append("Some Text") }
|
65
|
-
|
66
|
-
browser.text_field(:xpath , "//textarea[@name='txtMultiLine1']/").set("watir IE Controller")
|
67
|
-
assert_equal( "watir IE Controller" , browser.text_field(:xpath , "//textarea[@name='txtMultiLine1']/").value )
|
68
|
-
|
69
|
-
assert_raises(ObjectReadOnlyException , "ObjectReadOnlyException was supposed to be thrown" ) { browser.text_field(:xpath , "//textarea[@id='txtReadOnly']/").append("Some Text") }
|
70
|
-
assert_raises(ObjectDisabledException , "ObjectReadOnlyException was supposed to be thrown" ) { browser.text_field(:xpath , "//textarea[@name='txtDisabled']/").append("Some Text") }
|
71
|
-
assert_raises(UnknownObjectException , "ObjectReadOnlyException was supposed to be thrown" ) { browser.text_field(:xpath , "//textarea[@name='missing_field']/").append("Some Text") }
|
72
|
-
|
73
|
-
browser.text_field(:xpath , "//textarea[@name='txtMultiLine2']/").clear
|
74
|
-
assert_equal( "" , browser.text_field(:xpath , "//textarea[@name='txtMultiLine2']/").value )
|
75
|
-
end
|
76
|
-
|
77
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
|
4
|
-
require 'unittests/setup'
|
5
|
-
|
6
|
-
class TC_Fields_For_Chinese_Char < Test::Unit::TestCase
|
7
|
-
|
8
|
-
def setup()
|
9
|
-
goto_page "textfields1.html"
|
10
|
-
end
|
11
|
-
|
12
|
-
def test_chinese_char_should_be_appended_to_text_field
|
13
|
-
browser.text_field(:name, "text1").append(" ijij")
|
14
|
-
assert_equal( "Hello World ijij" , browser.text_field(:name, "text1").value )
|
15
|
-
end
|
16
|
-
|
17
|
-
def test_mixed_char_should_be_appended_to_text_field
|
18
|
-
browser.text_field(:name, "text1").append(" ijaija")
|
19
|
-
assert_equal( "Hello World ijaija" , browser.text_field(:name, "text1").value )
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_chinese_char_should_be_set_to_text_field
|
23
|
-
browser.text_field(:name, "text1").set("ijij")
|
24
|
-
assert_equal( "ijij" , browser.text_field(:name, "text1").value )
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_mixed_char_should_be_set_to_text_field
|
28
|
-
browser.text_field(:name, "text1").set("ijaija")
|
29
|
-
assert_equal( "ijaija" , browser.text_field(:name, "text1").value )
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|
@@ -1,184 +0,0 @@
|
|
1
|
-
# feature tests for Text Fields & Labels
|
2
|
-
|
3
|
-
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
|
4
|
-
require 'unittests/setup'
|
5
|
-
|
6
|
-
class TC_Fields < Test::Unit::TestCase
|
7
|
-
include Watir::Exception
|
8
|
-
|
9
|
-
def setup
|
10
|
-
goto_page "textfields1.html"
|
11
|
-
end
|
12
|
-
|
13
|
-
tag_method :test_text_field_exists, :fails_on_firefox
|
14
|
-
def test_text_field_exists
|
15
|
-
assert(browser.text_field(:name, "text1").exists?)
|
16
|
-
assert_false(browser.text_field(:name, "missing").exists?)
|
17
|
-
|
18
|
-
assert(browser.text_field(:id, "text2").exists?)
|
19
|
-
assert_false(browser.text_field(:id, "alsomissing").exists?)
|
20
|
-
|
21
|
-
assert(browser.text_field(:value, 'foo').exists?)
|
22
|
-
end
|
23
|
-
|
24
|
-
tag_method :test_text_field_dragContentsTo, :fails_on_firefox
|
25
|
-
def test_text_field_dragContentsTo
|
26
|
-
browser.text_field(:name, "text1").drag_contents_to(:id, "text2")
|
27
|
-
assert_equal(browser.text_field(:name, "text1").value, "")
|
28
|
-
assert_equal(browser.text_field(:id, "text2").value, "goodbye allHello World")
|
29
|
-
end
|
30
|
-
|
31
|
-
def test_text_field_verify_contains
|
32
|
-
assert(browser.text_field(:name, "text1").verify_contains("Hello World"))
|
33
|
-
assert(browser.text_field(:name, "text1").verify_contains(/Hello\sW/))
|
34
|
-
assert_false(browser.text_field(:name, "text1").verify_contains("Ruby"))
|
35
|
-
assert_false(browser.text_field(:name, "text1").verify_contains(/R/))
|
36
|
-
assert_raises(UnknownObjectException) { browser.text_field(:name, "NoName").verify_contains("No field to get a value of") }
|
37
|
-
|
38
|
-
assert(browser.text_field(:id, "text2").verify_contains("goodbye all") )
|
39
|
-
assert_raises(UnknownObjectException) { browser.text_field(:id, "noID").verify_contains("No field to get a value of") }
|
40
|
-
end
|
41
|
-
|
42
|
-
def test_text_field_enabled
|
43
|
-
assert_false(browser.text_field(:name, "disabled").enabled? )
|
44
|
-
assert(browser.text_field(:name, "text1").enabled? )
|
45
|
-
assert(browser.text_field(:id, "text2").enabled? )
|
46
|
-
end
|
47
|
-
|
48
|
-
def test_text_field_readonly
|
49
|
-
assert_false(browser.text_field(:name, "disabled").readonly? )
|
50
|
-
assert(browser.text_field(:name, "readOnly").readonly? )
|
51
|
-
assert(browser.text_field(:id, "readOnly2").readonly? )
|
52
|
-
end
|
53
|
-
|
54
|
-
def test_text_field_get_contents
|
55
|
-
assert_raises(UnknownObjectException) { browser.text_field(:name, "missing_field").append("Some Text") }
|
56
|
-
assert_equal("Hello World", browser.text_field(:name, "text1").value)
|
57
|
-
end
|
58
|
-
|
59
|
-
tag_method :test_text_field_append, :fails_on_firefox
|
60
|
-
def test_text_field_append
|
61
|
-
assert_raises(ObjectReadOnlyException) { browser.text_field(:id, "readOnly2").append("Some Text") }
|
62
|
-
assert_raises(ObjectDisabledException) { browser.text_field(:name, "disabled").append("Some Text") }
|
63
|
-
assert_raises(UnknownObjectException) { browser.text_field(:name, "missing_field").append("Some Text") }
|
64
|
-
|
65
|
-
browser.text_field(:name, "text1").append(" Some Text")
|
66
|
-
assert_equal("Hello World Some Text", browser.text_field(:name, "text1").value)
|
67
|
-
end
|
68
|
-
|
69
|
-
def test_text_field_clear
|
70
|
-
browser.text_field(:name, "text1").clear
|
71
|
-
assert_equal("", browser.text_field(:name, "text1").value)
|
72
|
-
end
|
73
|
-
|
74
|
-
def test_text_field_set
|
75
|
-
browser.text_field(:name, "text1").set("watir IE Controller")
|
76
|
-
assert_equal("watir IE Controller", browser.text_field(:name, "text1").value)
|
77
|
-
# adding for issue: http://jira.openqa.org/browse/WTR-89
|
78
|
-
browser.text_field(:name, /reGex/i).set("pass")
|
79
|
-
assert_equal("pass", browser.text_field(:name, /REgEx/i).value)
|
80
|
-
end
|
81
|
-
|
82
|
-
def test_text_field_properties
|
83
|
-
assert_raises(UnknownObjectException) { browser.text_field(:index, 199).value }
|
84
|
-
assert_raises(UnknownObjectException) { browser.text_field(:index, 199).name }
|
85
|
-
assert_raises(UnknownObjectException) { browser.text_field(:index, 199).id }
|
86
|
-
assert_raises(UnknownObjectException) { browser.text_field(:index, 199).disabled? }
|
87
|
-
assert_raises(UnknownObjectException) { browser.text_field(:index, 199).type }
|
88
|
-
|
89
|
-
assert_equal("Hello World" , browser.text_field(:index, 0).value)
|
90
|
-
assert_equal("text" , browser.text_field(:index, 0).type)
|
91
|
-
assert_equal("text1" , browser.text_field(:index, 0).name)
|
92
|
-
assert_equal("" , browser.text_field(:index, 0).id)
|
93
|
-
assert_equal(false , browser.text_field(:index, 0).disabled?)
|
94
|
-
|
95
|
-
assert_equal("" , browser.text_field(:index, 1).name)
|
96
|
-
assert_equal("text2" , browser.text_field(:index, 1).id)
|
97
|
-
|
98
|
-
assert(browser.text_field(:index, 3).disabled?)
|
99
|
-
|
100
|
-
assert_equal("This used to test :afterText", browser.text_field(:name, "aftertest").title)
|
101
|
-
assert_equal("", browser.text_field(:index, 0).title)
|
102
|
-
# adding for issue: http://jira.openqa.org/browse/WTR-89
|
103
|
-
assert_equal("RegEx test", browser.text_field(:name, /REgEx/i).value)
|
104
|
-
end
|
105
|
-
|
106
|
-
def test_text_field_iterators
|
107
|
-
assert_equal(14, browser.text_fields.length)
|
108
|
-
|
109
|
-
assert_equal("Hello World", browser.text_fields[0].value)
|
110
|
-
assert_equal("text1", browser.text_fields[0].name)
|
111
|
-
assert_equal("password", browser.text_fields[browser.text_fields.length - 1].type)
|
112
|
-
|
113
|
-
index = 0
|
114
|
-
browser.text_fields.each do |t|
|
115
|
-
assert_equal(browser.text_field(:index, index).value, t.value)
|
116
|
-
assert_equal(browser.text_field(:index, index).id, t.id)
|
117
|
-
assert_equal(browser.text_field(:index, index).name, t.name)
|
118
|
-
index += 1
|
119
|
-
end
|
120
|
-
assert_equal(index, browser.text_fields.length)
|
121
|
-
end
|
122
|
-
|
123
|
-
tag_method :test_JS_Events, :fails_on_firefox
|
124
|
-
def test_JS_Events
|
125
|
-
browser.text_field(:name, 'events_tester').requires_typing.set('p')
|
126
|
-
|
127
|
-
# the following line has an extra keypress at the begining, as we mimic the delete key being pressed
|
128
|
-
assert_equal( "keypresskeydownkeypresskeyup" , browser.text_field(:name, 'events_text').value.gsub(/(\r|\n)/ , "") )
|
129
|
-
browser.button(:value, "Clear Events Box").click
|
130
|
-
browser.text_field(:name, 'events_tester').requires_typing.set('ab')
|
131
|
-
|
132
|
-
# the following line has an extra keypress at the begining, as we mimic the delete key being pressed
|
133
|
-
assert_equal( "keypresskeydownkeypresskeyupkeydownkeypresskeyup", browser.text_field(:name , 'events_text').value.gsub(/(\r|\n)/ , "") )
|
134
|
-
end
|
135
|
-
|
136
|
-
def test_password
|
137
|
-
browser.text_field(:name, "password1").set("secret")
|
138
|
-
assert( 'secret' , browser.text_field(:name, "password1").value )
|
139
|
-
|
140
|
-
browser.text_field(:id, "password1").set("top_secret")
|
141
|
-
assert('top_secret', browser.text_field(:id, "password1").value )
|
142
|
-
end
|
143
|
-
|
144
|
-
def test_labels_iterator
|
145
|
-
assert_equal(3, browser.labels.length)
|
146
|
-
assert_equal('Label For this Field' , browser.labels[0].text.strip )
|
147
|
-
assert_equal('Password With ID ( the text here is a label for it )' , browser.labels[2].text )
|
148
|
-
|
149
|
-
count=0
|
150
|
-
browser.labels.each do |l|
|
151
|
-
count +=1
|
152
|
-
end
|
153
|
-
assert_equal(count, browser.labels.length)
|
154
|
-
end
|
155
|
-
|
156
|
-
def test_label_properties
|
157
|
-
assert_raises(UnknownObjectException) { browser.label(:index,20).text }
|
158
|
-
assert_raises(UnknownObjectException) { browser.label(:index,20).for }
|
159
|
-
assert_raises(UnknownObjectException) { browser.label(:index,20).id }
|
160
|
-
|
161
|
-
assert_false(browser.label(:index,10).exists?)
|
162
|
-
assert_false(browser.label(:id,'missing').exists?)
|
163
|
-
assert(browser.label(:index,0).exists?)
|
164
|
-
|
165
|
-
assert_equal("", browser.label(:index,0).id)
|
166
|
-
assert_false(browser.label(:index,0).disabled?)
|
167
|
-
assert(browser.label(:index,0).enabled?)
|
168
|
-
|
169
|
-
assert_equal("label2", browser.label(:index,1).id )
|
170
|
-
|
171
|
-
assert_equal("Password With ID ( the text here is a label for it )" , browser.label(:index,2).text)
|
172
|
-
assert_equal("password1", browser.label(:index,2).for)
|
173
|
-
end
|
174
|
-
|
175
|
-
def test_max_length_is_not_exceeded
|
176
|
-
browser.text_field(:name, 'text1').set("abcdefghijklmnopqrstuv")
|
177
|
-
assert_equal("abcdefghijklmnopqrst", browser.text_field(:name, 'text1').value )
|
178
|
-
end
|
179
|
-
|
180
|
-
def test_max_length
|
181
|
-
assert_equal(20, browser.text_field(:name, 'text1').maxlength)
|
182
|
-
end
|
183
|
-
|
184
|
-
end
|