-
Notifications
You must be signed in to change notification settings - Fork 751
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1865 from emanlove/add-expected-conditions-1827
Add expected conditions 1827
- Loading branch information
Showing
17 changed files
with
335 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
*** Test Cases *** | ||
# Wait Until Element State Is (Not) | ||
# Get Element State | ||
# Element States Should (Not) Be | ||
|
||
Check waiting for condition that takes a element | ||
Fail | ||
|
||
Check waiting for condition that takes a title | ||
Fail | ||
|
||
Check waiting for condition that takes a url | ||
Fail | ||
Wait Until url contains google | ||
# verify took 2 seconds | ||
|
||
Check waiting for condition that takes locator and string | ||
Wait Until Element State Is ${condition} ${locator} ${string} | ||
Wait Until Element State Is ${condition} ${element} | ||
Wait Until Condition Is ${condition} ${target} | ||
Wait Until Condition Is ${condition} ${whatelse you need for this condition} | ||
|
||
|
||
Wait Until State Is number_of_windows_to_be | ||
Wait Until Expected Condition Is number_of_windows_to_be | ||
Wait Until Condition Is number of windows to be 5 | ||
Wait Until Condition Is text to be present in element attribute //some/xpath/to/an/element href http://hello | ||
|
||
Wait Until Condition Is number of windows to be 5 text to be present in element attribute //some/xpath/to/an/element href http://hello | ||
|
||
Wait Until number of windows to be 5 | ||
Wait Until text to be present in element attribute //some/xpath/to/an/element href http://hello | ||
Get Condition | ||
Is number of windows to be 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
*** Settings *** | ||
Test Setup Go To Page "javascript/expected_conditions.html" | ||
Resource ../resource.robot | ||
*** Test Cases *** | ||
Wait For Expected Conditions One Argument | ||
Title Should Be Original | ||
Click Element link=delayed change title | ||
Wait For Expected Condition title_is Delayed | ||
Title Should Be Delayed | ||
Wait For Expected Condition Times out within set timeout | ||
[Documentation] FAIL REGEXP: TimeoutException: Message: Expected Condition not met within set timeout of 0.3* | ||
Title Should Be Original | ||
Click Element link=delayed change title | ||
Wait For Expected Condition title_is Delayed timeout=0.3 | ||
Wait For Expected Conditions using WebElement as locator | ||
Click Button Change the button state | ||
${dynamic_btn}= Get WebElement id:enabledDisabledBtn | ||
Wait For Expected Condition element_to_be_clickable ${dynamic_btn} | ||
Wait For Expected Conditions Where Condition Written With Spaces | ||
Title Should Be Original | ||
Click Element link=delayed change title | ||
Wait For Expected Condition title is Delayed | ||
Title Should Be Delayed | ||
Wait For Expected Conditions Where Condition Is Variable | ||
${condition}= Set Variable title is | ||
Title Should Be Original | ||
Click Element link=delayed change title | ||
Wait For Expected Condition ${condition} Delayed | ||
Title Should Be Delayed | ||
Wait For Expected Conditions Where Condition Is Strange Case | ||
Click Button Change the button state | ||
${dynamic_btn}= Get WebElement id:enabledDisabledBtn | ||
Wait For Expected Condition EleMENT tO BE cLiCkAbLe ${dynamic_btn} | ||
Wait For Non Existing Expected Conditions | ||
Click Button Change the button state | ||
${dynamic_btn}= Get WebElement id:enabledDisabledBtn | ||
Run Keyword And Expect Error this_is_not_an_expected_con_dition is an unknown expected condition | ||
... Wait For Expected Condition this_is not an expected con dition ${dynamic_btn} | ||
Wait For Expected Conditions When Condition Includes Locator | ||
Title Should Be Original | ||
${byElem}= Evaluate ("id","added_btn") | ||
Click Element link:delayed add element | ||
Wait For Expected Condition Presence Of Element Located ${byElem} | ||
Click Element id:added_btn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> | ||
<title>Original</title> | ||
<!-- Note the timeouts in the functions are chosen such they constitute | ||
a set with distinct subset sums. That is is a combination of any two | ||
or more were to be executed the total time for that distinct combination | ||
would be unique. This was done so we could do a ALL/AND/OR type of test | ||
and know that with the combination of expected conditions the execution | ||
was successful as the unique time took place. --> | ||
<!-- The set we are using is {6,9,11,12,13} --> | ||
<!-- (could also use {3,5,6,7} which would reduce total time)--> | ||
<script type="text/javascript"> | ||
function add_content(target_container, content) { | ||
p = document.createElement('p'); | ||
p.appendChild(document.createTextNode(content)); | ||
container = document.getElementById(target_container); | ||
container.appendChild(p); | ||
} | ||
|
||
function delayed_button_state() { | ||
setTimeout(function() { | ||
state_btn = document.getElementById('enabledDisabledBtn') | ||
if (state_btn.hasAttribute("disabled")) { | ||
state_btn.removeAttribute("disabled") | ||
state_btn.value = "Enabled" | ||
} else { | ||
state_btn.setAttribute("disabled", "") | ||
state_btn.value = "Disabled" | ||
} | ||
},900) | ||
} | ||
function delayed_title_change() { | ||
setTimeout(function(){ | ||
document.title='Delayed'; | ||
},600); | ||
} | ||
|
||
function delayed_add_element() { | ||
setTimeout(function(){ | ||
const newElem = document.createElement("input"); | ||
newElem.setAttribute("type", "button"); | ||
newElem.setAttribute("id", "added_btn"); | ||
newElem.setAttribute("value", "Added Button"); | ||
const container = document.getElementById("container"); | ||
document.body.insertBefore(newElem, container); | ||
},1100); | ||
} | ||
</script> | ||
</head> | ||
<body> | ||
<a href="javascript:return false;" onclick="document.title='Changed'; return false;">change title</a><br/> | ||
<a href="javascript:return false;" onclick="delayed_title_change(); return false;">delayed change title</a><br/> | ||
<a href="javascript:return false;" onclick="delayed_add_element(); return fales;">delayed add element</a><br/> | ||
<a href="javascript:return false;" onclick="add_content('target', 'added content'); return false;">add content</a><br/> | ||
<a id="unicode" href="javascript:return false;" onclick="document.title='äää'; return false;">title to ääää</a><br/> | ||
<p> | ||
<input type="radio" name="group" value="title" | ||
onclick="document.title='Changed by Button';" />Change Title<br/> | ||
<input type="radio" name="group" value="content" | ||
onclick="add_content('button_target', 'added by button');"/>Add Content<br/> | ||
</p> | ||
<div id="target"> | ||
</div> | ||
<div id="button_target"> | ||
</div> | ||
<form name=myform> | ||
<input type=button value="Change the title" | ||
onClick="if(confirm('Really change the title?')) | ||
document.title += ' Changed!';" > | ||
</form> | ||
<p> | ||
<input type=button id=stateChangeBtn value="Change the button state" | ||
onClick="delayed_button_state()" /> | ||
<input type=button id=enabledDisabledBtn value="Disabled" | ||
disabled /> | ||
</p> | ||
<p> | ||
<div id="container"></div> | ||
</p> | ||
<p> | ||
<form name=titleChanger> | ||
<td> | ||
<input type=text id=titleChangeTxt value="Enter Title here"> | ||
</td> | ||
<td> | ||
<input type=button id=titleChangeBtn value="Set Title" | ||
onClick="document.title = document.getElementById('titleChangeTxt').value;" > | ||
</td> | ||
</form> | ||
</p> | ||
</body> | ||
</html> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.