HsacAcceptanceTests.SlimTests.BrowserTest.FrameHandlingTests.IframeHandling


This test ensures we can find elements inside iframes.

variable defined: HTML_MAIN= {{{ <html> <title>Start Page Title</title> <body> <div id="container_top"> <input name="remove" type="button" value="Remove"> <iframe id="iframe1" src="frame1.html"></iframe> <iframe id="iframe2" src="frame2.html"></iframe> <label>Add button<input name="add" type="button" value="Add"></label> <label>Upload 1 button<input name="fileChooser1" type="file"></label> </div> </body> </html>}}}

variable defined: HTML_FRAME1= {{{ <html> <body> <div id="container1"> <input name="remove1" type="button" value="Remove1"> <iframe id="iframe1_1" src="frame3.html"></iframe> <iframe id="iframe1_2" src="frame4.html"></iframe> <label>Add button1<input name="add" type="button" value="Add1"></label> </div> </body> </html>}}}


variable defined: HTML_FRAME2= {{{ <html> <body> <div id="container2"> <input name="remove2" type="button" value="Remove2"> <label>Add button2<input name="add" type="button" value="Add2"></label> </div> </body> </html>}}}


variable defined: HTML_FRAME3= {{{ <html> <body> <div id="container3"> <input name="remove3" type="button" value="Remove3"> <label>Add button3<input name="add" type="button" value="Add3"></label> <label>Upload button<input name="fileChooser" type="file"></label> </div> </body> </html>}}}

variable defined: HTML_FRAME4= {{{ <html> <body> <div id="container4"> <input name="remove4" type="button" value="Remove4"> <label>Add button4<input name="add" type="button" value="Add4"></label> </div> </body> </html>}}}






script mock xml server setup
add response
<html>
<title>Start Page Title</title>
<body>
<div id="container_top">
<input name="remove" type="button" value="Remove">
<iframe id="iframe1" src="frame1.html"></iframe>
<iframe id="iframe2" src="frame2.html"></iframe>
<label>Add button<input name="add" type="button" value="Add"></label>
<label>Upload 1 button<input name="fileChooser1" type="file"></label>
</div>
</body>
</html>
add response
<html>
<body>
<div id="container1">
<input name="remove1" type="button" value="Remove1">
<iframe id="iframe1_1" src="frame3.html"></iframe>
<iframe id="iframe1_2" src="frame4.html"></iframe>
<label>Add button1<input name="add" type="button" value="Add1"></label>
</div>
</body>
</html>
for GET: /FitNesseMock/frame1.html
add response
<html>
<body>
<div id="container2">
<input name="remove2" type="button" value="Remove2">
<label>Add button2<input name="add" type="button" value="Add2"></label>
</div>
</body>
</html>
for GET: /FitNesseMock/frame2.html
add response
<html>
<body>
<div id="container3">
<input name="remove3" type="button" value="Remove3">
<label>Add button3<input name="add" type="button" value="Add3"></label>
<label>Upload button<input name="fileChooser" type="file"></label>
</div>
</body>
</html>
for GET: /FitNesseMock/frame3.html
add response
<html>
<body>
<div id="container4">
<input name="remove4" type="button" value="Remove4">
<label>Add button4<input name="add" type="button" value="Add4"></label>
</div>
</body>
</html>
for GET: /FitNesseMock/frame4.html
$url<-[http://127.0.0.1:8001/FitNesseMock] get mock server url


script file fixture
$file<-[testUpload.txt] create testUpload.txt containing Hallo


script browser test
open $url->[http://127.0.0.1:8001/FitNesseMock]/main
seconds before timeout 1
check page title Start Page Title
show save page source main.html
check number of times Remove is visible 5
check value of Add button Add
check value of Add button1 Add1
check value of Add button2 Add2
check value of Add button3 Add3
check value of Add button4 Add4
click Remove1
click Remove3
click Remove4
click Remove2
click Remove
select file $file->[testUpload.txt]
select file $file->[testUpload.txt] for Upload button
select file $file->[testUpload.txt] for Upload 1 button
scroll to Add
scroll to Add3
set search context to id=container_top
click Add
switch to frame id=iframe2
set search context to id=container2
click Add
switch to parent frame
set search context to id=container_top
click Add
switch to frame id=iframe1
click Add4
click Add3
set search context to id=container1
click Add
switch to frame id=iframe1_2
set search context to id=container4
click Add
click Add4
reject click if available Add3
reject switch to frame id=iframe2
switch to default content
switch to frame id=iframe2
reject click if available Add4
switch to default content
set search context to id=container4
click Add4
clear search context
switch to default content
set implicit find in frames to false
check number of times Remove is visible 1

script mock xml server setup
verify all responses served
stop