Author: ppitonak(a)redhat.com
Date: 2010-12-15 10:04:13 -0500 (Wed, 15 Dec 2010)
New Revision: 20582
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/A4JJSFunctionBean.java
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jJSFunction/simple.xhtml
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractMetamerTest.java
Log:
* tests for jsFunction fixed
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/A4JJSFunctionBean.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/A4JJSFunctionBean.java 2010-12-15
14:49:18 UTC (rev 20581)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/A4JJSFunctionBean.java 2010-12-15
15:04:13 UTC (rev 20582)
@@ -60,15 +60,11 @@
logger.debug("initializing bean " + getClass().getName());
year = Integer.parseInt(new SimpleDateFormat("yyyy").format(new
Date()));
- // initialize attributes
- attributes = Attributes.getUIComponentAttributes(UIFunction.class, getClass());
+ attributes = Attributes.getUIComponentAttributes(UIFunction.class, getClass(),
false);
- attributes.setAttribute("execute", "@form");
+ attributes.setAttribute("name", "metamerFunction");
attributes.setAttribute("render", "time1, time2, year");
attributes.setAttribute("rendered", true);
-
- // TODO has to be tested in other way
- attributes.remove("name");
}
public Attributes getAttributes() {
@@ -78,7 +74,7 @@
public void setAttributes(Attributes attributes) {
this.attributes = attributes;
}
-
+
public int getYear() {
return year;
}
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jJSFunction/simple.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jJSFunction/simple.xhtml 2010-12-15
14:49:18 UTC (rev 20581)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jJSFunction/simple.xhtml 2010-12-15
15:04:13 UTC (rev 20582)
@@ -59,10 +59,11 @@
action="#{a4jJSFunctionBean.attributes.action}"
actionListener="#{a4jJSFunctionBean.attributes.actionListener}"
bypassUpdates="#{a4jJSFunctionBean.attributes['bypassUpdates'].value}"
+
data="#{a4jJSFunctionBean.attributes['data'].value}"
execute="#{a4jJSFunctionBean.attributes['execute'].value}"
immediate="#{a4jJSFunctionBean.attributes['immediate'].value}"
limitRender="#{a4jJSFunctionBean.attributes['limitRender'].value}"
- name="metamerFunction"
+
name="#{a4jJSFunctionBean.attributes['name'].value}"
onbeforedomupdate="#{a4jJSFunctionBean.attributes['onbeforedomupdate'].value}"
onbegin="#{a4jJSFunctionBean.attributes['onbegin'].value}"
oncomplete="#{a4jJSFunctionBean.attributes['oncomplete'].value}"
@@ -74,7 +75,7 @@
</a4j:jsFunction>
<br/>
- <a id="callFunctionLink" href="#"
onclick="javascript:metamerFunction()">Call JavaScript function</a>
+ <a id="callFunctionLink" href="#"
onclick="javascript:#{a4jJSFunctionBean.attributes['name'].value}()">Call
JavaScript function (#{a4jJSFunctionBean.attributes['name'].value})</a>
</ui:define>
<ui:define name="outOfTemplateAfter">
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractMetamerTest.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractMetamerTest.java 2010-12-15
14:49:18 UTC (rev 20581)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractMetamerTest.java 2010-12-15
15:04:13 UTC (rev 20582)
@@ -32,11 +32,15 @@
import java.net.URL;
import java.util.Locale;
+import java.util.Random;
+import java.util.Set;
import javax.faces.event.PhaseId;
import org.apache.commons.lang.LocaleUtils;
import org.jboss.test.selenium.AbstractTestCase;
+import org.jboss.test.selenium.cookie.Cookie;
+import org.jboss.test.selenium.cookie.DeleteCookieOptions;
import org.jboss.test.selenium.dom.Event;
import org.jboss.test.selenium.encapsulated.JavaScript;
import org.jboss.test.selenium.locator.Attribute;
@@ -85,7 +89,7 @@
@BeforeMethod(alwaysRun = true)
public void loadPage(Object[] templates) {
if (selenium == null) {
- new SkipException("selenium isn't initialized");
+ throw new SkipException("selenium isn't initialized");
}
selenium.open(buildUrl(getTestUrl() + "?templates=" +
template.toString()));
selenium.waitForPageToLoad(TIMEOUT);
@@ -97,6 +101,16 @@
@AfterMethod(alwaysRun = true)
public void invalidateSession() {
selenium.deleteAllVisibleCookies();
+
+ // TODO slow and unreliable solution
+ selenium.open(contextPath);
+ selenium.waitForPageToLoad(TIMEOUT);
+ JQueryLocator button = jq("input[id$=invalidateSessionButton]");
+
+ if (selenium.isElementPresent(button)) {
+ selenium.click(button);
+ selenium.waitForPageToLoad(TIMEOUT);
+ }
}
/**
@@ -113,14 +127,14 @@
e.printStackTrace();
}
}
-
+
/**
* Do a full page refresh (regular HTTP request) by triggering a command with no
action bound.
*/
public void fullPageRefresh() {
guardHttp(selenium).click(id("controlsForm:fullPageRefreshImage"));
}
-
+
/**
* Rerender all content of the page (AJAX request) by trigerring a command with no
action but render bound.
*/
@@ -178,7 +192,7 @@
waitGui.failWith("Attribute on" + attributeName + " does not work
correctly").until(
new EventFiredCondition(event));
}
-
+
/**
* Returns the locale of the tested page
* @return the locale of the tested page
Show replies by date