watir-classic 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +721 -0
- data/LICENSE +34 -0
- data/README.rdoc +78 -0
- data/VERSION +1 -0
- data/bin/watir-console +5 -0
- data/lib/watir-classic.rb +14 -0
- data/lib/watir-classic/IEDialog/Release/IEDialog.dll +0 -0
- data/lib/watir-classic/assertions.rb +44 -0
- data/lib/watir-classic/browser.rb +149 -0
- data/lib/watir-classic/browsers.rb +7 -0
- data/lib/watir-classic/close_all.rb +31 -0
- data/lib/watir-classic/container.rb +110 -0
- data/lib/watir-classic/contrib/enabled_popup.rb +21 -0
- data/lib/watir-classic/contrib/ie-new-process.rb +27 -0
- data/lib/watir-classic/contrib/page_checker.rb +29 -0
- data/lib/watir-classic/cookies.rb +80 -0
- data/lib/watir-classic/core.rb +43 -0
- data/lib/watir-classic/dialogs/file_field.rb +34 -0
- data/lib/watir-classic/dialogs/javascript.rb +43 -0
- data/lib/watir-classic/drag_and_drop_helper.rb +68 -0
- data/lib/watir-classic/element.rb +438 -0
- data/lib/watir-classic/element_collection.rb +109 -0
- data/lib/watir-classic/element_extensions.rb +69 -0
- data/lib/watir-classic/exceptions.rb +50 -0
- data/lib/watir-classic/form.rb +96 -0
- data/lib/watir-classic/frame.rb +47 -0
- data/lib/watir-classic/ie-class.rb +767 -0
- data/lib/watir-classic/ie-process.rb +47 -0
- data/lib/watir-classic/ie.rb +20 -0
- data/lib/watir-classic/image.rb +111 -0
- data/lib/watir-classic/input_elements.rb +480 -0
- data/lib/watir-classic/irb-history.rb +31 -0
- data/lib/watir-classic/link.rb +46 -0
- data/lib/watir-classic/locator.rb +243 -0
- data/lib/watir-classic/logger.rb +19 -0
- data/lib/watir-classic/matches.rb +23 -0
- data/lib/watir-classic/modal_dialog.rb +72 -0
- data/lib/watir-classic/module.rb +12 -0
- data/lib/watir-classic/non_control_elements.rb +114 -0
- data/lib/watir-classic/options.rb +56 -0
- data/lib/watir-classic/page-container.rb +114 -0
- data/lib/watir-classic/process.rb +20 -0
- data/lib/watir-classic/screen_capture.rb +115 -0
- data/lib/watir-classic/supported_elements.rb +172 -0
- data/lib/watir-classic/table.rb +224 -0
- data/lib/watir-classic/testcase.rb +97 -0
- data/lib/watir-classic/util.rb +35 -0
- data/lib/watir-classic/version.rb +4 -0
- data/lib/watir-classic/wait.rb +41 -0
- data/lib/watir-classic/wait_helper.rb +12 -0
- data/lib/watir-classic/waiter.rb +98 -0
- data/lib/watir-classic/win32.rb +40 -0
- data/lib/watir-classic/win32ole.rb +16 -0
- data/lib/watir-classic/win32ole/1.8.7/win32ole.so +0 -0
- data/lib/watir-classic/win32ole/1.9.3/win32ole.so +0 -0
- data/lib/watir-classic/window.rb +68 -0
- data/lib/watir-classic/xpath_locator.rb +52 -0
- data/rakefile.rb +54 -0
- data/unittests/all_tests.rb +10 -0
- data/unittests/buttons_xpath_test.rb +68 -0
- data/unittests/checkbox_test.rb +163 -0
- data/unittests/checkbox_xpath_test.rb +106 -0
- data/unittests/click_no_wait_test.rb +23 -0
- data/unittests/close_all_test.rb +17 -0
- data/unittests/core_tests.rb +17 -0
- data/unittests/css_selector_test.rb +44 -0
- data/unittests/css_test.rb +38 -0
- data/unittests/dialog_test.rb +64 -0
- data/unittests/div2_xpath_test.rb +21 -0
- data/unittests/div_test.rb +170 -0
- data/unittests/div_xpath_test.rb +95 -0
- data/unittests/document_standards.rb +63 -0
- data/unittests/element_collection_indexes_test.rb +57 -0
- data/unittests/element_collections_test.rb +100 -0
- data/unittests/element_test.rb +47 -0
- data/unittests/errorchecker_test.rb +31 -0
- data/unittests/filefield_test.rb +43 -0
- data/unittests/filefield_xpath_test.rb +35 -0
- data/unittests/form_test.rb +282 -0
- data/unittests/form_xpath_test.rb +254 -0
- data/unittests/frame_test.rb +165 -0
- data/unittests/google_form_test.rb +15 -0
- data/unittests/html/JavascriptClick.html +39 -0
- data/unittests/html/blankpage.html +11 -0
- data/unittests/html/buttons1.html +40 -0
- data/unittests/html/checkboxes1.html +89 -0
- data/unittests/html/click_no_wait.html +14 -0
- data/unittests/html/complex_table.html +35 -0
- data/unittests/html/cssTest.html +42 -0
- data/unittests/html/depot_store.html +59 -0
- data/unittests/html/div.html +92 -0
- data/unittests/html/div_xml.html +21 -0
- data/unittests/html/fileupload.html +44 -0
- data/unittests/html/formTest1.html +38 -0
- data/unittests/html/forms2.html +44 -0
- data/unittests/html/forms3.html +131 -0
- data/unittests/html/forms4.html +26 -0
- data/unittests/html/frame_buttons.html +4 -0
- data/unittests/html/frame_links.html +4 -0
- data/unittests/html/frame_multi.html +5 -0
- data/unittests/html/google_india.html +119 -0
- data/unittests/html/ie7_document_standards.html +9 -0
- data/unittests/html/ie8_document_standards.html +9 -0
- data/unittests/html/ie9_document_standards.html +9 -0
- data/unittests/html/iframe.html +3 -0
- data/unittests/html/iframeTest.html +17 -0
- data/unittests/html/iframeTest1.html +7 -0
- data/unittests/html/iframeTest2.html +5 -0
- 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 +65 -0
- data/unittests/html/javascriptevents.html +33 -0
- data/unittests/html/link_pass.html +11 -0
- data/unittests/html/links1.html +37 -0
- data/unittests/html/links2.html +11 -0
- data/unittests/html/links_multi.html +12 -0
- data/unittests/html/list_matters.html +720 -0
- data/unittests/html/lists.html +18 -0
- data/unittests/html/map_test.html +30 -0
- data/unittests/html/modal_dialog.html +10 -0
- data/unittests/html/modal_dialog_launcher.html +12 -0
- data/unittests/html/multiple_specifiers.html +64 -0
- data/unittests/html/nestedFrames.html +6 -0
- data/unittests/html/new_browser.html +17 -0
- data/unittests/html/pass.html +13 -0
- data/unittests/html/popups1.html +59 -0
- data/unittests/html/pre.html +29 -0
- data/unittests/html/quirks_document_standards.html +8 -0
- data/unittests/html/radioButtons1.html +71 -0
- data/unittests/html/select_tealeaf.html +54 -0
- data/unittests/html/selectboxes1.html +52 -0
- data/unittests/html/simple_table.html +25 -0
- data/unittests/html/simple_table_buttons.html +104 -0
- data/unittests/html/simple_table_columns.html +75 -0
- data/unittests/html/table1.html +179 -0
- data/unittests/html/tableCell_using_xpath.html +19 -0
- data/unittests/html/table_and_tablerow_to_a.html +174 -0
- data/unittests/html/textarea.html +30 -0
- data/unittests/html/textfields1.html +100 -0
- data/unittests/html/textsearch.html +44 -0
- data/unittests/html/wallofcheckboxes.html +1003 -0
- data/unittests/html/xpath_nbsp.html +11 -0
- data/unittests/html/zeroindex.html +11 -0
- data/unittests/ie_exists_test.rb +16 -0
- data/unittests/ie_mock.rb +94 -0
- data/unittests/ie_test.rb +54 -0
- data/unittests/images_test.rb +156 -0
- data/unittests/images_xpath_test.rb +90 -0
- data/unittests/index_specifier_test.rb +31 -0
- data/unittests/js_events_test.rb +31 -0
- data/unittests/links_multi_test.rb +34 -0
- data/unittests/links_test.rb +131 -0
- data/unittests/links_xpath_test.rb +38 -0
- data/unittests/lists_test.rb +23 -0
- data/unittests/map_test.rb +98 -0
- data/unittests/minmax_test.rb +37 -0
- data/unittests/navigate_test.rb +38 -0
- data/unittests/nbsp_xpath_test.rb +16 -0
- data/unittests/no_wait_test.rb +28 -0
- data/unittests/non_core_tests.rb +12 -0
- data/unittests/other/all_tests_concurrent.rb +57 -0
- data/unittests/other/navigate_exception_test.rb +24 -0
- data/unittests/other/rexml_unit_test.rb +27 -0
- data/unittests/other/screen_capture_test.rb +53 -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 +102 -0
- data/unittests/pagecontainstext_test.rb +69 -0
- data/unittests/parent_child_test.rb +27 -0
- data/unittests/perf_test.rb +20 -0
- data/unittests/pre_test.rb +49 -0
- data/unittests/radios_test.rb +181 -0
- data/unittests/radios_xpath_test.rb +100 -0
- data/unittests/security_setting_test.rb +24 -0
- data/unittests/selectbox_test.rb +144 -0
- data/unittests/selectbox_xpath_test.rb +102 -0
- data/unittests/setup.rb +69 -0
- data/unittests/speed_settings_test.rb +67 -0
- data/unittests/table_cell_using_xpath_test.rb +34 -0
- data/unittests/table_test.rb +296 -0
- data/unittests/table_xpath_test.rb +109 -0
- data/unittests/test_tests.rb +9 -0
- data/unittests/textarea_test.rb +92 -0
- data/unittests/textarea_xpath_test.rb +77 -0
- data/unittests/textfield_for_ch_char_test.rb +32 -0
- data/unittests/textfields_test.rb +184 -0
- data/unittests/textfields_xpath_test.rb +110 -0
- data/unittests/version_test.rb +15 -0
- data/unittests/win32ole_so_test.rb +35 -0
- data/unittests/window_tests.rb +10 -0
- data/unittests/windows/attach_to_existing_window_test.rb +52 -0
- data/unittests/windows/attach_to_new_window_test.rb +74 -0
- data/unittests/windows/close_window_test.rb +20 -0
- data/unittests/windows/frame_links_test.rb +23 -0
- data/unittests/windows/ie-each_test.rb +46 -0
- data/unittests/windows/modal_dialog_test.rb +95 -0
- data/unittests/windows/new_process_test.rb +24 -0
- data/unittests/windows/new_test.rb +58 -0
- data/unittests/windows/open_close_test.rb +19 -0
- data/unittests/windows/send_keys_test.rb +26 -0
- data/unittests/xpath_tests.rb +11 -0
- data/watir-rdoc.rb +7 -0
- metadata +370 -0
@@ -0,0 +1,31 @@
|
|
1
|
+
# feature tests for JavaScript events
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
|
4
|
+
require 'unittests/setup'
|
5
|
+
|
6
|
+
class TC_JSEvents < Test::Unit::TestCase
|
7
|
+
def setup
|
8
|
+
goto_page "javascriptevents.html"
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_keyboard_event
|
12
|
+
browser.text_field(:index, 0).fire_event("onkeyup")
|
13
|
+
assert(browser.div(:id, 'event_name').text == 'onkeyup')
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_mouse_event
|
17
|
+
browser.text_field(:index, 0).fire_event("onmouseup")
|
18
|
+
assert(browser.div(:id, 'event_name').text == 'onmouseup')
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_html_event
|
22
|
+
browser.select_list(:index, 0).fire_event("onchange")
|
23
|
+
assert(browser.div(:id, 'event_name').text == 'onchange')
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_execute_script
|
27
|
+
assert_equal(browser.execute_script("2+2").to_i, 4)
|
28
|
+
assert_nil(browser.execute_script("null"))
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# feature tests for Links with multiple attributes
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
|
4
|
+
require 'unittests/setup'
|
5
|
+
|
6
|
+
class TC_Links_Multi < Test::Unit::TestCase
|
7
|
+
|
8
|
+
def setup
|
9
|
+
goto_page 'links_multi.html'
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_existing
|
13
|
+
assert_match(/not.html/, browser.link(:class, 'Papa').href)
|
14
|
+
assert_match(/mama.html/, browser.link(:text, 'click').href)
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_class_alias
|
18
|
+
assert_match(/not.html/, browser.link(:class_name, 'Papa').href)
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_hash_syntax
|
22
|
+
assert_match(/not.html/, browser.link(:class => 'Papa').href)
|
23
|
+
assert_match(/mama.html/, browser.link(:text => 'click').href)
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_class_and_text
|
27
|
+
assert_match(/papa.html/, browser.link(:class => 'Papa', :text => 'click').href)
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_class_and_index
|
31
|
+
assert_match(/papa.html/, browser.link(:class => 'Papa', :index => 1).href)
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
@@ -0,0 +1,131 @@
|
|
1
|
+
# feature tests for Links
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
|
4
|
+
require 'unittests/setup'
|
5
|
+
require 'cgi'
|
6
|
+
|
7
|
+
class TC_Links < Test::Unit::TestCase
|
8
|
+
include Watir::Exception
|
9
|
+
|
10
|
+
def setup
|
11
|
+
goto_page "links1.html"
|
12
|
+
end
|
13
|
+
|
14
|
+
tag_method :test_bad_attribute, :fails_on_firefox
|
15
|
+
def test_bad_attribute
|
16
|
+
browser.link(:bad_attribute, 199).click
|
17
|
+
fail "#click should have raised an Exception!"
|
18
|
+
rescue MissingWayOfFindingObjectException => e
|
19
|
+
assert_equal "bad_attribute is an unknown way of finding a <a> element (199)", e.to_s
|
20
|
+
end
|
21
|
+
|
22
|
+
def xtest_missing_links_dont_exist
|
23
|
+
assert_false(exists?{browser.link(:text, "missing")})
|
24
|
+
assert_false(exists?{browser.link(:text, /miss/)})
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_link_Exists
|
28
|
+
assert(browser.link(:text, "test1").exists?)
|
29
|
+
assert(browser.link(:text, /TEST/i).exists?)
|
30
|
+
assert_false(browser.link(:text, "missing").exists?)
|
31
|
+
assert_false(browser.link(:text, /miss/).exists?)
|
32
|
+
|
33
|
+
# this assert we have to build up the path
|
34
|
+
# this is what it looks like if you do a to_s on the link file:///C:/watir_bonus/unitTests/html/links1.HTML
|
35
|
+
# but what we get back from $htmlRoot is a mixed case, so its almost impossible for use to test this correctly
|
36
|
+
# assert(browser.link(:url,'file:///C:/watir_bonus/unitTests/html/links1.HTML' ).exists?)
|
37
|
+
|
38
|
+
assert(browser.link(:url, /link_pass.html/).exists?)
|
39
|
+
assert_false(browser.link(:url, "alsomissing.html").exists?)
|
40
|
+
|
41
|
+
assert(browser.link(:id, "link_id").exists?)
|
42
|
+
assert_false(browser.link(:id, "alsomissing").exists?)
|
43
|
+
|
44
|
+
assert(browser.link(:id, /_id/).exists?)
|
45
|
+
assert_false(browser.link(:id, /alsomissing/).exists?)
|
46
|
+
|
47
|
+
assert(browser.link(:title, /ti/).exists?)
|
48
|
+
assert(browser.link(:title, "link_title").exists?)
|
49
|
+
|
50
|
+
assert_false(browser.link(:title, /missing/).exists?)
|
51
|
+
|
52
|
+
assert(browser.link(:url, /_pass/).exists?)
|
53
|
+
assert_false(browser.link(:url, /dont_exist/).exists?)
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_link_click
|
57
|
+
browser.link(:text, "test1").click
|
58
|
+
assert( browser.text.include?("Links2-Pass") )
|
59
|
+
end
|
60
|
+
def test_link2_click
|
61
|
+
browser.link(:url, /link_pass.html/).click
|
62
|
+
assert( browser.text.include?("Links3-Pass") )
|
63
|
+
end
|
64
|
+
def test_link3_click
|
65
|
+
browser.link(:index, 0).click
|
66
|
+
assert( browser.text.include?("Links2-Pass") )
|
67
|
+
end
|
68
|
+
def test_link4_click
|
69
|
+
assert_raises(UnknownObjectException, "UnknownObjectException was supposed to be thrown" ) { browser.link(:index, 199).click }
|
70
|
+
end
|
71
|
+
|
72
|
+
def test_link_properties
|
73
|
+
assert_raises(UnknownObjectException) { browser.link(:index, 199).href }
|
74
|
+
assert_raises(UnknownObjectException) { browser.link(:index, 199).text }
|
75
|
+
assert_raises(UnknownObjectException) { browser.link(:index, 199).id }
|
76
|
+
assert_raises(UnknownObjectException) { browser.link(:index, 199).class_name }
|
77
|
+
|
78
|
+
assert_match(/links2/ ,browser.link(:index, 0).href )
|
79
|
+
assert_equal("test1" , browser.link(:index, 0).text )
|
80
|
+
assert_equal("" , browser.link(:index, 0).id )
|
81
|
+
assert_equal("" , browser.link(:index, 0).class_name)
|
82
|
+
assert_equal("link_class_1" , browser.link(:index, 1).class_name)
|
83
|
+
|
84
|
+
assert_equal("link_id" , browser.link(:index, 5).id )
|
85
|
+
|
86
|
+
assert_equal("" , browser.link(:index, 6).title)
|
87
|
+
|
88
|
+
assert_equal("link_title" , browser.link(:index, 7).title)
|
89
|
+
end
|
90
|
+
|
91
|
+
def test_link_iterator
|
92
|
+
assert_equal(9, browser.links.length )
|
93
|
+
assert_equal("Link Using a name" , browser.links[6].text)
|
94
|
+
|
95
|
+
index = 0
|
96
|
+
browser.links.each do |link|
|
97
|
+
assert_equal(browser.link(:index, index).href , link.href )
|
98
|
+
assert_equal(browser.link(:index, index).id , link.id )
|
99
|
+
assert_equal(browser.link(:index, index).text , link.text )
|
100
|
+
index+=1
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def test_div_xml_bug
|
105
|
+
goto_page "div_xml.html"
|
106
|
+
assert_nothing_raised {browser.link(:text, 'Create').exists? }
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
class TC_Frame_Links < Test::Unit::TestCase
|
111
|
+
include Watir::Exception
|
112
|
+
|
113
|
+
def setup
|
114
|
+
goto_page "frame_links.html"
|
115
|
+
end
|
116
|
+
|
117
|
+
def test_links_in_frames
|
118
|
+
assert(browser.frame(:name => "linkFrame").link(:text, "test1").exists?)
|
119
|
+
assert_false(browser.frame(:name => "linkFrame").link(:text, "missing").exists?)
|
120
|
+
|
121
|
+
assert_raises(UnknownObjectException, "UnknownObjectException was supposed to be thrown" ) { browser.frame(:name => "linkFrame").link(:index, 199).href }
|
122
|
+
assert_match(/links2/, browser.frame(:name => "linkFrame").link(:index, 0).href)
|
123
|
+
|
124
|
+
count =0
|
125
|
+
browser.frame(:name => "linkFrame").links.each do |l|
|
126
|
+
count+=1
|
127
|
+
end
|
128
|
+
|
129
|
+
assert_equal( 9 , count)
|
130
|
+
end
|
131
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# feature tests for Links
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
|
4
|
+
require 'unittests/setup'
|
5
|
+
|
6
|
+
class TC_Links_XPath < Test::Unit::TestCase
|
7
|
+
|
8
|
+
def setup
|
9
|
+
goto_page "links1.html"
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_link_exists
|
13
|
+
assert(browser.link(:xpath, "//a[contains(.,'test1')]/").exists?)
|
14
|
+
assert(browser.link(:xpath, "//a[contains(., /TEST/i)]/").exists?)
|
15
|
+
assert_false(browser.link(:xpath, "//a[contains(.,'missing')]/").exists?)
|
16
|
+
|
17
|
+
assert_false(browser.link(:xpath, "//a[@url='alsomissing.html']/").exists?)
|
18
|
+
|
19
|
+
assert(browser.link(:xpath, "//a[@id='link_id']/").exists?)
|
20
|
+
assert_false(browser.link(:xpath, "//a[@id='alsomissing']/").exists?)
|
21
|
+
|
22
|
+
assert(browser.link(:xpath, "//a[@name='link_name']/").exists?)
|
23
|
+
assert_false(browser.link(:xpath, "//a[@name='alsomissing']/").exists?)
|
24
|
+
assert(browser.link(:xpath, "//a[@title='link_title']/").exists?)
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_link_click
|
28
|
+
browser.link(:xpath, "//a[contains(.,'test1')]/").click
|
29
|
+
assert(browser.text.include?("Links2-Pass"))
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_link_with_text_call
|
33
|
+
browser.link(:xpath, "//a[text()='test1']").click
|
34
|
+
assert(browser.text.include?("Links2-Pass"))
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
|
2
|
+
require 'unittests/setup'
|
3
|
+
|
4
|
+
class Lists_Tests < Watir::TestCase
|
5
|
+
|
6
|
+
def setup
|
7
|
+
goto_page 'lists.html'
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_list_items_exist
|
11
|
+
assert(browser.li(:id, 'list1').exists?)
|
12
|
+
assert(browser.li(:id, 'list2').exists?)
|
13
|
+
assert(browser.li(:id, 'list3').exists?)
|
14
|
+
assert(browser.li(:id, 'ordered1').exists?)
|
15
|
+
assert_equal('Coffee', browser.li(:index, 0).text)
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_li_length
|
19
|
+
assert_equal(6, browser.lis.length)
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
@@ -0,0 +1,98 @@
|
|
1
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
|
2
|
+
require 'unittests/setup'
|
3
|
+
|
4
|
+
class Map_Tests < Watir::TestCase
|
5
|
+
|
6
|
+
def setup
|
7
|
+
goto_page 'map_test.html'
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_01
|
11
|
+
assert_contains_text "Test Page for Map Tests"
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_map_exists_by_name
|
15
|
+
assert(browser.map(:name, 'maptest01').exists?)
|
16
|
+
assert ! (browser.map(:name, 'maptest03').exists?)
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_map_exists_by_id
|
20
|
+
assert(browser.map(:id, 'maptestid01').exists?)
|
21
|
+
assert ! (browser.map(:id, 'maptestid03').exists?)
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_map_area_exists_by_href
|
25
|
+
assert(browser.area(:url, /pass.html/).exists?)
|
26
|
+
assert(browser.area(:url, /simple_table_buttons.html/).exists?)
|
27
|
+
assert(browser.area(:url, /images1.html/).exists?)
|
28
|
+
assert ! (browser.area(:url, /blobs.html/).exists?)
|
29
|
+
assert(browser.map(:name, 'maptest01').area(:url, /pass.html/).exists?)
|
30
|
+
assert(browser.map(:id, 'maptestid01').area(:url, /images1.html/).exists?)
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_map_area_exists_by_alt
|
34
|
+
assert(browser.area(:alt, 'Pass').exists?)
|
35
|
+
assert(browser.area(:alt, 'Table Buttons').exists?)
|
36
|
+
assert(browser.area(:alt, 'Images').exists?)
|
37
|
+
assert ! (browser.area(:alt, 'Blobs').exists?)
|
38
|
+
assert(browser.map(:name, 'maptest01').area(:alt, 'Pass').exists?)
|
39
|
+
assert(browser.map(:id, 'maptestid01').area(:alt, 'Table Buttons').exists?)
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_map_area_click
|
43
|
+
browser.area(:alt, 'Table Buttons').click
|
44
|
+
assert_contains_text "This table has 3 images"
|
45
|
+
browser.back
|
46
|
+
assert_contains_text "Test Page for Map Tests"
|
47
|
+
browser.area(:alt, 'Pass').click
|
48
|
+
assert_contains_text "PASS"
|
49
|
+
browser.back
|
50
|
+
assert_contains_text "Test Page for Map Tests"
|
51
|
+
browser.area(:alt, 'Images').click
|
52
|
+
assert_contains_text "The triangle only has"
|
53
|
+
browser.back
|
54
|
+
assert_contains_text "Test Page for Map Tests"
|
55
|
+
browser.area(:url, /simple_table_buttons.html/).click
|
56
|
+
assert_contains_text "This table has 3 images"
|
57
|
+
browser.back
|
58
|
+
assert_contains_text "Test Page for Map Tests"
|
59
|
+
browser.area(:url, /pass.html/).click
|
60
|
+
assert_contains_text "PASS"
|
61
|
+
browser.back
|
62
|
+
assert_contains_text "Test Page for Map Tests"
|
63
|
+
browser.area(:url, /images1.html/).click
|
64
|
+
assert_contains_text "The triangle only has"
|
65
|
+
browser.back
|
66
|
+
assert_contains_text "Test Page for Map Tests"
|
67
|
+
browser.map(:name, 'maptest01').area(:alt, 'Table Buttons').click
|
68
|
+
assert_contains_text "This table has 3 images"
|
69
|
+
browser.back
|
70
|
+
assert_contains_text "Test Page for Map Tests"
|
71
|
+
browser.map(:id, 'maptestid01').area(:alt, 'Pass').click
|
72
|
+
assert_contains_text "PASS"
|
73
|
+
browser.back
|
74
|
+
assert_contains_text "Test Page for Map Tests"
|
75
|
+
browser.map(:name, 'maptest01').area(:url, /pass.html/).click
|
76
|
+
assert_contains_text "PASS"
|
77
|
+
browser.back
|
78
|
+
assert_contains_text "Test Page for Map Tests"
|
79
|
+
browser.map(:id, 'maptestid01').area(:url, /images1.html/).click
|
80
|
+
assert_contains_text "The triangle only has"
|
81
|
+
browser.back
|
82
|
+
assert_contains_text "Test Page for Map Tests"
|
83
|
+
end
|
84
|
+
|
85
|
+
def test_maps
|
86
|
+
assert_equal(2, browser.maps.length)
|
87
|
+
end
|
88
|
+
|
89
|
+
def test_areas
|
90
|
+
assert_equal(3, browser.map(:index, 1).areas.length)
|
91
|
+
end
|
92
|
+
|
93
|
+
def assert_contains_text text
|
94
|
+
assert(browser.contains_text(text))
|
95
|
+
end
|
96
|
+
|
97
|
+
end # class Map_Tests
|
98
|
+
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# feature tests for minimizing and maximizing IE windows
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
|
4
|
+
require 'unittests/setup'
|
5
|
+
|
6
|
+
class TC_MinMax< Test::Unit::TestCase
|
7
|
+
tags :must_be_visible
|
8
|
+
def setup
|
9
|
+
goto_page 'pass.html'
|
10
|
+
end
|
11
|
+
def teardown
|
12
|
+
browser.restore
|
13
|
+
end
|
14
|
+
def test_minimimum
|
15
|
+
browser.minimize
|
16
|
+
assert browser.minimized?
|
17
|
+
end
|
18
|
+
def test_maximum
|
19
|
+
browser.maximize
|
20
|
+
assert !browser.minimized?
|
21
|
+
end
|
22
|
+
def test_activate
|
23
|
+
browser.activate
|
24
|
+
assert browser.active?
|
25
|
+
begin
|
26
|
+
new_browser = Watir::IE.start($htmlRoot + 'blankpage.html')
|
27
|
+
assert new_browser.active?
|
28
|
+
assert !browser.active?
|
29
|
+
browser.activate
|
30
|
+
browser.activate # bug in rautomation? It's in front just not activated
|
31
|
+
assert browser.active?
|
32
|
+
ensure
|
33
|
+
new_browser.close
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# feature tests for navigation
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
|
4
|
+
require 'unittests/setup'
|
5
|
+
require 'cgi'
|
6
|
+
|
7
|
+
class TC_Navigate < Test::Unit::TestCase
|
8
|
+
tags :fails_on_firefox
|
9
|
+
def test_navigation
|
10
|
+
browser.clear_url_list
|
11
|
+
goto_page 'buttons1.html'
|
12
|
+
assert_equal(($htmlRoot + 'buttons1.html').gsub(" ","%20").downcase, browser.url.downcase)
|
13
|
+
|
14
|
+
assert_equal(1, browser.url_list.length)
|
15
|
+
assert_equal(browser.url, browser.url_list[0])
|
16
|
+
|
17
|
+
goto_page 'checkboxes1.html'
|
18
|
+
assert_equal("Test page for Check Boxes", browser.title)
|
19
|
+
|
20
|
+
assert_equal(2, browser.url_list.length)
|
21
|
+
assert_equal(browser.url, browser.url_list[1])
|
22
|
+
|
23
|
+
browser.clear_url_list
|
24
|
+
assert_equal(0, browser.url_list.length )
|
25
|
+
|
26
|
+
browser.back
|
27
|
+
assert_equal("Test page for buttons", browser.title)
|
28
|
+
|
29
|
+
browser.forward
|
30
|
+
assert_equal("Test page for Check Boxes", browser.title)
|
31
|
+
browser.checkbox(:name, "box1").set
|
32
|
+
assert(browser.checkbox(:name, "box1").set?)
|
33
|
+
|
34
|
+
browser.refresh
|
35
|
+
# Not sure how we test this. Text fields and checkboxes dont get reset if you click the browser refresh button
|
36
|
+
# -- this could be tested with the add-row page.
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,16 @@
|
|
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_Nbsp_Xpath < Test::Unit::TestCase
|
7
|
+
|
8
|
+
def setup
|
9
|
+
goto_page "xpath_nbsp.html"
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_nbsp
|
13
|
+
div = browser.element(:xpath,"//div")
|
14
|
+
assert(div.innerText, "Hello world")
|
15
|
+
end
|
16
|
+
end
|