Author: lfryc(a)redhat.com
Date: 2009-09-02 02:25:05 -0400 (Wed, 02 Sep 2009)
New Revision: 15428
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/ajaxSupport/AjaxSupportTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/ajaxSupport/locators.properties
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/ajaxSupport/messages.properties
Log:
- refactored Ajax Support test cases to follow conventions
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/ajaxSupport/AjaxSupportTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/ajaxSupport/AjaxSupportTestCase.java 2009-09-02
06:12:16 UTC (rev 15427)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/ajaxSupport/AjaxSupportTestCase.java 2009-09-02
06:25:05 UTC (rev 15428)
@@ -1,7 +1,29 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces
+ *
+ * Copyright (C) 2009 Red Hat, Inc.
+ *
+ * This code 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 code 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 test suite; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
package org.jboss.richfaces.integrationTest.ajaxSupport;
import org.jboss.richfaces.integrationTest.AbstractSeleniumRichfacesTestCase;
+import org.jboss.test.selenium.dom.Event;
import org.jboss.test.selenium.waiting.Wait;
+import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
@@ -9,35 +31,33 @@
* @version $Revision$
*/
public class AjaxSupportTestCase extends AbstractSeleniumRichfacesTestCase {
+ private String LOC_INPUT_TEXT = getLoc("INPUT_TEXT");
+ private String LOC_OUTPUT_TEXT_RELATIVE = formatLoc("OUTPUT_TEXT_RELATIVE",
LOC_INPUT_TEXT);
+
+ private String MSG_INPUT_NON_EMPTY = getMsg("INPUT_NON_EMPTY");
+
/**
- * Opens specified page
+ * Try non-empty input. Input should appear in output.
*/
- private void openPage() {
- selenium.open(contextPath
- + "/richfaces/support.jsf?c=support&tab=usage");
- }
-
- private String textInput = getLoc("ajax-support--input");
- private String relativeText = formatLoc("ajax-support--text-relative",
- textInput);
- private String nonEmpty = getMess("ajax-support--non-empty");
- private String inputEvent = getMess("ajax-support--input-event");
-
@Test
public void testNonEmpty() {
- openPage();
nonEmpty();
}
+ /**
+ * Try empty input. No output should appear.
+ */
@Test
public void testEmpty() {
- openPage();
empty();
}
+ /**
+ * Test interleaving of typing empty and non-empty input and watch output to
+ * be changed in right way.
+ */
@Test
public void testInterleaving() {
- openPage();
nonEmpty();
empty();
nonEmpty();
@@ -45,16 +65,26 @@
}
public void nonEmpty() {
- selenium.type(textInput, nonEmpty);
- selenium.fireEvent(textInput, inputEvent);
+ selenium.type(LOC_INPUT_TEXT, MSG_INPUT_NON_EMPTY);
+ selenium.fireEvent(LOC_INPUT_TEXT, Event.KEYUP);
+
waitFor(Wait.DEFAULT_INTERVAL);
- waitForTextEquals(relativeText, nonEmpty);
+ waitForTextEquals(LOC_OUTPUT_TEXT_RELATIVE, MSG_INPUT_NON_EMPTY);
}
public void empty() {
- selenium.type(textInput, "");
- selenium.fireEvent(textInput, inputEvent);
+ selenium.type(LOC_INPUT_TEXT, "");
+ selenium.fireEvent(LOC_INPUT_TEXT, Event.KEYUP);
+
waitFor(Wait.DEFAULT_INTERVAL);
- waitForTextEquals(textInput, "");
+ waitForTextEquals(LOC_INPUT_TEXT, "");
}
+
+ @SuppressWarnings("unused")
+ @BeforeMethod
+ private void loadPage() {
+ openComponent("Ajax Support");
+
+ scrollIntoView(LOC_INPUT_TEXT, true);
+ }
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/ajaxSupport/locators.properties
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/ajaxSupport/locators.properties 2009-09-02
06:12:16 UTC (rev 15427)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/ajaxSupport/locators.properties 2009-09-02
06:25:05 UTC (rev 15428)
@@ -1,2 +1,2 @@
-ajax-support--input=//input[@type\='text']
-ajax-support--text-relative={0}/../../td[2]/*/text()
\ No newline at end of file
+INPUT_TEXT=//input[@type\='text']
+OUTPUT_TEXT_RELATIVE={0}/../../td[2]/*/text()
\ No newline at end of file
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/ajaxSupport/messages.properties
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/ajaxSupport/messages.properties 2009-09-02
06:12:16 UTC (rev 15427)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/ajaxSupport/messages.properties 2009-09-02
06:25:05 UTC (rev 15428)
@@ -1,2 +1 @@
-ajax-support--non-empty=abc
-ajax-support--input-event=keyup
\ No newline at end of file
+INPUT_NON_EMPTY=abc
Show replies by thread