Author: andrei_exadel
Date: 2008-05-26 10:19:15 -0400 (Mon, 26 May 2008)
New Revision: 8757
Added:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/RichSeleniumTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SeleniumTestBase.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/Templates.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/SpacerTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/TabPanelTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/TogglePanelTest.java
Log:
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-26
14:16:02 UTC (rev 8756)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxCommandButtonTest.java 2008-05-26
14:19:15 UTC (rev 8757)
@@ -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", serverPort);
- }
-
- /**
- * 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-26
14:16:02 UTC (rev 8756)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxCommandLinkTest.java 2008-05-26
14:19:15 UTC (rev 8757)
@@ -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", serverPort);
- }
-
- /**
- * 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-26
14:16:02 UTC (rev 8756)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxPollTest.java 2008-05-26
14:19:15 UTC (rev 8757)
@@ -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", serverPort);
- }
-
- /**
- * 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-26
14:16:02 UTC (rev 8756)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxRegionTest.java 2008-05-26
14:19:15 UTC (rev 8757)
@@ -1,103 +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 AjaxRegionTest extends SeleniumTestBase implements RichSeleniumTest {
-
- public AjaxRegionTest() {
- super("http", "localhost", serverPort);
- }
-
- /**
- * 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-26
14:16:02 UTC (rev 8756)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxStatusTest.java 2008-05-26
14:19:15 UTC (rev 8757)
@@ -1,91 +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 AjaxStatusTest extends SeleniumTestBase implements RichSeleniumTest {
-
- public AjaxStatusTest() {
- super("http", "localhost", serverPort);
- }
-
- /**
- * 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-26
14:16:02 UTC (rev 8756)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/CalendarTest.java 2008-05-26
14:19:15 UTC (rev 8757)
@@ -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", serverPort);
- }
-
-
- /**
- * 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-26
14:16:02 UTC (rev 8756)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/ComboBoxTest.java 2008-05-26
14:19:15 UTC (rev 8757)
@@ -1,115 +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 ComboBoxTest extends SeleniumTestBase implements RichSeleniumTest {
-
- public ComboBoxTest() {
- super("http", "localhost", serverPort);
- }
-
- /**
- * 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's pop-up must show up on key typing");
-
- clickById(predefinedCBId + "list");
-
- Assert.assertFalse(isVisibleById(predefinedCBId + "list"),
"Component's pop-up has to be closed");
- Assert.assertEquals(getValue(predefinedCBId), "Hunter");
-
- writeStatus("check a combobox with dynamic suggestions list");
-
- clickById(selectItemsCBId);
-
- writeStatus("verify \"directInputSuggestions\" component's
attribute");
-
- writeStatus("type \"O\"");
-
- selenium.type(selectItemsCBId + "comboboxField", "O");
- selenium.typeKeys(selectItemsCBId + "comboboxField", "O");
-
- Assert.assertTrue(isVisibleById(selectItemsCBId + "list"),
"Component's pop-up must show up on key typing");
- Assert.assertEquals(getValue(selectItemsCBId), "Oak");
-
- writeStatus("check a combobox with a simple String list as suggestions
list");
-
- clickById(suggestionValuesCBId);
- writeStatus("type \"Ma\"");
-
- selenium.type(suggestionValuesCBId + "comboboxField", "Ma");
- selenium.typeKeys(suggestionValuesCBId + "comboboxField",
"Ma");
-
- Assert.assertTrue(isVisibleById(suggestionValuesCBId + "list"),
"Component's pop-up must show up on key typing");
-
- clickById(suggestionValuesCBId + "list");
-
- Assert.assertFalse(isVisibleById(suggestionValuesCBId + "list"),
"Component's pop-up has to be closed");
- Assert.assertEquals(getValue(suggestionValuesCBId), "Maple");
- }
-
- /**
- * 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-26
14:16:02 UTC (rev 8756)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/ContextMenuTest.java 2008-05-26
14:19:15 UTC (rev 8757)
@@ -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", serverPort);
- }
-
- /**
- * 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-26
14:16:02 UTC (rev 8756)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/DataTableTest.java 2008-05-26
14:19:15 UTC (rev 8757)
@@ -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", serverPort);
- }
-
- /**
- * 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-26
14:16:02 UTC (rev 8756)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/DropDownMenuTest.java 2008-05-26
14:19:15 UTC (rev 8757)
@@ -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 DropDownMenuTest extends SeleniumTestBase implements RichSeleniumTest {
-
- public DropDownMenuTest() {
- super("http", "localhost", serverPort);
- }
-
- /**
- * 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-26
14:16:02 UTC (rev 8756)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/InplaceSelectTest.java 2008-05-26
14:19:15 UTC (rev 8757)
@@ -1,120 +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 InplaceSelectTest extends SeleniumTestBase implements RichSeleniumTest {
-
- public InplaceSelectTest() {
- super("http", "localhost", serverPort);
- }
-
- /**
- * 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-26
14:16:02 UTC (rev 8756)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/InputNumberSpinnerTest.java 2008-05-26
14:19:15 UTC (rev 8757)
@@ -1,97 +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 InputNumberSpinnerTest extends SeleniumTestBase implements RichSeleniumTest
{
-
- public InputNumberSpinnerTest() {
- super("http", "localhost", serverPort);
- }
-
- /**
- * 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-26
14:16:02 UTC (rev 8756)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/JSFunctionTest.java 2008-05-26
14:19:15 UTC (rev 8757)
@@ -1,65 +0,0 @@
-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", serverPort);
- }
-
- /**
- * 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-26
14:16:02 UTC (rev 8756)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/KeepAliveTest.java 2008-05-26
14:19:15 UTC (rev 8757)
@@ -1,90 +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 KeepAliveTest extends SeleniumTestBase implements RichSeleniumTest {
-
- public KeepAliveTest() {
- super("http", "localhost", serverPort);
- }
-
- /**
- * 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-26
14:16:02 UTC (rev 8756)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/LoadScriptTest.java 2008-05-26
14:19:15 UTC (rev 8757)
@@ -1,55 +0,0 @@
-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", serverPort);
- }
-
- /**
- * 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-26
14:16:02 UTC (rev 8756)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/LoadStyleTest.java 2008-05-26
14:19:15 UTC (rev 8757)
@@ -1,53 +0,0 @@
-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", serverPort);
- }
-
- /**
- * 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-26
14:16:02 UTC (rev 8756)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/OrderingListTest.java 2008-05-26
14:19:15 UTC (rev 8757)
@@ -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", serverPort);
- }
-
- 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-26
14:16:02 UTC (rev 8756)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/PanelBarTest.java 2008-05-26
14:19:15 UTC (rev 8757)
@@ -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", serverPort);
- }
-
-
- /**
- * 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-26
14:16:02 UTC (rev 8756)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/PanelMenuTest.java 2008-05-26
14:19:15 UTC (rev 8757)
@@ -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", serverPort);
- }
-
- /**
- * 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-26
14:16:02 UTC (rev 8756)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/PickListTest.java 2008-05-26
14:19:15 UTC (rev 8757)
@@ -1,103 +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 PickListTest extends SeleniumTestBase implements RichSeleniumTest {
-
- public PickListTest() {
- super("http", "localhost", serverPort);
- }
-
- /**
- * 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-26
14:16:02 UTC (rev 8756)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/ProgressBarTest.java 2008-05-26
14:19:15 UTC (rev 8757)
@@ -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", serverPort);
- }
-
- /**
- * 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";
- }
-
-
-}
Copied:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/RichSeleniumTest.java
(from rev 8749,
trunk/test-applications/seleniumTest/src/test/java/org/ajax4jsf/test/base/RichSeleniumTest.java)
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/RichSeleniumTest.java
(rev 0)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/RichSeleniumTest.java 2008-05-26
14:19:15 UTC (rev 8757)
@@ -0,0 +1,11 @@
+package org.richfaces;
+
+public interface RichSeleniumTest {
+
+ public void startSelenium (String browser);
+
+ public void stopSelenium();
+
+ public String getTestUrl();
+
+}
Copied:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SeleniumTestBase.java
(from rev 8749,
trunk/test-applications/seleniumTest/src/test/java/org/ajax4jsf/test/base/SeleniumTestBase.java)
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SeleniumTestBase.java
(rev 0)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SeleniumTestBase.java 2008-05-26
14:19:15 UTC (rev 8757)
@@ -0,0 +1,498 @@
+/**
+ * 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.javascript.ScriptUtils;
+import org.testng.Assert;
+
+import com.thoughtworks.selenium.DefaultSelenium;
+
+/**
+ * The base java class for selenium tests implementation.
+ *
+ * @author Andrey Markavtsov
+ *
+ */
+public abstract class SeleniumTestBase {
+
+ /** Specifies the time to wait for page rendering */
+ private static final Integer pageRenderTime = 5000;
+
+ /** Specifies the time to wait for ajax processing */
+ protected static final int ajaxCompletionTime = 3000;
+
+ protected static final String serverPort = "8085";
+
+ private static final String WINDOW_JS_RESOLVER =
"selenium.browserbot.getCurrentWindow().";
+
+ /** Parent component id */
+ private String parentId;
+
+ /** The default selenium instance */
+ public DefaultSelenium selenium;
+
+ /** Host */
+ public String host;
+
+ /** Port */
+ public String port;
+
+ /** Protocol */
+ public String protocol;
+
+ /** Defines the name of current j2ee application name */
+ public static final String APPLICATION_NAME = "seleniumTest";
+
+
+ public static final String DATA_TABLE_TEMPLATE = "dataTable";
+ public static final String MODAL_PANEL_TEMPLATE = "modalPanel";
+ public static final String SIMPLE_TEMPLATE = "simple";
+
+
+ public SeleniumTestBase(String protocol, String host, String port) {
+ this.host = host;
+ this.port = port;
+ this.protocol = protocol;
+ }
+
+ /**
+ * @param url
+ * @param browser
+ * @return
+ */
+ private DefaultSelenium createSeleniumClient(String url, String browser) {
+ return new DefaultSelenium(host, 4444, browser, url);
+ }
+
+ /**
+ * This method are invoking before selenium tests started
+ */
+ protected void startSelenium(String browser) {
+ selenium = createSeleniumClient(protocol + "://" + host + ":" +
port + "/", browser);
+ selenium.start();
+ }
+
+ /**
+ * Renders page
+ */
+ protected void renderPage(String homePage) {
+ selenium.open(protocol + "://" + host + ":" + port +
"/" + APPLICATION_NAME + homePage);
+ selenium.waitForPageToLoad(String.valueOf(pageRenderTime));
+
+
+ checkPageRendering(); // At the first we check if page has been
+ // rendered
+ checkJSError(); // At the second we check if JS errors occurred
+
+ //reRenderForm(); // ReRender component
+
+ //checkPageRendering(); // Check all again
+ //checkJSError();
+
+ }
+
+ /**
+ * Renders page
+ */
+ protected void renderPage(String homePage, Templates template) {
+ selenium.open(protocol + "://" + host + ":" + port +
"/" + APPLICATION_NAME + homePage);
+ selenium.waitForPageToLoad(String.valueOf(pageRenderTime));
+
+ template.loadTemplate(this);
+
+ checkPageRendering(); // At the first we check if page has been
+ // rendered
+ checkJSError(); // At the second we check if JS errors occurred
+
+ reRenderForm(); // ReRender component
+
+ checkPageRendering(); // Check all again
+ checkJSError();
+
+ }
+
+ /**
+ * Writes status message on client side
+ * @param message
+ */
+ public void writeStatus(String message) {
+ message = message.replace("'", "\\'");
+ StringBuffer buffer = new StringBuffer("writeStatus('");
+ buffer.append(message);
+ buffer.append("')");
+ runScript(buffer.toString());
+ }
+
+
+ /**
+ * ReRenders the component
+ */
+ public void reRenderForm() {
+
selenium.getEval("selenium.browserbot.getCurrentWindow().reRenderAll();");
+ // clickById("_Selenium_Test_ReRender_Form:_reRender");
+ waitForAjaxCompletion(3000);
+ }
+
+
+ /**
+ * Performs script defined in parameter
+ * @param script
+ * @return
+ */
+ public String runScript(String script) {
+ String result = selenium.getEval(WINDOW_JS_RESOLVER + script);
+ checkJSError();
+ return result;
+ }
+
+ /**
+ * Performs script defined in parameter
+ * @param script
+ * @return
+ */
+ public String runScript(String script, boolean checkEerror) {
+ String result = selenium.getEval(WINDOW_JS_RESOLVER + script);
+ if (checkEerror) {
+ checkJSError();
+ }
+ return result;
+ }
+
+ /**
+ * This method are invoking after selenium tests completed
+ */
+ protected void stopSelenium() {
+ selenium.stop();
+ selenium = null;
+ }
+
+ /**
+ * Checks if JS error occurred. Fails test if yes. This method should be
+ * invoked after each event or any thing which can be a cause of JS error.
+ */
+ public void checkJSError() {
+ String error = selenium.getEval(WINDOW_JS_RESOLVER +
"checkError();");
+ if (error != null && !("null".equals(error)) &&
!("".equals(error))) {
+ Assert.fail("Failure by the following Javascript error: " +
error);
+ }
+ }
+
+ /**
+ * Checks if page containing component test has been rendered completely
+ */
+ public void checkPageRendering() {
+ try {
+ String t1 = getTextById("_Selenium_Test_ControlPoint1");
+ String t2 = getTextById("_Selenium_Test_ControlPoint2");
+ if (t1 == null || t2 == null || !"Control1".equals(t1) ||
!"Control2".equals(t2)) {
+ Assert.fail("The page has been not rendered properlly");
+ }
+ }catch (Exception e) {
+ Assert.fail("The page has not been rendered properly due the following error:
" + e);
+ }
+ }
+ /**
+ * Waits while AJAX request will be completed
+ *
+ * @param miliseconds -
+ * time to wait
+ */
+ public void waitForAjaxCompletion(int miliseconds) {
+ selenium.waitForCondition(WINDOW_JS_RESOLVER + "done==true",
String.valueOf(miliseconds));
+ runScript("window.done=false");
+ }
+
+ /**
+ * Waits while AJAX request will be completed
+ *
+ * @param miliseconds -
+ * time to wait
+ */
+ public void waitForAjaxCompletion() {
+ waitForAjaxCompletion(ajaxCompletionTime);
+ }
+
+ /**
+ * Waits while simple request will be completed
+ *
+ * @param miliseconds -
+ * time to wait
+ */
+ public void waitForPageToLoad(int miliseconds) {
+ selenium.waitForPageToLoad(String.valueOf(miliseconds));
+ }
+
+ /**
+ * Waits for condition
+ * @param condition
+ * @param miliseconds
+ */
+ public void waiteForCondition(String condition, int miliseconds) {
+ selenium.waitForCondition(WINDOW_JS_RESOLVER + condition,
String.valueOf(miliseconds));
+ checkJSError();
+ }
+
+ /**
+ * Waits while simple request will be completed
+ *
+ */
+ public void waitForPageToLoad() {
+ selenium.waitForPageToLoad(String.valueOf(pageRenderTime));
+ }
+
+ /**
+ * Asserts DOM node value equals to value defined
+ *
+ * @param id -
+ * DOM element id
+ * @param value -
+ * value defined
+ */
+ public void AssertValueEquals(String id, String value) {
+ String _v = getValueById(id);
+ Assert.assertEquals(_v, value);
+ }
+
+ /**
+ * Asserts DOM node value does not equal to value defined
+ *
+ * @param id -
+ * DOM element id
+ * @param value -
+ * value defined
+ */
+ public void AssertValueNotEquals(String id, String value) {
+ String _v = getValueById(id);
+ Assert.assertNotSame(_v, value);
+ }
+
+ /**
+ * Asserts DOM node text equals to text defined
+ *
+ * @param id -
+ * DOM element id
+ * @param value -
+ * text defined
+ */
+ public void AssertTextEquals(String id, String value) {
+ String _v = getTextById(id);
+ Assert.assertEquals(_v, value);
+ }
+
+ /**
+ * Asserts DOM node text does not equal to text defined
+ *
+ * @param id -
+ * DOM element id
+ * @param value -
+ * text defined
+ */
+ public void AssertTextNotEquals(String id, String value) {
+ String _v = getTextById(id);
+ Assert.assertNotSame(_v, value);
+ }
+
+ /**
+ * Asserts DOM node is visible
+ *
+ * @param id -
+ * DOM element id
+ */
+ public void AssertVisible(String id) {
+ Assert.assertTrue(isVisibleById(id));
+ }
+
+ /**
+ * Asserts DOM node is not present
+ *
+ * @param id -
+ * DOM element id
+ */
+ public void AssertNotPresent(String id) {
+ Assert.assertFalse(isPresentById(id));
+ }
+
+ /**
+ * Asserts DOM node is not visible
+ *
+ * @param id -
+ * DOM element id
+ */
+ public void AssertNotVisible(String id) {
+ Assert.assertFalse(isVisibleById(id));
+ }
+
+ /**
+ * Returns element's text
+ *
+ * @param id -
+ * DOM element id
+ * @return
+ */
+ public String getTextById(String id) {
+ return selenium.getText("id=" + id);
+ }
+
+ /**
+ * Returns element's value
+ *
+ * @param id -
+ * DOM element id
+ * @return
+ */
+ public String getValueById(String id) {
+ return selenium.getValue("id=" + id);
+ }
+
+ /**
+ * Sets a new value for DOM node with specified id.
+ *
+ * @param id -
+ * DOM element id
+ * @param value -
+ * a new DOM element's value
+ */
+ public void setValueById(String id, String value) {
+
runScript(String.format("document.getElementById('%1$s').value=%2$s;",
id, value));
+ }
+
+ /**
+ * Returns element's width
+ * @param id - DOM element id
+ * @return
+ */
+ public Number getWidthById(String id) {
+ return selenium.getElementWidth("id=" + id);
+ }
+
+ /**
+ * Returns element's height
+ * @param id - DOM element id
+ * @return
+ */
+ public Number getHeightById(String id) {
+ return selenium.getElementHeight("id=" + id);
+ }
+
+ /**
+ * Clicks on element
+ *
+ * @param id -
+ * DOM element id
+ * @return
+ */
+ public void clickById(String id) {
+ selenium.click("id=" + id);
+ checkJSError();
+ }
+
+ /**
+ * This method should be used for click on command controls instead of
'clickById' method.
+ * @param commandId
+ */
+ public void clickCommandAndWait(String commandId) {
+ selenium.click("id=" + commandId);
+ waitForPageToLoad();
+ }
+
+ /**
+ * Return true if element is visible
+ * @param id - DOM element id
+ * @return
+ */
+ public boolean isVisibleById(String id) {
+ return selenium.isVisible("id=" + id);
+ }
+
+ /**
+ * Returns true if element with given id is present.
+ * @param id - DOM element id
+ * @return true if element with given id is present, otherwise - false
+ */
+ public boolean isPresentById(String id) {
+ return selenium.isElementPresent("id=" + id);
+ }
+
+ /**
+ * Invokes JS method on client.
+ * @param id - DOM id of component
+ * @param method - string method name
+ * @param parameters - parameters
+ * @return
+ */
+ public String invokeFromComponent(String id, String method, Object parameters) {
+ String _return = null;
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("$('");
+ buffer.append(id);
+ buffer.append("').component.");
+ buffer.append(method);
+ buffer.append("(");
+ buffer.append(ScriptUtils.toScript(parameters));
+ buffer.append(");");
+ _return = runScript(buffer.toString());
+ return _return;
+ }
+
+
+ /**
+ * Creates delay
+ * @param miliSeconds
+ * @throws InterruptedException
+ */
+ public void delay(int miliSeconds) {
+ try {
+ Thread.sleep(miliSeconds);
+ } catch (Exception e) {
+
+ }
+ }
+
+ /**
+ * Creates pause for defined time in miliSeconds
+ * @param miliSeconds
+ */
+ public void pause(int miliSeconds, String id) {
+ StringBuffer script = new StringBuffer("pause(");
+ script.append(miliSeconds);
+ script.append(",'");
+ script.append(id);
+ script.append("');");
+ runScript(script.toString());
+ selenium.waitForCondition(WINDOW_JS_RESOLVER + "pauseHolder['" + id +
"'] == true;", String.valueOf(miliSeconds + 1000));
+ }
+
+ /**
+ * @return the parentId
+ */
+ public String getParentId() {
+ return parentId;
+ }
+
+ /**
+ * @param parentId the parentId to set
+ */
+ public void setParentId(String parentId) {
+ this.parentId = parentId;
+ }
+
+}
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-26
14:16:02 UTC (rev 8756)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SimpleTogglePanelTest.java 2008-05-26
14:19:15 UTC (rev 8757)
@@ -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", serverPort);
- }
-
- /**
- * 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/SpacerTest.java
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SpacerTest.java 2008-05-26
14:16:02 UTC (rev 8756)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SpacerTest.java 2008-05-26
14:19:15 UTC (rev 8757)
@@ -1,123 +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 SpacerTest extends SeleniumTestBase implements RichSeleniumTest {
-
- public SpacerTest() {
- super("http", "localhost", serverPort);
- }
-
- /**
- * 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();
- String spacerId = parentId + "sp";
-
- writeStatus("Check width ");
- assertWidth(1 + 2, spacerId);
-
- writeStatus("Check height ");
- assertHeight(5 + 2, spacerId);
-
- writeStatus("Check styleClass ");
- assertStyleClass("sp", spacerId);
-
- writeStatus("Check style ");
- assertStyleClass("border: solid 1px green;", spacerId);
- }
-
- public String getTestUrl() {
- return "/faces/pages/spacer/spacerTest.xhtml";
- }
-
- private void assertWidth(int width, String spacerId) {
- StringBuffer script = new StringBuffer(" document.getElementById('");
- script.append(spacerId);
- script.append("').offsetWidth");
-
- String w = runScript(script.toString());
- Assert.assertEquals(w, String.valueOf(width));
- }
-
- private void assertHeight(int height, String spacerId) {
- StringBuffer script = new StringBuffer(" document.getElementById('");
- script.append(spacerId);
- script.append("').offsetHeight");
-
- String h = runScript(script.toString());
- Assert.assertEquals(h, String.valueOf(height));
- }
-
- private void assertStyleClass(String styleClass, String spacerId) {
- StringBuffer script = new StringBuffer(" document.getElementById('");
- script.append(spacerId);
- script.append("').className");
-
- String sc = runScript(script.toString());
- if (sc != null) {
- Assert.assertTrue(sc.endsWith("sp"));
- } else {
- Assert.fail("ClassName is null");
- }
- }
- private void assertStyle(String style, String spacerId) {
- StringBuffer script = new StringBuffer(" document.getElementById('");
- script.append(spacerId);
- script.append("').style");
-
- String s = runScript(script.toString());
- Assert.assertEquals(s, style);
- }
-}
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-26
14:16:02 UTC (rev 8756)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/TabPanelTest.java 2008-05-26
14:19:15 UTC (rev 8757)
@@ -1,127 +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", serverPort);
- }
-
- /**
- * 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";
- }
-
-
-}
Copied: trunk/test-applications/seleniumTest/src/test/java/org/richfaces/Templates.java
(from rev 8749,
trunk/test-applications/seleniumTest/src/test/java/org/ajax4jsf/test/base/Templates.java)
===================================================================
--- trunk/test-applications/seleniumTest/src/test/java/org/richfaces/Templates.java
(rev 0)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/Templates.java 2008-05-26
14:19:15 UTC (rev 8757)
@@ -0,0 +1,48 @@
+package org.richfaces;
+
+import org.ajax4jsf.template.Template;
+
+
+
+public class Templates implements Template {
+
+ private String template = null;
+
+ public Templates(String name) {
+ template = name;
+ }
+
+ public static Templates SIMPLE = new Templates("simple");
+
+ public static Templates DATATABLE = new Templates("dataTable");
+
+ public static Templates MODALPANEL = new Templates("modalPanel");
+
+ private void setParentId(SeleniumTestBase test) {
+ if ("dataTable".equals(template)) {
+ test.setParentId(COMPONENT_PREFIX_INSIDE_TABLE);
+ } else {
+ test.setParentId(COMPONENT_PREFIX_SIMPLE);
+ }
+ }
+
+ public void loadTemplate(SeleniumTestBase test) {
+ setParentId(test);
+ test.runScript("loadTemplate('" + template + "');",
false);
+ test.waitForPageToLoad();
+ }
+
+ public boolean equals(Object obj) {
+ if (obj == null || !(obj instanceof Templates)) {
+ return false;
+ }
+ Templates template = (Templates) obj;
+ if (template.template.equals(this.template)) {
+ return true;
+ }
+ return false;
+ }
+
+
+
+}
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-26
14:16:02 UTC (rev 8756)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/TogglePanelTest.java 2008-05-26
14:19:15 UTC (rev 8757)
@@ -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", serverPort);
- }
-
- /**
- * 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";
- }
-
-}