Author: dsvyatobatsko
Date: 2008-05-13 06:30:49 -0400 (Tue, 13 May 2008)
New Revision: 8547
Added:
trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/PickListTestBean.java
trunk/test-applications/seleniumTest/src/main/webapp/pages/pickList/
trunk/test-applications/seleniumTest/src/main/webapp/pages/pickList/pickListTest.xhtml
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/PickListTest.java
Modified:
trunk/test-applications/seleniumTest/src/main/webapp/WEB-INF/faces-config.xml
Log:
PickList component test
Added:
trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/PickListTestBean.java
===================================================================
--- trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/PickListTestBean.java
(rev 0)
+++
trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/PickListTestBean.java 2008-05-13
10:30:49 UTC (rev 8547)
@@ -0,0 +1,110 @@
+package org.ajax4jsf;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.faces.model.SelectItem;
+
+public class PickListTestBean {
+
+ private String copyAllLabel = "MOVE ALL";
+
+ private String copyLabel = "MOVE";
+
+ private String removeLabel = "TAKE AWAY";
+
+ private String removeAllLabel = "TAKE ALL AWAY";
+
+ private List<String> items = Arrays.asList("ZHURIK",
"MELESHKO", "LEONTIEV", "KOVAL", "KALYUZHNY",
"DUDIK",
+ "KOSTITSYN", "GRABOVSKI");
+
+ private List<SelectItem> options = new ArrayList<SelectItem>();
+
+ private List<String> result = new ArrayList<String>();
+
+ public PickListTestBean() {
+ for (String player : items) {
+ options.add(new SelectItem(player, player));
+ }
+
+ // preselected items
+ result.add(items.get(0));
+ result.add(items.get(1));
+ }
+
+ /**
+ * Gets value of copyAllLabel field.
+ *
+ * @return value of copyAllLabel field
+ */
+ public String getCopyAllLabel() {
+ return copyAllLabel;
+ }
+
+ /**
+ * Gets value of copyLabel field.
+ *
+ * @return value of copyLabel field
+ */
+ public String getCopyLabel() {
+ return copyLabel;
+ }
+
+ /**
+ * Gets value of removeLabel field.
+ *
+ * @return value of removeLabel field
+ */
+ public String getRemoveLabel() {
+ return removeLabel;
+ }
+
+ /**
+ * Gets value of removeAllLabel field.
+ *
+ * @return value of removeAllLabel field
+ */
+ public String getRemoveAllLabel() {
+ return removeAllLabel;
+ }
+
+ /**
+ * Gets value of options field.
+ *
+ * @return value of options field
+ */
+ public List<SelectItem> getOptions() {
+ return options;
+ }
+
+ /**
+ * Set a new value for options field.
+ *
+ * @param options
+ * a new value for options field
+ */
+ public void setOptions(List<SelectItem> options) {
+ this.options = options;
+ }
+
+ /**
+ * Gets value of result field.
+ *
+ * @return value of result field
+ */
+ public List<String> getResult() {
+ return result;
+ }
+
+ /**
+ * Set a new value for result field.
+ *
+ * @param result
+ * a new value for result field
+ */
+ public void setResult(List<String> result) {
+ this.result = result;
+ }
+
+}
Property changes on:
trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/PickListTestBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified: trunk/test-applications/seleniumTest/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
---
trunk/test-applications/seleniumTest/src/main/webapp/WEB-INF/faces-config.xml 2008-05-13
09:36:53 UTC (rev 8546)
+++
trunk/test-applications/seleniumTest/src/main/webapp/WEB-INF/faces-config.xml 2008-05-13
10:30:49 UTC (rev 8547)
@@ -81,11 +81,15 @@
<managed-bean-name>ddmenuBean</managed-bean-name>
<managed-bean-class>org.ajax4jsf.DropDownMenuTestBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
- </managed-bean>
-
+ </managed-bean>
<managed-bean>
<managed-bean-name>contextMenuBean</managed-bean-name>
<managed-bean-class>org.ajax4jsf.ContextMenuTestBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+ <managed-bean>
+ <managed-bean-name>pickListBean</managed-bean-name>
+ <managed-bean-class>org.ajax4jsf.PickListTestBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
</managed-bean>
</faces-config>
\ No newline at end of file
Added:
trunk/test-applications/seleniumTest/src/main/webapp/pages/pickList/pickListTest.xhtml
===================================================================
(Binary files differ)
Property changes on:
trunk/test-applications/seleniumTest/src/main/webapp/pages/pickList/pickListTest.xhtml
___________________________________________________________________
Name: svn:mime-type
+ application/xhtml+xml
Added: trunk/test-applications/seleniumTest/src/test/java/org/richfaces/PickListTest.java
===================================================================
--- trunk/test-applications/seleniumTest/src/test/java/org/richfaces/PickListTest.java
(rev 0)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/PickListTest.java 2008-05-13
10:30:49 UTC (rev 8547)
@@ -0,0 +1,99 @@
+package org.richfaces;
+
+import org.ajax4jsf.test.base.SeleniumTestBase;
+import org.ajax4jsf.test.base.Templates;
+import org.testng.Assert;
+import org.testng.annotations.AfterTest;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Parameters;
+import org.testng.annotations.Test;
+
+public class PickListTest extends SeleniumTestBase {
+
+ public PickListTest() {
+ super("http", "localhost", "8080");
+ }
+
+ /**
+ * This method are invoking before selenium tests started
+ */
+ @BeforeTest
+ @Parameters( { "browser" })
+ public void startSelenium(String browser) {
+ super.startSelenium(browser);
+ }
+
+ /**
+ * This method are invoking after selenium tests completed
+ */
+ @AfterTest
+ public void stopSelenium() {
+ super.stopSelenium();
+ }
+
+ @Test
+ public void testPickListComponent() throws Exception {
+ _testPickListComponent(Templates.SIMPLE);
+ _testPickListComponent(Templates.DATATABLE);
+ }
+
+ private void _testPickListComponent(Templates template) {
+ renderPage("/faces/pages/pickList/pickListTest.xhtml", template);
+
+ String parentId = getParentId() + "_form:";
+ String pickListId = "pickList";
+ String copyElemId = parentId + pickListId + "discopy";
+ String copyAllElemId = parentId + pickListId + "copyAll";
+ String removeElemId = parentId + pickListId + "disremove";
+ String removeAllElemId = parentId + pickListId + "removeAll";
+
+ writeStatus("Check move controls customized labels");
+
+ AssertTextEquals(copyElemId, "MOVE");
+ AssertTextEquals(copyAllElemId, "MOVE ALL");
+ AssertTextEquals(removeElemId, "TAKE AWAY");
+ AssertTextEquals(removeAllElemId, "TAKE ALL AWAY");
+
+ String destListId = parentId + pickListId + "tlTbody";
+ String srcListId = parentId + pickListId + "tbody";
+
+ writeStatus("Check initial disposition");
+
+ Assert.assertEquals(getNumberOfChildren(srcListId), 6);
+ Assert.assertEquals(getNumberOfChildren(destListId), 2);
+
+ writeStatus("Verify initial selected items.");
+
+
Assert.assertEquals(selenium.getText("dom=selenium.browserbot.getCurrentWindow().$('"
+ destListId
+ + "').down('tr', 0)"), "ZHURIK");
+
Assert.assertEquals(selenium.getText("dom=selenium.browserbot.getCurrentWindow().$('"
+ destListId
+ + "').down('tr', 1)"), "MELESHKO");
+
+ writeStatus("Try to select first item and check state thereafter");
+
+
selenium.doubleClick("dom=selenium.browserbot.getCurrentWindow().$('" +
srcListId + "').down('tr').down('td')");
+ Assert.assertEquals(getNumberOfChildren(srcListId), 5);
+ Assert.assertEquals(getNumberOfChildren(destListId), 3);
+
Assert.assertEquals(selenium.getText("dom=selenium.browserbot.getCurrentWindow().$('"
+ destListId
+ + "').down('tr', 2)"), "LEONTIEV");
+
+ }
+
+ /**
+ * Returns number of children for DOM element with given id.
+ * @param elemId DOM element id
+ * @return number of children
+ */
+ private int getNumberOfChildren(String elemId) {
+ int retVal = -1;
+ try {
+ retVal =
Integer.parseInt(runScript("dom=selenium.browserbot.getCurrentWindow().$('"
+ elemId
+ + "').childElements().size()"));
+ } catch (Exception e) {
+ Assert.fail(e.getMessage());
+ }
+
+ return retVal;
+ }
+
+}
Property changes on:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/PickListTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Show replies by date