Author: dsvyatobatsko
Date: 2009-03-23 16:46:03 -0400 (Mon, 23 Mar 2009)
New Revision: 13128
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/AjaxLogBean.java
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/ajaxLog/ajaxLogAutoTest.xhtml
Removed:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/ajaxLog/ajaxLogTest.xhtml
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/faces-config.xml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxLogTest.java
Log:
RF-6321, RF-6322, RF-6323, RF-6324
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/AjaxLogBean.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/AjaxLogBean.java
(rev 0)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/AjaxLogBean.java 2009-03-23
20:46:03 UTC (rev 13128)
@@ -0,0 +1,34 @@
+package org.ajax4jsf.bean;
+
+public class AjaxLogBean {
+
+ private boolean popup = false;
+
+ /**
+ * Gets value of popup field.
+ *
+ * @return value of popup field
+ */
+ public boolean isPopup() {
+ return popup;
+ }
+
+ /**
+ * Set a new value for popup field.
+ *
+ * @param popup
+ * a new value for popup field
+ */
+ public void setPopup(boolean popup) {
+ this.popup = popup;
+ }
+
+ public void initPopupMode() {
+ popup = true;
+ }
+
+ public void reset() {
+ popup = false;
+ }
+
+}
Property changes on:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/AjaxLogBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/faces-config.xml 2009-03-23
19:43:48 UTC (rev 13127)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/faces-config.xml 2009-03-23
20:46:03 UTC (rev 13128)
@@ -368,6 +368,11 @@
<managed-bean-name>suggestionBean</managed-bean-name>
<managed-bean-class>org.ajax4jsf.bean.SuggestionBoxBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+ <managed-bean>
+ <managed-bean-name>logBean</managed-bean-name>
+ <managed-bean-class>org.ajax4jsf.bean.AjaxLogBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<navigation-rule>
<from-view-id>/pages/ajaxInclude/step1.xhtml</from-view-id>
Copied:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/ajaxLog/ajaxLogAutoTest.xhtml
(from rev 13106,
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/ajaxLog/ajaxLogTest.xhtml)
===================================================================
(Binary files differ)
Deleted:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/ajaxLog/ajaxLogTest.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxLogTest.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxLogTest.java 2009-03-23
19:43:48 UTC (rev 13127)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxLogTest.java 2009-03-23
20:46:03 UTC (rev 13128)
@@ -17,17 +17,24 @@
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
+ */
package org.richfaces.testng;
import org.ajax4jsf.template.Template;
+import org.richfaces.AutoTester;
+import org.richfaces.SeleniumEvent;
import org.richfaces.SeleniumTestBase;
+import org.richfaces.AutoTester.TestSetupEntry;
import org.testng.Assert;
import org.testng.annotations.Test;
public class AjaxLogTest extends SeleniumTestBase {
- @Test
+ private final static String RESET_METHOD = "#{logBean.reset}";
+
+ private final static String INIT_POPUP_MODE = "#{logBean.initPopupMode}";
+
+ // @Test
public void testAjaxLogLayout(Template template) {
renderPage(template);
@@ -71,7 +78,8 @@
writeStatus("test style attribute");
- //String style =
selenium.getAttribute("//div[@id='logConsole']/@style");
+ // String style =
+ // selenium.getAttribute("//div[@id='logConsole']/@style");
int w =
selenium.getElementWidth("//div[(a)id='logConsole']").intValue();
int h =
selenium.getElementHeight("//div[(a)id='logConsole']").intValue();
@@ -80,9 +88,127 @@
}
}
+ @Test
+ public void testLogComponentWithPopupTrue(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, INIT_POPUP_MODE);
+ writeStatus("Check log component opens popup window by hotkey, ajax request
changes component content");
+ // TODO: implement test
+ }
+
+ @Test
+ public void testLogComponentWithPopupFalse(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, RESET_METHOD);
+ writeStatus("Check log component is embedded, ajax request changes component
content");
+
+ String inputElemId = tester.getClientId("input");
+ String componentId = "logConsole";
+
+ writeStatus("Type smth. All typing is being logged");
+
+ type(inputElemId, "typing");
+ waitForAjaxCompletion();
+
+ writeStatus("test that log element is present");
+ AssertRendered(componentId);
+
+ writeStatus("at least dozen messages have to be logged");
+ int logCount = selenium.getXpathCount("//div[@id='" + componentId +
"']/div").intValue();
+ if (logCount < 12) {
+ Assert.fail("There are suspiciously few log messages here");
+ }
+ }
+
+ @Test
+ public void testClearLogButton(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, RESET_METHOD);
+ writeStatus("Check clear button clears log");
+
+ String componentId = "logConsole";
+ String inputElemId = tester.getClientId("input");
+
+ writeStatus("Type smth. All typing is being logged");
+
+ type(inputElemId, "typing");
+ waitForAjaxCompletion();
+
+ writeStatus("test that log element is present");
+ AssertRendered(componentId);
+
+ writeStatus("test that clear button is present and has proper label");
+ String buttonXpath = "//div[@id='" + componentId +
"']/button";
+
+ if (selenium.isElementPresent(buttonXpath)) {
+ String clearBtnLabel = selenium.getText(buttonXpath);
+ if (null == clearBtnLabel ||
!clearBtnLabel.trim().equalsIgnoreCase("Clear")) {
+ Assert.fail("Clear button has obscure label");
+ }
+ } else {
+ Assert.fail("Clear button is not rendered");
+ }
+
+ writeStatus("At least dozen messages have to be logged. Check it!");
+ String logDivXpath = "//div[@id='" + componentId +
"']/div";
+ int logCount = selenium.getXpathCount(logDivXpath).intValue();
+ if (logCount < 12) {
+ Assert.fail("There are suspiciously few log messages here");
+ }
+
+ writeStatus("check clear button");
+ selenium.click(buttonXpath);
+
+ logCount = selenium.getXpathCount(logDivXpath).intValue();
+ if (logCount > 0) {
+ Assert.fail("log must be empty");
+ }
+ }
+
+ @Test
+ public void testStylesAndClassesAndHtmlAttributes(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, RESET_METHOD);
+ String componentId = "logConsole";
+
+ writeStatus("Check styles and classes are output to client");
+
+ writeStatus("Check styleClass/style attributes");
+ assertStyleAttributeContains(componentId, "font-size: 13px",
"Style attribute was not output to client");
+ // assertClassAttributeContains(componentId, "noclass", "Class
attribute was not output to client");
+
+ int w = selenium.getElementWidth(componentId).intValue();
+ int h = selenium.getElementHeight(componentId).intValue();
+
+ if (800 != w || 300 != h) {
+ Assert.fail("Style does not affect ajax log component");
+ }
+
+ writeStatus("Test component html events");
+ assertEvents(componentId, SeleniumEvent.STANDARD_HTML_EVENTS);
+ }
+
+ @Test
+ public void testRenderedAttribute(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, RESET_METHOD);
+ writeStatus("Test component with rendered = false is not present on the
page");
+ tester.reset();
+ tester.setupControl(TestSetupEntry.rendered, Boolean.FALSE);
+ tester.clickLoad();
+
+ String componentId = "logConsole";
+ AssertNotPresent(componentId, "Rendered attribute does not work");
+ }
+
@Override
+ public String getAutoTestUrl() {
+ return "pages/ajaxLog/ajaxLogAutoTest.xhtml";
+ }
+
+ @Override
public String getTestUrl() {
- return "pages/ajaxLog/ajaxLogTest.xhtml";
+ throw new UnsupportedOperationException();
}
}
Show replies by date