-
Notifications
You must be signed in to change notification settings - Fork 32
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 #4 from bobsilverberg/master
Added some helper methods to selenium.cfc
- Loading branch information
Showing
10 changed files
with
145 additions
and
18 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
Binary file not shown.
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
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,81 @@ | ||
component extends="cfselenium.CFSeleniumTestCase" { | ||
|
||
public void function beforeTests() { | ||
browserUrl = "http://localhost/CFSelenium/test/fixture/"; | ||
selenium = createObject("component", "cfselenium.selenium").init(waitTimeout=5000); | ||
selenium.start(browserUrl,"*firefox"); | ||
selenium.setTimeout(30000); | ||
} | ||
|
||
function setup() { | ||
selenium.open("http://localhost/CFSelenium/test/fixture/waitForFixture.htm"); | ||
} | ||
|
||
function waitForElementPresentShouldFindElementThatIsAlreadyThere() { | ||
|
||
selenium.waitForElementPresent("alwaysPresentAndVisible"); | ||
assertEquals("alwaysPresentAndVisible",selenium.getText("alwaysPresentAndVisible")); | ||
|
||
} | ||
|
||
function waitForElementPresentShouldThrowIfElementIsNeverThere() expectedException="CFSelenium.elementNotFound" { | ||
|
||
selenium.waitForElementPresent("neverPresent"); | ||
|
||
} | ||
|
||
function waitForElementPresentShouldFindElementThatAppears() { | ||
|
||
assertEquals(false,selenium.isElementPresent("presentAfterAPause")); | ||
selenium.click("createElement"); | ||
selenium.waitForElementPresent("presentAfterAPause"); | ||
assertEquals("presentAfterAPause",selenium.getText("presentAfterAPause")); | ||
|
||
} | ||
|
||
function waitForElementVisibleShouldFindElementThatIsAlreadyThere() { | ||
|
||
selenium.waitForElementVisible("alwaysPresentAndVisible"); | ||
assertEquals("alwaysPresentAndVisible",selenium.getText("alwaysPresentAndVisible")); | ||
|
||
} | ||
|
||
function waitForElementVisibleShouldThrowIfElementIsNeverVisible() expectedException="CFSelenium.elementNotVisible" { | ||
|
||
selenium.waitForElementVisible("neverVisible"); | ||
|
||
} | ||
|
||
function waitForElementVisibleShouldFindElementThatAppears() { | ||
|
||
assertEquals(false,selenium.isVisible("becomesVisible")); | ||
selenium.click("showElement"); | ||
selenium.waitForElementVisible("becomesVisible"); | ||
assertEquals("becomesVisible",selenium.getText("becomesVisible")); | ||
|
||
} | ||
|
||
function waitForElementNotVisibleShouldSucceedIfElementIsAlreadyInvisible() { | ||
|
||
selenium.waitForElementNotVisible("neverVisible"); | ||
assertEquals("",selenium.getText("neverVisible")); | ||
|
||
} | ||
|
||
function waitForElementNotVisibleShouldThrowIfElementIsAlwaysVisible() expectedException="CFSelenium.elementStillVisible" { | ||
|
||
selenium.waitForElementNotVisible("alwaysPresentAndVisible"); | ||
|
||
} | ||
|
||
function waitForElementNotVisibleShouldSucceedIfElementDisappears() { | ||
|
||
assertEquals(true,selenium.isVisible("becomesInvisible")); | ||
selenium.click("hideElement"); | ||
selenium.waitForElementNotVisible("becomesInvisible"); | ||
assertEquals("",selenium.getText("becomesInvisible")); | ||
|
||
} | ||
|
||
} | ||
|
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,23 @@ | ||
<html> | ||
<body> | ||
<script src="//ajax.microsoft.com/ajax/jquery/jquery-1.5.min.js" type="text/javascript"></script> | ||
<script type="text/javascript"> | ||
function createElement() { | ||
$('<div id="presentAfterAPause">presentAfterAPause</div>').appendTo("body"); | ||
} | ||
function showElement() { | ||
$("#becomesVisible").show(); | ||
} | ||
function hideElement() { | ||
$("#becomesInvisible").hide(); | ||
} | ||
</script> | ||
<div id="alwaysPresentAndVisible">alwaysPresentAndVisible</div> | ||
<div id="neverVisible" style="display:none">neverVisible</div> | ||
<div id="becomesVisible" style="display:none">becomesVisible</div> | ||
<div id="becomesInvisible">becomesInvisible</div> | ||
<a id="createElement" href="javascript:createElement();">Create an element</a> | ||
<a id="showElement" href="javascript:showElement();">Show an element</a> | ||
<a id="hideElement" href="javascript:hideElement();">Hide an element</a> | ||
</body> | ||
</html> |