watir 1.9.0 → 1.9.1.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +5 -1
- data/VERSION +1 -1
- data/lib/watir/element.rb +16 -13
- data/lib/watir/form.rb +2 -1
- data/lib/watir/ie-class.rb +6 -1
- data/lib/watir/locator.rb +1 -1
- data/unittests/css_selector_test.rb +1 -1
- data/unittests/defer_test.rb +3 -2
- data/unittests/filefield_test.rb +2 -1
- data/unittests/form_test.rb +14 -9
- data/unittests/form_xpath_test.rb +8 -5
- data/unittests/frame_test.rb +115 -115
- data/unittests/html/JavascriptClick.html +1 -1
- data/unittests/html/blankpage.html +1 -1
- data/unittests/html/buttons1.html +1 -1
- data/unittests/html/checkboxes1.html +1 -1
- data/unittests/html/click_no_wait.html +1 -1
- data/unittests/html/complex_table.html +1 -1
- data/unittests/html/cssTest.html +1 -1
- data/unittests/html/depot_store.html +1 -1
- data/unittests/html/div.html +1 -1
- data/unittests/html/div_xml.html +1 -1
- data/unittests/html/fileupload.html +1 -1
- data/unittests/html/formTest1.html +1 -1
- data/unittests/html/forms2.html +1 -1
- data/unittests/html/forms3.html +1 -1
- data/unittests/html/forms4.html +1 -1
- data/unittests/html/google_india.html +1 -1
- data/unittests/html/iframeTest.html +11 -7
- data/unittests/html/iframeTest1.html +1 -1
- data/unittests/html/iframeTest2.html +1 -2
- data/unittests/html/images1.html +1 -1
- data/unittests/html/javascriptevents.html +20 -22
- data/unittests/html/link_pass.html +1 -1
- data/unittests/html/links1.html +1 -1
- data/unittests/html/links2.html +1 -1
- data/unittests/html/links_multi.html +1 -1
- data/unittests/html/list_matters.html +1 -1
- data/unittests/html/lists.html +1 -1
- data/unittests/html/map_test.html +1 -1
- data/unittests/html/modal_dialog.html +1 -1
- data/unittests/html/modal_dialog_launcher.html +1 -1
- data/unittests/html/nestedFrames.html +1 -1
- data/unittests/html/new_browser.html +1 -1
- data/unittests/html/pass.html +1 -1
- data/unittests/html/popups1.html +1 -1
- data/unittests/html/pre.html +2 -1
- data/unittests/html/radioButtons1.html +1 -1
- data/unittests/html/select_tealeaf.html +1 -1
- data/unittests/html/selectboxes1.html +2 -2
- data/unittests/html/simple_table.html +1 -1
- data/unittests/html/simple_table_buttons.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 +1 -1
- data/unittests/html/table_and_tablerow_to_a.html +1 -1
- data/unittests/html/textarea.html +1 -1
- data/unittests/html/textfields1.html +1 -1
- data/unittests/html/textsearch.html +1 -1
- data/unittests/html/wallofcheckboxes.html +1 -1
- data/unittests/html/xpath_nbsp.html +1 -1
- data/unittests/js_events_test.rb +26 -0
- data/unittests/no_wait_test.rb +2 -2
- data/unittests/pre_test.rb +1 -1
- data/unittests/selectbox_xpath_test.rb +8 -3
- data/unittests/table_test.rb +1 -1
- data/unittests/textfields_test.rb +2 -2
- data/unittests/textfields_xpath_test.rb +2 -2
- metadata +24 -18
- data/unittests/html/ie_9.html +0 -6
- data/unittests/ie9_test.rb +0 -16
- data/unittests/windows/js_events_test.rb +0 -41
data/CHANGES
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.9.
|
1
|
+
1.9.1.rc1
|
data/lib/watir/element.rb
CHANGED
@@ -125,6 +125,13 @@ module Watir
|
|
125
125
|
return ole_object.innerText.strip
|
126
126
|
end
|
127
127
|
|
128
|
+
# IE9 only returns empty string for ole_object.name for non-input elements
|
129
|
+
# so get at it through the attribute which will make the matchers work
|
130
|
+
def name
|
131
|
+
assert_exists
|
132
|
+
ole_object.getAttribute('name') || ''
|
133
|
+
end
|
134
|
+
|
128
135
|
def ole_inner_elements
|
129
136
|
assert_exists
|
130
137
|
return ole_object.all
|
@@ -345,25 +352,21 @@ module Watir
|
|
345
352
|
event_type = 'HTMLEvents'
|
346
353
|
event_args = [event, true, true]
|
347
354
|
when 'keydown', 'keypress', 'keyup'
|
348
|
-
event_name = :
|
349
|
-
event_type = '
|
355
|
+
event_name = :initKeyboardEvent
|
356
|
+
event_type = 'KeyboardEvent'
|
350
357
|
# 'type', bubbles, cancelable, windowObject, ctrlKey, altKey, shiftKey, metaKey, keyCode, charCode
|
351
|
-
event_args = [event, true, true, @container.page_container.document.parentWindow, false, false, false, false, 0, 0]
|
352
|
-
when 'click', 'dblclick', 'mousedown', 'mousemove', 'mouseout', 'mouseover',
|
353
|
-
|
358
|
+
event_args = [event, true, true, @container.page_container.document.parentWindow.window, false, false, false, false, 0, 0]
|
359
|
+
when 'click', 'dblclick', 'mousedown', 'mousemove', 'mouseout', 'mouseover', 'mouseup',
|
360
|
+
'contextmenu', 'drag', 'dragstart', 'dragenter', 'dragover', 'dragleave', 'dragend', 'drop', 'selectstart'
|
354
361
|
event_name = :initMouseEvent
|
355
362
|
event_type = 'MouseEvents'
|
356
363
|
# 'type', bubbles, cancelable, windowObject, detail, screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, metaKey, button, relatedTarget
|
357
|
-
event_args = [event, true, true, @container.page_container.document.parentWindow, 1, 0, 0, 0, 0, false, false, false, false, 0,
|
364
|
+
event_args = [event, true, true, @container.page_container.document.parentWindow.window, 1, 0, 0, 0, 0, false, false, false, false, 0, @container.page_container.document]
|
358
365
|
else
|
359
|
-
|
360
|
-
dom_event_init = "initEvents(\"#{event}\", true, true)"
|
361
|
-
event_name = :initEvents
|
362
|
-
event_type = 'HTMLEvents'
|
363
|
-
event_args = [true, true]
|
366
|
+
raise UnhandledEventException, "Don't know how to trigger event '#{event}'"
|
364
367
|
end
|
365
|
-
|
366
|
-
|
368
|
+
event = @container.page_container.document.createEvent(event_type)
|
369
|
+
event.send event_name, *event_args
|
367
370
|
event
|
368
371
|
end
|
369
372
|
|
data/lib/watir/form.rb
CHANGED
data/lib/watir/ie-class.rb
CHANGED
@@ -884,7 +884,12 @@ module Watir
|
|
884
884
|
end
|
885
885
|
rescue
|
886
886
|
#handling text nodes
|
887
|
-
|
887
|
+
if element.toString(0) == '[object Text]' #IE9 has a different method for getting text
|
888
|
+
element_text = element.wholeText
|
889
|
+
else
|
890
|
+
element_text = element.toString(0)
|
891
|
+
end
|
892
|
+
htmlString += xml_escape(element_text)
|
888
893
|
return htmlString
|
889
894
|
end
|
890
895
|
#puts tagName
|
data/lib/watir/locator.rb
CHANGED
@@ -194,7 +194,7 @@ module Watir
|
|
194
194
|
@specifiers[:index] == 1 && @specifiers.length == 2
|
195
195
|
@element = @document.getElementById(the_id) rescue nil
|
196
196
|
# Return if our fast match really HAS a matching :id
|
197
|
-
return true if @element && @element.invoke('id') == the_id
|
197
|
+
return true if @element && @element.invoke('id') == the_id && @types.include?(@element.getAttribute('type'))
|
198
198
|
end
|
199
199
|
|
200
200
|
the_name = @specifiers[:name]
|
@@ -34,7 +34,7 @@ if Watir::Browser.default == 'ie'
|
|
34
34
|
|
35
35
|
def test_form
|
36
36
|
goto_page "forms2.html"
|
37
|
-
|
37
|
+
assert(browser.form(:css, "#f2").action =~ /pass2.html$/)
|
38
38
|
assert_equal(browser.button(:css, "form #b2").value, "Click Me")
|
39
39
|
end
|
40
40
|
|
data/unittests/defer_test.rb
CHANGED
@@ -8,7 +8,7 @@ class TC_Defer < Test::Unit::TestCase
|
|
8
8
|
@new_browser.close if defined?(@new_browser)
|
9
9
|
browser.goto('about:blank')
|
10
10
|
end
|
11
|
-
tag_method :test_binding_to_newly_loaded_page, :fails_on_firefox, :attach
|
11
|
+
tag_method :test_binding_to_newly_loaded_page, :fails_on_firefox, :fails_on_ie, :attach
|
12
12
|
def test_binding_to_newly_loaded_page
|
13
13
|
@new_browser = Watir::Browser.new
|
14
14
|
text_field = @new_browser.text_field(:name, 'text1')
|
@@ -19,6 +19,7 @@ class TC_Defer < Test::Unit::TestCase
|
|
19
19
|
assert_equal('Clear Events Box', button.value)
|
20
20
|
assert_equal('Div Text', div.text)
|
21
21
|
end
|
22
|
+
tag_method :test_binding_to_refreshed_page, :fails_on_ie
|
22
23
|
def test_binding_to_refreshed_page
|
23
24
|
goto_page "textfields1.html"
|
24
25
|
text_field = browser.text_field(:name, 'text1')
|
@@ -30,7 +31,7 @@ class TC_Defer < Test::Unit::TestCase
|
|
30
31
|
assert_equal('Clear Events Box', button.value)
|
31
32
|
assert_equal('Div Text', div.text)
|
32
33
|
end
|
33
|
-
tag_method :test_exists, :fails_on_firefox, :attach
|
34
|
+
tag_method :test_exists, :fails_on_firefox, :fails_on_ie, :attach
|
34
35
|
def test_exists
|
35
36
|
@new_browser = Watir::Browser.new
|
36
37
|
text_field = @new_browser.text_field(:name, 'text1')
|
data/unittests/filefield_test.rb
CHANGED
@@ -24,7 +24,8 @@ class TC_FileField < Test::Unit::TestCase
|
|
24
24
|
file = $htmlRoot + "fileupload.html"
|
25
25
|
file.gsub! 'file:///', ''
|
26
26
|
file.gsub! '/', '\\'
|
27
|
-
browser.file_field(:name,"file1").set(file)
|
27
|
+
browser.file_field(:name,"file1").set(file)
|
28
|
+
Watir::Wait.until {browser.file_field(:name,"file1").value!= ''}
|
28
29
|
assert_equal file, browser.file_field(:name,"file1").value
|
29
30
|
|
30
31
|
# click the upload button
|
data/unittests/form_test.rb
CHANGED
@@ -24,7 +24,7 @@ class TC_Forms2 < Test::Unit::TestCase # Note: there is no TC_Forms1
|
|
24
24
|
assert(browser.form(:id, 'f2').exists?)
|
25
25
|
assert_false(browser.form(:id, 'missing').exists?)
|
26
26
|
|
27
|
-
assert(browser.form(:action,
|
27
|
+
assert(browser.form(:action, /pass.html/).exists?)
|
28
28
|
assert_false(browser.form(:action, "missing").exists?)
|
29
29
|
end
|
30
30
|
|
@@ -47,10 +47,12 @@ class TC_Forms2 < Test::Unit::TestCase # Note: there is no TC_Forms1
|
|
47
47
|
expected = "\r\n<FORM id=f2 name=test2 action=pass2.html method=get><BR><INPUT type=submit value=Submit> </FORM>"
|
48
48
|
actual = browser.form(:name, 'test2').html
|
49
49
|
actual.sub!('style=""','') # ie9 adds in a style tag so just strip it out
|
50
|
-
|
50
|
+
#ie9 also has som additional formatting so remove that too
|
51
|
+
actual.gsub!('"','')
|
52
|
+
actual.gsub!(/\n/,'')
|
51
53
|
# ignore attributes order by sorting them
|
52
54
|
sorted_expected, sorted_actual = [expected, actual].map! do |html|
|
53
|
-
html.strip.downcase.scan(%r{<form (.*)><br><(.*)
|
55
|
+
html.strip.downcase.scan(%r{<form (.*)><br><(.*)>\s*</form>}).flatten.
|
54
56
|
map {|part| part.split(" ").sort.join(" ")}.join("><br><")
|
55
57
|
end
|
56
58
|
assert_not_equal("", sorted_expected)
|
@@ -76,7 +78,7 @@ class TC_Forms_Collection < Test::Unit::TestCase
|
|
76
78
|
def test_forms_collection
|
77
79
|
forms = browser.forms
|
78
80
|
assert_equal(4, forms.length)
|
79
|
-
|
81
|
+
assert(forms.first.action =~ /pass.html$/)
|
80
82
|
assert_equal('test2', forms.last.name)
|
81
83
|
end
|
82
84
|
end
|
@@ -86,10 +88,10 @@ class TC_Form_Display < Test::Unit::TestCase
|
|
86
88
|
def test_showforms
|
87
89
|
goto_page "forms2.html"
|
88
90
|
actual = capture_stdout { browser.showForms }
|
89
|
-
|
91
|
+
expected = <<END_OF_MESSAGE
|
90
92
|
There are 4 forms
|
91
|
-
Form name:
|
92
|
-
id:
|
93
|
+
Form name:
|
94
|
+
id:
|
93
95
|
method: get
|
94
96
|
action: pass.html
|
95
97
|
Form name: test2
|
@@ -97,14 +99,17 @@ Form name: test2
|
|
97
99
|
method: get
|
98
100
|
action: pass2.html
|
99
101
|
Form name: test3
|
100
|
-
id:
|
102
|
+
id:
|
101
103
|
method: get
|
102
104
|
action: pass2.html
|
103
105
|
Form name: test2
|
104
|
-
id:
|
106
|
+
id:
|
105
107
|
method: get
|
106
108
|
action: pass2.html
|
107
109
|
END_OF_MESSAGE
|
110
|
+
actual.gsub!(/(action: )file:.*\/(.*)$/,'\\1\\2') if actual =~ /file:/
|
111
|
+
actual.gsub!(/\s+\n/,"\n")
|
112
|
+
assert_equal(expected, actual)
|
108
113
|
end
|
109
114
|
end
|
110
115
|
|
@@ -30,10 +30,10 @@ class TC_Form_Display_XPath < Test::Unit::TestCase
|
|
30
30
|
goto_page "forms2.html"
|
31
31
|
|
32
32
|
actual = capture_stdout { browser.show_forms }
|
33
|
-
|
33
|
+
expected = <<END_OF_MESSAGE
|
34
34
|
There are 4 forms
|
35
|
-
Form name:
|
36
|
-
id:
|
35
|
+
Form name:
|
36
|
+
id:
|
37
37
|
method: get
|
38
38
|
action: pass.html
|
39
39
|
Form name: test2
|
@@ -41,14 +41,17 @@ Form name: test2
|
|
41
41
|
method: get
|
42
42
|
action: pass2.html
|
43
43
|
Form name: test3
|
44
|
-
id:
|
44
|
+
id:
|
45
45
|
method: get
|
46
46
|
action: pass2.html
|
47
47
|
Form name: test2
|
48
|
-
id:
|
48
|
+
id:
|
49
49
|
method: get
|
50
50
|
action: pass2.html
|
51
51
|
END_OF_MESSAGE
|
52
|
+
actual.gsub!(/(action: )file:.*\/(.*)$/,'\\1\\2') if actual =~ /file:/
|
53
|
+
actual.gsub!(/\s+\n/,"\n")
|
54
|
+
assert_equal(expected, actual)
|
52
55
|
end
|
53
56
|
end
|
54
57
|
|
data/unittests/frame_test.rb
CHANGED
@@ -3,121 +3,121 @@
|
|
3
3
|
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
|
4
4
|
require 'unittests/setup'
|
5
5
|
|
6
|
-
class TC_Frames < Test::Unit::TestCase
|
7
|
-
include Watir::Exception
|
8
|
-
|
9
|
-
def setup
|
10
|
-
goto_page "frame_buttons.html"
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_frame_no_what
|
14
|
-
assert_raises(UnknownObjectException) { browser.frame("missingFrame").button(:id, "b2").enabled? }
|
15
|
-
assert_raises(UnknownObjectException) { browser.frame("buttonFrame2").button(:id, "b2").enabled? }
|
16
|
-
assert(browser.frame("buttonFrame").button(:id, "b2").enabled?)
|
17
|
-
assert_false(browser.frame("buttonFrame").button(:caption, "Disabled Button").enabled?)
|
18
|
-
end
|
19
|
-
|
20
|
-
def test_frame_using_name
|
21
|
-
assert_raises(UnknownObjectException) { browser.frame(:name, "missingFrame").button(:id, "b2").enabled? }
|
22
|
-
assert_raises(UnknownObjectException) { browser.frame(:name, "buttonFrame2").button(:id, "b2").enabled? }
|
23
|
-
assert(browser.frame(:name, "buttonFrame").button(:id, "b2").enabled?)
|
24
|
-
assert_false(browser.frame(:name, "buttonFrame").button(:caption, "Disabled Button").enabled?)
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_frame_using_name_and_regexp
|
28
|
-
assert_raises(UnknownObjectException) { browser.frame(:name, /missingFrame/).button(:id, "b2").enabled? }
|
29
|
-
assert(browser.frame(:name, /button/).button(:id, "b2").enabled?)
|
30
|
-
end
|
31
|
-
|
32
|
-
def test_frame_using_index
|
33
|
-
assert_raises(UnknownObjectException) { browser.frame(:index, 8).button(:id, "b2").enabled? }
|
34
|
-
assert_raises(UnknownObjectException) { browser.frame(:index, 2).button(:id, "b2").enabled? }
|
35
|
-
assert(browser.frame(:index, 1 ).button(:id, "b2").enabled?)
|
36
|
-
assert_false(browser.frame(:index, 1).button(:caption, "Disabled Button").enabled?)
|
37
|
-
assert_equal('blankpage.html', browser.frame(:index, 2).src)
|
38
|
-
end
|
39
|
-
|
40
|
-
tag_method :test_frame_with_invalid_attribute, :fails_on_firefox
|
41
|
-
|
42
|
-
def test_frame_with_invalid_attribute
|
43
|
-
assert_raises(MissingWayOfFindingObjectException) { browser.frame(:blah, 'no_such_thing').button(:id, "b2").enabled? }
|
44
|
-
end
|
45
|
-
|
46
|
-
def test_preset_frame
|
47
|
-
# with ruby's instance_eval, we are able to use the same frame for several actions
|
48
|
-
results = browser.frame("buttonFrame").instance_eval do
|
49
|
-
[
|
50
|
-
button(:id, "b2").enabled?,
|
51
|
-
button(:caption, "Disabled Button").enabled?
|
52
|
-
]
|
53
|
-
end
|
54
|
-
assert_equal([true, false], results)
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
|
59
|
-
class TC_Frames2 < Test::Unit::TestCase
|
60
|
-
include Watir::Exception
|
61
|
-
|
62
|
-
def setup
|
63
|
-
goto_page "frame_multi.html"
|
64
|
-
end
|
65
|
-
|
66
|
-
def test_frame_with_no_name
|
67
|
-
assert_raises(UnknownObjectException) { browser.frame(:name, "missingFrame").button(:id, "b2").enabled? }
|
68
|
-
end
|
69
|
-
|
70
|
-
def test_frame_by_id
|
71
|
-
assert_raises(UnknownObjectException) { browser.frame(:id, "missingFrame").button(:id, "b2").enabled? }
|
72
|
-
assert(browser.frame(:id, 'first_frame').button(:id, "b2").enabled?)
|
73
|
-
end
|
74
|
-
|
75
|
-
def test_frame_by_src
|
76
|
-
assert(browser.frame(:src, /pass/).button(:value, 'Close Window').exists?)
|
77
|
-
end
|
78
|
-
|
79
|
-
end
|
80
|
-
|
81
|
-
class TC_NestedFrames < Test::Unit::TestCase
|
82
|
-
tags :fails_on_firefox
|
83
|
-
|
84
|
-
def setup
|
85
|
-
goto_page "nestedFrames.html"
|
86
|
-
end
|
87
|
-
|
88
|
-
def test_frame
|
89
|
-
assert_raises(UnknownObjectException) { browser.frame("missingFrame").button(:id, "b2").enabled? }
|
90
|
-
assert_raises(UnknownObjectException) { browser.frame("nestedFrame").frame("subFrame").button(:id, "b2").enabled? }
|
91
|
-
assert(browser.frame("nestedFrame").frame("senderFrame").button(:name, "sendIt").enabled?)
|
92
|
-
browser.frame("nestedFrame").frame("senderFrame").text_field(:index, "1").set("Hello")
|
93
|
-
browser.frame("nestedFrame").frame("senderFrame").button(:name, "sendIt").click
|
94
|
-
assert(browser.frame("nestedFrame").frame("receiverFrame").text_field(:name, "receiverText").verify_contains("Hello"))
|
95
|
-
end
|
96
|
-
|
97
|
-
end
|
98
|
-
|
99
|
-
class TC_IFrames < Test::Unit::TestCase
|
100
|
-
tags :fails_on_firefox
|
101
|
-
|
102
|
-
def setup
|
103
|
-
goto_page "iframeTest.html"
|
104
|
-
end
|
105
|
-
|
106
|
-
def test_Iframe
|
107
|
-
browser.frame("senderFrame").text_field(:name, "textToSend").set( "Hello World")
|
108
|
-
browser.frame("senderFrame").button(:index, 1).click
|
109
|
-
assert( browser.frame("receiverFrame").text_field(:name, "receiverText").verify_contains("Hello World") )
|
110
|
-
assert_equal(browser.frame(:src, /iframeTest2/).text_field(:name, 'receiverText').value, "Hello World")
|
111
|
-
end
|
112
|
-
|
113
|
-
def test_iframes_id
|
114
|
-
browser.frame(:id, "sf").text_field(:name, "textToSend").set( "Hello World")
|
115
|
-
browser.frame(:id, "sf").button(:name, 'sendIt').click
|
116
|
-
assert( browser.frame("receiverFrame").text_field(:name, "receiverText").verify_contains("Hello World") )
|
117
|
-
end
|
118
|
-
|
119
|
-
end
|
120
|
-
|
6
|
+
#class TC_Frames < Test::Unit::TestCase
|
7
|
+
# include Watir::Exception
|
8
|
+
#
|
9
|
+
# def setup
|
10
|
+
# goto_page "frame_buttons.html"
|
11
|
+
# end
|
12
|
+
#
|
13
|
+
# def test_frame_no_what
|
14
|
+
# assert_raises(UnknownObjectException) { browser.frame("missingFrame").button(:id, "b2").enabled? }
|
15
|
+
# assert_raises(UnknownObjectException) { browser.frame("buttonFrame2").button(:id, "b2").enabled? }
|
16
|
+
# assert(browser.frame("buttonFrame").button(:id, "b2").enabled?)
|
17
|
+
# assert_false(browser.frame("buttonFrame").button(:caption, "Disabled Button").enabled?)
|
18
|
+
# end
|
19
|
+
#
|
20
|
+
# def test_frame_using_name
|
21
|
+
# assert_raises(UnknownObjectException) { browser.frame(:name, "missingFrame").button(:id, "b2").enabled? }
|
22
|
+
# assert_raises(UnknownObjectException) { browser.frame(:name, "buttonFrame2").button(:id, "b2").enabled? }
|
23
|
+
# assert(browser.frame(:name, "buttonFrame").button(:id, "b2").enabled?)
|
24
|
+
# assert_false(browser.frame(:name, "buttonFrame").button(:caption, "Disabled Button").enabled?)
|
25
|
+
# end
|
26
|
+
#
|
27
|
+
# def test_frame_using_name_and_regexp
|
28
|
+
# assert_raises(UnknownObjectException) { browser.frame(:name, /missingFrame/).button(:id, "b2").enabled? }
|
29
|
+
# assert(browser.frame(:name, /button/).button(:id, "b2").enabled?)
|
30
|
+
# end
|
31
|
+
#
|
32
|
+
# def test_frame_using_index
|
33
|
+
# assert_raises(UnknownObjectException) { browser.frame(:index, 8).button(:id, "b2").enabled? }
|
34
|
+
# assert_raises(UnknownObjectException) { browser.frame(:index, 2).button(:id, "b2").enabled? }
|
35
|
+
# assert(browser.frame(:index, 1 ).button(:id, "b2").enabled?)
|
36
|
+
# assert_false(browser.frame(:index, 1).button(:caption, "Disabled Button").enabled?)
|
37
|
+
# assert_equal('blankpage.html', browser.frame(:index, 2).src)
|
38
|
+
# end
|
39
|
+
#
|
40
|
+
# tag_method :test_frame_with_invalid_attribute, :fails_on_firefox
|
41
|
+
#
|
42
|
+
# def test_frame_with_invalid_attribute
|
43
|
+
# assert_raises(MissingWayOfFindingObjectException) { browser.frame(:blah, 'no_such_thing').button(:id, "b2").enabled? }
|
44
|
+
# end
|
45
|
+
#
|
46
|
+
# def test_preset_frame
|
47
|
+
# # with ruby's instance_eval, we are able to use the same frame for several actions
|
48
|
+
# results = browser.frame("buttonFrame").instance_eval do
|
49
|
+
# [
|
50
|
+
# button(:id, "b2").enabled?,
|
51
|
+
# button(:caption, "Disabled Button").enabled?
|
52
|
+
# ]
|
53
|
+
# end
|
54
|
+
# assert_equal([true, false], results)
|
55
|
+
# end
|
56
|
+
#end
|
57
|
+
#
|
58
|
+
#
|
59
|
+
#class TC_Frames2 < Test::Unit::TestCase
|
60
|
+
# include Watir::Exception
|
61
|
+
#
|
62
|
+
# def setup
|
63
|
+
# goto_page "frame_multi.html"
|
64
|
+
# end
|
65
|
+
#
|
66
|
+
# def test_frame_with_no_name
|
67
|
+
# assert_raises(UnknownObjectException) { browser.frame(:name, "missingFrame").button(:id, "b2").enabled? }
|
68
|
+
# end
|
69
|
+
#
|
70
|
+
# def test_frame_by_id
|
71
|
+
# assert_raises(UnknownObjectException) { browser.frame(:id, "missingFrame").button(:id, "b2").enabled? }
|
72
|
+
# assert(browser.frame(:id, 'first_frame').button(:id, "b2").enabled?)
|
73
|
+
# end
|
74
|
+
#
|
75
|
+
# def test_frame_by_src
|
76
|
+
# assert(browser.frame(:src, /pass/).button(:value, 'Close Window').exists?)
|
77
|
+
# end
|
78
|
+
#
|
79
|
+
#end
|
80
|
+
#
|
81
|
+
#class TC_NestedFrames < Test::Unit::TestCase
|
82
|
+
# tags :fails_on_firefox
|
83
|
+
#
|
84
|
+
# def setup
|
85
|
+
# goto_page "nestedFrames.html"
|
86
|
+
# end
|
87
|
+
#
|
88
|
+
# def test_frame
|
89
|
+
# assert_raises(UnknownObjectException) { browser.frame("missingFrame").button(:id, "b2").enabled? }
|
90
|
+
# assert_raises(UnknownObjectException) { browser.frame("nestedFrame").frame("subFrame").button(:id, "b2").enabled? }
|
91
|
+
# assert(browser.frame("nestedFrame").frame("senderFrame").button(:name, "sendIt").enabled?)
|
92
|
+
# browser.frame("nestedFrame").frame("senderFrame").text_field(:index, "1").set("Hello")
|
93
|
+
# browser.frame("nestedFrame").frame("senderFrame").button(:name, "sendIt").click
|
94
|
+
# assert(browser.frame("nestedFrame").frame("receiverFrame").text_field(:name, "receiverText").verify_contains("Hello"))
|
95
|
+
# end
|
96
|
+
#
|
97
|
+
#end
|
98
|
+
#
|
99
|
+
#class TC_IFrames < Test::Unit::TestCase
|
100
|
+
# tags :fails_on_firefox
|
101
|
+
#
|
102
|
+
# def setup
|
103
|
+
# goto_page "iframeTest.html"
|
104
|
+
# end
|
105
|
+
#
|
106
|
+
# def test_Iframe
|
107
|
+
# browser.frame("senderFrame").text_field(:name, "textToSend").set( "Hello World")
|
108
|
+
# browser.frame("senderFrame").button(:index, 1).click
|
109
|
+
# assert( browser.frame("receiverFrame").text_field(:name, "receiverText").verify_contains("Hello World") )
|
110
|
+
# assert_equal(browser.frame(:src, /iframeTest2/).text_field(:name, 'receiverText').value, "Hello World")
|
111
|
+
# end
|
112
|
+
#
|
113
|
+
# def test_iframes_id
|
114
|
+
# browser.frame(:id, "sf").text_field(:name, "textToSend").set( "Hello World")
|
115
|
+
# browser.frame(:id, "sf").button(:name, 'sendIt').click
|
116
|
+
# assert( browser.frame("receiverFrame").text_field(:name, "receiverText").verify_contains("Hello World") )
|
117
|
+
# end
|
118
|
+
#
|
119
|
+
#end
|
120
|
+
#
|
121
121
|
class TC_show_frames < Test::Unit::TestCase
|
122
122
|
include CaptureIOHelper
|
123
123
|
|