Skip to content

Commit

Permalink
Initial test files for Selenium 2 implicitly_wait functionality.
Browse files Browse the repository at this point in the history
  • Loading branch information
emanlove committed Dec 14, 2011
1 parent 46a58da commit 76d1e88
Show file tree
Hide file tree
Showing 3 changed files with 179 additions and 0 deletions.
92 changes: 92 additions & 0 deletions test/acceptance/keywords/implicitwait.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
*** Settings ***
#Test Setup Go To Page "javascript/dynamic.html"
#Test Setup Go To Page "javascript/dynamic_timeout.html?timeout=4000"
Resource ../resource.txt

*** Test Cases ***
Implicit Wait 10 seconds For 4000 Element
Set Selenium Speed 0 seconds
Set Selenium Timeout 0 seconds
Set Selenium Implicit Wait 10 seconds
Go To Page "javascript/dynamic_timeout.html?timeout=4000"
Page Should Not Contain Element css=html body div#box0.redbox
Click Element adder
Page Should Contain Element css=html body div#box0.redbox

Implicit Wait 0.5 seconds For 4000 Element
Set Selenium Speed 0 seconds
Set Selenium Timeout 0 seconds
Set Selenium Implicit Wait 0.5 seconds
Go To Page "javascript/dynamic_timeout.html?timeout=4000"
Page Should Not Contain Element css=html body div#box0.redbox
Click Element adder
Page Should Not Contain Element css=html body div#box0.redbox

Implicit Wait 0 seconds For 4000 Element
Set Selenium Speed 0 seconds
Set Selenium Timeout 0 seconds
Set Selenium Implicit Wait 0 seconds
Go To Page "javascript/dynamic_timeout.html?timeout=4000"
Page Should Not Contain Element css=html body div#box0.redbox
Click Element adder
Page Should Not Contain Element css=html body div#box0.redbox

Implicit Wait 10 seconds For 6000 Element
Set Selenium Speed 0 seconds
Set Selenium Timeout 0 seconds
Set Selenium Implicit Wait 10 seconds
Go To Page "javascript/dynamic_timeout.html?timeout=6000"
Page Should Not Contain Element css=html body div#box0.redbox
Click Element adder
Page Should Contain Element css=html body div#box0.redbox

Implicit Wait 0.5 seconds For 6000 Element
Set Selenium Speed 0 seconds
Set Selenium Timeout 0 seconds
Set Selenium Implicit Wait 0.5 seconds
Go To Page "javascript/dynamic_timeout.html?timeout=6000"
Page Should Not Contain Element css=html body div#box0.redbox
Click Element adder
Page Should Not Contain Element css=html body div#box0.redbox

Implicit Wait 0 seconds For 6000 Element
Set Selenium Speed 0 seconds
Set Selenium Timeout 0 seconds
Set Selenium Implicit Wait 0 seconds
Go To Page "javascript/dynamic_timeout.html?timeout=6000"
Page Should Not Contain Element css=html body div#box0.redbox
Click Element adder
Page Should Not Contain Element css=html body div#box0.redbox

Implicit Wait 10 seconds For 10000 Element
Set Selenium Speed 0 seconds
Set Selenium Timeout 0 seconds
Set Selenium Implicit Wait 10 seconds
Go To Page "javascript/dynamic_timeout.html?timeout=10000"
Page Should Not Contain Element css=html body div#box0.redbox
Click Element adder
Page Should Contain Element css=html body div#box0.redbox

Implicit Wait 0.5 seconds For 10000 Element
Set Selenium Speed 0 seconds
Set Selenium Timeout 0 seconds
Set Selenium Implicit Wait 0.5 seconds
Go To Page "javascript/dynamic_timeout.html?timeout=10000"
Page Should Not Contain Element css=html body div#box0.redbox
Click Element adder
Page Should Not Contain Element css=html body div#box0.redbox

Implicit Wait 0 seconds For 10000 Element
Set Selenium Speed 0 seconds
Set Selenium Timeout 0 seconds
Set Selenium Implicit Wait 0 seconds
Go To Page "javascript/dynamic_timeout.html?timeout=10000"
Page Should Not Contain Element css=html body div#box0.redbox
Click Element adder
Page Should Not Contain Element css=html body div#box0.redbox

No Element
Set Selenium Speed 0 seconds
Set Selenium Timeout 0 seconds
Set Selenium Implicit Wait 0 seconds
Page Should Not Contain Element css=html body div#box0.redbox
39 changes: 39 additions & 0 deletions test/resources/html/javascript/dynamic.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<script type="text/javascript">
var next = 0;

function addMore() {
var box = document.createElement('DIV');
box.id = 'box' + next++;
box.className = 'redbox';
box.style.width = '150px';
box.style.height = '150px';
box.style.backgroundColor = 'red';
box.style.border = '1px solid black';
box.style.margin = '5px';

window.setTimeout(function() {
document.body.appendChild(box);
}, 10000);
}

function reveal() {
var elem = document.getElementById('revealed');
window.setTimeout(function() {
elem.style.display = '';
}, 10000);
}
</script>
</head>
<body>
<input id="adder" type="button" value="Add a box!" onclick="addMore()"/>

<input id="reveal" type="button" value="Reveal a new input" onclick="reveal();" />

<input id="revealed" style="display:none;" />
</body>
</html>
48 changes: 48 additions & 0 deletions test/resources/html/javascript/dynamic_timeout.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<script type="text/javascript">
var next = 0;

function getUrlVars() {
var vars = {};
var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
vars[key] = value;
});
return vars;
}

function addMore() {
var box = document.createElement('DIV');
var timeout = getUrlVars()["timeout"];
box.id = 'box' + next++;
box.className = 'redbox';
box.style.width = '150px';
box.style.height = '150px';
box.style.backgroundColor = 'red';
box.style.border = '1px solid black';
box.style.margin = '5px';

window.setTimeout(function() {
document.body.appendChild(box);
}, timeout);
}

function reveal() {
var elem = document.getElementById('revealed');
window.setTimeout(function() {
elem.style.display = '';
}, 10000);
}
</script>
</head>
<body>
<input id="adder" type="button" value="Add a box!" onclick="addMore()"/>

<input id="reveal" type="button" value="Reveal a new input" onclick="reveal();" />

<input id="revealed" style="display:none;" />
</body>
</html>

0 comments on commit 76d1e88

Please sign in to comment.