Author: andrei_exadel
Date: 2008-05-23 12:04:20 -0400 (Fri, 23 May 2008)
New Revision: 8734
Added:
trunk/test-applications/seleniumTest/src/main/webapp/index.xhtml
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxCommandButtonTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxCommandLinkTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxPollTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxRegionTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxStatusTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/CalendarTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/ComboBoxTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/ContextMenuTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/DataTableTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/DropDownMenuTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/InplaceSelectTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/InputNumberSpinnerTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/JSFunctionTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/KeepAliveTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/LoadScriptTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/LoadStyleTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/OrderingListTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/PanelBarTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/PanelMenuTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/PickListTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/ProgressBarTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SimpleTogglePanelTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/TabPanelTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/TogglePanelTest.java
Removed:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxCommandButtonTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxCommandLinkTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxPollTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxRegionTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxStatusTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/CalendarTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/ComboBoxTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/ContextMenuTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/DataTableTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/DropDownMenuTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/InplaceSelectTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/InputNumberSpinnerTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/JSFunctionTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/KeepAliveTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/LoadScriptTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/LoadStyleTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/OrderingListTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/PanelBarTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/PanelMenuTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/PickListTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/ProgressBarTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SimpleTogglePanelTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/TabPanelTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/TogglePanelTest.java
Modified:
trunk/test-applications/seleniumTest/src/main/webapp/index.jsp
trunk/test-applications/seleniumTest/src/main/webapp/layout/layout.xhtml
trunk/test-applications/seleniumTest/src/main/webapp/template/dataTable.xhtml
Log:
Modified: trunk/test-applications/seleniumTest/src/main/webapp/index.jsp
===================================================================
--- trunk/test-applications/seleniumTest/src/main/webapp/index.jsp 2008-05-23 15:10:59 UTC
(rev 8733)
+++ trunk/test-applications/seleniumTest/src/main/webapp/index.jsp 2008-05-23 16:04:20 UTC
(rev 8734)
@@ -1,5 +1 @@
-<html>
-<body>
-<h2>Hello World!</h2>
-</body>
-</html>
+<jsp:forward page="faces/index.xhtml"></jsp:forward>
Added: trunk/test-applications/seleniumTest/src/main/webapp/index.xhtml
===================================================================
--- trunk/test-applications/seleniumTest/src/main/webapp/index.xhtml
(rev 0)
+++ trunk/test-applications/seleniumTest/src/main/webapp/index.xhtml 2008-05-23 16:04:20
UTC (rev 8734)
@@ -0,0 +1,23 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:ui="http://java.sun.com/jsf/facelets">
+<body>
+ <h:dataTable value="#{indexBean.list}" var="var">
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="Component"></h:outputText>
+ </f:facet>
+ <h:outputText value="#{var.name}"></h:outputText>
+ </h:column>
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="Link"></h:outputText>
+ </f:facet>
+ <h:outputLink
value="#{facesContext.externalContext.requestContextPath}/faces/pages/#{var.link}">test</h:outputLink>
+ </h:column>
+ </h:dataTable>
+</body>
+</html>
\ No newline at end of file
Modified: trunk/test-applications/seleniumTest/src/main/webapp/layout/layout.xhtml
===================================================================
--- trunk/test-applications/seleniumTest/src/main/webapp/layout/layout.xhtml 2008-05-23
15:10:59 UTC (rev 8733)
+++ trunk/test-applications/seleniumTest/src/main/webapp/layout/layout.xhtml 2008-05-23
16:04:20 UTC (rev 8734)
@@ -83,6 +83,29 @@
</script>
<div id="_Selenium_Test_ControlPoint2" style="display:
none;">Control2</div>
+<hr />
+<table style="background-color: #F2F2F2">
+<tr>
+<td>
+Current Template:
+</td>
+<td>
+ <h:selectOneMenu value="#{templateBean.templateId}"
readonly="true" id="_Selenium_Test_Template_id">
+ <f:selectItem itemValue="simple" itemLabel="Simple"/>
+ <f:selectItem itemValue="dataTable" itemLabel="DataTable"/>
+ <f:selectItem itemValue="modalPanel" itemLabel="Modal
Panel"/>
+ </h:selectOneMenu>
+</td>
+<td>
+ <a href="#"
onclick="loadTemplate(document.getElementById('_Selenium_Test_Template_id').value);
return false;">Load</a>
+</td>
+</tr>
+<tr>
+<td colspan="2">
+ <a
href="#{facesContext.externalContext.requestContextPath}/faces/index.xhtml">home</a>
+</td>
+</tr>
+</table>
</body>
</f:view>
</html>
\ No newline at end of file
Modified: trunk/test-applications/seleniumTest/src/main/webapp/template/dataTable.xhtml
===================================================================
(Binary files differ)
Deleted:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxCommandButtonTest.java
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxCommandButtonTest.java 2008-05-23
15:10:59 UTC (rev 8733)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxCommandButtonTest.java 2008-05-23
16:04:20 UTC (rev 8734)
@@ -1,94 +0,0 @@
-package org.richfaces;
-
-import org.ajax4jsf.test.base.RichSeleniumTest;
-import org.ajax4jsf.test.base.SeleniumTestBase;
-import org.ajax4jsf.test.base.Templates;
-import org.testng.annotations.AfterTest;
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.Parameters;
-import org.testng.annotations.Test;
-
-
-public class AjaxCommandButtonTest extends SeleniumTestBase implements RichSeleniumTest
{
-
- public AjaxCommandButtonTest() {
- 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 testAjaxCommandButtonComponent() throws Exception {
- _testAjaxCommandButtonComponent(Templates.SIMPLE);
- _testAjaxCommandButtonComponent(Templates.DATATABLE);
- _testAjaxCommandButtonComponent(Templates.MODALPANEL);
- }
-
- private void _testAjaxCommandButtonComponent(Templates template) {
- renderPage(getTestUrl(), template);
-
- String parentId = getParentId() + "_form:";
-
- String buttonId = parentId + "b1";
- String inputId = parentId + "_value";
-
- writeStatus("Click button 1 : ");
- clickById(buttonId);
- waitForAjaxCompletion();
- AssertValueEquals(inputId, "12345");
-
- writeStatus("Click button 1 again: ");
- clickById(buttonId);
- waitForAjaxCompletion();
- AssertValueEquals(inputId, "123452345");
-
- buttonId = parentId + "b2";
-
- writeStatus("Click button 2: ");
- clickById(buttonId);
- waitForAjaxCompletion();
- AssertValueEquals(inputId, "1234523455");
-
- buttonId = parentId + "b3";
-
- writeStatus("Click button 3: ");
- clickById(buttonId);
- waitForAjaxCompletion();
- AssertValueEquals(inputId, "1234523455");
-
- buttonId = parentId + "b4";
-
- writeStatus("Click button 4: ");
- clickById(buttonId);
- waitForAjaxCompletion();
- AssertValueEquals(inputId, "12345234555");
-
- buttonId = parentId + "b5";
-
- writeStatus("Click button 5: ");
- clickById(buttonId);
- waitForAjaxCompletion();
- AssertValueEquals(inputId, "12345234555");
-
- }
-
- public String getTestUrl() {
- return "/faces/pages/ajaxCommandButton/ajaxButtonTest.xhtml";
- }
-
-}
Added:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxCommandButtonTest.java
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxCommandButtonTest.java
(rev 0)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxCommandButtonTest.java 2008-05-23
16:04:20 UTC (rev 8734)
@@ -0,0 +1,94 @@
+package org.richfaces;
+
+import org.ajax4jsf.test.base.RichSeleniumTest;
+import org.ajax4jsf.test.base.SeleniumTestBase;
+import org.ajax4jsf.test.base.Templates;
+import org.testng.annotations.AfterTest;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Parameters;
+import org.testng.annotations.Test;
+
+
+public class AjaxCommandButtonTest extends SeleniumTestBase implements RichSeleniumTest
{
+
+ public AjaxCommandButtonTest() {
+ 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 testAjaxCommandButtonComponent() throws Exception {
+ _testAjaxCommandButtonComponent(Templates.SIMPLE);
+ _testAjaxCommandButtonComponent(Templates.DATATABLE);
+ _testAjaxCommandButtonComponent(Templates.MODALPANEL);
+ }
+
+ private void _testAjaxCommandButtonComponent(Templates template) {
+ renderPage(getTestUrl(), template);
+
+ String parentId = getParentId() + "_form:";
+
+ String buttonId = parentId + "b1";
+ String inputId = parentId + "_value";
+
+ writeStatus("Click button 1 : ");
+ clickById(buttonId);
+ waitForAjaxCompletion();
+ AssertValueEquals(inputId, "12345");
+
+ writeStatus("Click button 1 again: ");
+ clickById(buttonId);
+ waitForAjaxCompletion();
+ AssertValueEquals(inputId, "123452345");
+
+ buttonId = parentId + "b2";
+
+ writeStatus("Click button 2: ");
+ clickById(buttonId);
+ waitForAjaxCompletion();
+ AssertValueEquals(inputId, "1234523455");
+
+ buttonId = parentId + "b3";
+
+ writeStatus("Click button 3: ");
+ clickById(buttonId);
+ waitForAjaxCompletion();
+ AssertValueEquals(inputId, "1234523455");
+
+ buttonId = parentId + "b4";
+
+ writeStatus("Click button 4: ");
+ clickById(buttonId);
+ waitForAjaxCompletion();
+ AssertValueEquals(inputId, "12345234555");
+
+ buttonId = parentId + "b5";
+
+ writeStatus("Click button 5: ");
+ clickById(buttonId);
+ waitForAjaxCompletion();
+ AssertValueEquals(inputId, "12345234555");
+
+ }
+
+ public String getTestUrl() {
+ return "/faces/pages/ajaxCommandButton/ajaxButtonTest.xhtml";
+ }
+
+}
Deleted:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxCommandLinkTest.java
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxCommandLinkTest.java 2008-05-23
15:10:59 UTC (rev 8733)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxCommandLinkTest.java 2008-05-23
16:04:20 UTC (rev 8734)
@@ -1,93 +0,0 @@
-package org.richfaces;
-
-import org.ajax4jsf.test.base.RichSeleniumTest;
-import org.ajax4jsf.test.base.SeleniumTestBase;
-import org.ajax4jsf.test.base.Templates;
-import org.testng.annotations.AfterTest;
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.Parameters;
-import org.testng.annotations.Test;
-
-public class AjaxCommandLinkTest extends SeleniumTestBase implements RichSeleniumTest {
-
- public AjaxCommandLinkTest() {
- 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 testAjaxCommandLinkComponent() throws Exception {
- _testAjaxCommandLinkComponent(Templates.SIMPLE);
- _testAjaxCommandLinkComponent(Templates.DATATABLE);
- _testAjaxCommandLinkComponent(Templates.MODALPANEL);
- }
-
- private void _testAjaxCommandLinkComponent(Templates template) {
- renderPage(getTestUrl(), template);
-
- String parentId = getParentId() + "_form:";
-
- String LinkId = parentId + "l1";
- String inputId = parentId + "_value";
-
- writeStatus("Click link 1 : ");
- clickById(LinkId);
- waitForAjaxCompletion();
- AssertValueEquals(inputId, "12345");
-
- writeStatus("Click link 1 again: ");
- clickById(LinkId);
- waitForAjaxCompletion();
- AssertValueEquals(inputId, "123452345");
-
- LinkId = parentId + "l2";
-
- writeStatus("Click link 2 : ");
- clickById(LinkId);
- waitForAjaxCompletion();
- AssertValueEquals(inputId, "1234523455");
-
- LinkId = parentId + "l3";
-
- writeStatus("Click link 3 : ");
- clickById(LinkId);
- waitForAjaxCompletion();
- AssertValueEquals(inputId, "1234523455");
-
- LinkId = parentId + "l4";
-
- writeStatus("Click link 4 : ");
- clickById(LinkId);
- waitForAjaxCompletion();
- AssertValueEquals(inputId, "12345234555");
-
- LinkId = parentId + "l5";
-
- writeStatus("Click link 5 : ");
- clickById(LinkId);
- waitForAjaxCompletion();
- AssertValueEquals(inputId, "12345234555");
-
- }
-
- public String getTestUrl() {
- return "/faces/pages/ajaxCommandLink/ajaxLinkTest.xhtml";
- }
-
-}
Added:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxCommandLinkTest.java
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxCommandLinkTest.java
(rev 0)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxCommandLinkTest.java 2008-05-23
16:04:20 UTC (rev 8734)
@@ -0,0 +1,93 @@
+package org.richfaces;
+
+import org.ajax4jsf.test.base.RichSeleniumTest;
+import org.ajax4jsf.test.base.SeleniumTestBase;
+import org.ajax4jsf.test.base.Templates;
+import org.testng.annotations.AfterTest;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Parameters;
+import org.testng.annotations.Test;
+
+public class AjaxCommandLinkTest extends SeleniumTestBase implements RichSeleniumTest {
+
+ public AjaxCommandLinkTest() {
+ 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 testAjaxCommandLinkComponent() throws Exception {
+ _testAjaxCommandLinkComponent(Templates.SIMPLE);
+ _testAjaxCommandLinkComponent(Templates.DATATABLE);
+ _testAjaxCommandLinkComponent(Templates.MODALPANEL);
+ }
+
+ private void _testAjaxCommandLinkComponent(Templates template) {
+ renderPage(getTestUrl(), template);
+
+ String parentId = getParentId() + "_form:";
+
+ String LinkId = parentId + "l1";
+ String inputId = parentId + "_value";
+
+ writeStatus("Click link 1 : ");
+ clickById(LinkId);
+ waitForAjaxCompletion();
+ AssertValueEquals(inputId, "12345");
+
+ writeStatus("Click link 1 again: ");
+ clickById(LinkId);
+ waitForAjaxCompletion();
+ AssertValueEquals(inputId, "123452345");
+
+ LinkId = parentId + "l2";
+
+ writeStatus("Click link 2 : ");
+ clickById(LinkId);
+ waitForAjaxCompletion();
+ AssertValueEquals(inputId, "1234523455");
+
+ LinkId = parentId + "l3";
+
+ writeStatus("Click link 3 : ");
+ clickById(LinkId);
+ waitForAjaxCompletion();
+ AssertValueEquals(inputId, "1234523455");
+
+ LinkId = parentId + "l4";
+
+ writeStatus("Click link 4 : ");
+ clickById(LinkId);
+ waitForAjaxCompletion();
+ AssertValueEquals(inputId, "12345234555");
+
+ LinkId = parentId + "l5";
+
+ writeStatus("Click link 5 : ");
+ clickById(LinkId);
+ waitForAjaxCompletion();
+ AssertValueEquals(inputId, "12345234555");
+
+ }
+
+ public String getTestUrl() {
+ return "/faces/pages/ajaxCommandLink/ajaxLinkTest.xhtml";
+ }
+
+}
Deleted:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxPollTest.java
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxPollTest.java 2008-05-23
15:10:59 UTC (rev 8733)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxPollTest.java 2008-05-23
16:04:20 UTC (rev 8734)
@@ -1,80 +0,0 @@
-/**
- *
- */
-package org.richfaces;
-
-import org.ajax4jsf.test.base.RichSeleniumTest;
-import org.ajax4jsf.test.base.SeleniumTestBase;
-import org.ajax4jsf.test.base.Templates;
-import org.testng.annotations.AfterTest;
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.Parameters;
-import org.testng.annotations.Test;
-
-/**
- * @author Andrey Markavstov
- *
- */
-public class AjaxPollTest extends SeleniumTestBase implements RichSeleniumTest {
-
- public AjaxPollTest() {
- 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 testAjaxPollComponent() {
- _testAjaxPollComponent(Templates.SIMPLE);
- _testAjaxPollComponent(Templates.DATATABLE);
- _testAjaxPollComponent(Templates.MODALPANEL);
- }
-
- private void _testAjaxPollComponent(Templates template) {
- renderPage(getTestUrl(), template);
- String parentId = getParentId() + "_form:";
- String pollId = parentId + "poll";
- String inputId = parentId + "_value";
-
- writeStatus("Start polling...");
- clickById(parentId + "_enabled");
- waitForAjaxCompletion();
- AssertValueEquals(inputId, "1");
-
- writeStatus("Polling in progress...");
- pause(1500, pollId);
- AssertValueNotEquals(inputId, "1");
- waiteForCondition("document.getElementById('"+inputId+"').value
== 8", 7000);
-
- pause(1500, pollId);
- writeStatus("Polling should be stopped...");
- AssertValueEquals(inputId, "8");
- AssertTextEquals(parentId + "_text", "Polling");
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.test.base.RichSeleniumTest#getTestUrl()
- */
- public String getTestUrl() {
- return "/faces/pages/ajaxPoll/ajaxPollTest.xhtml";
- }
-
-}
Added: trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxPollTest.java
===================================================================
--- trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxPollTest.java
(rev 0)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxPollTest.java 2008-05-23
16:04:20 UTC (rev 8734)
@@ -0,0 +1,80 @@
+/**
+ *
+ */
+package org.richfaces;
+
+import org.ajax4jsf.test.base.RichSeleniumTest;
+import org.ajax4jsf.test.base.SeleniumTestBase;
+import org.ajax4jsf.test.base.Templates;
+import org.testng.annotations.AfterTest;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Parameters;
+import org.testng.annotations.Test;
+
+/**
+ * @author Andrey Markavstov
+ *
+ */
+public class AjaxPollTest extends SeleniumTestBase implements RichSeleniumTest {
+
+ public AjaxPollTest() {
+ 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 testAjaxPollComponent() {
+ _testAjaxPollComponent(Templates.SIMPLE);
+ _testAjaxPollComponent(Templates.DATATABLE);
+ _testAjaxPollComponent(Templates.MODALPANEL);
+ }
+
+ private void _testAjaxPollComponent(Templates template) {
+ renderPage(getTestUrl(), template);
+ String parentId = getParentId() + "_form:";
+ String pollId = parentId + "poll";
+ String inputId = parentId + "_value";
+
+ writeStatus("Start polling...");
+ clickById(parentId + "_enabled");
+ waitForAjaxCompletion();
+ AssertValueEquals(inputId, "1");
+
+ writeStatus("Polling in progress...");
+ pause(1500, pollId);
+ AssertValueNotEquals(inputId, "1");
+ waiteForCondition("document.getElementById('"+inputId+"').value
== 8", 7000);
+
+ pause(1500, pollId);
+ writeStatus("Polling should be stopped...");
+ AssertValueEquals(inputId, "8");
+ AssertTextEquals(parentId + "_text", "Polling");
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.test.base.RichSeleniumTest#getTestUrl()
+ */
+ public String getTestUrl() {
+ return "/faces/pages/ajaxPoll/ajaxPollTest.xhtml";
+ }
+
+}
Deleted:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxRegionTest.java
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxRegionTest.java 2008-05-23
15:10:59 UTC (rev 8733)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxRegionTest.java 2008-05-23
16:04:20 UTC (rev 8734)
@@ -1,98 +0,0 @@
-package org.richfaces;
-
-import org.ajax4jsf.test.base.SeleniumTestBase;
-import org.ajax4jsf.test.base.Templates;
-import org.testng.annotations.AfterTest;
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.Parameters;
-import org.testng.annotations.Test;
-
-public class AjaxRegionTest extends SeleniumTestBase {
-
- public AjaxRegionTest() {
- 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 testAjaxRegionComponent() throws Exception {
- _testAjaxRegionComponent(Templates.SIMPLE);
- _testAjaxRegionComponent(Templates.DATATABLE);
- _testAjaxRegionComponent(Templates.MODALPANEL);
- }
-
- private void _testAjaxRegionComponent(Templates template) {
- renderPage("/faces/pages/ajaxRegion/ajaxRegionTest.xhtml", template);
-
- String parentId = getParentId() + "_form:";
-
- writeStatus("check nested regions");
-
- String externalLink = parentId + "externalLink";
- String internalLink = parentId + "internalLink";
-
- String internalElemId = parentId + "internal";
- String externalElemId = parentId + "external";
-
- selenium.type(internalElemId, "5");
- selenium.type(externalElemId, "5");
-
- clickById(internalLink);
- waitForAjaxCompletion();
- AssertValueEquals(internalElemId, "5");
- AssertValueEquals(externalElemId, "0");
-
- selenium.type(internalElemId, "10");
- selenium.type(externalElemId, "10");
-
- clickById(externalLink);
- waitForAjaxCompletion();
- AssertValueEquals(internalElemId, "10");
- AssertValueEquals(externalElemId, "10");
-
- writeStatus("verify \"selfRendered\" component's
attribute");
-
- String selfRenderedLink = parentId + "selfRenderedLink";
- clickById(selfRenderedLink);
- waitForAjaxCompletion();
- AssertNotPresent("transientText");
-
- writeStatus("verify \"renderRegionOnly\" component's
attribute");
-
- String renderOnlyLink = parentId + "renderOnlyLink";
- String renderLink = parentId + "renderLink";
-
- String renderOnlyElemId = parentId + "renderOnly";
- String renderElemId = parentId + "render";
-
- selenium.type(renderOnlyElemId, "7");
-
- clickById(renderOnlyLink);
-
- AssertValueEquals(renderOnlyElemId, "7");
- AssertValueEquals(renderElemId, "0");
-
- selenium.type(renderElemId, "11");
- clickById(renderLink);
-
- AssertValueEquals(renderOnlyElemId, "11");
- AssertValueEquals(renderElemId, "11");
- }
-
-}
Added:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxRegionTest.java
===================================================================
--- trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxRegionTest.java
(rev 0)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxRegionTest.java 2008-05-23
16:04:20 UTC (rev 8734)
@@ -0,0 +1,103 @@
+package org.richfaces;
+
+import org.ajax4jsf.test.base.RichSeleniumTest;
+import org.ajax4jsf.test.base.SeleniumTestBase;
+import org.ajax4jsf.test.base.Templates;
+import org.testng.annotations.AfterTest;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Parameters;
+import org.testng.annotations.Test;
+
+public class AjaxRegionTest extends SeleniumTestBase implements RichSeleniumTest {
+
+ public AjaxRegionTest() {
+ 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 testAjaxRegionComponent() throws Exception {
+ _testAjaxRegionComponent(Templates.SIMPLE);
+ _testAjaxRegionComponent(Templates.DATATABLE);
+ _testAjaxRegionComponent(Templates.MODALPANEL);
+ }
+
+ private void _testAjaxRegionComponent(Templates template) {
+ renderPage(getTestUrl(), template);
+
+ String parentId = getParentId() + "_form:";
+
+ writeStatus("check nested regions");
+
+ String externalLink = parentId + "externalLink";
+ String internalLink = parentId + "internalLink";
+
+ String internalElemId = parentId + "internal";
+ String externalElemId = parentId + "external";
+
+ selenium.type(internalElemId, "5");
+ selenium.type(externalElemId, "5");
+
+ clickById(internalLink);
+ waitForAjaxCompletion();
+ AssertValueEquals(internalElemId, "5");
+ AssertValueEquals(externalElemId, "0");
+
+ selenium.type(internalElemId, "10");
+ selenium.type(externalElemId, "10");
+
+ clickById(externalLink);
+ waitForAjaxCompletion();
+ AssertValueEquals(internalElemId, "10");
+ AssertValueEquals(externalElemId, "10");
+
+ writeStatus("verify \"selfRendered\" component's
attribute");
+
+ String selfRenderedLink = parentId + "selfRenderedLink";
+ clickById(selfRenderedLink);
+ waitForAjaxCompletion();
+ AssertNotPresent("transientText");
+
+ writeStatus("verify \"renderRegionOnly\" component's
attribute");
+
+ String renderOnlyLink = parentId + "renderOnlyLink";
+ String renderLink = parentId + "renderLink";
+
+ String renderOnlyElemId = parentId + "renderOnly";
+ String renderElemId = parentId + "render";
+
+ selenium.type(renderOnlyElemId, "7");
+
+ clickById(renderOnlyLink);
+
+ AssertValueEquals(renderOnlyElemId, "7");
+ AssertValueEquals(renderElemId, "0");
+
+ selenium.type(renderElemId, "11");
+ clickById(renderLink);
+
+ AssertValueEquals(renderOnlyElemId, "11");
+ AssertValueEquals(renderElemId, "11");
+ }
+
+ public String getTestUrl() {
+ return "/faces/pages/ajaxRegion/ajaxRegionTest.xhtml";
+ }
+
+}
Deleted:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxStatusTest.java
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxStatusTest.java 2008-05-23
15:10:59 UTC (rev 8733)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxStatusTest.java 2008-05-23
16:04:20 UTC (rev 8734)
@@ -1,86 +0,0 @@
-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 AjaxStatusTest extends SeleniumTestBase {
-
- public AjaxStatusTest() {
- 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 testAjaxStatusComponent() throws Exception {
- _testAjaxStatusComponent(Templates.SIMPLE);
- _testAjaxStatusComponent(Templates.DATATABLE);
- _testAjaxStatusComponent(Templates.MODALPANEL);
- }
-
- private void _testAjaxStatusComponent(Templates template) {
- renderPage("/faces/pages/ajaxStatus/ajaxStatusTest.xhtml", template);
-
- String parentId = getParentId() + "_form:";
- String btn1 = parentId + "button1";
- clickById(btn1);
-
- String reg1Status = parentId + "region1:status";
-
- writeStatus("Ajax request is in progress");
-
- AssertVisible(reg1Status + ".start");
- AssertNotVisible(reg1Status + ".stop");
- String start = getTextById(reg1Status + ".start");
- Assert.assertTrue(start.startsWith("In progress..."));
- pause(3000, reg1Status);
-
- writeStatus("Ajax request completed");
-
- AssertNotVisible(reg1Status + ".start");
- AssertVisible(reg1Status + ".stop");
- String stop = getTextById(reg1Status + ".stop");
- Assert.assertTrue(stop.startsWith("Complete"));
-
- String btn2 = parentId + "button2";
- clickById(btn2);
-
- String reg2Status = parentId + "region2:status";
-
- writeStatus("Ajax request is in progress");
-
- AssertVisible(reg2Status + ".start");
- AssertNotVisible(reg2Status + ".stop");
- start = getTextById(reg2Status + ".start");
- Assert.assertTrue(start.startsWith("In progress..."));
- pause(3000, reg2Status);
-
- writeStatus("Ajax request completed");
-
- AssertNotVisible(reg2Status + ".start");
- AssertVisible(reg2Status + ".stop");
- stop = getTextById(reg1Status + ".stop");
- Assert.assertTrue(stop.startsWith("Complete"));
-
- }
-}
Added:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxStatusTest.java
===================================================================
--- trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxStatusTest.java
(rev 0)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxStatusTest.java 2008-05-23
16:04:20 UTC (rev 8734)
@@ -0,0 +1,91 @@
+package org.richfaces;
+
+import org.ajax4jsf.test.base.RichSeleniumTest;
+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 AjaxStatusTest extends SeleniumTestBase implements RichSeleniumTest {
+
+ public AjaxStatusTest() {
+ 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 testAjaxStatusComponent() throws Exception {
+ _testAjaxStatusComponent(Templates.SIMPLE);
+ _testAjaxStatusComponent(Templates.DATATABLE);
+ _testAjaxStatusComponent(Templates.MODALPANEL);
+ }
+
+ private void _testAjaxStatusComponent(Templates template) {
+ renderPage(getTestUrl(), template);
+
+ String parentId = getParentId() + "_form:";
+ String btn1 = parentId + "button1";
+ clickById(btn1);
+
+ String reg1Status = parentId + "region1:status";
+
+ writeStatus("Ajax request is in progress");
+
+ AssertVisible(reg1Status + ".start");
+ AssertNotVisible(reg1Status + ".stop");
+ String start = getTextById(reg1Status + ".start");
+ Assert.assertTrue(start.startsWith("In progress..."));
+ pause(3000, reg1Status);
+
+ writeStatus("Ajax request completed");
+
+ AssertNotVisible(reg1Status + ".start");
+ AssertVisible(reg1Status + ".stop");
+ String stop = getTextById(reg1Status + ".stop");
+ Assert.assertTrue(stop.startsWith("Complete"));
+
+ String btn2 = parentId + "button2";
+ clickById(btn2);
+
+ String reg2Status = parentId + "region2:status";
+
+ writeStatus("Ajax request is in progress");
+
+ AssertVisible(reg2Status + ".start");
+ AssertNotVisible(reg2Status + ".stop");
+ start = getTextById(reg2Status + ".start");
+ Assert.assertTrue(start.startsWith("In progress..."));
+ pause(3000, reg2Status);
+
+ writeStatus("Ajax request completed");
+
+ AssertNotVisible(reg2Status + ".start");
+ AssertVisible(reg2Status + ".stop");
+ stop = getTextById(reg1Status + ".stop");
+ Assert.assertTrue(stop.startsWith("Complete"));
+
+ }
+
+ public String getTestUrl() {
+ return "/faces/pages/ajaxStatus/ajaxStatusTest.xhtml";
+ }
+}
Deleted:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/CalendarTest.java
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/CalendarTest.java 2008-05-23
15:10:59 UTC (rev 8733)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/CalendarTest.java 2008-05-23
16:04:20 UTC (rev 8734)
@@ -1,148 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * 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;
-
-import java.text.ParseException;
-import java.util.Date;
-
-import org.ajax4jsf.CalendarTestBean;
-import org.ajax4jsf.test.base.RichSeleniumTest;
-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 CalendarTest extends SeleniumTestBase implements RichSeleniumTest {
-
- /**
- * Default constructor
- */
- public CalendarTest() {
- 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 testContextMenuComponent() throws Exception {
- _testSelectDateComponent(Templates.SIMPLE);
- _testCalendarComponent(Templates.DATATABLE);
- _testCalendarComponent(Templates.MODALPANEL);
- }
-
- private void _testCalendarComponent(Templates template) {
- renderPage(getTestUrl(), template);
-
- String containerId = getParentId() + "_form:";
- String calendarOpenedId = containerId + "calendar";
- String calendarCollapsedId = calendarOpenedId + "Popup";
- String calendarInputDate = calendarOpenedId + "InputDate";
- String calendarPopupButton = calendarCollapsedId + "Button";
- String outputPanel = containerId + "outputPanel";
-
- Assert.assertFalse(isVisibleById(calendarOpenedId), "Calendar window should NOT be
visible on the component!");
-
- writeStatus("Mouse click on calendar InputDate field");
- clickById(calendarInputDate);
-
- Assert.assertTrue(isVisibleById(calendarOpenedId), "Calendar window should be
visible on the component!");
-
- writeStatus("Mouse click outside calendar");
- clickById(outputPanel);
-
- Assert.assertFalse(isVisibleById(calendarOpenedId), "Calendar window should NOT be
visible on the component!");
-
- writeStatus("Mouse click on calendar popup button");
- clickById(calendarPopupButton);
-
- Assert.assertTrue(isVisibleById(calendarOpenedId), "Calendar window should be
visible on the component!");
- }
-
- private void _testSelectDateComponent(Templates template) {
- renderPage(getTestUrl(), template);
-
- Date newSelectedDate = CalendarTestBean.getDayInMay(15);
-
- String containerId = getParentId() + "_form:";
- String calendarOpenedId = containerId + "calendar";
- String calendarCollapsedId = calendarOpenedId + "Popup";
- String calendarInputDate = calendarOpenedId + "InputDate";
- String calendarPopupButton = calendarCollapsedId + "Button";
- String outputPanel = containerId + "outputPanel";
-
- Assert.assertFalse(isVisibleById(calendarOpenedId), "Calendar window should NOT be
visible on the component!");
- writeStatus("Mouse click on calendar popup button");
- clickById(calendarPopupButton);
- Assert.assertTrue(isVisibleById(calendarOpenedId), "Calendar window should be
visible on the component!");
-
- String inputDateString = getValueById(calendarInputDate);
- Date readDate = null;
- try {
- readDate = CalendarTestBean.DATE_FORMAT.parse(inputDateString);
- } catch(ParseException parseException) {
- // skip exception
- }
- Assert.assertEquals(readDate, CalendarTestBean.DEFAULT_DATE, "Default date
representation is wrong!");
-
- // click on 15th of May
- String newSelectedDateId = calendarOpenedId + "DayCell18";
- clickById(newSelectedDateId);
-
- writeStatus("Mouse click outside calendar");
- clickById(outputPanel);
-
- inputDateString = getValueById(calendarInputDate);
- try {
- readDate = CalendarTestBean.DATE_FORMAT.parse(inputDateString);
- } catch(ParseException parseException) {
- // skip exception
- }
- Assert.assertEquals(readDate, newSelectedDate, "Date representation after selecting
15.May.2008 is wrong!");
-
- Assert.assertFalse(isVisibleById(calendarOpenedId), "Calendar window should NOT be
visible on the component!");
-
-
- }
-
- public String getTestUrl() {
- return "/faces/pages/calendar/calendarTest.xhtml";
- }
-}
Added: trunk/test-applications/seleniumTest/src/test/java/org/richfaces/CalendarTest.java
===================================================================
--- trunk/test-applications/seleniumTest/src/test/java/org/richfaces/CalendarTest.java
(rev 0)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/CalendarTest.java 2008-05-23
16:04:20 UTC (rev 8734)
@@ -0,0 +1,148 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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;
+
+import java.text.ParseException;
+import java.util.Date;
+
+import org.ajax4jsf.CalendarTestBean;
+import org.ajax4jsf.test.base.RichSeleniumTest;
+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 CalendarTest extends SeleniumTestBase implements RichSeleniumTest {
+
+ /**
+ * Default constructor
+ */
+ public CalendarTest() {
+ 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 testContextMenuComponent() throws Exception {
+ _testSelectDateComponent(Templates.SIMPLE);
+ _testCalendarComponent(Templates.DATATABLE);
+ _testCalendarComponent(Templates.MODALPANEL);
+ }
+
+ private void _testCalendarComponent(Templates template) {
+ renderPage(getTestUrl(), template);
+
+ String containerId = getParentId() + "_form:";
+ String calendarOpenedId = containerId + "calendar";
+ String calendarCollapsedId = calendarOpenedId + "Popup";
+ String calendarInputDate = calendarOpenedId + "InputDate";
+ String calendarPopupButton = calendarCollapsedId + "Button";
+ String outputPanel = containerId + "outputPanel";
+
+ Assert.assertFalse(isVisibleById(calendarOpenedId), "Calendar window should NOT be
visible on the component!");
+
+ writeStatus("Mouse click on calendar InputDate field");
+ clickById(calendarInputDate);
+
+ Assert.assertTrue(isVisibleById(calendarOpenedId), "Calendar window should be
visible on the component!");
+
+ writeStatus("Mouse click outside calendar");
+ clickById(outputPanel);
+
+ Assert.assertFalse(isVisibleById(calendarOpenedId), "Calendar window should NOT be
visible on the component!");
+
+ writeStatus("Mouse click on calendar popup button");
+ clickById(calendarPopupButton);
+
+ Assert.assertTrue(isVisibleById(calendarOpenedId), "Calendar window should be
visible on the component!");
+ }
+
+ private void _testSelectDateComponent(Templates template) {
+ renderPage(getTestUrl(), template);
+
+ Date newSelectedDate = CalendarTestBean.getDayInMay(15);
+
+ String containerId = getParentId() + "_form:";
+ String calendarOpenedId = containerId + "calendar";
+ String calendarCollapsedId = calendarOpenedId + "Popup";
+ String calendarInputDate = calendarOpenedId + "InputDate";
+ String calendarPopupButton = calendarCollapsedId + "Button";
+ String outputPanel = containerId + "outputPanel";
+
+ Assert.assertFalse(isVisibleById(calendarOpenedId), "Calendar window should NOT be
visible on the component!");
+ writeStatus("Mouse click on calendar popup button");
+ clickById(calendarPopupButton);
+ Assert.assertTrue(isVisibleById(calendarOpenedId), "Calendar window should be
visible on the component!");
+
+ String inputDateString = getValueById(calendarInputDate);
+ Date readDate = null;
+ try {
+ readDate = CalendarTestBean.DATE_FORMAT.parse(inputDateString);
+ } catch(ParseException parseException) {
+ // skip exception
+ }
+ Assert.assertEquals(readDate, CalendarTestBean.DEFAULT_DATE, "Default date
representation is wrong!");
+
+ // click on 15th of May
+ String newSelectedDateId = calendarOpenedId + "DayCell18";
+ clickById(newSelectedDateId);
+
+ writeStatus("Mouse click outside calendar");
+ clickById(outputPanel);
+
+ inputDateString = getValueById(calendarInputDate);
+ try {
+ readDate = CalendarTestBean.DATE_FORMAT.parse(inputDateString);
+ } catch(ParseException parseException) {
+ // skip exception
+ }
+ Assert.assertEquals(readDate, newSelectedDate, "Date representation after selecting
15.May.2008 is wrong!");
+
+ Assert.assertFalse(isVisibleById(calendarOpenedId), "Calendar window should NOT be
visible on the component!");
+
+
+ }
+
+ public String getTestUrl() {
+ return "/faces/pages/calendar/calendarTest.xhtml";
+ }
+}
Deleted:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/ComboBoxTest.java
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/ComboBoxTest.java 2008-05-23
15:10:59 UTC (rev 8733)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/ComboBoxTest.java 2008-05-23
16:04:20 UTC (rev 8734)
@@ -1,83 +0,0 @@
-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 ComboBoxTest extends SeleniumTestBase {
-
- public ComboBoxTest() {
- 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 testComboBoxComponent() throws Exception {
- _testComboBoxComponent(Templates.SIMPLE);
- _testComboBoxComponent(Templates.DATATABLE);
- _testComboBoxComponent(Templates.MODALPANEL);
- }
-
- private void _testComboBoxComponent(Templates template) {
- renderPage("/faces/pages/comboBox/comboBoxTest.xhtml", template);
-
- String parentId = getParentId() + "_form:";
-
- String predefinedCBId = parentId + "predefined";
- String selectItemsCBId = parentId + "selectItems";
- String suggestionValuesCBId = parentId + "suggestionValues";
-
- writeStatus("check components' default labels");
-
- getTextById(predefinedCBId + "comboboxField").startsWith("Select
a");
- getTextById(selectItemsCBId + "comboboxField").startsWith("Select
a");
- getTextById(suggestionValuesCBId +
"comboboxField").startsWith("Select a");
-
- writeStatus("check a combobox with predefined suggestions");
-
- clickById(predefinedCBId);
- writeStatus("type \"Hunt\"");
-
- selenium.type(predefinedCBId + "comboboxField", "Hunt");
- selenium.typeKeys(predefinedCBId + "comboboxField", "Hunt");
-
- Assert.assertTrue(isVisibleById(predefinedCBId + "list"),
"Component pop-up should show up on click");
-
- clickById(predefinedCBId + "list");
-
- Assert.assertFalse(isVisibleById(predefinedCBId + "list"),
"Component pop-up has to be closed");
- Assert.assertEquals(getValue(predefinedCBId), "Hunter");
-
- delay(2000);
- }
-
- /**
- * Gets component value.
- * @param clientId
- * @return
- */
- private String getValue(String clientId) {
- return runScript("$('" + clientId +
"comboboxValue').value;");
- }
-
-}
Added: trunk/test-applications/seleniumTest/src/test/java/org/richfaces/ComboBoxTest.java
===================================================================
--- trunk/test-applications/seleniumTest/src/test/java/org/richfaces/ComboBoxTest.java
(rev 0)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/ComboBoxTest.java 2008-05-23
16:04:20 UTC (rev 8734)
@@ -0,0 +1,88 @@
+package org.richfaces;
+
+import org.ajax4jsf.test.base.RichSeleniumTest;
+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 ComboBoxTest extends SeleniumTestBase implements RichSeleniumTest {
+
+ public ComboBoxTest() {
+ 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 testComboBoxComponent() throws Exception {
+ _testComboBoxComponent(Templates.SIMPLE);
+ _testComboBoxComponent(Templates.DATATABLE);
+ _testComboBoxComponent(Templates.MODALPANEL);
+ }
+
+ private void _testComboBoxComponent(Templates template) {
+ renderPage(getTestUrl(), template);
+
+ String parentId = getParentId() + "_form:";
+
+ String predefinedCBId = parentId + "predefined";
+ String selectItemsCBId = parentId + "selectItems";
+ String suggestionValuesCBId = parentId + "suggestionValues";
+
+ writeStatus("check components' default labels");
+
+ getTextById(predefinedCBId + "comboboxField").startsWith("Select
a");
+ getTextById(selectItemsCBId + "comboboxField").startsWith("Select
a");
+ getTextById(suggestionValuesCBId +
"comboboxField").startsWith("Select a");
+
+ writeStatus("check a combobox with predefined suggestions");
+
+ clickById(predefinedCBId);
+ writeStatus("type \"Hunt\"");
+
+ selenium.type(predefinedCBId + "comboboxField", "Hunt");
+ selenium.typeKeys(predefinedCBId + "comboboxField", "Hunt");
+
+ Assert.assertTrue(isVisibleById(predefinedCBId + "list"),
"Component pop-up should show up on click");
+
+ clickById(predefinedCBId + "list");
+
+ Assert.assertFalse(isVisibleById(predefinedCBId + "list"),
"Component pop-up has to be closed");
+ Assert.assertEquals(getValue(predefinedCBId), "Hunter");
+
+ delay(2000);
+ }
+
+ /**
+ * Gets component value.
+ * @param clientId
+ * @return
+ */
+ private String getValue(String clientId) {
+ return runScript("$('" + clientId +
"comboboxValue').value;");
+ }
+
+ public String getTestUrl() {
+ return "/faces/pages/comboBox/comboBoxTest.xhtml";
+ }
+
+}
Deleted:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/ContextMenuTest.java
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/ContextMenuTest.java 2008-05-23
15:10:59 UTC (rev 8733)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/ContextMenuTest.java 2008-05-23
16:04:20 UTC (rev 8734)
@@ -1,124 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * 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;
-
-import org.ajax4jsf.test.base.RichSeleniumTest;
-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 ContextMenuTest extends SeleniumTestBase implements RichSeleniumTest {
-
- public ContextMenuTest() {
- 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 testContextMenuComponent() throws Exception {
- _testContextMenuComponent(Templates.SIMPLE);
- _testContextMenuComponent(Templates.DATATABLE);
- _testContextMenuComponent(Templates.MODALPANEL);
- }
-
- private void _testContextMenuComponent(Templates template) {
- renderPage(getTestUrl(), template);
-
- String parentId = getParentId() + "_form:";
- String inputId = parentId + "input";
- String input2Id = parentId + "input2";
- String outputId = parentId + "_value2";
- String menuId = parentId + "menu_input_menu";
- String menu2Id = parentId + "menu_input2_menu";
-
- String menu1_item_ajax = parentId + "menu1_item1";
- String menu1_item_server = parentId + "menu1_item2";
- String menu2_item_ajax = parentId + "menu2_item1";
- String menu2_item_server = parentId + "menu2_item2";
-
- writeStatus("Click on first input");
- clickById(inputId);
- Assert.assertTrue(isVisibleById(menuId));
-
- writeStatus("Click on second input");
- clickById(input2Id);
- Assert.assertFalse(isVisibleById(menuId));
- Assert.assertTrue(isVisibleById(menu2Id));
-
- writeStatus("Click on first input again");
- clickById(inputId);
- Assert.assertTrue(isVisibleById(menuId));
- Assert.assertFalse(isVisibleById(menu2Id));
-
- writeStatus("Click on ajax item in first menu");
- clickById(menu1_item_ajax);
- waitForAjaxCompletion();
- AssertValueEquals(inputId, "menu1_item1");
- AssertTextEquals(outputId, "1");
-
- writeStatus("Click on server item in first menu");
- clickCommandAndWait(menu1_item_server);
- AssertValueEquals(inputId, "menu1_item2");
- AssertTextEquals(outputId, "2");
-
- writeStatus("Click on second input again");
- clickById(input2Id);
- Assert.assertTrue(isVisibleById(menu2Id));
-
- writeStatus("Click on ajax item in first menu");
- clickById(menu2_item_ajax);
- waitForAjaxCompletion();
- AssertValueEquals(inputId, "menu2_item1");
- AssertTextEquals(outputId, "3");
-
- writeStatus("Click on server item in second menu");
- clickCommandAndWait(menu2_item_server);
- AssertValueEquals(inputId, "menu2_item2");
- AssertTextEquals(outputId, "4");
- }
-
- public String getTestUrl() {
- return "/faces/pages/contextMenu/contextMenu.xhtml";
- }
-
-}
-
Added:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/ContextMenuTest.java
===================================================================
--- trunk/test-applications/seleniumTest/src/test/java/org/richfaces/ContextMenuTest.java
(rev 0)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/ContextMenuTest.java 2008-05-23
16:04:20 UTC (rev 8734)
@@ -0,0 +1,124 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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;
+
+import org.ajax4jsf.test.base.RichSeleniumTest;
+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 ContextMenuTest extends SeleniumTestBase implements RichSeleniumTest {
+
+ public ContextMenuTest() {
+ 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 testContextMenuComponent() throws Exception {
+ _testContextMenuComponent(Templates.SIMPLE);
+ _testContextMenuComponent(Templates.DATATABLE);
+ _testContextMenuComponent(Templates.MODALPANEL);
+ }
+
+ private void _testContextMenuComponent(Templates template) {
+ renderPage(getTestUrl(), template);
+
+ String parentId = getParentId() + "_form:";
+ String inputId = parentId + "input";
+ String input2Id = parentId + "input2";
+ String outputId = parentId + "_value2";
+ String menuId = parentId + "menu_input_menu";
+ String menu2Id = parentId + "menu_input2_menu";
+
+ String menu1_item_ajax = parentId + "menu1_item1";
+ String menu1_item_server = parentId + "menu1_item2";
+ String menu2_item_ajax = parentId + "menu2_item1";
+ String menu2_item_server = parentId + "menu2_item2";
+
+ writeStatus("Click on first input");
+ clickById(inputId);
+ Assert.assertTrue(isVisibleById(menuId));
+
+ writeStatus("Click on second input");
+ clickById(input2Id);
+ Assert.assertFalse(isVisibleById(menuId));
+ Assert.assertTrue(isVisibleById(menu2Id));
+
+ writeStatus("Click on first input again");
+ clickById(inputId);
+ Assert.assertTrue(isVisibleById(menuId));
+ Assert.assertFalse(isVisibleById(menu2Id));
+
+ writeStatus("Click on ajax item in first menu");
+ clickById(menu1_item_ajax);
+ waitForAjaxCompletion();
+ AssertValueEquals(inputId, "menu1_item1");
+ AssertTextEquals(outputId, "1");
+
+ writeStatus("Click on server item in first menu");
+ clickCommandAndWait(menu1_item_server);
+ AssertValueEquals(inputId, "menu1_item2");
+ AssertTextEquals(outputId, "2");
+
+ writeStatus("Click on second input again");
+ clickById(input2Id);
+ Assert.assertTrue(isVisibleById(menu2Id));
+
+ writeStatus("Click on ajax item in first menu");
+ clickById(menu2_item_ajax);
+ waitForAjaxCompletion();
+ AssertValueEquals(inputId, "menu2_item1");
+ AssertTextEquals(outputId, "3");
+
+ writeStatus("Click on server item in second menu");
+ clickCommandAndWait(menu2_item_server);
+ AssertValueEquals(inputId, "menu2_item2");
+ AssertTextEquals(outputId, "4");
+ }
+
+ public String getTestUrl() {
+ return "/faces/pages/contextMenu/contextMenu.xhtml";
+ }
+
+}
+
Deleted:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/DataTableTest.java
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/DataTableTest.java 2008-05-23
15:10:59 UTC (rev 8733)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/DataTableTest.java 2008-05-23
16:04:20 UTC (rev 8734)
@@ -1,235 +0,0 @@
-package org.richfaces;
-
-import org.ajax4jsf.test.base.RichSeleniumTest;
-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 DataTableTest extends SeleniumTestBase implements RichSeleniumTest {
-
- public DataTableTest() {
- 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();
- }
-
- public String getTestUrl() {
- return "/faces/pages/dataTable/dataTableTest.xhtml";
- }
-
- @Test
- public void testDataTable() {
- _testDataTable(Templates.SIMPLE);
- }
-
- private void _testDataTable(Templates template) {
- renderPage(getTestUrl(), template);
-
- String parentId = getParentId() + "_form:";
- String dataTableId = parentId + "table";
-
- writeStatus("Check columns count equals to 3 ");
- assertColumnsCount(3, dataTableId);
- writeStatus("Check rows count equals to 22 ");
- assertRowsCount(22, dataTableId);
-
- String columnsId = getColumnId(dataTableId, 0);
-
- writeStatus("Check inputs' values ");
- assertInputValue(dataTableId, 0, columnsId, "0");
- assertInputValue(dataTableId, 5, columnsId, "5");
- assertInputValue(dataTableId, 19, columnsId, "19");
-
- columnsId = getColumnId(dataTableId, 1);
-
- assertInputValue(dataTableId, 0, columnsId, "1");
- assertInputValue(dataTableId, 7, columnsId, "8");
- assertInputValue(dataTableId, 19, columnsId, "20");
-
- columnsId = getColumnId(dataTableId, 2);
-
- assertInputValue(dataTableId, 0, columnsId, "2");
- assertInputValue(dataTableId, 11, columnsId, "13");
- assertInputValue(dataTableId, 19, columnsId, "21");
-
- writeStatus("Insert some values ");
- insertInputValue(dataTableId, 0, getColumnId(dataTableId, 0), "000");
- insertInputValue(dataTableId, 19, getColumnId(dataTableId, 2), "777");
-
- writeStatus("Rerender table");
- clickById("_form:submit");
- waitForAjaxCompletion();
-
- writeStatus("Check values entered ");
- assertInputValue(dataTableId, 0, getColumnId(dataTableId, 0), "000");
- assertInputValue(dataTableId, 19, getColumnId(dataTableId, 2), "777");
-
- columnsId = getColumnId(dataTableId, 0);
-
- writeStatus("Sort ASC by 1'st column ");
- sortColumn(dataTableId, columnsId);
- writeStatus("Check ordering");
- assertInputValue(dataTableId, 0, columnsId, "000");
- assertInputValue(dataTableId, 1, columnsId, "1");
- assertInputValue(dataTableId, 18, columnsId, "8");
- assertInputValue(dataTableId, 19, columnsId, "9");
-
- writeStatus("Sort DESC by 1'st column ");
- sortColumn(dataTableId, columnsId);
- writeStatus("Check ordering");
- assertInputValue(dataTableId, 0, columnsId, "9");
- assertInputValue(dataTableId, 1, columnsId, "8");
- assertInputValue(dataTableId, 18, columnsId, "1");
- assertInputValue(dataTableId, 19, columnsId, "000");
-
- columnsId = getColumnId(dataTableId, 2);
-
- writeStatus("Sort ASC by 3'st column ");
- sortColumn(dataTableId, columnsId);
- writeStatus("Check ordering");
- assertInputValue(dataTableId, 0, columnsId, "10");
- assertInputValue(dataTableId, 1, columnsId, "11");
- assertInputValue(dataTableId, 18, columnsId, "8");
- assertInputValue(dataTableId, 19, columnsId, "9");
-
- writeStatus("Set columns count == 5, rows count == 10");
- changeColumnCount(10, 5, 0 ,100);
-
-
- writeStatus("Check columns count equals to 5 ");
- assertColumnsCount(5, dataTableId);
- writeStatus("Check rows count equals to 12 ");
- assertRowsCount(12, dataTableId);
-
- columnsId = getColumnId(dataTableId, 0);
-
- writeStatus("Check inputs' values ");
- assertInputValue(dataTableId, 0, columnsId, "0");
- assertInputValue(dataTableId, 5, columnsId, "5");
- assertInputValue(dataTableId, 9, columnsId, "9");
-
- columnsId = getColumnId(dataTableId, 1);
-
- assertInputValue(dataTableId, 0, columnsId, "1");
- assertInputValue(dataTableId, 7, columnsId, "8");
- assertInputValue(dataTableId, 9, columnsId, "10");
-
- columnsId = getColumnId(dataTableId, 4);
-
- assertInputValue(dataTableId, 0, columnsId, "4");
- assertInputValue(dataTableId, 2, columnsId, "6");
- assertInputValue(dataTableId, 9, columnsId, "13");
-
- writeStatus("Sort ASC by the last column ");
- sortColumn(dataTableId, columnsId);
- writeStatus("Check ordering");
- assertInputValue(dataTableId, 0, columnsId, "10");
- assertInputValue(dataTableId, 2, columnsId, "12");
- assertInputValue(dataTableId, 9, columnsId, "9");
-
- writeStatus("Sort DESC by the last column ");
- sortColumn(dataTableId, columnsId);
- writeStatus("Check ordering");
- assertInputValue(dataTableId, 0, columnsId, "9");
- assertInputValue(dataTableId, 2, columnsId, "7");
- assertInputValue(dataTableId, 9, columnsId, "10");
-
- columnsId = getColumnId(dataTableId, 2);
- writeStatus("Sort ASC by the 3d column ");
- sortColumn(dataTableId, columnsId);
-
- writeStatus("Check ordering");
- assertInputValue(dataTableId, 0, columnsId, "10");
- assertInputValue(dataTableId, 2, columnsId, "2");
- assertInputValue(dataTableId, 9, columnsId, "9");
-
- changeColumnCount(2, 5, 2 ,2);
- assertColumnsCount(1, dataTableId);
- assertRowsCount(4, dataTableId);
-
- changeColumnCount(10, 5, 10 ,0);
- assertRowsCount(0, dataTableId);
-
-
-
- }
-
- private String getColumnId (String tableId, int i) {
- String script =
"$('"+tableId+"').rows[0].cells["+String.valueOf(i)+"].id";
- String id = runScript(script);
- id = id.replace(tableId + ":", "");
- id = id.replace("header", "");
- return id;
- }
-
- private void changeColumnCount(int rows, int columns, int begin, int end) {
- String script = "$('_controls:rows').value='" +
String.valueOf(rows) + "';";
- runScript(script);
- script = "$('_controls:column').value='" +
String.valueOf(columns) + "';";
- runScript(script);
- script = "$('_controls:begin').value='" + String.valueOf(begin) +
"';";
- runScript(script);
- script = "$('_controls:end').value='" + String.valueOf(end) +
"';";
- runScript(script);
- clickById("_controls:apply");
- waitForAjaxCompletion();
- }
-
- private void sortColumn(String tableId, String columnId) {
- clickById(tableId + ":" + columnId + "header");
- waitForAjaxCompletion();
- }
-
-
- private void insertInputValue(String tableId, int row, String inputId, String value) {
- String id = tableId + ":"+row+":"+inputId;
- String script = ("$('" + id + "').firstChild.value='" +
value + "';");
- runScript(script);
- }
-
-
- private void assertInputValue(String tableId, int row, String inputId, String value) {
- String id = tableId + ":"+row+":"+inputId;
- String script = "$('" + id + "').firstChild.value";
- Assert.assertEquals(runScript(script), value);
- }
-
-
- private void assertColumnsCount(int i, String tableId) {
- StringBuffer script = new StringBuffer("$('");
- script.append(tableId);
- script.append("').rows[0].cells.length");
-
- String count = runScript(script.toString());
- Assert.assertEquals(count, String.valueOf(i));
- }
-
- private void assertRowsCount(int i, String tableId) {
- StringBuffer script = new StringBuffer("$('");
- script.append(tableId);
- script.append("').rows.length");
-
- String count = runScript(script.toString());
- Assert.assertEquals(count, String.valueOf(i));
- }
-
-}
Added:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/DataTableTest.java
===================================================================
--- trunk/test-applications/seleniumTest/src/test/java/org/richfaces/DataTableTest.java
(rev 0)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/DataTableTest.java 2008-05-23
16:04:20 UTC (rev 8734)
@@ -0,0 +1,235 @@
+package org.richfaces;
+
+import org.ajax4jsf.test.base.RichSeleniumTest;
+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 DataTableTest extends SeleniumTestBase implements RichSeleniumTest {
+
+ public DataTableTest() {
+ 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();
+ }
+
+ public String getTestUrl() {
+ return "/faces/pages/dataTable/dataTableTest.xhtml";
+ }
+
+ @Test
+ public void testDataTable() {
+ _testDataTable(Templates.SIMPLE);
+ }
+
+ private void _testDataTable(Templates template) {
+ renderPage(getTestUrl(), template);
+
+ String parentId = getParentId() + "_form:";
+ String dataTableId = parentId + "table";
+
+ writeStatus("Check columns count equals to 3 ");
+ assertColumnsCount(3, dataTableId);
+ writeStatus("Check rows count equals to 22 ");
+ assertRowsCount(22, dataTableId);
+
+ String columnsId = getColumnId(dataTableId, 0);
+
+ writeStatus("Check inputs' values ");
+ assertInputValue(dataTableId, 0, columnsId, "0");
+ assertInputValue(dataTableId, 5, columnsId, "5");
+ assertInputValue(dataTableId, 19, columnsId, "19");
+
+ columnsId = getColumnId(dataTableId, 1);
+
+ assertInputValue(dataTableId, 0, columnsId, "1");
+ assertInputValue(dataTableId, 7, columnsId, "8");
+ assertInputValue(dataTableId, 19, columnsId, "20");
+
+ columnsId = getColumnId(dataTableId, 2);
+
+ assertInputValue(dataTableId, 0, columnsId, "2");
+ assertInputValue(dataTableId, 11, columnsId, "13");
+ assertInputValue(dataTableId, 19, columnsId, "21");
+
+ writeStatus("Insert some values ");
+ insertInputValue(dataTableId, 0, getColumnId(dataTableId, 0), "000");
+ insertInputValue(dataTableId, 19, getColumnId(dataTableId, 2), "777");
+
+ writeStatus("Rerender table");
+ clickById("_form:submit");
+ waitForAjaxCompletion();
+
+ writeStatus("Check values entered ");
+ assertInputValue(dataTableId, 0, getColumnId(dataTableId, 0), "000");
+ assertInputValue(dataTableId, 19, getColumnId(dataTableId, 2), "777");
+
+ columnsId = getColumnId(dataTableId, 0);
+
+ writeStatus("Sort ASC by 1'st column ");
+ sortColumn(dataTableId, columnsId);
+ writeStatus("Check ordering");
+ assertInputValue(dataTableId, 0, columnsId, "000");
+ assertInputValue(dataTableId, 1, columnsId, "1");
+ assertInputValue(dataTableId, 18, columnsId, "8");
+ assertInputValue(dataTableId, 19, columnsId, "9");
+
+ writeStatus("Sort DESC by 1'st column ");
+ sortColumn(dataTableId, columnsId);
+ writeStatus("Check ordering");
+ assertInputValue(dataTableId, 0, columnsId, "9");
+ assertInputValue(dataTableId, 1, columnsId, "8");
+ assertInputValue(dataTableId, 18, columnsId, "1");
+ assertInputValue(dataTableId, 19, columnsId, "000");
+
+ columnsId = getColumnId(dataTableId, 2);
+
+ writeStatus("Sort ASC by 3'st column ");
+ sortColumn(dataTableId, columnsId);
+ writeStatus("Check ordering");
+ assertInputValue(dataTableId, 0, columnsId, "10");
+ assertInputValue(dataTableId, 1, columnsId, "11");
+ assertInputValue(dataTableId, 18, columnsId, "8");
+ assertInputValue(dataTableId, 19, columnsId, "9");
+
+ writeStatus("Set columns count == 5, rows count == 10");
+ changeColumnCount(10, 5, 0 ,100);
+
+
+ writeStatus("Check columns count equals to 5 ");
+ assertColumnsCount(5, dataTableId);
+ writeStatus("Check rows count equals to 12 ");
+ assertRowsCount(12, dataTableId);
+
+ columnsId = getColumnId(dataTableId, 0);
+
+ writeStatus("Check inputs' values ");
+ assertInputValue(dataTableId, 0, columnsId, "0");
+ assertInputValue(dataTableId, 5, columnsId, "5");
+ assertInputValue(dataTableId, 9, columnsId, "9");
+
+ columnsId = getColumnId(dataTableId, 1);
+
+ assertInputValue(dataTableId, 0, columnsId, "1");
+ assertInputValue(dataTableId, 7, columnsId, "8");
+ assertInputValue(dataTableId, 9, columnsId, "10");
+
+ columnsId = getColumnId(dataTableId, 4);
+
+ assertInputValue(dataTableId, 0, columnsId, "4");
+ assertInputValue(dataTableId, 2, columnsId, "6");
+ assertInputValue(dataTableId, 9, columnsId, "13");
+
+ writeStatus("Sort ASC by the last column ");
+ sortColumn(dataTableId, columnsId);
+ writeStatus("Check ordering");
+ assertInputValue(dataTableId, 0, columnsId, "10");
+ assertInputValue(dataTableId, 2, columnsId, "12");
+ assertInputValue(dataTableId, 9, columnsId, "9");
+
+ writeStatus("Sort DESC by the last column ");
+ sortColumn(dataTableId, columnsId);
+ writeStatus("Check ordering");
+ assertInputValue(dataTableId, 0, columnsId, "9");
+ assertInputValue(dataTableId, 2, columnsId, "7");
+ assertInputValue(dataTableId, 9, columnsId, "10");
+
+ columnsId = getColumnId(dataTableId, 2);
+ writeStatus("Sort ASC by the 3d column ");
+ sortColumn(dataTableId, columnsId);
+
+ writeStatus("Check ordering");
+ assertInputValue(dataTableId, 0, columnsId, "10");
+ assertInputValue(dataTableId, 2, columnsId, "2");
+ assertInputValue(dataTableId, 9, columnsId, "9");
+
+ changeColumnCount(2, 5, 2 ,2);
+ assertColumnsCount(1, dataTableId);
+ assertRowsCount(4, dataTableId);
+
+ changeColumnCount(10, 5, 10 ,0);
+ assertRowsCount(0, dataTableId);
+
+
+
+ }
+
+ private String getColumnId (String tableId, int i) {
+ String script =
"$('"+tableId+"').rows[0].cells["+String.valueOf(i)+"].id";
+ String id = runScript(script);
+ id = id.replace(tableId + ":", "");
+ id = id.replace("header", "");
+ return id;
+ }
+
+ private void changeColumnCount(int rows, int columns, int begin, int end) {
+ String script = "$('_controls:rows').value='" +
String.valueOf(rows) + "';";
+ runScript(script);
+ script = "$('_controls:column').value='" +
String.valueOf(columns) + "';";
+ runScript(script);
+ script = "$('_controls:begin').value='" + String.valueOf(begin) +
"';";
+ runScript(script);
+ script = "$('_controls:end').value='" + String.valueOf(end) +
"';";
+ runScript(script);
+ clickById("_controls:apply");
+ waitForAjaxCompletion();
+ }
+
+ private void sortColumn(String tableId, String columnId) {
+ clickById(tableId + ":" + columnId + "header");
+ waitForAjaxCompletion();
+ }
+
+
+ private void insertInputValue(String tableId, int row, String inputId, String value) {
+ String id = tableId + ":"+row+":"+inputId;
+ String script = ("$('" + id + "').firstChild.value='" +
value + "';");
+ runScript(script);
+ }
+
+
+ private void assertInputValue(String tableId, int row, String inputId, String value) {
+ String id = tableId + ":"+row+":"+inputId;
+ String script = "$('" + id + "').firstChild.value";
+ Assert.assertEquals(runScript(script), value);
+ }
+
+
+ private void assertColumnsCount(int i, String tableId) {
+ StringBuffer script = new StringBuffer("$('");
+ script.append(tableId);
+ script.append("').rows[0].cells.length");
+
+ String count = runScript(script.toString());
+ Assert.assertEquals(count, String.valueOf(i));
+ }
+
+ private void assertRowsCount(int i, String tableId) {
+ StringBuffer script = new StringBuffer("$('");
+ script.append(tableId);
+ script.append("').rows.length");
+
+ String count = runScript(script.toString());
+ Assert.assertEquals(count, String.valueOf(i));
+ }
+
+}
Deleted:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/DropDownMenuTest.java
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/DropDownMenuTest.java 2008-05-23
15:10:59 UTC (rev 8733)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/DropDownMenuTest.java 2008-05-23
16:04:20 UTC (rev 8734)
@@ -1,89 +0,0 @@
-package org.richfaces;
-
-import org.ajax4jsf.test.base.SeleniumTestBase;
-import org.ajax4jsf.test.base.Templates;
-import org.testng.annotations.AfterTest;
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.Parameters;
-import org.testng.annotations.Test;
-
-public class DropDownMenuTest extends SeleniumTestBase {
-
- public DropDownMenuTest() {
- 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 testDropDownMenuComponent() throws Exception {
- _testDropDownMenuComponent(Templates.SIMPLE);
- _testDropDownMenuComponent(Templates.DATATABLE);
- _testDropDownMenuComponent(Templates.MODALPANEL);
- }
-
- private void _testDropDownMenuComponent(Templates template) {
- renderPage("/faces/pages/dropDownMenu/dropDownMenuTest.xhtml",
template);
-
- String parentId = getParentId() + "_form:";
- String file = parentId + "file";
- 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 operation = parentId + "operation";
-
- writeStatus("Check menu item in ajax mode");
-
- selenium.mouseOver(file);
- selenium.mouseOver(saveAs);
- clickById(saveAll);
-
- AssertTextEquals(operation, "Save All");
-
- selenium.mouseOver(file);
- selenium.mouseOver(saveAs);
- clickById(save);
-
- AssertTextEquals(operation, "Save");
-
- writeStatus("Check the drop down menu closed");
-
- AssertNotVisible(save);
- AssertNotVisible(saveAs);
-
- writeStatus("Check menu item in server mode");
-
- selenium.mouseOver(file);
- clickCommandAndWait(close);
-
- AssertTextEquals(operation, "Close");
-
- writeStatus("Check menu item in 'none' mode");
-
- selenium.mouseOver(file);
- selenium.mouseOver(exit);
- clickById(exit);
-
- AssertTextEquals(operation, "Close");
- AssertNotVisible(exit);
-
- }
-}
Added:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/DropDownMenuTest.java
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/DropDownMenuTest.java
(rev 0)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/DropDownMenuTest.java 2008-05-23
16:04:20 UTC (rev 8734)
@@ -0,0 +1,94 @@
+package org.richfaces;
+
+import org.ajax4jsf.test.base.RichSeleniumTest;
+import org.ajax4jsf.test.base.SeleniumTestBase;
+import org.ajax4jsf.test.base.Templates;
+import org.testng.annotations.AfterTest;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Parameters;
+import org.testng.annotations.Test;
+
+public class DropDownMenuTest extends SeleniumTestBase implements RichSeleniumTest {
+
+ public DropDownMenuTest() {
+ 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 testDropDownMenuComponent() throws Exception {
+ _testDropDownMenuComponent(Templates.SIMPLE);
+ _testDropDownMenuComponent(Templates.DATATABLE);
+ _testDropDownMenuComponent(Templates.MODALPANEL);
+ }
+
+ private void _testDropDownMenuComponent(Templates template) {
+ renderPage(getTestUrl(), template);
+
+ String parentId = getParentId() + "_form:";
+ String file = parentId + "file";
+ 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 operation = parentId + "operation";
+
+ writeStatus("Check menu item in ajax mode");
+
+ selenium.mouseOver(file);
+ selenium.mouseOver(saveAs);
+ clickById(saveAll);
+
+ AssertTextEquals(operation, "Save All");
+
+ selenium.mouseOver(file);
+ selenium.mouseOver(saveAs);
+ clickById(save);
+
+ AssertTextEquals(operation, "Save");
+
+ writeStatus("Check the drop down menu closed");
+
+ AssertNotVisible(save);
+ AssertNotVisible(saveAs);
+
+ writeStatus("Check menu item in server mode");
+
+ selenium.mouseOver(file);
+ clickCommandAndWait(close);
+
+ AssertTextEquals(operation, "Close");
+
+ writeStatus("Check menu item in 'none' mode");
+
+ selenium.mouseOver(file);
+ selenium.mouseOver(exit);
+ clickById(exit);
+
+ AssertTextEquals(operation, "Close");
+ AssertNotVisible(exit);
+
+ }
+
+ public String getTestUrl() {
+ return "/faces/pages/dropDownMenu/dropDownMenuTest.xhtml";
+ }
+}
Deleted:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/InplaceSelectTest.java
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/InplaceSelectTest.java 2008-05-23
15:10:59 UTC (rev 8733)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/InplaceSelectTest.java 2008-05-23
16:04:20 UTC (rev 8734)
@@ -1,115 +0,0 @@
-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 InplaceSelectTest extends SeleniumTestBase {
-
- public InplaceSelectTest() {
- 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 testInplaceSelectComponent() throws Exception {
- _testInplaceSelectComponent(Templates.SIMPLE);
- _testInplaceSelectComponent(Templates.DATATABLE);
- _testInplaceSelectComponent(Templates.MODALPANEL);
- }
-
- private void _testInplaceSelectComponent(Templates template) {
- renderPage("/faces/pages/inplaceSelect/inplaceSelectTest.xhtml",
template);
-
- String parentId = getParentId() + "_form:";
- String inplaceSelectId = parentId + "inplaceSelect";
- String okButton = parentId + "inplaceSelect" + "ok";
- //String inplaceTmpValueElemId = parentId + "inplaceSelect" +
"inplaceTmpValue";
- String cancelButton = parentId + "inplaceSelect" + "cancel";
- String popupId = "list" + inplaceSelectId;
-
- writeStatus("click the component");
-
- clickById(inplaceSelectId);
- Assert.assertFalse(isVisibleById(popupId), "Component pop-up should not show
up on solitary click");
-
- writeStatus("double click the component");
-
- selenium.doubleClick(inplaceSelectId);
- Assert.assertTrue(isVisibleById(popupId), "Component pop-up should show up
on double click");
-
- writeStatus("Check that controls buttons are present");
-
- Assert.assertTrue(isPresentById(okButton));
- Assert.assertTrue(isPresentById(cancelButton));
-
- writeStatus("Select second element"); //Birch
-
- selenium.mouseMove("xpath=//div[@id='list" + inplaceSelectId +
"']/span[2]");
- selenium.fireEvent(okButton, "mousedown");
-
- writeStatus("Check that a new element is selected");
-
- Assert.assertEquals(getValue(inplaceSelectId), "Birch");
-
- writeStatus("Select another element"); // Aspen
-
- selenium.doubleClick(inplaceSelectId);
-
- selenium.mouseMove("xpath=//div[@id='list" + inplaceSelectId +
"']/span[3]");
- selenium.fireEvent(cancelButton, "mousedown");
-
- writeStatus("Cancel selected value.");
- Assert.assertEquals(getValue(inplaceSelectId), "Birch", "A value
has not to be changed");
-
- writeStatus("Verify javascript event triggering");
-
- runScript("theLatestEvent='undefined'");
-
- writeStatus("Double click the component");
- selenium.doubleClick(inplaceSelectId);
-
- Assert.assertEquals(runScript("theLatestEvent"),
"editactivated", "editactivated event has not been triggered");
-
- writeStatus("Stop editing with ok");
- selenium.fireEvent(okButton, "mousedown");
- Assert.assertEquals(runScript("theLatestEvent"),
"viewactivated", "viewactivated event has not been triggered");
-
-// viewactivated event is not fired ... almost sure bug
-// writeStatus("Stop editing with cancel");
-// selenium.fireEvent(cancelButton, "mousedown");
-// Assert.assertEquals(runScript("theLatestEvent"),
"viewactivated", "viewactivated event has not been triggered");
-
- }
-
- /**
- * Gets component value.
- * Note: JavaScript component API getValue() doesn't exit
- * @param clientId
- * @return
- */
- private String getValue(String clientId) {
- return runScript("$('" + clientId +
"inplaceValue').value;");
- }
-
-}
Added:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/InplaceSelectTest.java
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/InplaceSelectTest.java
(rev 0)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/InplaceSelectTest.java 2008-05-23
16:04:20 UTC (rev 8734)
@@ -0,0 +1,120 @@
+package org.richfaces;
+
+import org.ajax4jsf.test.base.RichSeleniumTest;
+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 InplaceSelectTest extends SeleniumTestBase implements RichSeleniumTest {
+
+ public InplaceSelectTest() {
+ 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 testInplaceSelectComponent() throws Exception {
+ _testInplaceSelectComponent(Templates.SIMPLE);
+ _testInplaceSelectComponent(Templates.DATATABLE);
+ _testInplaceSelectComponent(Templates.MODALPANEL);
+ }
+
+ private void _testInplaceSelectComponent(Templates template) {
+ renderPage(getTestUrl(), template);
+
+ String parentId = getParentId() + "_form:";
+ String inplaceSelectId = parentId + "inplaceSelect";
+ String okButton = parentId + "inplaceSelect" + "ok";
+ //String inplaceTmpValueElemId = parentId + "inplaceSelect" +
"inplaceTmpValue";
+ String cancelButton = parentId + "inplaceSelect" + "cancel";
+ String popupId = "list" + inplaceSelectId;
+
+ writeStatus("click the component");
+
+ clickById(inplaceSelectId);
+ Assert.assertFalse(isVisibleById(popupId), "Component pop-up should not show
up on solitary click");
+
+ writeStatus("double click the component");
+
+ selenium.doubleClick(inplaceSelectId);
+ Assert.assertTrue(isVisibleById(popupId), "Component pop-up should show up
on double click");
+
+ writeStatus("Check that controls buttons are present");
+
+ Assert.assertTrue(isPresentById(okButton));
+ Assert.assertTrue(isPresentById(cancelButton));
+
+ writeStatus("Select second element"); //Birch
+
+ selenium.mouseMove("xpath=//div[@id='list" + inplaceSelectId +
"']/span[2]");
+ selenium.fireEvent(okButton, "mousedown");
+
+ writeStatus("Check that a new element is selected");
+
+ Assert.assertEquals(getValue(inplaceSelectId), "Birch");
+
+ writeStatus("Select another element"); // Aspen
+
+ selenium.doubleClick(inplaceSelectId);
+
+ selenium.mouseMove("xpath=//div[@id='list" + inplaceSelectId +
"']/span[3]");
+ selenium.fireEvent(cancelButton, "mousedown");
+
+ writeStatus("Cancel selected value.");
+ Assert.assertEquals(getValue(inplaceSelectId), "Birch", "A value
has not to be changed");
+
+ writeStatus("Verify javascript event triggering");
+
+ runScript("theLatestEvent='undefined'");
+
+ writeStatus("Double click the component");
+ selenium.doubleClick(inplaceSelectId);
+
+ Assert.assertEquals(runScript("theLatestEvent"),
"editactivated", "editactivated event has not been triggered");
+
+ writeStatus("Stop editing with ok");
+ selenium.fireEvent(okButton, "mousedown");
+ Assert.assertEquals(runScript("theLatestEvent"),
"viewactivated", "viewactivated event has not been triggered");
+
+// viewactivated event is not fired ... almost sure bug
+// writeStatus("Stop editing with cancel");
+// selenium.fireEvent(cancelButton, "mousedown");
+// Assert.assertEquals(runScript("theLatestEvent"),
"viewactivated", "viewactivated event has not been triggered");
+
+ }
+
+ /**
+ * Gets component value.
+ * Note: JavaScript component API getValue() doesn't exit
+ * @param clientId
+ * @return
+ */
+ private String getValue(String clientId) {
+ return runScript("$('" + clientId +
"inplaceValue').value;");
+ }
+
+ public String getTestUrl() {
+ return "/faces/pages/inplaceSelect/inplaceSelectTest.xhtml";
+ }
+
+}
Deleted:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/InputNumberSpinnerTest.java
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/InputNumberSpinnerTest.java 2008-05-23
15:10:59 UTC (rev 8733)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/InputNumberSpinnerTest.java 2008-05-23
16:04:20 UTC (rev 8734)
@@ -1,92 +0,0 @@
-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 InputNumberSpinnerTest extends SeleniumTestBase {
-
- public InputNumberSpinnerTest() {
- 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 testInputNumberSpinnerComponent() throws Exception {
- _testInputNumberSpinnerComponent(Templates.SIMPLE);
- //it looks as if the spinner does not work inside rich:dataTable
- _testInputNumberSpinnerComponent(Templates.DATATABLE);
- _testInputNumberSpinnerComponent(Templates.MODALPANEL);
- }
-
- private void _testInputNumberSpinnerComponent(Templates template) {
-
renderPage("/faces/pages/inputNumberSpinner/inputNumberSpinnerTest.xhtml",
template);
-
- writeStatus("check whether the spinner is invariant with respect to pair of
sequential opposite operations");
-
- //start value = 20
- String before = getSpinnerValue();
- clickUp();
- clickDown();
- String after = getSpinnerValue();
- Assert.assertEquals(before, after);
- Assert.assertEquals(after, "20");
-
- writeStatus("check upper bound and cycling");
-
- clickUp(); //+10
- clickUp(); //+10
- clickUp(); //+10
- clickUp(); //+10
- clickUp(); //+10
- Assert.assertEquals(getSpinnerValue(), "10");
-
- writeStatus("check lower bound and cycling");
-
- clickDown(); //-10
- Assert.assertEquals(getSpinnerValue(), "0");
- clickDown(); //-10
- Assert.assertEquals(getSpinnerValue(), "50");
- clickDown(); //-10
- Assert.assertEquals(getSpinnerValue(), "40");
- }
-
- private void clickUp() {
- String id = getParentId() + "_form:" + "spinnerButtons";
- selenium.fireEvent("xpath=//table[@id='" + id +
"']/tbody/tr[1]/td/input", "mousedown");
- selenium.fireEvent("xpath=//table[@id='" + id +
"']/tbody/tr[1]/td/input", "mouseup");
- }
-
- private void clickDown() {
- String id = getParentId() + "_form:" + "spinnerButtons";
- selenium.fireEvent("xpath=//table[@id='" + id +
"']/tbody/tr[2]/td/input", "mousedown");
- selenium.fireEvent("xpath=//table[@id='" + id +
"']/tbody/tr[2]/td/input", "mouseup");
- }
-
- private String getSpinnerValue() {
- String id = getParentId() + "_form:" + "spinnerEdit";
- return runScript("$('" + id +
"').down('input').value");
- }
-
-}
Added:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/InputNumberSpinnerTest.java
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/InputNumberSpinnerTest.java
(rev 0)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/InputNumberSpinnerTest.java 2008-05-23
16:04:20 UTC (rev 8734)
@@ -0,0 +1,97 @@
+package org.richfaces;
+
+import org.ajax4jsf.test.base.RichSeleniumTest;
+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 InputNumberSpinnerTest extends SeleniumTestBase implements RichSeleniumTest
{
+
+ public InputNumberSpinnerTest() {
+ 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 testInputNumberSpinnerComponent() throws Exception {
+ _testInputNumberSpinnerComponent(Templates.SIMPLE);
+ //it looks as if the spinner does not work inside rich:dataTable
+ _testInputNumberSpinnerComponent(Templates.DATATABLE);
+ _testInputNumberSpinnerComponent(Templates.MODALPANEL);
+ }
+
+ private void _testInputNumberSpinnerComponent(Templates template) {
+ renderPage(getTestUrl(), template);
+
+ writeStatus("check whether the spinner is invariant with respect to pair of
sequential opposite operations");
+
+ //start value = 20
+ String before = getSpinnerValue();
+ clickUp();
+ clickDown();
+ String after = getSpinnerValue();
+ Assert.assertEquals(before, after);
+ Assert.assertEquals(after, "20");
+
+ writeStatus("check upper bound and cycling");
+
+ clickUp(); //+10
+ clickUp(); //+10
+ clickUp(); //+10
+ clickUp(); //+10
+ clickUp(); //+10
+ Assert.assertEquals(getSpinnerValue(), "10");
+
+ writeStatus("check lower bound and cycling");
+
+ clickDown(); //-10
+ Assert.assertEquals(getSpinnerValue(), "0");
+ clickDown(); //-10
+ Assert.assertEquals(getSpinnerValue(), "50");
+ clickDown(); //-10
+ Assert.assertEquals(getSpinnerValue(), "40");
+ }
+
+ private void clickUp() {
+ String id = getParentId() + "_form:" + "spinnerButtons";
+ selenium.fireEvent("xpath=//table[@id='" + id +
"']/tbody/tr[1]/td/input", "mousedown");
+ selenium.fireEvent("xpath=//table[@id='" + id +
"']/tbody/tr[1]/td/input", "mouseup");
+ }
+
+ private void clickDown() {
+ String id = getParentId() + "_form:" + "spinnerButtons";
+ selenium.fireEvent("xpath=//table[@id='" + id +
"']/tbody/tr[2]/td/input", "mousedown");
+ selenium.fireEvent("xpath=//table[@id='" + id +
"']/tbody/tr[2]/td/input", "mouseup");
+ }
+
+ private String getSpinnerValue() {
+ String id = getParentId() + "_form:" + "spinnerEdit";
+ return runScript("$('" + id +
"').down('input').value");
+ }
+
+ public String getTestUrl() {
+ return "/faces/pages/inputNumberSpinner/inputNumberSpinnerTest.xhtml";
+ }
+
+}
Deleted:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/JSFunctionTest.java
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/JSFunctionTest.java 2008-05-23
15:10:59 UTC (rev 8733)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/JSFunctionTest.java 2008-05-23
16:04:20 UTC (rev 8734)
@@ -1,59 +0,0 @@
-package org.richfaces;
-
-import static org.testng.Assert.assertEquals;
-import org.ajax4jsf.test.base.SeleniumTestBase;
-import org.ajax4jsf.test.base.Templates;
-
-import org.testng.annotations.AfterTest;
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.Parameters;
-import org.testng.annotations.Test;
-
-public class JSFunctionTest extends SeleniumTestBase {
-
- public JSFunctionTest() {
- 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 testJSFunctionComponent() throws Exception {
- _testJSFunctionComponent(Templates.SIMPLE);
- _testJSFunctionComponent(Templates.DATATABLE);
- _testJSFunctionComponent(Templates.MODALPANEL);
- }
-
- private void _testJSFunctionComponent(Templates template) {
- renderPage("/faces/pages/jsFunction/jsFunctionTest.xhtml", template);
-
- String showNameElemId = getParentId() + "showname";
- selenium.mouseOver("alex");
- waitForAjaxCompletion();
- assertEquals(getTextById(showNameElemId), "Alex");
-
- selenium.mouseOver("jonh");
- waitForAjaxCompletion();
- assertEquals(getTextById(showNameElemId), "Jonh");
-
- selenium.mouseOver("roger");
- waitForAjaxCompletion();
- assertEquals(getTextById(showNameElemId), "Roger");
- }
-
-}
Added:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/JSFunctionTest.java
===================================================================
--- trunk/test-applications/seleniumTest/src/test/java/org/richfaces/JSFunctionTest.java
(rev 0)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/JSFunctionTest.java 2008-05-23
16:04:20 UTC (rev 8734)
@@ -0,0 +1,65 @@
+package org.richfaces;
+
+import static org.testng.Assert.assertEquals;
+
+import org.ajax4jsf.test.base.RichSeleniumTest;
+import org.ajax4jsf.test.base.SeleniumTestBase;
+import org.ajax4jsf.test.base.Templates;
+
+import org.testng.annotations.AfterTest;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Parameters;
+import org.testng.annotations.Test;
+
+public class JSFunctionTest extends SeleniumTestBase implements RichSeleniumTest {
+
+ public JSFunctionTest() {
+ 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 testJSFunctionComponent() throws Exception {
+ _testJSFunctionComponent(Templates.SIMPLE);
+ _testJSFunctionComponent(Templates.DATATABLE);
+ _testJSFunctionComponent(Templates.MODALPANEL);
+ }
+
+ private void _testJSFunctionComponent(Templates template) {
+ renderPage(getTestUrl(), template);
+
+ String showNameElemId = getParentId() + "showname";
+ selenium.mouseOver("alex");
+ waitForAjaxCompletion();
+ assertEquals(getTextById(showNameElemId), "Alex");
+
+ selenium.mouseOver("jonh");
+ waitForAjaxCompletion();
+ assertEquals(getTextById(showNameElemId), "Jonh");
+
+ selenium.mouseOver("roger");
+ waitForAjaxCompletion();
+ assertEquals(getTextById(showNameElemId), "Roger");
+ }
+
+ public String getTestUrl() {
+ return "/faces/pages/jsFunction/jsFunctionTest.xhtml";
+ }
+
+}
Deleted:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/KeepAliveTest.java
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/KeepAliveTest.java 2008-05-23
15:10:59 UTC (rev 8733)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/KeepAliveTest.java 2008-05-23
16:04:20 UTC (rev 8734)
@@ -1,85 +0,0 @@
-package org.richfaces;
-
-import org.ajax4jsf.test.base.SeleniumTestBase;
-import org.ajax4jsf.test.base.Templates;
-import org.testng.annotations.AfterTest;
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.Parameters;
-import org.testng.annotations.Test;
-
-public class KeepAliveTest extends SeleniumTestBase {
-
- public KeepAliveTest() {
- 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 testKeepAliveComponent() throws Exception {
- _testKeepAliveComponent(Templates.SIMPLE);
- _testKeepAliveComponent(Templates.DATATABLE);
- _testKeepAliveComponent(Templates.MODALPANEL);
- }
-
- private void _testKeepAliveComponent(Templates template) {
- renderPage("/faces/pages/keepAlive/keepAliveTest.xhtml", template);
-
- String parentId = getParentId();
-
- String sumElemId = parentId + "sum";
- AssertValueEquals(sumElemId, "0");
- String addButtonId = parentId + "form:add";
- String addAjaxButtonId = parentId + "form:addAjax";
-
- writeStatus("The sum has to be increased by 5 twice");
-
- clickCommandAndWait(addButtonId);
- clickCommandAndWait(addButtonId);
- AssertValueEquals(sumElemId, "10");
-
- writeStatus("The sum has to be increased by 5 twice again");
-
- clickById(addAjaxButtonId);
- clickById(addAjaxButtonId);
- waitForAjaxCompletion();
- AssertValueEquals(sumElemId, "20");
-
- writeStatus("Test ajax only regime ... ");
-
- String sumAjaxOnlyElemId = parentId + "sumAjaxOnly";
- AssertValueEquals(sumAjaxOnlyElemId, "0");
- addButtonId = parentId + "formAjaxOnly:add";
- addAjaxButtonId = parentId + "formAjaxOnly:addAjax";
-
- writeStatus("State is not saved between full submits. The sum always is
5");
-
- clickCommandAndWait(addButtonId);
- clickCommandAndWait(addButtonId);
- AssertValueNotEquals(sumAjaxOnlyElemId, "10");
-
- writeStatus("Ajax request! The sum has to be increased by 5 twice");
-
-// This test doesn't pass! Bug?!
-
-// clickById(addAjaxButtonId);
-// clickById(addAjaxButtonId);
-// waitForAjaxCompletion();
-// AssertValueEquals(sumAjaxOnlyElemId, "10");
- }
-}
Added:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/KeepAliveTest.java
===================================================================
--- trunk/test-applications/seleniumTest/src/test/java/org/richfaces/KeepAliveTest.java
(rev 0)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/KeepAliveTest.java 2008-05-23
16:04:20 UTC (rev 8734)
@@ -0,0 +1,90 @@
+package org.richfaces;
+
+import org.ajax4jsf.test.base.RichSeleniumTest;
+import org.ajax4jsf.test.base.SeleniumTestBase;
+import org.ajax4jsf.test.base.Templates;
+import org.testng.annotations.AfterTest;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Parameters;
+import org.testng.annotations.Test;
+
+public class KeepAliveTest extends SeleniumTestBase implements RichSeleniumTest {
+
+ public KeepAliveTest() {
+ 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 testKeepAliveComponent() throws Exception {
+ _testKeepAliveComponent(Templates.SIMPLE);
+ _testKeepAliveComponent(Templates.DATATABLE);
+ _testKeepAliveComponent(Templates.MODALPANEL);
+ }
+
+ private void _testKeepAliveComponent(Templates template) {
+ renderPage(getTestUrl(), template);
+
+ String parentId = getParentId();
+
+ String sumElemId = parentId + "sum";
+ AssertValueEquals(sumElemId, "0");
+ String addButtonId = parentId + "form:add";
+ String addAjaxButtonId = parentId + "form:addAjax";
+
+ writeStatus("The sum has to be increased by 5 twice");
+
+ clickCommandAndWait(addButtonId);
+ clickCommandAndWait(addButtonId);
+ AssertValueEquals(sumElemId, "10");
+
+ writeStatus("The sum has to be increased by 5 twice again");
+
+ clickById(addAjaxButtonId);
+ clickById(addAjaxButtonId);
+ waitForAjaxCompletion();
+ AssertValueEquals(sumElemId, "20");
+
+ writeStatus("Test ajax only regime ... ");
+
+ String sumAjaxOnlyElemId = parentId + "sumAjaxOnly";
+ AssertValueEquals(sumAjaxOnlyElemId, "0");
+ addButtonId = parentId + "formAjaxOnly:add";
+ addAjaxButtonId = parentId + "formAjaxOnly:addAjax";
+
+ writeStatus("State is not saved between full submits. The sum always is
5");
+
+ clickCommandAndWait(addButtonId);
+ clickCommandAndWait(addButtonId);
+ AssertValueNotEquals(sumAjaxOnlyElemId, "10");
+
+ writeStatus("Ajax request! The sum has to be increased by 5 twice");
+
+// This test doesn't pass! Bug?!
+
+// clickById(addAjaxButtonId);
+// clickById(addAjaxButtonId);
+// waitForAjaxCompletion();
+// AssertValueEquals(sumAjaxOnlyElemId, "10");
+ }
+
+ public String getTestUrl() {
+ return "/faces/pages/keepAlive/keepAliveTest.xhtml";
+ }
+}
Deleted:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/LoadScriptTest.java
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/LoadScriptTest.java 2008-05-23
15:10:59 UTC (rev 8733)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/LoadScriptTest.java 2008-05-23
16:04:20 UTC (rev 8734)
@@ -1,50 +0,0 @@
-package org.richfaces;
-
-import static org.testng.Assert.assertEquals;
-
-import org.ajax4jsf.test.base.SeleniumTestBase;
-import org.ajax4jsf.test.base.Templates;
-import org.testng.annotations.AfterTest;
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.Parameters;
-import org.testng.annotations.Test;
-
-public class LoadScriptTest extends SeleniumTestBase {
-
- public LoadScriptTest() {
- 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 testLoadScriptComponent() throws Exception {
- _testLoadScriptComponent(Templates.SIMPLE);
- _testLoadScriptComponent(Templates.DATATABLE);
- _testLoadScriptComponent(Templates.MODALPANEL);
- }
-
- private void _testLoadScriptComponent(Templates template) {
- renderPage("/faces/pages/loadScript/loadScriptTest.xhtml", template);
- String jsCall = "summarize(%1$s, %2$s);";
- int opr1 = 1;
- int opr2 = 2;
- String result = runScript(String.format(jsCall, opr1, opr2));
- assertEquals(Integer.parseInt(result), opr1 + opr2);
- }
-}
Added:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/LoadScriptTest.java
===================================================================
--- trunk/test-applications/seleniumTest/src/test/java/org/richfaces/LoadScriptTest.java
(rev 0)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/LoadScriptTest.java 2008-05-23
16:04:20 UTC (rev 8734)
@@ -0,0 +1,55 @@
+package org.richfaces;
+
+import static org.testng.Assert.assertEquals;
+
+import org.ajax4jsf.test.base.RichSeleniumTest;
+import org.ajax4jsf.test.base.SeleniumTestBase;
+import org.ajax4jsf.test.base.Templates;
+import org.testng.annotations.AfterTest;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Parameters;
+import org.testng.annotations.Test;
+
+public class LoadScriptTest extends SeleniumTestBase implements RichSeleniumTest {
+
+ public LoadScriptTest() {
+ 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 testLoadScriptComponent() throws Exception {
+ _testLoadScriptComponent(Templates.SIMPLE);
+ _testLoadScriptComponent(Templates.DATATABLE);
+ _testLoadScriptComponent(Templates.MODALPANEL);
+ }
+
+ private void _testLoadScriptComponent(Templates template) {
+ renderPage(getTestUrl(), template);
+ String jsCall = "summarize(%1$s, %2$s);";
+ int opr1 = 1;
+ int opr2 = 2;
+ String result = runScript(String.format(jsCall, opr1, opr2));
+ assertEquals(Integer.parseInt(result), opr1 + opr2);
+ }
+
+ public String getTestUrl() {
+ return "/faces/pages/loadScript/loadScriptTest.xhtml";
+ }
+}
Deleted:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/LoadStyleTest.java
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/LoadStyleTest.java 2008-05-23
15:10:59 UTC (rev 8733)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/LoadStyleTest.java 2008-05-23
16:04:20 UTC (rev 8734)
@@ -1,48 +0,0 @@
-package org.richfaces;
-
-import org.ajax4jsf.test.base.SeleniumTestBase;
-import org.ajax4jsf.test.base.Templates;
-
-import static org.testng.Assert.assertEquals;
-import org.testng.annotations.AfterTest;
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.Parameters;
-import org.testng.annotations.Test;
-
-public class LoadStyleTest extends SeleniumTestBase {
-
- public LoadStyleTest() {
- 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 testLoadStyleComponent() throws Exception {
- _testLoadStyleComponent(Templates.SIMPLE);
- _testLoadStyleComponent(Templates.DATATABLE);
- _testLoadStyleComponent(Templates.MODALPANEL);
- }
-
- private void _testLoadStyleComponent(Templates template) {
- renderPage("/faces/pages/loadStyle/loadStyleTest.xhtml", template);
- String divId = getParentId() + "rectangle";
- assertEquals(50, getWidthById(divId));
- assertEquals(100, getHeightById(divId));
- }
-}
Added:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/LoadStyleTest.java
===================================================================
--- trunk/test-applications/seleniumTest/src/test/java/org/richfaces/LoadStyleTest.java
(rev 0)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/LoadStyleTest.java 2008-05-23
16:04:20 UTC (rev 8734)
@@ -0,0 +1,53 @@
+package org.richfaces;
+
+import org.ajax4jsf.test.base.RichSeleniumTest;
+import org.ajax4jsf.test.base.SeleniumTestBase;
+import org.ajax4jsf.test.base.Templates;
+
+import static org.testng.Assert.assertEquals;
+import org.testng.annotations.AfterTest;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Parameters;
+import org.testng.annotations.Test;
+
+public class LoadStyleTest extends SeleniumTestBase implements RichSeleniumTest {
+
+ public LoadStyleTest() {
+ 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 testLoadStyleComponent() throws Exception {
+ _testLoadStyleComponent(Templates.SIMPLE);
+ _testLoadStyleComponent(Templates.DATATABLE);
+ _testLoadStyleComponent(Templates.MODALPANEL);
+ }
+
+ private void _testLoadStyleComponent(Templates template) {
+ renderPage(getTestUrl(), template);
+ String divId = getParentId() + "rectangle";
+ assertEquals(50, getWidthById(divId));
+ assertEquals(100, getHeightById(divId));
+ }
+
+ public String getTestUrl() {
+ return "/faces/pages/loadStyle/loadStyleTest.xhtml";
+ }
+}
Deleted:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/OrderingListTest.java
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/OrderingListTest.java 2008-05-23
15:10:59 UTC (rev 8733)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/OrderingListTest.java 2008-05-23
16:04:20 UTC (rev 8734)
@@ -1,249 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * 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;
-
-import org.ajax4jsf.test.base.RichSeleniumTest;
-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 OrderingListTest extends SeleniumTestBase implements RichSeleniumTest {
- private String firstButton;
- private String firstButtonDisabled;
-
- private String upButton;
- private String upButtonDisabled;
-
- private String downButton;
- private String downButtonDisabled;
-
- private String lastButton;
- private String lastButtonDisabled;
-
- private String firstRow;
-
- private String actionResultText;
- private String ajax;
- private String server;
- private String thirdRow;
- private String selectionText;
- private String activeItemText;
-
- public OrderingListTest() {
- super("http", "localhost", "8080");
- }
-
- public OrderingListTest(String protocol, String host, String port) {
- super(protocol, host, port);
- }
-
- /**
- * 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 testOrderingListComponent() throws Exception {
- _testOrderingListComponent(Templates.SIMPLE);
- _testOrderingListComponent(Templates.DATATABLE);
- _testOrderingListComponent(Templates.MODALPANEL);
- }
-
- private void _testOrderingListComponent(Templates template) {
- renderPage(getTestUrl(), template);
- initFields();
-
- _testButtons();
- _testActions();
- _testJSFunctions();
- }
-
- public String getTestUrl() {
- return "/faces/pages/orderingList/orderingListTest.xhtml";
- }
-
- private void _testButtons() {
- writeStatus("Check if all buttons are disabled first time");
- checkButtons(true, true, true, true);
-
- writeStatus("Click on first row");
- clickById(firstRow);
- checkButtons(true, true, false, false);
-
- writeStatus("Click on down button");
- Assert.assertEquals(selenium.getElementIndex("id=" + firstRow), 0);
- clickById(downButton);
- checkButtons(false, false, false, false);
- Assert.assertEquals(selenium.getElementIndex("id=" + firstRow), 1);
-
- writeStatus("Click on last button");
- clickById(lastButton);
- checkButtons(false, false, true, true);
- Assert.assertEquals(selenium.getElementIndex("id=" + firstRow), 3);
-
- writeStatus("Click on first button");
- clickById(firstButton);
- checkButtons(true, true, false, false);
- Assert.assertEquals(selenium.getElementIndex("id=" + firstRow), 0);
-
- cleanSelection();
- }
-
- private void _testActions() {
- writeStatus("Select two rows");
- clickById(firstRow);
- selenium.controlKeyDown();
- clickById(thirdRow);
- selenium.controlKeyUp();
- checkButtons(true, true, false, false);
-
- writeStatus("Click on ajax button");
- clickById(ajax);
- waitForAjaxCompletion();
- AssertTextEquals(actionResultText, "item0");
- AssertTextEquals(selectionText, "item0,item2");
- AssertTextEquals(activeItemText, "Item [item2]");
-
- writeStatus("Select one row");
- clickById(firstRow);
-
- writeStatus("Click on server link");
- clickCommandAndWait(server);
- AssertTextEquals(actionResultText, "item1");
- AssertTextEquals(selectionText, "item0");
- AssertTextEquals(activeItemText, "Item [item0]");
- checkButtons(true, true, false, false);
-
- cleanSelection();
- }
-
- private void _testJSFunctions() {
- writeStatus("Select one row");
- clickById(thirdRow);
-
- writeStatus("Check if 'onupclick' event works");
- clickById(upButton);
- Assert.assertEquals(selenium.getEval("window.status"), "up
orderchanged");
-
- writeStatus("Check if 'ondownclick' event works");
- clickById(downButton);
- Assert.assertEquals(selenium.getEval("window.status"), "down
orderchanged");
-
- writeStatus("Check if 'ontopclick' event works");
- clickById(firstButton);
- Assert.assertEquals(selenium.getEval("window.status"), "top
orderchanged");
-
- writeStatus("Check if 'onbottomclick' event works");
- clickById(lastButton);
- Assert.assertEquals(selenium.getEval("window.status"), "bottom
orderchanged");
-
- cleanSelection();
- }
-
- private void cleanSelection() {
- writeStatus("Unselect element");
- clickById(firstRow);
- selenium.controlKeyDown();
- clickById(firstRow);
- selenium.controlKeyUp();
- checkButtons(true, true, true, true);
-
- writeStatus("Submit empty selection to save it into server bean");
- clickById(ajax);
- waitForAjaxCompletion();
- }
-
- private void checkButtons(boolean firstDisabled, boolean upDisabled, boolean
downDisabled, boolean lastDisabled) {
- if (firstDisabled) {
- Assert.assertTrue(isVisibleById(firstButtonDisabled));
- Assert.assertFalse(isVisibleById(firstButton));
- } else {
- Assert.assertFalse(isVisibleById(firstButtonDisabled));
- Assert.assertTrue(isVisibleById(firstButton));
- }
-
- if (upDisabled) {
- Assert.assertTrue(isVisibleById(upButtonDisabled));
- Assert.assertFalse(isVisibleById(upButton));
- } else {
- Assert.assertFalse(isVisibleById(upButtonDisabled));
- Assert.assertTrue(isVisibleById(upButton));
- }
-
- if (downDisabled) {
- Assert.assertTrue(isVisibleById(downButtonDisabled));
- Assert.assertFalse(isVisibleById(downButton));
- } else {
- Assert.assertFalse(isVisibleById(downButtonDisabled));
- Assert.assertTrue(isVisibleById(downButton));
- }
-
- if (lastDisabled) {
- Assert.assertTrue(isVisibleById(lastButtonDisabled));
- Assert.assertFalse(isVisibleById(lastButton));
- } else {
- Assert.assertFalse(isVisibleById(lastButtonDisabled));
- Assert.assertTrue(isVisibleById(lastButton));
- }
- }
-
- private void initFields() {
- String parentId = getParentId() + "_form:orderingList";
-
- firstButton = parentId + "first";
- firstButtonDisabled = parentId + "disfirst";
-
- upButton = parentId + "up";
- upButtonDisabled = parentId + "disup";
-
- downButton = parentId + "down";
- downButtonDisabled = parentId + "disdown";
-
- lastButton = parentId + "last";
- lastButtonDisabled = parentId + "dislast";
-
- firstRow = parentId + ":0";
- thirdRow = parentId + ":2";
-
- actionResultText = getParentId() + "_form:actionResult";
- selectionText = getParentId() + "_form:selection";
- activeItemText = getParentId() + "_form:activeItem";
- ajax = firstRow + ":_ajax";
- server = parentId + ":1:_server";
- }
-}
Added:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/OrderingListTest.java
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/OrderingListTest.java
(rev 0)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/OrderingListTest.java 2008-05-23
16:04:20 UTC (rev 8734)
@@ -0,0 +1,249 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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;
+
+import org.ajax4jsf.test.base.RichSeleniumTest;
+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 OrderingListTest extends SeleniumTestBase implements RichSeleniumTest {
+ private String firstButton;
+ private String firstButtonDisabled;
+
+ private String upButton;
+ private String upButtonDisabled;
+
+ private String downButton;
+ private String downButtonDisabled;
+
+ private String lastButton;
+ private String lastButtonDisabled;
+
+ private String firstRow;
+
+ private String actionResultText;
+ private String ajax;
+ private String server;
+ private String thirdRow;
+ private String selectionText;
+ private String activeItemText;
+
+ public OrderingListTest() {
+ super("http", "localhost", "8080");
+ }
+
+ public OrderingListTest(String protocol, String host, String port) {
+ super(protocol, host, port);
+ }
+
+ /**
+ * 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 testOrderingListComponent() throws Exception {
+ _testOrderingListComponent(Templates.SIMPLE);
+ _testOrderingListComponent(Templates.DATATABLE);
+ _testOrderingListComponent(Templates.MODALPANEL);
+ }
+
+ private void _testOrderingListComponent(Templates template) {
+ renderPage(getTestUrl(), template);
+ initFields();
+
+ _testButtons();
+ _testActions();
+ _testJSFunctions();
+ }
+
+ public String getTestUrl() {
+ return "/faces/pages/orderingList/orderingListTest.xhtml";
+ }
+
+ private void _testButtons() {
+ writeStatus("Check if all buttons are disabled first time");
+ checkButtons(true, true, true, true);
+
+ writeStatus("Click on first row");
+ clickById(firstRow);
+ checkButtons(true, true, false, false);
+
+ writeStatus("Click on down button");
+ Assert.assertEquals(selenium.getElementIndex("id=" + firstRow), 0);
+ clickById(downButton);
+ checkButtons(false, false, false, false);
+ Assert.assertEquals(selenium.getElementIndex("id=" + firstRow), 1);
+
+ writeStatus("Click on last button");
+ clickById(lastButton);
+ checkButtons(false, false, true, true);
+ Assert.assertEquals(selenium.getElementIndex("id=" + firstRow), 3);
+
+ writeStatus("Click on first button");
+ clickById(firstButton);
+ checkButtons(true, true, false, false);
+ Assert.assertEquals(selenium.getElementIndex("id=" + firstRow), 0);
+
+ cleanSelection();
+ }
+
+ private void _testActions() {
+ writeStatus("Select two rows");
+ clickById(firstRow);
+ selenium.controlKeyDown();
+ clickById(thirdRow);
+ selenium.controlKeyUp();
+ checkButtons(true, true, false, false);
+
+ writeStatus("Click on ajax button");
+ clickById(ajax);
+ waitForAjaxCompletion();
+ AssertTextEquals(actionResultText, "item0");
+ AssertTextEquals(selectionText, "item0,item2");
+ AssertTextEquals(activeItemText, "Item [item2]");
+
+ writeStatus("Select one row");
+ clickById(firstRow);
+
+ writeStatus("Click on server link");
+ clickCommandAndWait(server);
+ AssertTextEquals(actionResultText, "item1");
+ AssertTextEquals(selectionText, "item0");
+ AssertTextEquals(activeItemText, "Item [item0]");
+ checkButtons(true, true, false, false);
+
+ cleanSelection();
+ }
+
+ private void _testJSFunctions() {
+ writeStatus("Select one row");
+ clickById(thirdRow);
+
+ writeStatus("Check if 'onupclick' event works");
+ clickById(upButton);
+ Assert.assertEquals(selenium.getEval("window.status"), "up
orderchanged");
+
+ writeStatus("Check if 'ondownclick' event works");
+ clickById(downButton);
+ Assert.assertEquals(selenium.getEval("window.status"), "down
orderchanged");
+
+ writeStatus("Check if 'ontopclick' event works");
+ clickById(firstButton);
+ Assert.assertEquals(selenium.getEval("window.status"), "top
orderchanged");
+
+ writeStatus("Check if 'onbottomclick' event works");
+ clickById(lastButton);
+ Assert.assertEquals(selenium.getEval("window.status"), "bottom
orderchanged");
+
+ cleanSelection();
+ }
+
+ private void cleanSelection() {
+ writeStatus("Unselect element");
+ clickById(firstRow);
+ selenium.controlKeyDown();
+ clickById(firstRow);
+ selenium.controlKeyUp();
+ checkButtons(true, true, true, true);
+
+ writeStatus("Submit empty selection to save it into server bean");
+ clickById(ajax);
+ waitForAjaxCompletion();
+ }
+
+ private void checkButtons(boolean firstDisabled, boolean upDisabled, boolean
downDisabled, boolean lastDisabled) {
+ if (firstDisabled) {
+ Assert.assertTrue(isVisibleById(firstButtonDisabled));
+ Assert.assertFalse(isVisibleById(firstButton));
+ } else {
+ Assert.assertFalse(isVisibleById(firstButtonDisabled));
+ Assert.assertTrue(isVisibleById(firstButton));
+ }
+
+ if (upDisabled) {
+ Assert.assertTrue(isVisibleById(upButtonDisabled));
+ Assert.assertFalse(isVisibleById(upButton));
+ } else {
+ Assert.assertFalse(isVisibleById(upButtonDisabled));
+ Assert.assertTrue(isVisibleById(upButton));
+ }
+
+ if (downDisabled) {
+ Assert.assertTrue(isVisibleById(downButtonDisabled));
+ Assert.assertFalse(isVisibleById(downButton));
+ } else {
+ Assert.assertFalse(isVisibleById(downButtonDisabled));
+ Assert.assertTrue(isVisibleById(downButton));
+ }
+
+ if (lastDisabled) {
+ Assert.assertTrue(isVisibleById(lastButtonDisabled));
+ Assert.assertFalse(isVisibleById(lastButton));
+ } else {
+ Assert.assertFalse(isVisibleById(lastButtonDisabled));
+ Assert.assertTrue(isVisibleById(lastButton));
+ }
+ }
+
+ private void initFields() {
+ String parentId = getParentId() + "_form:orderingList";
+
+ firstButton = parentId + "first";
+ firstButtonDisabled = parentId + "disfirst";
+
+ upButton = parentId + "up";
+ upButtonDisabled = parentId + "disup";
+
+ downButton = parentId + "down";
+ downButtonDisabled = parentId + "disdown";
+
+ lastButton = parentId + "last";
+ lastButtonDisabled = parentId + "dislast";
+
+ firstRow = parentId + ":0";
+ thirdRow = parentId + ":2";
+
+ actionResultText = getParentId() + "_form:actionResult";
+ selectionText = getParentId() + "_form:selection";
+ activeItemText = getParentId() + "_form:activeItem";
+ ajax = firstRow + ":_ajax";
+ server = parentId + ":1:_server";
+ }
+}
Deleted:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/PanelBarTest.java
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/PanelBarTest.java 2008-05-23
15:10:59 UTC (rev 8733)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/PanelBarTest.java 2008-05-23
16:04:20 UTC (rev 8734)
@@ -1,105 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * 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;
-
-import org.ajax4jsf.test.base.RichSeleniumTest;
-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 PanelBarTest extends SeleniumTestBase implements RichSeleniumTest {
-
-
- public PanelBarTest() {
- 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 testPanelBarComponent() throws Exception {
- _testPanelBarComponent(Templates.SIMPLE);
- _testPanelBarComponent(Templates.DATATABLE);
- _testPanelBarComponent(Templates.MODALPANEL);
- }
-
- private void _testPanelBarComponent(Templates template) {
- renderPage(getTestUrl(), template);
- String parentId = getParentId() + "_form:";
-
- String label2 = parentId + "label2";
- String label3 = parentId + "label3";
-
- String output1 = parentId + "output1";
- String output2 = parentId + "output2";
- String output3 = parentId + "output3";
-
- String ajaxButton = parentId + "button_ajax";
- String simpleButton = parentId + "button_simple";
-
- clickById(label2);
- Assert.assertFalse(isVisibleById(output1));
- Assert.assertTrue(isVisibleById(output2));
- Assert.assertFalse(isVisibleById(output3));
-
- clickCommandAndWait(simpleButton);
- Assert.assertFalse(isVisibleById(output1));
- Assert.assertTrue(isVisibleById(output2));
- Assert.assertFalse(isVisibleById(output3));
-
- clickById(label3);
- Assert.assertFalse(isVisibleById(output1));
- Assert.assertFalse(isVisibleById(output2));
- Assert.assertTrue(isVisibleById(output3));
-
- clickById(ajaxButton);
- waitForAjaxCompletion();
- Assert.assertFalse(isVisibleById(output1));
- Assert.assertFalse(isVisibleById(output2));
- Assert.assertTrue(isVisibleById(output3));
- }
-
- public String getTestUrl() {
- return "/faces/pages/panelBar/panelBarTest.xhtml";
- }
-
-}
Added: trunk/test-applications/seleniumTest/src/test/java/org/richfaces/PanelBarTest.java
===================================================================
--- trunk/test-applications/seleniumTest/src/test/java/org/richfaces/PanelBarTest.java
(rev 0)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/PanelBarTest.java 2008-05-23
16:04:20 UTC (rev 8734)
@@ -0,0 +1,105 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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;
+
+import org.ajax4jsf.test.base.RichSeleniumTest;
+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 PanelBarTest extends SeleniumTestBase implements RichSeleniumTest {
+
+
+ public PanelBarTest() {
+ 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 testPanelBarComponent() throws Exception {
+ _testPanelBarComponent(Templates.SIMPLE);
+ _testPanelBarComponent(Templates.DATATABLE);
+ _testPanelBarComponent(Templates.MODALPANEL);
+ }
+
+ private void _testPanelBarComponent(Templates template) {
+ renderPage(getTestUrl(), template);
+ String parentId = getParentId() + "_form:";
+
+ String label2 = parentId + "label2";
+ String label3 = parentId + "label3";
+
+ String output1 = parentId + "output1";
+ String output2 = parentId + "output2";
+ String output3 = parentId + "output3";
+
+ String ajaxButton = parentId + "button_ajax";
+ String simpleButton = parentId + "button_simple";
+
+ clickById(label2);
+ Assert.assertFalse(isVisibleById(output1));
+ Assert.assertTrue(isVisibleById(output2));
+ Assert.assertFalse(isVisibleById(output3));
+
+ clickCommandAndWait(simpleButton);
+ Assert.assertFalse(isVisibleById(output1));
+ Assert.assertTrue(isVisibleById(output2));
+ Assert.assertFalse(isVisibleById(output3));
+
+ clickById(label3);
+ Assert.assertFalse(isVisibleById(output1));
+ Assert.assertFalse(isVisibleById(output2));
+ Assert.assertTrue(isVisibleById(output3));
+
+ clickById(ajaxButton);
+ waitForAjaxCompletion();
+ Assert.assertFalse(isVisibleById(output1));
+ Assert.assertFalse(isVisibleById(output2));
+ Assert.assertTrue(isVisibleById(output3));
+ }
+
+ public String getTestUrl() {
+ return "/faces/pages/panelBar/panelBarTest.xhtml";
+ }
+
+}
Deleted:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/PanelMenuTest.java
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/PanelMenuTest.java 2008-05-23
15:10:59 UTC (rev 8733)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/PanelMenuTest.java 2008-05-23
16:04:20 UTC (rev 8734)
@@ -1,227 +0,0 @@
-package org.richfaces;
-
-import org.ajax4jsf.test.base.RichSeleniumTest;
-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 PanelMenuTest extends SeleniumTestBase implements RichSeleniumTest {
-
- public PanelMenuTest() {
- 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 testPanelMenuComponent() throws Exception {
-
- _testPanelMenuComponent(Templates.SIMPLE);
- _testPanelMenuComponent(Templates.DATATABLE);
- _testPanelMenuComponent(Templates.MODALPANEL);
-
- _testPanelMenuComponentSingleMode(Templates.SIMPLE);
- _testPanelMenuComponentSingleMode(Templates.DATATABLE);
- _testPanelMenuComponentSingleMode(Templates.MODALPANEL);
-
- _testPanelMenuItemAction(Templates.SIMPLE);
- _testPanelMenuItemAction(Templates.DATATABLE);
- _testPanelMenuItemAction(Templates.MODALPANEL);
-
- }
-
- private void _testPanelMenuComponent(Templates template) {
- renderPage(getTestUrl(), template);
- String parentId = getParentId() + "_form:";
-
- String inputId = parentId + "_value";
- String outputId = parentId + "_value2";
-
- String ajaxGroup = "tablehide" + parentId + "pGroup1";
- String serverGroup = "tablehide" + parentId + "pGroup2";
- String clientGroup = "tablehide" + parentId + "pGroup3";
- String disabledGroup = "tablehide" + parentId + "pGroup4";
-
- String ajaxItem = "tablehide" + parentId + "pItem1";
- String serverItem = "tablehide" + parentId + "pItem2";
- String clientItem = "tablehide" + parentId + "pItem3";
- String disabledItem = "tablehide" + parentId + "pItem4";
-
- writeStatus("Click on ajax group");
- clickById(ajaxGroup);
- waitForAjaxCompletion();
- AssertValueEquals(inputId, "pGroup1");
- AssertTextEquals(outputId, "1");
- Assert.assertTrue(isVisibleById(ajaxItem));
- Assert.assertFalse(isVisibleById(serverItem));
- Assert.assertFalse(isVisibleById(clientItem));
-
- writeStatus("Click on server group");
- clickCommandAndWait(serverGroup);
- AssertValueEquals(inputId, "pGroup2");
- AssertTextEquals(outputId, "2");
- Assert.assertTrue(isVisibleById(ajaxItem));
- Assert.assertTrue(isVisibleById(serverItem));
- Assert.assertFalse(isVisibleById(clientItem));
-
- writeStatus("Click on ajax group");
- clickById(ajaxGroup);
- waitForAjaxCompletion();
- AssertValueEquals(inputId, "pGroup1");
- AssertTextEquals(outputId, "3");
- Assert.assertFalse(isVisibleById(ajaxItem));
- Assert.assertTrue(isVisibleById(serverItem));
- Assert.assertFalse(isVisibleById(clientItem));
-
- writeStatus("Click on server group");
- clickCommandAndWait(serverGroup);
-
- AssertValueEquals(inputId, "pGroup2");
- AssertTextEquals(outputId, "4");
- Assert.assertFalse(isVisibleById(ajaxItem));
- Assert.assertFalse(isVisibleById(serverItem));
- Assert.assertFalse(isVisibleById(clientItem));
-
- writeStatus("Click on client group");
- clickById(clientGroup);
- Assert.assertFalse(isVisibleById(ajaxItem));
- Assert.assertFalse(isVisibleById(serverItem));
- Assert.assertTrue(isVisibleById(clientItem));
-
- writeStatus("Click on client group");
- clickById(clientGroup);
- Assert.assertFalse(isVisibleById(ajaxItem));
- Assert.assertFalse(isVisibleById(serverItem));
- Assert.assertFalse(isVisibleById(clientItem));
-
- writeStatus("Click on disabled client group");
- clickById(disabledGroup);
- Assert.assertFalse(isVisibleById(disabledItem));
- }
-
- private void _testPanelMenuComponentSingleMode(Templates template) {
- renderPage(getTestUrl(), template);
- String parentId = getParentId() + "_form:";
-
- String inputId = parentId + "_value";
- String outputId = parentId + "_value2";
-
- String ajaxGroup = "tablehide" + parentId +
"pGroup1_single";
- String serverGroup = "tablehide" + parentId +
"pGroup2_single";
- String clientGroup = "tablehide" + parentId +
"pGroup3_single";
- String disabledGroup = "tablehide" + parentId +
"pGroup4_single";
-
- String ajaxItem = "tablehide" + parentId + "pItem1_single";
- String serverItem = "tablehide" + parentId +
"pItem2_single";
- String clientItem = "tablehide" + parentId +
"pItem3_single";
- String disabledItem = "tablehide" + parentId +
"pItem4_single";
-
- writeStatus("Click on ajax group");
- clickById(ajaxGroup);
- waitForAjaxCompletion();
- AssertValueEquals(inputId, "pGroup1_single");
- AssertTextEquals(outputId, "1");
- Assert.assertTrue(isVisibleById(ajaxItem));
- Assert.assertFalse(isVisibleById(serverItem));
- Assert.assertFalse(isVisibleById(clientItem));
-
- writeStatus("Click on server group");
- clickCommandAndWait(serverGroup);
- AssertValueEquals(inputId, "pGroup2_single");
- AssertTextEquals(outputId, "2");
- Assert.assertFalse(isVisibleById(ajaxItem));
- Assert.assertTrue(isVisibleById(serverItem));
- Assert.assertFalse(isVisibleById(clientItem));
-
- writeStatus("Click on ajax group");
- clickById(ajaxGroup);
- waitForAjaxCompletion();
- AssertValueEquals(inputId, "pGroup1_single");
- AssertTextEquals(outputId, "3");
- Assert.assertTrue(isVisibleById(ajaxItem));
- Assert.assertFalse(isVisibleById(serverItem));
- Assert.assertFalse(isVisibleById(clientItem));
-
- writeStatus("Click on server group");
- clickCommandAndWait(serverGroup);
- AssertValueEquals(inputId, "pGroup2_single");
- AssertTextEquals(outputId, "4");
- Assert.assertFalse(isVisibleById(ajaxItem));
- Assert.assertTrue(isVisibleById(serverItem));
- Assert.assertFalse(isVisibleById(clientItem));
-
- writeStatus("Click on client group");
- clickById(clientGroup);
- Assert.assertFalse(isVisibleById(ajaxItem));
- Assert.assertFalse(isVisibleById(serverItem));
- Assert.assertTrue(isVisibleById(clientItem));
-
- writeStatus("Click on client group");
- clickById(clientGroup);
- Assert.assertFalse(isVisibleById(ajaxItem));
- Assert.assertFalse(isVisibleById(serverItem));
- Assert.assertFalse(isVisibleById(clientItem));
-
- writeStatus("Click on disabled client group");
- clickById(disabledGroup);
- Assert.assertFalse(isVisibleById(disabledItem));
- }
-
- private void _testPanelMenuItemAction(Templates template) {
- renderPage(getTestUrl(), template);
- String parentId = getParentId() + "_form:";
-
- String inputId = parentId + "_value";
- String outputId = parentId + "_value2";
-
- String group = "tablehide" + parentId + "pGroup1";
- String groupSingle = "tablehide" + parentId + "pGroup1_single";
-
- String item = "tablehide" + parentId + "pItem1";
- String itemSingle = "tablehide" + parentId +
"pItem1_single";
-
- writeStatus("Click on ajax group");
- clickById(group);
- waitForAjaxCompletion();
- AssertValueEquals(inputId, "pGroup1");
-
- writeStatus("Click on ajax group");
- clickById(groupSingle);
- waitForAjaxCompletion();
- AssertValueEquals(inputId, "pGroup1_single");
-
- writeStatus("Click on server group");
- clickCommandAndWait(item);
- AssertValueEquals(inputId, "pItem1");
- AssertTextEquals(outputId, "1");
-
- writeStatus("Click on server group");
- clickCommandAndWait(itemSingle);
- AssertValueEquals(inputId, "pItem1_single");
- AssertTextEquals(outputId, "2");
- }
-
- public String getTestUrl() {
- return "/faces/pages/panelMenu/panelMenuTest.xhtml";
- }
-
-}
Added:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/PanelMenuTest.java
===================================================================
--- trunk/test-applications/seleniumTest/src/test/java/org/richfaces/PanelMenuTest.java
(rev 0)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/PanelMenuTest.java 2008-05-23
16:04:20 UTC (rev 8734)
@@ -0,0 +1,227 @@
+package org.richfaces;
+
+import org.ajax4jsf.test.base.RichSeleniumTest;
+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 PanelMenuTest extends SeleniumTestBase implements RichSeleniumTest {
+
+ public PanelMenuTest() {
+ 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 testPanelMenuComponent() throws Exception {
+
+ _testPanelMenuComponent(Templates.SIMPLE);
+ _testPanelMenuComponent(Templates.DATATABLE);
+ _testPanelMenuComponent(Templates.MODALPANEL);
+
+ _testPanelMenuComponentSingleMode(Templates.SIMPLE);
+ _testPanelMenuComponentSingleMode(Templates.DATATABLE);
+ _testPanelMenuComponentSingleMode(Templates.MODALPANEL);
+
+ _testPanelMenuItemAction(Templates.SIMPLE);
+ _testPanelMenuItemAction(Templates.DATATABLE);
+ _testPanelMenuItemAction(Templates.MODALPANEL);
+
+ }
+
+ private void _testPanelMenuComponent(Templates template) {
+ renderPage(getTestUrl(), template);
+ String parentId = getParentId() + "_form:";
+
+ String inputId = parentId + "_value";
+ String outputId = parentId + "_value2";
+
+ String ajaxGroup = "tablehide" + parentId + "pGroup1";
+ String serverGroup = "tablehide" + parentId + "pGroup2";
+ String clientGroup = "tablehide" + parentId + "pGroup3";
+ String disabledGroup = "tablehide" + parentId + "pGroup4";
+
+ String ajaxItem = "tablehide" + parentId + "pItem1";
+ String serverItem = "tablehide" + parentId + "pItem2";
+ String clientItem = "tablehide" + parentId + "pItem3";
+ String disabledItem = "tablehide" + parentId + "pItem4";
+
+ writeStatus("Click on ajax group");
+ clickById(ajaxGroup);
+ waitForAjaxCompletion();
+ AssertValueEquals(inputId, "pGroup1");
+ AssertTextEquals(outputId, "1");
+ Assert.assertTrue(isVisibleById(ajaxItem));
+ Assert.assertFalse(isVisibleById(serverItem));
+ Assert.assertFalse(isVisibleById(clientItem));
+
+ writeStatus("Click on server group");
+ clickCommandAndWait(serverGroup);
+ AssertValueEquals(inputId, "pGroup2");
+ AssertTextEquals(outputId, "2");
+ Assert.assertTrue(isVisibleById(ajaxItem));
+ Assert.assertTrue(isVisibleById(serverItem));
+ Assert.assertFalse(isVisibleById(clientItem));
+
+ writeStatus("Click on ajax group");
+ clickById(ajaxGroup);
+ waitForAjaxCompletion();
+ AssertValueEquals(inputId, "pGroup1");
+ AssertTextEquals(outputId, "3");
+ Assert.assertFalse(isVisibleById(ajaxItem));
+ Assert.assertTrue(isVisibleById(serverItem));
+ Assert.assertFalse(isVisibleById(clientItem));
+
+ writeStatus("Click on server group");
+ clickCommandAndWait(serverGroup);
+
+ AssertValueEquals(inputId, "pGroup2");
+ AssertTextEquals(outputId, "4");
+ Assert.assertFalse(isVisibleById(ajaxItem));
+ Assert.assertFalse(isVisibleById(serverItem));
+ Assert.assertFalse(isVisibleById(clientItem));
+
+ writeStatus("Click on client group");
+ clickById(clientGroup);
+ Assert.assertFalse(isVisibleById(ajaxItem));
+ Assert.assertFalse(isVisibleById(serverItem));
+ Assert.assertTrue(isVisibleById(clientItem));
+
+ writeStatus("Click on client group");
+ clickById(clientGroup);
+ Assert.assertFalse(isVisibleById(ajaxItem));
+ Assert.assertFalse(isVisibleById(serverItem));
+ Assert.assertFalse(isVisibleById(clientItem));
+
+ writeStatus("Click on disabled client group");
+ clickById(disabledGroup);
+ Assert.assertFalse(isVisibleById(disabledItem));
+ }
+
+ private void _testPanelMenuComponentSingleMode(Templates template) {
+ renderPage(getTestUrl(), template);
+ String parentId = getParentId() + "_form:";
+
+ String inputId = parentId + "_value";
+ String outputId = parentId + "_value2";
+
+ String ajaxGroup = "tablehide" + parentId +
"pGroup1_single";
+ String serverGroup = "tablehide" + parentId +
"pGroup2_single";
+ String clientGroup = "tablehide" + parentId +
"pGroup3_single";
+ String disabledGroup = "tablehide" + parentId +
"pGroup4_single";
+
+ String ajaxItem = "tablehide" + parentId + "pItem1_single";
+ String serverItem = "tablehide" + parentId +
"pItem2_single";
+ String clientItem = "tablehide" + parentId +
"pItem3_single";
+ String disabledItem = "tablehide" + parentId +
"pItem4_single";
+
+ writeStatus("Click on ajax group");
+ clickById(ajaxGroup);
+ waitForAjaxCompletion();
+ AssertValueEquals(inputId, "pGroup1_single");
+ AssertTextEquals(outputId, "1");
+ Assert.assertTrue(isVisibleById(ajaxItem));
+ Assert.assertFalse(isVisibleById(serverItem));
+ Assert.assertFalse(isVisibleById(clientItem));
+
+ writeStatus("Click on server group");
+ clickCommandAndWait(serverGroup);
+ AssertValueEquals(inputId, "pGroup2_single");
+ AssertTextEquals(outputId, "2");
+ Assert.assertFalse(isVisibleById(ajaxItem));
+ Assert.assertTrue(isVisibleById(serverItem));
+ Assert.assertFalse(isVisibleById(clientItem));
+
+ writeStatus("Click on ajax group");
+ clickById(ajaxGroup);
+ waitForAjaxCompletion();
+ AssertValueEquals(inputId, "pGroup1_single");
+ AssertTextEquals(outputId, "3");
+ Assert.assertTrue(isVisibleById(ajaxItem));
+ Assert.assertFalse(isVisibleById(serverItem));
+ Assert.assertFalse(isVisibleById(clientItem));
+
+ writeStatus("Click on server group");
+ clickCommandAndWait(serverGroup);
+ AssertValueEquals(inputId, "pGroup2_single");
+ AssertTextEquals(outputId, "4");
+ Assert.assertFalse(isVisibleById(ajaxItem));
+ Assert.assertTrue(isVisibleById(serverItem));
+ Assert.assertFalse(isVisibleById(clientItem));
+
+ writeStatus("Click on client group");
+ clickById(clientGroup);
+ Assert.assertFalse(isVisibleById(ajaxItem));
+ Assert.assertFalse(isVisibleById(serverItem));
+ Assert.assertTrue(isVisibleById(clientItem));
+
+ writeStatus("Click on client group");
+ clickById(clientGroup);
+ Assert.assertFalse(isVisibleById(ajaxItem));
+ Assert.assertFalse(isVisibleById(serverItem));
+ Assert.assertFalse(isVisibleById(clientItem));
+
+ writeStatus("Click on disabled client group");
+ clickById(disabledGroup);
+ Assert.assertFalse(isVisibleById(disabledItem));
+ }
+
+ private void _testPanelMenuItemAction(Templates template) {
+ renderPage(getTestUrl(), template);
+ String parentId = getParentId() + "_form:";
+
+ String inputId = parentId + "_value";
+ String outputId = parentId + "_value2";
+
+ String group = "tablehide" + parentId + "pGroup1";
+ String groupSingle = "tablehide" + parentId + "pGroup1_single";
+
+ String item = "tablehide" + parentId + "pItem1";
+ String itemSingle = "tablehide" + parentId +
"pItem1_single";
+
+ writeStatus("Click on ajax group");
+ clickById(group);
+ waitForAjaxCompletion();
+ AssertValueEquals(inputId, "pGroup1");
+
+ writeStatus("Click on ajax group");
+ clickById(groupSingle);
+ waitForAjaxCompletion();
+ AssertValueEquals(inputId, "pGroup1_single");
+
+ writeStatus("Click on server group");
+ clickCommandAndWait(item);
+ AssertValueEquals(inputId, "pItem1");
+ AssertTextEquals(outputId, "1");
+
+ writeStatus("Click on server group");
+ clickCommandAndWait(itemSingle);
+ AssertValueEquals(inputId, "pItem1_single");
+ AssertTextEquals(outputId, "2");
+ }
+
+ public String getTestUrl() {
+ return "/faces/pages/panelMenu/panelMenuTest.xhtml";
+ }
+
+}
Deleted:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/PickListTest.java
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/PickListTest.java 2008-05-23
15:10:59 UTC (rev 8733)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/PickListTest.java 2008-05-23
16:04:20 UTC (rev 8734)
@@ -1,98 +0,0 @@
-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);
- _testPickListComponent(Templates.MODALPANEL);
- }
-
- 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("xpath=//tbody[@id='" +
destListId + "']/tr[1]"), "ZHURIK");
- Assert.assertEquals(selenium.getText("xpath=//tbody[@id='" +
destListId + "']/tr[2]"), "MELESHKO");
-
- writeStatus("Try to select first item and check state thereafter");
-
- selenium.doubleClick("xpath=//tbody[@id='" + srcListId +
"']/tr/td");
-
- Assert.assertEquals(getNumberOfChildren(srcListId), 5);
- Assert.assertEquals(getNumberOfChildren(destListId), 3);
- Assert.assertEquals(selenium.getText("xpath=//tbody[@id='" +
destListId + "']/tr[3]"), "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;
- }
-
-}
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-23
16:04:20 UTC (rev 8734)
@@ -0,0 +1,103 @@
+package org.richfaces;
+
+import org.ajax4jsf.test.base.RichSeleniumTest;
+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 implements RichSeleniumTest {
+
+ 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);
+ _testPickListComponent(Templates.MODALPANEL);
+ }
+
+ private void _testPickListComponent(Templates template) {
+ renderPage(getTestUrl(), 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("xpath=//tbody[@id='" +
destListId + "']/tr[1]"), "ZHURIK");
+ Assert.assertEquals(selenium.getText("xpath=//tbody[@id='" +
destListId + "']/tr[2]"), "MELESHKO");
+
+ writeStatus("Try to select first item and check state thereafter");
+
+ selenium.doubleClick("xpath=//tbody[@id='" + srcListId +
"']/tr/td");
+
+ Assert.assertEquals(getNumberOfChildren(srcListId), 5);
+ Assert.assertEquals(getNumberOfChildren(destListId), 3);
+ Assert.assertEquals(selenium.getText("xpath=//tbody[@id='" +
destListId + "']/tr[3]"), "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;
+ }
+
+ public String getTestUrl() {
+ return "/faces/pages/pickList/pickListTest.xhtml";
+ }
+
+}
Deleted:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/ProgressBarTest.java
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/ProgressBarTest.java 2008-05-23
15:10:59 UTC (rev 8733)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/ProgressBarTest.java 2008-05-23
16:04:20 UTC (rev 8734)
@@ -1,139 +0,0 @@
-package org.richfaces;
-
-import org.ajax4jsf.test.base.RichSeleniumTest;
-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 ProgressBarTest extends SeleniumTestBase implements
- RichSeleniumTest {
-
- public ProgressBarTest() {
- 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 testProgressBarComponent() {
- _testProgressBarComponent(Templates.SIMPLE);
- _testProgressBarComponent(Templates.DATATABLE);
- _testProgressBarComponent(Templates.MODALPANEL);
- }
-
- private void _testProgressBarComponent(Templates template) {
-
- renderPage(getTestUrl(), template);
-
- String parentId = getParentId() + "_form:";
-
- String progressBarId = parentId + "progressBar1";
- int value = getProgressBarValue(progressBarId);
- Assert.assertTrue(value < 0);
- String text = getTextById(progressBarId);
- writeStatus("Check if process not started");
- Assert.assertTrue(text.startsWith("Process not started"));
-
- writeStatus("Enable polling");
- enableProgressBar(progressBarId, true);
-
- pause(5000, progressBarId);
-
- writeStatus("Disable polling");
- enableProgressBar(progressBarId, false);
-
- writeStatus("Check label");
- text = getTextById(progressBarId + ":remain");
- Assert.assertTrue(text.endsWith("%"));
-
- writeStatus("Check value");
- value = getProgressBarValue(progressBarId);
- Assert.assertTrue(value > 0);
-
- writeStatus("Enable polling");
- enableProgressBar(progressBarId, true);
-
- pause(5000, progressBarId);
- writeStatus("Check value");
- Assert.assertTrue((getProgressBarValue(progressBarId).intValue() != value));
-
- writeStatus("Disable polling");
- enableProgressBar(progressBarId, false);
-
- value = getProgressBarValue(progressBarId);
- pause(1500, progressBarId);
- writeStatus("Check value");
- Assert.assertTrue(getProgressBarValue(progressBarId) == value);
-
- clickById(parentId + "_complete");
- waitForAjaxCompletion();
- writeStatus("Check if process completed");
- text = getTextById(progressBarId);
- Assert.assertTrue(text.startsWith("Process completed"));
-
-
- // - Test client mode
-
- writeStatus("Check value");
- progressBarId = parentId + "progressBar2";
- value = getProgressBarValue(progressBarId);
- Assert.assertTrue(value == -5);
-
- text = getTextById(progressBarId);
- writeStatus("Check if process not started");
- Assert.assertTrue(text.startsWith("Process not started"));
-
- setProgressBarValue(progressBarId, 20);
- value = getProgressBarValue(progressBarId);
- writeStatus("Check value");
- Assert.assertTrue(value == 20);
-
- setProgressBarValue(progressBarId, 60);
- value = getProgressBarValue(progressBarId);
- writeStatus("Check value");
- Assert.assertTrue(value == 60);
-
- clickById(parentId + "_reset");
- waitForAjaxCompletion();
-
- }
-
- private void enableProgressBar(String id, boolean enable) {
- invokeFromComponent(id, (enable ? "enable" : "disable"), null);
- }
-
- private void setProgressBarValue(String id, Object value) {
- invokeFromComponent(id, "setValue", value);
- }
-
- private Integer getProgressBarValue(String id) {
- String value = invokeFromComponent(id, "getValue", null);
//runScript(script.toString());
- Integer v = Integer.parseInt(value);
- return v;
- }
-
- public String getTestUrl() {
- return "/faces/pages/progressBar/progressBarTest.xhtml";
- }
-
-
-}
Added:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/ProgressBarTest.java
===================================================================
--- trunk/test-applications/seleniumTest/src/test/java/org/richfaces/ProgressBarTest.java
(rev 0)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/ProgressBarTest.java 2008-05-23
16:04:20 UTC (rev 8734)
@@ -0,0 +1,139 @@
+package org.richfaces;
+
+import org.ajax4jsf.test.base.RichSeleniumTest;
+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 ProgressBarTest extends SeleniumTestBase implements
+ RichSeleniumTest {
+
+ public ProgressBarTest() {
+ 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 testProgressBarComponent() {
+ _testProgressBarComponent(Templates.SIMPLE);
+ _testProgressBarComponent(Templates.DATATABLE);
+ _testProgressBarComponent(Templates.MODALPANEL);
+ }
+
+ private void _testProgressBarComponent(Templates template) {
+
+ renderPage(getTestUrl(), template);
+
+ String parentId = getParentId() + "_form:";
+
+ String progressBarId = parentId + "progressBar1";
+ int value = getProgressBarValue(progressBarId);
+ Assert.assertTrue(value < 0);
+ String text = getTextById(progressBarId);
+ writeStatus("Check if process not started");
+ Assert.assertTrue(text.startsWith("Process not started"));
+
+ writeStatus("Enable polling");
+ enableProgressBar(progressBarId, true);
+
+ pause(5000, progressBarId);
+
+ writeStatus("Disable polling");
+ enableProgressBar(progressBarId, false);
+
+ writeStatus("Check label");
+ text = getTextById(progressBarId + ":remain");
+ Assert.assertTrue(text.endsWith("%"));
+
+ writeStatus("Check value");
+ value = getProgressBarValue(progressBarId);
+ Assert.assertTrue(value > 0);
+
+ writeStatus("Enable polling");
+ enableProgressBar(progressBarId, true);
+
+ pause(5000, progressBarId);
+ writeStatus("Check value");
+ Assert.assertTrue((getProgressBarValue(progressBarId).intValue() != value));
+
+ writeStatus("Disable polling");
+ enableProgressBar(progressBarId, false);
+
+ value = getProgressBarValue(progressBarId);
+ pause(1500, progressBarId);
+ writeStatus("Check value");
+ Assert.assertTrue(getProgressBarValue(progressBarId) == value);
+
+ clickById(parentId + "_complete");
+ waitForAjaxCompletion();
+ writeStatus("Check if process completed");
+ text = getTextById(progressBarId);
+ Assert.assertTrue(text.startsWith("Process completed"));
+
+
+ // - Test client mode
+
+ writeStatus("Check value");
+ progressBarId = parentId + "progressBar2";
+ value = getProgressBarValue(progressBarId);
+ Assert.assertTrue(value == -5);
+
+ text = getTextById(progressBarId);
+ writeStatus("Check if process not started");
+ Assert.assertTrue(text.startsWith("Process not started"));
+
+ setProgressBarValue(progressBarId, 20);
+ value = getProgressBarValue(progressBarId);
+ writeStatus("Check value");
+ Assert.assertTrue(value == 20);
+
+ setProgressBarValue(progressBarId, 60);
+ value = getProgressBarValue(progressBarId);
+ writeStatus("Check value");
+ Assert.assertTrue(value == 60);
+
+ clickById(parentId + "_reset");
+ waitForAjaxCompletion();
+
+ }
+
+ private void enableProgressBar(String id, boolean enable) {
+ invokeFromComponent(id, (enable ? "enable" : "disable"), null);
+ }
+
+ private void setProgressBarValue(String id, Object value) {
+ invokeFromComponent(id, "setValue", value);
+ }
+
+ private Integer getProgressBarValue(String id) {
+ String value = invokeFromComponent(id, "getValue", null);
//runScript(script.toString());
+ Integer v = Integer.parseInt(value);
+ return v;
+ }
+
+ public String getTestUrl() {
+ return "/faces/pages/progressBar/progressBarTest.xhtml";
+ }
+
+
+}
Deleted:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SimpleTogglePanelTest.java
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SimpleTogglePanelTest.java 2008-05-23
15:10:59 UTC (rev 8733)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SimpleTogglePanelTest.java 2008-05-23
16:04:20 UTC (rev 8734)
@@ -1,110 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * 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;
-
-import org.ajax4jsf.test.base.RichSeleniumTest;
-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 SimpleTogglePanelTest extends SeleniumTestBase implements RichSeleniumTest
{
-
- public SimpleTogglePanelTest() {
- 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 testSimpleTogglePanelComponent() throws Exception {
- _testSimpleTogglePanelComponent(Templates.SIMPLE);
- _testSimpleTogglePanelComponent(Templates.DATATABLE);
- _testSimpleTogglePanelComponent(Templates.MODALPANEL);
- }
-
- private void _testSimpleTogglePanelComponent(Templates template) {
- renderPage(getTestUrl(), template);
- String parentId = getParentId() + "_form:";
- String inputId = parentId + "_value";
- String outputId = parentId + "_value2";
-
- String ajaxHeader = parentId + "panel1_header";
- String serverHeader = parentId + "panel2_header";
- String clientHeader = parentId + "panel3_header";
-
- String ajaxBody = parentId + "panel1_body";
- String serverBody = parentId + "panel2_body";
- String clientBody = parentId + "panel3_body";
-
- clickById(clientHeader);
- Assert.assertTrue(isVisibleById(clientBody));
- clickById(clientHeader);
- Assert.assertFalse(isVisibleById(clientBody));
-
- clickById(ajaxHeader);
- waitForAjaxCompletion(5000);
- AssertValueEquals(inputId, "panel1");
- AssertTextEquals(outputId, "1");
- Assert.assertTrue(isVisibleById(ajaxBody));
-
- clickById(ajaxHeader);
- waitForAjaxCompletion(5000);
- AssertValueEquals(inputId, "panel1");
- AssertTextEquals(outputId, "2");
- Assert.assertFalse(isVisibleById(ajaxBody));
-
- clickCommandAndWait(serverHeader);
- AssertValueEquals(inputId, "panel2");
- AssertTextEquals(outputId, "3");
- Assert.assertTrue(isVisibleById(serverBody));
-
- clickCommandAndWait(serverHeader);
- AssertValueEquals(inputId, "panel2");
- AssertTextEquals(outputId, "4");
- Assert.assertFalse(isVisibleById(serverBody));
- }
-
- public String getTestUrl() {
- return "/faces/pages/simpleTogglePanel/simpleTogglePanel.xhtml";
- }
-
-
-}
Added:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SimpleTogglePanelTest.java
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SimpleTogglePanelTest.java
(rev 0)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SimpleTogglePanelTest.java 2008-05-23
16:04:20 UTC (rev 8734)
@@ -0,0 +1,110 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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;
+
+import org.ajax4jsf.test.base.RichSeleniumTest;
+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 SimpleTogglePanelTest extends SeleniumTestBase implements RichSeleniumTest
{
+
+ public SimpleTogglePanelTest() {
+ 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 testSimpleTogglePanelComponent() throws Exception {
+ _testSimpleTogglePanelComponent(Templates.SIMPLE);
+ _testSimpleTogglePanelComponent(Templates.DATATABLE);
+ _testSimpleTogglePanelComponent(Templates.MODALPANEL);
+ }
+
+ private void _testSimpleTogglePanelComponent(Templates template) {
+ renderPage(getTestUrl(), template);
+ String parentId = getParentId() + "_form:";
+ String inputId = parentId + "_value";
+ String outputId = parentId + "_value2";
+
+ String ajaxHeader = parentId + "panel1_header";
+ String serverHeader = parentId + "panel2_header";
+ String clientHeader = parentId + "panel3_header";
+
+ String ajaxBody = parentId + "panel1_body";
+ String serverBody = parentId + "panel2_body";
+ String clientBody = parentId + "panel3_body";
+
+ clickById(clientHeader);
+ Assert.assertTrue(isVisibleById(clientBody));
+ clickById(clientHeader);
+ Assert.assertFalse(isVisibleById(clientBody));
+
+ clickById(ajaxHeader);
+ waitForAjaxCompletion(5000);
+ AssertValueEquals(inputId, "panel1");
+ AssertTextEquals(outputId, "1");
+ Assert.assertTrue(isVisibleById(ajaxBody));
+
+ clickById(ajaxHeader);
+ waitForAjaxCompletion(5000);
+ AssertValueEquals(inputId, "panel1");
+ AssertTextEquals(outputId, "2");
+ Assert.assertFalse(isVisibleById(ajaxBody));
+
+ clickCommandAndWait(serverHeader);
+ AssertValueEquals(inputId, "panel2");
+ AssertTextEquals(outputId, "3");
+ Assert.assertTrue(isVisibleById(serverBody));
+
+ clickCommandAndWait(serverHeader);
+ AssertValueEquals(inputId, "panel2");
+ AssertTextEquals(outputId, "4");
+ Assert.assertFalse(isVisibleById(serverBody));
+ }
+
+ public String getTestUrl() {
+ return "/faces/pages/simpleTogglePanel/simpleTogglePanel.xhtml";
+ }
+
+
+}
Deleted:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/TabPanelTest.java
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/TabPanelTest.java 2008-05-23
15:10:59 UTC (rev 8733)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/TabPanelTest.java 2008-05-23
16:04:20 UTC (rev 8734)
@@ -1,132 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * 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;
-
-import org.ajax4jsf.test.base.RichSeleniumTest;
-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;
-
-import com.thoughtworks.selenium.SeleniumException;
-
-public class TabPanelTest extends SeleniumTestBase implements RichSeleniumTest {
-
- public TabPanelTest() {
- super("http", "localhost", "8080");
- }
-
- public TabPanelTest(String protocol, String host, String port) {
- super(protocol, host, port);
- // TODO Auto-generated constructor stub
- }
-
- /**
- * 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 testTabPanelComponent() throws Exception {
- _testRichTabPanelComponent(Templates.SIMPLE);
- _testRichTabPanelComponent(Templates.DATATABLE);
- _testRichTabPanelComponent(Templates.MODALPANEL);
- }
-
- private void _testRichTabPanelComponent(Templates template) {
- renderPage(getTestUrl(), template);
- String parentId = getParentId() + "_form:";
- String linkId = parentId + "tab2_lbl";
- String tabId1 = parentId + "tab1";
- String tabId2 = parentId + "tab2";
- String tabId4 = parentId + "tab4";
- String inputId = parentId + "_value";
- String outputId = parentId + "_value2";
-
- writeStatus("Click on tab1");
- clickById(linkId);
- waitForAjaxCompletion();
- AssertValueEquals(inputId, "tab2");
- AssertTextEquals(outputId, "2");
- Assert.assertTrue(isVisibleById(tabId2));
- Assert.assertFalse(isVisibleById(tabId4));
- try {
- getTextById(tabId1);
- Assert.fail("Both of 'tab1' and 'tab2' tabs were rendered
for tab panel.");
- } catch (SeleniumException se) {
-
- }
-
- writeStatus("Click on tab2");
- linkId = parentId + "tab1_lbl";
- clickCommandAndWait(linkId);
- AssertValueEquals(inputId, "tab1");
- AssertTextEquals(outputId, "1");
- Assert.assertTrue(isVisibleById(tabId1));
- Assert.assertFalse(isVisibleById(tabId4));
- try {
- getTextById(tabId2);
- Assert.fail("Both of 'tab1' and 'tab2' tabs were rendered
for tab panel.");
- } catch (SeleniumException se) {
-
- }
-
- writeStatus("Click on tab3");
- linkId = parentId + "tab3_lbl";
- clickById(linkId);
- AssertValueEquals(inputId, "tab1");
- Assert.assertTrue(isVisibleById(tabId1));
-
- writeStatus("Click on tab4");
- linkId = parentId + "tab4_lbl";
- clickById(linkId);
- Assert.assertTrue(isVisibleById(tabId4));
- Assert.assertFalse(isVisibleById(tabId1));
- try {
- getTextById(tabId2);
- Assert.fail("Both of 'tab1' and 'tab2' tabs were rendered
for tab panel.");
- } catch (SeleniumException se) {
-
- }
- }
-
- public String getTestUrl() {
- return "/faces/pages/tabPanel/tabPanelTest.xhtml";
- }
-
-
-}
Added: trunk/test-applications/seleniumTest/src/test/java/org/richfaces/TabPanelTest.java
===================================================================
--- trunk/test-applications/seleniumTest/src/test/java/org/richfaces/TabPanelTest.java
(rev 0)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/TabPanelTest.java 2008-05-23
16:04:20 UTC (rev 8734)
@@ -0,0 +1,127 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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;
+
+import org.ajax4jsf.test.base.RichSeleniumTest;
+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;
+
+import com.thoughtworks.selenium.SeleniumException;
+
+public class TabPanelTest extends SeleniumTestBase implements RichSeleniumTest {
+
+ public TabPanelTest() {
+ 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 testTabPanelComponent() throws Exception {
+ _testRichTabPanelComponent(Templates.SIMPLE);
+ _testRichTabPanelComponent(Templates.DATATABLE);
+ _testRichTabPanelComponent(Templates.MODALPANEL);
+ }
+
+ private void _testRichTabPanelComponent(Templates template) {
+ renderPage(getTestUrl(), template);
+ String parentId = getParentId() + "_form:";
+ String linkId = parentId + "tab2_lbl";
+ String tabId1 = parentId + "tab1";
+ String tabId2 = parentId + "tab2";
+ String tabId4 = parentId + "tab4";
+ String inputId = parentId + "_value";
+ String outputId = parentId + "_value2";
+
+ writeStatus("Click on tab1");
+ clickById(linkId);
+ waitForAjaxCompletion();
+ AssertValueEquals(inputId, "tab2");
+ AssertTextEquals(outputId, "2");
+ Assert.assertTrue(isVisibleById(tabId2));
+ Assert.assertFalse(isVisibleById(tabId4));
+ try {
+ getTextById(tabId1);
+ Assert.fail("Both of 'tab1' and 'tab2' tabs were rendered
for tab panel.");
+ } catch (SeleniumException se) {
+
+ }
+
+ writeStatus("Click on tab2");
+ linkId = parentId + "tab1_lbl";
+ clickCommandAndWait(linkId);
+ AssertValueEquals(inputId, "tab1");
+ AssertTextEquals(outputId, "1");
+ Assert.assertTrue(isVisibleById(tabId1));
+ Assert.assertFalse(isVisibleById(tabId4));
+ try {
+ getTextById(tabId2);
+ Assert.fail("Both of 'tab1' and 'tab2' tabs were rendered
for tab panel.");
+ } catch (SeleniumException se) {
+
+ }
+
+ writeStatus("Click on tab3");
+ linkId = parentId + "tab3_lbl";
+ clickById(linkId);
+ AssertValueEquals(inputId, "tab1");
+ Assert.assertTrue(isVisibleById(tabId1));
+
+ writeStatus("Click on tab4");
+ linkId = parentId + "tab4_lbl";
+ clickById(linkId);
+ Assert.assertTrue(isVisibleById(tabId4));
+ Assert.assertFalse(isVisibleById(tabId1));
+ try {
+ getTextById(tabId2);
+ Assert.fail("Both of 'tab1' and 'tab2' tabs were rendered
for tab panel.");
+ } catch (SeleniumException se) {
+
+ }
+ }
+
+ public String getTestUrl() {
+ return "/faces/pages/tabPanel/tabPanelTest.xhtml";
+ }
+
+
+}
Deleted:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/TogglePanelTest.java
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/TogglePanelTest.java 2008-05-23
15:10:59 UTC (rev 8733)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/TogglePanelTest.java 2008-05-23
16:04:20 UTC (rev 8734)
@@ -1,194 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * 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;
-
-import org.ajax4jsf.test.base.RichSeleniumTest;
-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;
-
-import com.thoughtworks.selenium.SeleniumException;
-
-public class TogglePanelTest extends SeleniumTestBase implements
- RichSeleniumTest {
-
- public TogglePanelTest() {
- 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 testTogglePanelComponent() throws Exception {
- _testTogglePanelComponent(Templates.SIMPLE);
- _testTogglePanelComponent(Templates.DATATABLE);
- _testTogglePanelComponent(Templates.MODALPANEL);
- }
-
- private void _testTogglePanelComponent(Templates template) {
- renderPage(getTestUrl(), template);
- String parentId = getParentId() + "_form:";
-
- String inputId = parentId + "_value";
- String outputId = parentId + "_value2";
-
- String controlNext = parentId + "ajax_next";
- String controlOne = parentId + "ajax_one";
- String controlTwo = parentId + "ajax_two";
-
- String oneFacet = parentId + "ajax_state_one";
- String twoFacet = parentId + "ajax_state_two";
-
- writeStatus("Click on ajax controlNext");
- clickById(controlNext);
- waitForAjaxCompletion();
- //pause(6000, "panel_ajax");
- AssertValueEquals(inputId, "ajax_next");
- AssertTextEquals(outputId, "1");
- Assert.assertTrue(isVisibleById(twoFacet));
- try {
- getTextById(oneFacet);
- Assert
- .fail("Both of 'one' and 'two' states were rendered for ajax
toggle panel.");
- } catch (SeleniumException se) {
-
- }
-
- writeStatus("Click on ajax controlOne");
- clickById(controlOne);
- waitForAjaxCompletion(5000);
- AssertValueEquals(inputId, "ajax_one");
- AssertTextEquals(outputId, "2");
- Assert.assertTrue(isVisibleById(oneFacet));
- try {
- getTextById(twoFacet);
- Assert
- .fail("Both of 'one' and 'two' states were rendered for ajax
toggle panel.");
- } catch (SeleniumException se) {
-
- }
-
- writeStatus("Click on ajax controlTwo");
- clickById(controlTwo);
- waitForAjaxCompletion(5000);
- AssertValueEquals(inputId, "ajax_two");
- AssertTextEquals(outputId, "1");
- Assert.assertTrue(isVisibleById(twoFacet));
- try {
- getTextById(oneFacet);
- Assert
- .fail("Both of 'one' and 'two' states were rendered for ajax
toggle panel.");
- } catch (SeleniumException se) {
-
- }
-
- controlNext = parentId + "server_next";
- controlOne = parentId + "server_one";
- controlTwo = parentId + "server_two";
- oneFacet = parentId + "server_state_one";
- twoFacet = parentId + "server_state_two";
-
- writeStatus("Click on controlNext");
- clickCommandAndWait(controlNext);
- AssertValueEquals(inputId, "server_next");
- AssertTextEquals(outputId, "2");
- Assert.assertTrue(isVisibleById(twoFacet));
- try {
- getTextById(oneFacet);
- Assert
- .fail("Both of 'one' and 'two' states were rendered for server
toggle panel.");
- } catch (SeleniumException se) {
-
- }
-
- writeStatus("Click on server controlOne");
- clickCommandAndWait(controlOne);
- AssertValueEquals(inputId, "server_one");
- AssertTextEquals(outputId, "3");
- Assert.assertTrue(isVisibleById(oneFacet));
- try {
- getTextById(twoFacet);
- Assert
- .fail("Both of 'one' and 'two' states were rendered for server
toggle panel.");
- } catch (SeleniumException se) {
-
- }
-
- writeStatus("Click on server controlTwo");
- clickCommandAndWait(controlTwo);
- AssertValueEquals(inputId, "server_two");
- AssertTextEquals(outputId, "4");
- Assert.assertTrue(isVisibleById(twoFacet));
- try {
- getTextById(oneFacet);
- Assert
- .fail("Both of 'one' and 'two' states were rendered for server
toggle panel.");
- } catch (SeleniumException se) {
-
- }
-
- controlNext = parentId + "client_next";
- controlOne = parentId + "client_one";
- controlTwo = parentId + "client_two";
- oneFacet = parentId + "client_state_one";
- twoFacet = parentId + "client_state_two";
-
- writeStatus("Click on client controlNext");
- clickById(controlNext);
- Assert.assertTrue(isVisibleById(twoFacet));
- Assert.assertFalse(isVisibleById(oneFacet));
-
- writeStatus("Click on client controlOne");
- clickById(controlOne);
- Assert.assertTrue(isVisibleById(oneFacet));
- Assert.assertFalse(isVisibleById(twoFacet));
-
- writeStatus("Click on client controlTwo");
- clickById(controlTwo);
- Assert.assertTrue(isVisibleById(twoFacet));
- Assert.assertFalse(isVisibleById(oneFacet));
- }
-
- public String getTestUrl() {
- return "/faces/pages/togglePanel/togglePanelTest.xhtml";
- }
-
-}
Added:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/TogglePanelTest.java
===================================================================
--- trunk/test-applications/seleniumTest/src/test/java/org/richfaces/TogglePanelTest.java
(rev 0)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/TogglePanelTest.java 2008-05-23
16:04:20 UTC (rev 8734)
@@ -0,0 +1,194 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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;
+
+import org.ajax4jsf.test.base.RichSeleniumTest;
+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;
+
+import com.thoughtworks.selenium.SeleniumException;
+
+public class TogglePanelTest extends SeleniumTestBase implements
+ RichSeleniumTest {
+
+ public TogglePanelTest() {
+ 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 testTogglePanelComponent() throws Exception {
+ _testTogglePanelComponent(Templates.SIMPLE);
+ _testTogglePanelComponent(Templates.DATATABLE);
+ _testTogglePanelComponent(Templates.MODALPANEL);
+ }
+
+ private void _testTogglePanelComponent(Templates template) {
+ renderPage(getTestUrl(), template);
+ String parentId = getParentId() + "_form:";
+
+ String inputId = parentId + "_value";
+ String outputId = parentId + "_value2";
+
+ String controlNext = parentId + "ajax_next";
+ String controlOne = parentId + "ajax_one";
+ String controlTwo = parentId + "ajax_two";
+
+ String oneFacet = parentId + "ajax_state_one";
+ String twoFacet = parentId + "ajax_state_two";
+
+ writeStatus("Click on ajax controlNext");
+ clickById(controlNext);
+ waitForAjaxCompletion();
+ //pause(6000, "panel_ajax");
+ AssertValueEquals(inputId, "ajax_next");
+ AssertTextEquals(outputId, "1");
+ Assert.assertTrue(isVisibleById(twoFacet));
+ try {
+ getTextById(oneFacet);
+ Assert
+ .fail("Both of 'one' and 'two' states were rendered for ajax
toggle panel.");
+ } catch (SeleniumException se) {
+
+ }
+
+ writeStatus("Click on ajax controlOne");
+ clickById(controlOne);
+ waitForAjaxCompletion(5000);
+ AssertValueEquals(inputId, "ajax_one");
+ AssertTextEquals(outputId, "2");
+ Assert.assertTrue(isVisibleById(oneFacet));
+ try {
+ getTextById(twoFacet);
+ Assert
+ .fail("Both of 'one' and 'two' states were rendered for ajax
toggle panel.");
+ } catch (SeleniumException se) {
+
+ }
+
+ writeStatus("Click on ajax controlTwo");
+ clickById(controlTwo);
+ waitForAjaxCompletion(5000);
+ AssertValueEquals(inputId, "ajax_two");
+ AssertTextEquals(outputId, "1");
+ Assert.assertTrue(isVisibleById(twoFacet));
+ try {
+ getTextById(oneFacet);
+ Assert
+ .fail("Both of 'one' and 'two' states were rendered for ajax
toggle panel.");
+ } catch (SeleniumException se) {
+
+ }
+
+ controlNext = parentId + "server_next";
+ controlOne = parentId + "server_one";
+ controlTwo = parentId + "server_two";
+ oneFacet = parentId + "server_state_one";
+ twoFacet = parentId + "server_state_two";
+
+ writeStatus("Click on controlNext");
+ clickCommandAndWait(controlNext);
+ AssertValueEquals(inputId, "server_next");
+ AssertTextEquals(outputId, "2");
+ Assert.assertTrue(isVisibleById(twoFacet));
+ try {
+ getTextById(oneFacet);
+ Assert
+ .fail("Both of 'one' and 'two' states were rendered for server
toggle panel.");
+ } catch (SeleniumException se) {
+
+ }
+
+ writeStatus("Click on server controlOne");
+ clickCommandAndWait(controlOne);
+ AssertValueEquals(inputId, "server_one");
+ AssertTextEquals(outputId, "3");
+ Assert.assertTrue(isVisibleById(oneFacet));
+ try {
+ getTextById(twoFacet);
+ Assert
+ .fail("Both of 'one' and 'two' states were rendered for server
toggle panel.");
+ } catch (SeleniumException se) {
+
+ }
+
+ writeStatus("Click on server controlTwo");
+ clickCommandAndWait(controlTwo);
+ AssertValueEquals(inputId, "server_two");
+ AssertTextEquals(outputId, "4");
+ Assert.assertTrue(isVisibleById(twoFacet));
+ try {
+ getTextById(oneFacet);
+ Assert
+ .fail("Both of 'one' and 'two' states were rendered for server
toggle panel.");
+ } catch (SeleniumException se) {
+
+ }
+
+ controlNext = parentId + "client_next";
+ controlOne = parentId + "client_one";
+ controlTwo = parentId + "client_two";
+ oneFacet = parentId + "client_state_one";
+ twoFacet = parentId + "client_state_two";
+
+ writeStatus("Click on client controlNext");
+ clickById(controlNext);
+ Assert.assertTrue(isVisibleById(twoFacet));
+ Assert.assertFalse(isVisibleById(oneFacet));
+
+ writeStatus("Click on client controlOne");
+ clickById(controlOne);
+ Assert.assertTrue(isVisibleById(oneFacet));
+ Assert.assertFalse(isVisibleById(twoFacet));
+
+ writeStatus("Click on client controlTwo");
+ clickById(controlTwo);
+ Assert.assertTrue(isVisibleById(twoFacet));
+ Assert.assertFalse(isVisibleById(oneFacet));
+ }
+
+ public String getTestUrl() {
+ return "/faces/pages/togglePanel/togglePanelTest.xhtml";
+ }
+
+}