Author: andrei_exadel
Date: 2008-05-22 07:50:22 -0400 (Thu, 22 May 2008)
New Revision: 8689
Added:
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
Log:
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-22
11:50:22 UTC (rev 8689)
@@ -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";
+ }
+
+}
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-22
11:50:22 UTC (rev 8689)
@@ -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";
+ }
+
+}
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-22
11:50:22 UTC (rev 8689)
@@ -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";
+ }
+
+}
Show replies by date