Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Base test URL added

  • Loading branch information...
commit 9a5a28b22bdba8a799a860c32def2ab48ed41b24 1 parent 7541053
@adrianblynch adrianblynch authored
Showing with 34 additions and 32 deletions.
  1. +13 −12 test/cf7_cf8/waitForTest_cf8.cfc
  2. +21 −20 test/cf9/waitForTest.cfc
View
25 test/cf7_cf8/waitForTest_cf8.cfc
@@ -1,7 +1,8 @@
-<cfcomponent extends="cfselenium.CFSeleniumTestCase_Tags" >
+<cfcomponent extends="cfselenium.CFSeleniumTestCase_Tags">
<cffunction name="beforeTests">
- <cfset browserUrl = "http://localhost/CFSelenium/test/fixture/">
+ <cfset variables.baseTestURL = mid(cgi.request_url, 1, findNoCase("/CFSelenium/test/", cgi.request_url)) & "CFSelenium/test/">
+ <cfset browserUrl = variables.baseTestURL & "fixture/">
<cfset browserCommand= "*firefox">
<cfset selenium= createObject("component","cfselenium.selenium_tags").init(waitTimeout=5000)>
<cfset selenium.start(browserUrl,browserCommand)>
@@ -9,56 +10,56 @@
</cffunction>
<cffunction name="setup">
- <cfset selenium.open("http://localhost/cfselenium/test/fixture/waitForFixture.htm") />
+ <cfset selenium.open(variables.baseTestURL & "fixture/waitForFixture.htm") />
</cffunction>
<cffunction name="waitForElementPresentShouldFindElementThatIsAlreadyThere">
<cfset selenium.waitForElementPresent("alwaysPresentAndVisible") />
<cfset assertEquals("alwaysPresentAndVisible",selenium.getText("alwaysPresentAndVisible")) />
</cffunction>
-
+
<cffunction name="waitForElementPresentShouldThrowIfElementIsNeverThere" mxunit:expectedException="CFSelenium.elementNotFound">
<cfset selenium.waitForElementPresent("neverPresent") />
</cffunction>
-
+
<cffunction name="waitForElementPresentShouldFindElementThatAppears">
<cfset assertEquals(false,selenium.isElementPresent("presentAfterAPause")) />
<cfset selenium.click("createElement") />
<cfset selenium.waitForElementPresent("presentAfterAPause") />
<cfset assertEquals("presentAfterAPause",selenium.getText("presentAfterAPause")) />
</cffunction>
-
+
<cffunction name="waitForElementVisibleShouldFindElementThatIsAlreadyThere">
<cfset selenium.waitForElementVisible("alwaysPresentAndVisible") />
<cfset assertEquals("alwaysPresentAndVisible",selenium.getText("alwaysPresentAndVisible")) />
</cffunction>
-
+
<cffunction name="waitForElementVisibleShouldThrowIfElementIsNeverVisible" mxunit:expectedException="CFSelenium.elementNotVisible">
<cfset selenium.waitForElementVisible("neverVisible") />
</cffunction>
-
+
<cffunction name="waitForElementVisibleShouldFindElementThatAppears">
<cfset assertEquals(false,selenium.isVisible("becomesVisible")) />
<cfset selenium.click("showElement") />
<cfset selenium.waitForElementVisible("becomesVisible") />
<cfset assertEquals("becomesVisible",selenium.getText("becomesVisible")) />
</cffunction>
-
+
<cffunction name="waitForElementNotVisibleShouldSucceedIfElementIsAlreadyInvisible">
<cfset selenium.waitForElementNotVisible("neverVisible") />
<cfset assertEquals("",selenium.getText("neverVisible")) />
</cffunction>
-
+
<cffunction name="waitForElementNotVisibleShouldThrowIfElementIsAlwaysVisible" mxunit:expectedException="CFSelenium.elementStillVisible">
<cfset selenium.waitForElementNotVisible("alwaysPresentAndVisible") />
</cffunction>
-
+
<cffunction name="waitForElementNotVisibleShouldSucceedIfElementDisappears">
<cfset assertEquals(true,selenium.isVisible("becomesInvisible")) />
<cfset selenium.click("hideElement") />
<cfset selenium.waitForElementNotVisible("becomesInvisible") />
<cfset assertEquals("",selenium.getText("becomesInvisible")) />
</cffunction>
-
+
</cfcomponent>
View
41 test/cf9/waitForTest.cfc
@@ -1,80 +1,81 @@
component extends="cfselenium.CFSeleniumTestCase" {
public void function beforeTests() {
- browserUrl = "http://localhost/CFSelenium/test/fixture/";
+ variables.baseTestURL = mid(cgi.request_url, 1, findNoCase("/CFSelenium/test/", cgi.request_url)) & "CFSelenium/test/";
+ browserUrl = variables.baseTestURL & "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");
+ selenium.open(variables.baseTestURL & "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"));
-
+
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.