Author: dsvyatobatsko
Date: 2009-03-02 12:24:13 -0500 (Mon, 02 Mar 2009)
New Revision: 12789
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/pickList/pickListAutoTest.xhtml
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/PickListTestBean.java
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PickListTest.java
Log:
RF-6164, RF-6165, RF-6166, RF-6175
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/PickListTestBean.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/PickListTestBean.java 2009-03-02
16:40:50 UTC (rev 12788)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/PickListTestBean.java 2009-03-02
17:24:13 UTC (rev 12789)
@@ -39,18 +39,12 @@
private List<String> items = Arrays.asList("ZHURIK",
"MELESHKO", "LEONTIEV", "KOVAL", "KALYUZHNY",
"DUDIK",
"KOSTITSYN", "GRABOVSKI");
- private List<SelectItem> options = new ArrayList<SelectItem>();
+ private List<SelectItem> options;
- private List<String> result = new ArrayList<String>();
+ private List<String> result;
public PickListTestBean() {
- for (String player : items) {
- options.add(new SelectItem(player, player));
- }
-
- // preselected items
- result.add(items.get(0));
- result.add(items.get(1));
+ reset();
}
/**
@@ -127,4 +121,15 @@
this.result = result;
}
+ public void reset() {
+ options = new ArrayList<SelectItem>();
+ for (String player : items) {
+ options.add(new SelectItem(player, player));
+ }
+
+ // preselected items
+ result = new ArrayList<String>();
+ result.add(items.get(0));
+ result.add(items.get(1));
+ }
}
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/pickList/pickListAutoTest.xhtml
===================================================================
(Binary files differ)
Property changes on:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/pickList/pickListAutoTest.xhtml
___________________________________________________________________
Name: svn:mime-type
+ application/xhtml+xml
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PickListTest.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PickListTest.java 2009-03-02
16:40:50 UTC (rev 12788)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PickListTest.java 2009-03-02
17:24:13 UTC (rev 12789)
@@ -20,7 +20,11 @@
*/
package org.richfaces.testng;
+import java.util.HashMap;
+import java.util.Map;
+
import org.ajax4jsf.template.Template;
+import org.richfaces.AutoTester;
import org.richfaces.SeleniumTestBase;
import org.testng.Assert;
import org.testng.annotations.Test;
@@ -34,9 +38,19 @@
private static final String REMOVE_ALL_BTN = "removeAll";
private static final String SRC_ELEM_PREFIX = ":source::";
+ private final static String RESET_METHOD = "#{pickListBean.reset}";
+
+ private static Map<String, String> params = new HashMap<String,
String>();
+
+ static {
+ params.put("parameter1", "value1");
+ params.put("parameter2", "value2");
+ params.put("parameter3", "value3");
+ }
+
@Test
public void testPickListComponent(Template template) {
- renderPage(template);
+ renderPage(template, RESET_METHOD);
String parentId = getParentId() + "_form:";
String pickListId = parentId + PICK_LIST;
@@ -76,7 +90,7 @@
writeStatus("Try to move the first item and check state thereafter");
String srcElemPrefix = parentId + PICK_LIST + SRC_ELEM_PREFIX;
- fireMouseEvent(srcElemPrefix + "1", "click", 0, 0, false);
+ fireMouseEvent(srcElemPrefix + "0", "click", 0, 0, false);
clickById(copyElemId);
Assert.assertEquals(getNumberOfChildren(srcListId), 5);
@@ -108,16 +122,47 @@
assertButtonDisabled(REMOVE_ALL_BTN);
}
+ @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.testRendered();
+ }
+
+ @Test
+ public void testConverterAttribute(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, RESET_METHOD);
+ tester.testConverterAttribute();
+ }
+
+ @Test
+ public void testValidatorAndValidatorMessageAttributes(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, RESET_METHOD);
+ tester.testValidatorAndValidatorMessageAttributes(false);
+ }
+
+ @Test
+ public void testRequiredAndRequiredMessageAttributes(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, RESET_METHOD);
+
+ writeStatus("Check required & requiredMessage attributes");
+ tester.testRequiredAndRequiredMessageAttributes();
+ }
+
private void assertButtonEnabled(String btnId) {
String id = getParentId() + "_form:" + PICK_LIST;
- Assert.assertTrue(isVisibleById(id + btnId));
- Assert.assertFalse(isVisibleById(id + "dis" + btnId));
+ AssertVisible(id + btnId);
+ AssertNotVisible(id + "dis" + btnId);
}
private void assertButtonDisabled(String btnId) {
String id = getParentId() + "_form:" + PICK_LIST;
- Assert.assertFalse(isVisibleById(id + btnId));
- Assert.assertTrue(isVisibleById(id + "dis" + btnId));
+ AssertNotVisible(id + btnId);
+ AssertVisible(id + "dis" + btnId);
}
/**
@@ -129,8 +174,24 @@
return selenium.getXpathCount("//*[@id='" + elemId +
"']/*").intValue();
}
+ @Override
+ public void changeValue() {
+ clickById(getAutoTester(this).getClientId(AutoTester.COMPONENT_ID) +
COPY_ALL_BTN);
+ }
+
+ @Override
+ public void setValueEmpty() {
+ clickById(getAutoTester(this).getClientId(AutoTester.COMPONENT_ID) +
REMOVE_ALL_BTN);
+ }
+
+ @Override
public String getTestUrl() {
return "pages/pickList/pickListTest.xhtml";
}
+ @Override
+ public String getAutoTestUrl() {
+ return "pages/pickList/pickListAutoTest.xhtml";
+ }
+
}