Author: vmolotkov
Date: 2008-10-30 11:31:35 -0400 (Thu, 30 Oct 2008)
New Revision: 10984
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/inplaceInput/testControlsFacet.xhtml
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/InplaceInputTest.java
Log:
tests for inplaceinput
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/inplaceInput/testControlsFacet.xhtml
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/inplaceInput/testControlsFacet.xhtml
(rev 0)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/inplaceInput/testControlsFacet.xhtml 2008-10-30
15:31:35 UTC (rev 10984)
@@ -0,0 +1,20 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:rich="http://richfaces.org/rich"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+ template="../../template/caseTemplate.xhtml">
+ <ui:define name="caseName">testControlsFacet</ui:define>
+ <ui:define name="caseBody">
+ <h:form id="_form">
+ <rich:inplaceInput id="ii_tcf" value="test"
showControls="true">
+ <f:facet name="controls">
+ <button id="ok_tcf">ok</button>
+ <button id="canclel_tcf">cancel</button>
+ </f:facet>
+ </rich:inplaceInput>
+ </h:form>
+ </ui:define>
+</ui:composition>
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/InplaceInputTest.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/InplaceInputTest.java 2008-10-30
15:13:51 UTC (rev 10983)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/InplaceInputTest.java 2008-10-30
15:31:35 UTC (rev 10984)
@@ -35,6 +35,14 @@
private static final String EDITEVENT_ATTRIBUTES_ID_PREFIX = "_teea";
+ private static final String CONTROLS_FACET_PAGE =
"testControlsFacet.xhtml";
+
+ private static final String CONTROLS_FACET_ID_PREFIX = "_tcf";
+
+ private static final String CONTROLS_FACET_BN_OK = "ok";
+
+ private static final String CONTROLS_FACET_BN_CANCEL = "cancel";
+
private String testUrl;
private String formId;
@@ -187,20 +195,39 @@
*
* @param template - current template
*/
-// @Test
-// public void testEditEventAttribute(Template template) {
-// setTestUrl(EDITEVENT_ATTRIBUTES_PAGE);
-// init(template);
-//
-// selenium.doubleClick(inplaceInputId + EDITEVENT_ATTRIBUTES_ID_PREFIX);
-// Map<String, String> expMap = new HashMap<String, String>();
-// expMap.put("clip", "rect(auto, auto, auto, auto)");
-// assertStyleAttributes(inplaceInputId + EDITEVENT_ATTRIBUTES_ID_PREFIX +
"tempValue", expMap);
-// }
+ @Test
+ public void testEditEventAttribute(Template template) {
+ setTestUrl(EDITEVENT_ATTRIBUTES_PAGE);
+ init(template);
+
+ selenium.doubleClick(inplaceInputId + EDITEVENT_ATTRIBUTES_ID_PREFIX);
+ Map<String, String> expMap = new HashMap<String, String>();
+ expMap.put("clip", "rect(auto auto auto auto)");
+ assertStyleAttributes(inplaceInputId + EDITEVENT_ATTRIBUTES_ID_PREFIX +
"tempValue", expMap);
+ }
+ /**
+ * Check 'controls' facet
+ *
+ * @param template - current template
+ */
+ @Test
+ public void testControlsFacet(Template template) {
+ setTestUrl(CONTROLS_FACET_PAGE);
+ init(template);
+
+ check((isPresentById(CONTROLS_FACET_BN_OK + CONTROLS_FACET_ID_PREFIX) ||
isPresentById(CONTROLS_FACET_BN_CANCEL + CONTROLS_FACET_ID_PREFIX)),
+ CommonUtils.getSuccessfulTestMessage(inplaceInputId + CONTROLS_FACET_ID_PREFIX),
+ CommonUtils.getFailedTestMessage(inplaceInputId + CONTROLS_FACET_ID_PREFIX));
+ }
+
private void checkMessage(String elementId, String expectedValue, String okMsg,
String errMsg) {
String currentValue = getTextById(elementId);
- if (("text:" + expectedValue).equals(currentValue)) {
+ check(("text:" + expectedValue).equals(currentValue), okMsg, errMsg);
+ }
+
+ private void check(boolean expression, String okMsg, String errMsg) {
+ if (expression) {
writeStatus(okMsg);
} else {
writeStatus(errMsg, true);