Author: andrei_exadel
Date: 2009-02-06 10:06:55 -0500 (Fri, 06 Feb 2009)
New Revision: 12592
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dropDownMenu/dropDownMenuAutoTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/AutoTester.java
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DropDownMenuTest.java
Log:
Drop Down component tests
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dropDownMenu/dropDownMenuAutoTest.xhtml
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dropDownMenu/dropDownMenuAutoTest.xhtml 2009-02-06
13:59:50 UTC (rev 12591)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dropDownMenu/dropDownMenuAutoTest.xhtml 2009-02-06
15:06:55 UTC (rev 12592)
@@ -18,6 +18,9 @@
ajaxSingle="#{autoTestBean.ajaxSingle}"
value="New"
process="#{autoTestBean.process}"
+ bypassUpdates="#{autoTestBean.bypassUpdate}"
+ limitToList="#{autoTestBean.limitToList}"
+ reRender="#{autoTestBean.reRender}"
action="#{ddmenuBean.doNew}"
actionListener="#{autoTestBean.actionListener}"
oncomplete="#{autoTestBean.oncomplete}">
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/AutoTester.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/AutoTester.java 2009-02-06
13:59:50 UTC (rev 12591)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/AutoTester.java 2009-02-06
15:06:55 UTC (rev 12592)
@@ -256,18 +256,22 @@
reset();
setupControl(TestSetupEntry.limitToList, Boolean.TRUE);
- setupControl(TestSetupEntry.reRender, STATUS_ID + "," + TIME_ID);
+ setupControl(TestSetupEntry.reRender, TIME_ID);
clickLoad();
String text = base.getTextById(base.getParentId() + AUTOTEST_FORM_ID + TIME_ID);
+ String status = getStatus();
checkComponentReRendered();
base.AssertTextNotEquals(base.getParentId() + AUTOTEST_FORM_ID + TIME_ID, text,
""
+ "LimitToList = true does not work. Component in reRender list was
not rerendered");
+ base.AssertTextEquals(base.getParentId() + AUTOTEST_FORM_ID + STATUS_ID, status,
"Component inside <a4j:outputPanel ajaxRendered='true'> was rendered
but should not in case of limitToList=true.");
+
}
+
public void testRequestParameters(Map<String, String> params) {
reset();
clickLoad();
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DropDownMenuTest.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DropDownMenuTest.java 2009-02-06
13:59:50 UTC (rev 12591)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DropDownMenuTest.java 2009-02-06
15:06:55 UTC (rev 12592)
@@ -23,10 +23,10 @@
import java.util.HashMap;
import java.util.Map;
-import org.ajax4jsf.autotest.bean.AutoTestBean;
import org.ajax4jsf.template.Template;
import org.richfaces.AutoTester;
import org.richfaces.SeleniumTestBase;
+import org.testng.Assert;
import org.testng.annotations.Test;
public class DropDownMenuTest extends SeleniumTestBase {
@@ -42,7 +42,98 @@
static {
params.put("parameter1", "value1");
}
+
+ @Test
+ public void testOnComplete(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, RESET_METHOD);
+
+ tester.testOncomplete();
+ }
+
+ @Test
+ public void testReRender(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, RESET_METHOD);
+
+ tester.testReRender();
+ }
+
+ @Test
+ public void testLimitToList(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, RESET_METHOD);
+
+ tester.testLimitToList();
+ }
+
+ @Test
+ public void testByPassUpdates(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, RESET_METHOD);
+
+ tester.testBypassUpdate();
+ }
+
+ @Test
+ public void testRendered(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, RESET_METHOD);
+
+ tester.testRendered();
+ }
+
+ @Test
+ public void testDropDownMenuOutput(Template template) {
+ renderPage(template, RESET_METHOD);
+
+ String parentId = getParentId() + "_form:";
+ String file = parentId + "file";
+ String filePath = "//div[@id='" + file +
"']/div[1]";
+ String open = parentId + "open:anchor";
+ String saveAs = parentId + "saveAs:anchor";
+ String save = parentId + "save:anchor";
+ String saveAll = parentId + "saveAll:anchor";
+ String close = parentId + "close:anchor";
+ String exit = parentId + "exit:anchor";
+ String menu = file + "_menu";
+ String separator = parentId + "menuSeparator11";
+ selenium.mouseOver(filePath);
+ pause(1000, menu);
+ Number width = selenium.getElementWidth(menu);
+ System.out.println(width);
+ if (width.equals(0)) {
+ Assert.fail("Drop down menu has null width");
+ }
+ if (selenium.getElementPositionTop(menu).intValue() <= 0) {
+ Assert.fail("Drop down menu should have top position more than 0");
+ }
+ AssertVisible(open);
+ AssertTextEquals(open, "Open", "Open menu Item was not
rendered");
+ AssertVisible(saveAs);
+ AssertTextEquals(saveAs, "Save As...", "Save As... menu Item was
not rendered");
+ AssertVisible(close);
+ AssertTextEquals(close, "Close", "Open menu Item was not
rendered");
+ AssertVisible(exit);
+ AssertTextEquals(exit, "Exit", "Exit menu Item was not
rendered");
+ AssertVisible(parentId + "open:icon", "Icon for menu item was not
rendered");
+
+
+
+ selenium.mouseOver(saveAs);
+ pause(1000, menu);
+ AssertVisible(save);
+ AssertVisible(saveAll);
+ AssertTextEquals(save, "Save", "Save menu Item was not
rendered");
+ AssertTextEquals(saveAll, "Save All", "Save All menu Item was not
rendered");
+ AssertVisible(parentId + "saveAs:folder", "Save as group was not
rendered");
+
+ assertClassNames(separator, new String [] {"dr-menu-separator",
"rich-menu-separator"}, "Separator has invalid css class names",
true);
+ AssertVisible(separator, "Separator was not output");
+
+ }
+
@Test
public void testDropDownMenuComponent(Template template) {
renderPage(template, RESET_METHOD);
@@ -50,7 +141,7 @@
testDropDownComponent();
}
- @Test
+ @Test
public void testWithExternalvalidationFailure(Template template) {
AutoTester autoTester = getAutoTester(this);
autoTester.renderPage(template, RESET_METHOD);