JBoss Rich Faces SVN: r15439 - in branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test: resources/org/jboss/richfaces/integrationTest/keepAlive and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2009-09-02 10:24:38 -0400 (Wed, 02 Sep 2009)
New Revision: 15439
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/keepAlive/KeepAliveTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/keepAlive/locators.properties
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/keepAlive/messages.properties
Log:
- refactored Keep Alive test cases to follow conventions
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/keepAlive/KeepAliveTestCase.java
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/keepAlive/KeepAliveTestCase.java 2009-09-02 12:34:47 UTC (rev 15438)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/keepAlive/KeepAliveTestCase.java 2009-09-02 14:24:38 UTC (rev 15439)
@@ -1,12 +1,33 @@
+/**
+ * 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.keepAlive;
-import junit.framework.Assert;
+import static org.testng.Assert.*;
import org.apache.commons.lang.StringUtils;
import org.jboss.richfaces.integrationTest.AbstractSeleniumRichfacesTestCase;
import org.jboss.test.selenium.dom.Event;
import org.jboss.test.selenium.waiting.Condition;
import org.jboss.test.selenium.waiting.Wait;
+import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
@@ -14,90 +35,93 @@
* @version $Revision$
*/
public class KeepAliveTestCase extends AbstractSeleniumRichfacesTestCase {
+ private final String LOC_INPUT_INCORRECT1 = getLoc("INPUT_INCORRECT1");
+ private final String LOC_INPUT_INCORRECT2 = getLoc("INPUT_INCORRECT2");
+ private final String LOC_BUTTON_INCORRECT = getLoc("BUTTON_INCORRECT");
+ private final String LOC_OUTPUT_INCORRECT = getLoc("OUTPUT_INCORRECT");
+ private final String LOC_INPUT_CORRECT1 = getLoc("INPUT_CORRECT1");
+ private final String LOC_INPUT_CORRECT2 = getLoc("INPUT_CORRECT2");
+ private final String LOC_BUTTON_CORRECT = getLoc("BUTTON_CORRECT");
+ private final String LOC_OUTPUT_CORRECT = getLoc("OUTPUT_CORRECT");
+
+ private final String MSG_INPUT_FIRST_NUMBER = getMsg("INPUT_FIRST_NUMBER");
+ private final String MSG_INPUT_SECOND_NUMBER = getMsg("INPUT_SECOND_NUMBER");
+ private final String MSG_OUTPUT_RESULT_NUMBER = getMsg("OUTPUT_RESULT_NUMBER");
+
/**
- * Opens specified page
+ * Type two summands to incorrect way form, wait for button became enabled
+ * and checks that after click will appear no result.
*/
- private void openPage() {
- selenium.open(contextPath
- + "/richfaces/keepAlive.jsf?c=keepAlive&tab=usage");
- }
-
- private String header = getLoc("keep-alive--header");
- private String inputIncorrect1 = getLoc("keep-alive--input--incorrect1");
- private String inputIncorrect2 = getLoc("keep-alive--input--incorrect2");
- private String buttonIncorrect = getLoc("keep-alive--button--incorrect");
- private String outputIncorrect = getLoc("keep-alive--output--incorrect");
- private String inputCorrect1 = getLoc("keep-alive--input--correct1");
- private String inputCorrect2 = getLoc("keep-alive--input--correct2");
- private String buttonCorrect = getLoc("keep-alive--button--correct");
- private String outputCorrect = getLoc("keep-alive--output--correct");
- private String firstNumber = getMess("keep-alive--input--first-number");
- private String secondNumber = getMess("keep-alive--input--second-number");
- private String expectedResultNumber = getMess("keep-alive--output--expected-result-number");
-
@Test
- public void usingIncorrectWay() {
- openPage();
- scrollIntoView(header, true);
+ public void testUsingIncorrectWay() {
// fill first two summands
- selenium.type(inputIncorrect1, firstNumber);
- selenium.fireEvent(inputIncorrect1, Event.KEYUP);
- selenium.type(inputIncorrect2, secondNumber);
- selenium.fireEvent(inputIncorrect2, Event.KEYUP);
+ scrollIntoView(LOC_INPUT_INCORRECT1, true);
+
+ selenium.type(LOC_INPUT_INCORRECT1, MSG_INPUT_FIRST_NUMBER);
+ selenium.fireEvent(LOC_INPUT_INCORRECT1, Event.KEYUP);
+ selenium.type(LOC_INPUT_INCORRECT2, MSG_INPUT_SECOND_NUMBER);
+ selenium.fireEvent(LOC_INPUT_INCORRECT2, Event.KEYUP);
+
// wait for "equal sign" button became enabled (lost disabled status)
- Wait.until(new Condition() {
+ Wait.failWith("Button \"=\" never became enabled").until(new Condition() {
public boolean isTrue() {
- boolean result = selenium.isElementPresent(format(
- "{0}/@disabled", buttonIncorrect));
- return !result;
+ return !selenium.isElementPresent(format("{0}/@disabled", LOC_BUTTON_INCORRECT));
}
});
// try to count result
- selenium.click(buttonIncorrect);
+ selenium.click(LOC_BUTTON_INCORRECT);
// TODO: try to find exact way to catch "progress done" event
// waiting for summarization is processed
waitFor(5000);
-
+
// get a result and validate it
- String result = selenium.getText(outputIncorrect);
- Assert.assertTrue(StringUtils.isBlank(result));
+ String result = selenium.getText(LOC_OUTPUT_INCORRECT);
+ assertTrue(StringUtils.isBlank(result), "Result should be blank");
}
+ /**
+ * Type two summands into correct way form, waits for button became enabled
+ * and check that after click will appear right result.
+ */
@Test
- public void usingCorrectWay() {
- openPage();
- scrollIntoView(header, true);
-
+ public void testUsingCorrectWay() {
// fill first two summands
- selenium.type(inputCorrect1, firstNumber);
- selenium.fireEvent(inputCorrect1, Event.KEYUP);
- selenium.type(inputCorrect2, secondNumber);
- selenium.fireEvent(inputCorrect2, Event.KEYUP);
+ scrollIntoView(LOC_INPUT_CORRECT1, true);
+
+ selenium.type(LOC_INPUT_CORRECT1, MSG_INPUT_FIRST_NUMBER);
+ selenium.fireEvent(LOC_INPUT_CORRECT1, Event.KEYUP);
+ selenium.type(LOC_INPUT_CORRECT2, MSG_INPUT_SECOND_NUMBER);
+ selenium.fireEvent(LOC_INPUT_CORRECT2, Event.KEYUP);
+
// wait for "equal sign" button became enabled (lost disabled status)
- Wait.until(new Condition() {
+ Wait.failWith("Button \"=\" never became enabled").until(new Condition() {
public boolean isTrue() {
- boolean result = selenium.isElementPresent(format(
- "{0}/@disabled", buttonCorrect));
- return !result;
-
+ return !selenium.isElementPresent(format("{0}/@disabled", LOC_BUTTON_CORRECT));
}
});
// try to count result
- selenium.click(buttonCorrect);
+ selenium.click(LOC_BUTTON_CORRECT);
- // waiting for result became right - If this not happen, waiting timeouts and test fail
- Wait.until(new Condition() {
+ // waiting for result became right - If this not happen, waiting
+ // timeouts and test fail
+ Wait.failWith("Result never became correct").until(new Condition() {
public boolean isTrue() {
- String result = selenium.getText(outputCorrect);
- return expectedResultNumber.equals(result);
+ String result = selenium.getText(LOC_OUTPUT_CORRECT);
+ return MSG_OUTPUT_RESULT_NUMBER.equals(result);
}
});
}
+
+ @SuppressWarnings("unused")
+ @BeforeMethod
+ private void loadPage() {
+ openComponent("Keep Alive");
+ }
}
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/keepAlive/locators.properties
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/keepAlive/locators.properties 2009-09-02 12:34:47 UTC (rev 15438)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/keepAlive/locators.properties 2009-09-02 14:24:38 UTC (rev 15439)
@@ -1,9 +1,8 @@
-keep-alive--header=//legend[text()\='KeepAlive demo']
-keep-alive--input--incorrect1=//fieldset/div/table/tbody/tr[2]/td[1]/form/input[@type\='text'][1]
-keep-alive--input--incorrect2=//fieldset/div/table/tbody/tr[2]/td[1]/form/input[@type\='text'][2]
-keep-alive--button--incorrect=//fieldset/div/table/tbody/tr[2]/td[1]/form/*[@type\='button']
-keep-alive--output--incorrect=//fieldset/div/table/tbody/tr[2]/td[1]/form/*[contains(@id, 'sum')]
-keep-alive--input--correct1=//fieldset/div/table/tbody/tr[2]/td[2]/form/input[@type\='text'][1]
-keep-alive--input--correct2=//fieldset/div/table/tbody/tr[2]/td[2]/form/input[@type\='text'][2]
-keep-alive--button--correct=//fieldset/div/table/tbody/tr[2]/td[2]/form/*[@type\='button']
-keep-alive--output--correct=//fieldset/div/table/tbody/tr[2]/td[2]/form/*[contains(@id, 'sum')]
+INPUT_INCORRECT1=//fieldset/div/table/tbody/tr[2]/td[1]/form/input[@type\='text'][1]
+INPUT_INCORRECT2=//fieldset/div/table/tbody/tr[2]/td[1]/form/input[@type\='text'][2]
+BUTTON_INCORRECT=//fieldset/div/table/tbody/tr[2]/td[1]/form/*[@type\='button']
+OUTPUT_INCORRECT=//fieldset/div/table/tbody/tr[2]/td[1]/form/*[contains(@id, 'sum')]
+INPUT_CORRECT1=//fieldset/div/table/tbody/tr[2]/td[2]/form/input[@type\='text'][1]
+INPUT_CORRECT2=//fieldset/div/table/tbody/tr[2]/td[2]/form/input[@type\='text'][2]
+BUTTON_CORRECT=//fieldset/div/table/tbody/tr[2]/td[2]/form/*[@type\='button']
+OUTPUT_CORRECT=//fieldset/div/table/tbody/tr[2]/td[2]/form/*[contains(@id, 'sum')]
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/keepAlive/messages.properties
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/keepAlive/messages.properties 2009-09-02 12:34:47 UTC (rev 15438)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/keepAlive/messages.properties 2009-09-02 14:24:38 UTC (rev 15439)
@@ -1,3 +1,3 @@
-keep-alive--input--first-number=2
-keep-alive--input--second-number=3
-keep-alive--output--expected-result-number=5
+INPUT_FIRST_NUMBER=2
+INPUT_SECOND_NUMBER=3
+OUTPUT_RESULT_NUMBER=5
15 years, 3 months
JBoss Rich Faces SVN: r15438 - branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/status.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2009-09-02 08:34:47 -0400 (Wed, 02 Sep 2009)
New Revision: 15438
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/status/StatusTestCase.java
Log:
- refactored StatusTestCase to follow conventions
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/status/StatusTestCase.java
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/status/StatusTestCase.java 2009-09-02 12:27:23 UTC (rev 15437)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/status/StatusTestCase.java 2009-09-02 12:34:47 UTC (rev 15438)
@@ -27,6 +27,8 @@
import org.jboss.test.selenium.dom.Event;
import org.jboss.test.selenium.waiting.Condition;
import static org.testng.Assert.*;
+
+import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
@@ -34,16 +36,7 @@
* @version $Revision$
*/
public class StatusTestCase extends AbstractSeleniumRichfacesTestCase {
- /**
- * Opens specified page
- */
- private void openPage() {
- selenium.allowNativeXpath("true");
- openComponent("Status");
- openTab("Usage");
- }
-
private final String LOC_FIELDSET_PAGE_PART_PREFORMATTED = getLoc("FIELDSET_PAGE_PART_PREFORMATTED");
private final String LOC_OUTPUT_STATUS_MESSAGE_PREFORMATTED = getLoc("OUTPUT_STATUS_MESSAGE_PREFORMATTED");
private final String LOC_BUTTON_REQUEST_PREFORMATTED = getLoc("BUTTON_REQUEST_PREFORMATTED");
@@ -93,7 +86,6 @@
* version of test (1 or 2)
*/
private void doStatusTesting(final int testNumber) {
- openPage();
scrollIntoView(format(LOC_FIELDSET_PAGE_PART_PREFORMATTED, testNumber), true);
// PAGE COMPONENTS
@@ -138,7 +130,6 @@
*/
@Test
public void testInputsStatus() {
- openPage();
scrollIntoView(format(LOC_FIELDSET_PAGE_PART_PREFORMATTED, 3), true);
// PAGE CONTROLS
@@ -211,4 +202,13 @@
}
});
}
+
+ @SuppressWarnings("unused")
+ @BeforeMethod
+ private void loadPage() {
+ openComponent("Status");
+ openTab("Usage");
+
+ selenium.allowNativeXpath("true");
+ }
}
15 years, 3 months
JBoss Rich Faces SVN: r15437 - in branches/community/3.3.X: framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/dnd and 5 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2009-09-02 08:27:23 -0400 (Wed, 02 Sep 2009)
New Revision: 15437
Modified:
branches/community/3.3.X/framework/impl/src/main/javascript/dnd/dnd.js
branches/community/3.3.X/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/dnd/dnd-draggable.js
branches/community/3.3.X/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DnDTest.java
branches/community/3.3.X/ui/drag-drop/src/main/java/org/richfaces/renderkit/DraggableRendererContributor.java
branches/community/3.3.X/ui/drag-drop/src/main/java/org/richfaces/renderkit/DropzoneRendererContributor.java
branches/community/3.3.X/ui/drag-drop/src/main/resources/org/richfaces/renderkit/html/scripts/drag-indicator.js
branches/community/3.3.X/ui/drag-drop/src/main/templates/org/richfaces/htmlDragIndicator.jspx
branches/community/3.3.X/ui/drag-drop/src/test/java/org/richfaces/component/DragDropTest.java
Log:
https://jira.jboss.org/jira/browse/RF-7156
Modified: branches/community/3.3.X/framework/impl/src/main/javascript/dnd/dnd.js
===================================================================
--- branches/community/3.3.X/framework/impl/src/main/javascript/dnd/dnd.js 2009-09-02 12:22:33 UTC (rev 15436)
+++ branches/community/3.3.X/framework/impl/src/main/javascript/dnd/dnd.js 2009-09-02 12:27:23 UTC (rev 15437)
@@ -50,9 +50,10 @@
var drag = window.drag;
if (!drag.source.onupdatedrag || (drag.source.onupdatedrag(event) != false)) {
- var x = Event.pointerX(event);
- var y = Event.pointerY(event);
- drag.indicator.position(x + 5, y + 14);
+ var cursorRect = Richfaces.jQuery.getPointerRectangle(event);
+ cursorRect.left += 5;
+ cursorRect.top += 14;
+ drag.indicator.position(cursorRect.left, cursorRect.top);
Event.stop(event);
}
},
Modified: branches/community/3.3.X/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/dnd/dnd-draggable.js
===================================================================
--- branches/community/3.3.X/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/dnd/dnd-draggable.js 2009-09-02 12:22:33 UTC (rev 15436)
+++ branches/community/3.3.X/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/dnd/dnd-draggable.js 2009-09-02 12:27:23 UTC (rev 15437)
@@ -188,10 +188,9 @@
moveDrag: function(event) {
//TODO handle mouseover to update coords
- var x = Event.pointerX(event);
- var y = Event.pointerY(event);
+ var cursorRect = Richfaces.jQuery.getPointerRectangle(event);
- if (!window.drag && (Math.abs(this.lastDragX - x) + Math.abs(this.lastDragY - y)) > 2) {
+ if (!window.drag && (Math.abs(this.lastDragX - cursorRect.left) + Math.abs(this.lastDragY - cursorRect.top)) > 2) {
this.updateDrag(event);
}
},
@@ -223,8 +222,9 @@
this.endDragListener.activate(event);
Event.observe(document, "mousemove", this.dragTrigger);
- this.lastDragX = Event.pointerX(event);
- this.lastDragY = Event.pointerY(event);
+ var cursorRect = Richfaces.jQuery.getPointerRectangle(event);
+ this.lastDragX = cursorRect.left;
+ this.lastDragY = cursorRect.top;
}
},
@@ -232,15 +232,16 @@
var type = this.getContentType();
var indicator = this.getIndicator();
var drag = new DnD.Drag(this, indicator, type);
-
+
if (indicator.id.indexOf("_rfDefaultDragIndicator") != -1) {
var target = drag.source.getElement();
- var offSets = Position.cumulativeOffset(target);
indicator.indicatorWidth = Element.getWidth(target);
indicator.indicatorHeight = Element.getHeight(target);
- indicator.position(offSets[0], offSets[1]);
- indicator.removalX = Event.pointerX(event) - offSets[0];
- indicator.removalY = Event.pointerY(event) - offSets[1];
+ var rect = Richfaces.jQuery.getElementRectangle(target);
+ var cursorRect = Richfaces.jQuery.getPointerRectangle(event);
+ indicator.position(rect.left, rect.top);
+ indicator.removalX = cursorRect.left - rect.left;
+ indicator.removalY = cursorRect.top - rect.top;
}
DnD.startDrag(drag);
Modified: branches/community/3.3.X/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DnDTest.java
===================================================================
--- branches/community/3.3.X/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DnDTest.java 2009-09-02 12:22:33 UTC (rev 15436)
+++ branches/community/3.3.X/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DnDTest.java 2009-09-02 12:27:23 UTC (rev 15437)
@@ -69,13 +69,7 @@
resetButtonId = parentId + FORMID + DATAID + "reset";
}
- @Override
- protected String getFirefoxTemplate() {
- return "c:/FFProfile";
- }
-
-
@Test
public void testExternalValidationFailure(Template template) {
AutoTester tester = getAutoTester(this);
@@ -110,7 +104,6 @@
tester.testAjaxSingleWithInternalValidationFailed();
}
-
Modified: branches/community/3.3.X/ui/drag-drop/src/main/java/org/richfaces/renderkit/DraggableRendererContributor.java
===================================================================
--- branches/community/3.3.X/ui/drag-drop/src/main/java/org/richfaces/renderkit/DraggableRendererContributor.java 2009-09-02 12:22:33 UTC (rev 15436)
+++ branches/community/3.3.X/ui/drag-drop/src/main/java/org/richfaces/renderkit/DraggableRendererContributor.java 2009-09-02 12:27:23 UTC (rev 15437)
@@ -93,6 +93,8 @@
public String[] getScriptDependencies() {
return new String[] {
PrototypeScript.class.getName(),
+ "/org/richfaces/renderkit/html/scripts/jquery/jquery.js",
+ "/org/richfaces/renderkit/html/scripts/jquery.utils.js",
"/org/richfaces/renderkit/html/scripts/json/json-mini.js",
DnDScript.class.getName(),
"/org/richfaces/renderkit/html/scripts/utils.js",
Modified: branches/community/3.3.X/ui/drag-drop/src/main/java/org/richfaces/renderkit/DropzoneRendererContributor.java
===================================================================
--- branches/community/3.3.X/ui/drag-drop/src/main/java/org/richfaces/renderkit/DropzoneRendererContributor.java 2009-09-02 12:22:33 UTC (rev 15436)
+++ branches/community/3.3.X/ui/drag-drop/src/main/java/org/richfaces/renderkit/DropzoneRendererContributor.java 2009-09-02 12:27:23 UTC (rev 15437)
@@ -302,6 +302,8 @@
public String[] getScriptDependencies() {
return new String[] {
PrototypeScript.class.getName(),
+ "/org/richfaces/renderkit/html/scripts/jquery/jquery.js",
+ "/org/richfaces/renderkit/html/scripts/jquery.utils.js",
"/org/richfaces/renderkit/html/scripts/json/json-mini.js",
DnDScript.class.getName(),
"/org/richfaces/renderkit/html/scripts/utils.js",
Modified: branches/community/3.3.X/ui/drag-drop/src/main/resources/org/richfaces/renderkit/html/scripts/drag-indicator.js
===================================================================
--- branches/community/3.3.X/ui/drag-drop/src/main/resources/org/richfaces/renderkit/html/scripts/drag-indicator.js 2009-09-02 12:22:33 UTC (rev 15436)
+++ branches/community/3.3.X/ui/drag-drop/src/main/resources/org/richfaces/renderkit/html/scripts/drag-indicator.js 2009-09-02 12:27:23 UTC (rev 15437)
@@ -88,14 +88,15 @@
}
},
- position: function(x, y) {
+ position: function(x,y) {
if (!this.offsets) {
Element.show(this);
this.style.position = 'absolute';
- }
+ }
+
Element.setStyle(this, {"left": x + "px", "top": y + "px"});
- this.moveIFrame(x, y);
+ this.moveIFrame(x,y);
},
accept: function() {
Modified: branches/community/3.3.X/ui/drag-drop/src/main/templates/org/richfaces/htmlDragIndicator.jspx
===================================================================
--- branches/community/3.3.X/ui/drag-drop/src/main/templates/org/richfaces/htmlDragIndicator.jspx 2009-09-02 12:22:33 UTC (rev 15436)
+++ branches/community/3.3.X/ui/drag-drop/src/main/templates/org/richfaces/htmlDragIndicator.jspx 2009-09-02 12:27:23 UTC (rev 15437)
@@ -13,6 +13,8 @@
<h:scripts>
new org.ajax4jsf.javascript.PrototypeScript(),
+ /org/richfaces/renderkit/html/scripts/jquery/jquery.js,
+ /org/richfaces/renderkit/html/scripts/jquery.utils.js,
new org.ajax4jsf.javascript.AjaxScript(),
new org.ajax4jsf.javascript.DnDScript(),
/org/richfaces/renderkit/html/scripts/utils.js,
Modified: branches/community/3.3.X/ui/drag-drop/src/test/java/org/richfaces/component/DragDropTest.java
===================================================================
--- branches/community/3.3.X/ui/drag-drop/src/test/java/org/richfaces/component/DragDropTest.java 2009-09-02 12:22:33 UTC (rev 15436)
+++ branches/community/3.3.X/ui/drag-drop/src/test/java/org/richfaces/component/DragDropTest.java 2009-09-02 12:27:23 UTC (rev 15437)
@@ -71,6 +71,8 @@
private static Set javaScripts = new HashSet();
static {
javaScripts.add("org.ajax4jsf.javascript.PrototypeScript");
+ javaScripts.add("scripts/jquery/jquery.js");
+ javaScripts.add("scripts/jquery.utils.js");
javaScripts.add("org.ajax4jsf.javascript.AjaxScript");
javaScripts.add("scripts/browser_info.js");
javaScripts.add("org.ajax4jsf.javascript.DnDScript");
15 years, 3 months
JBoss Rich Faces SVN: r15436 - in branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test: resources/org/jboss/richfaces/integrationTest/queue and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2009-09-02 08:22:33 -0400 (Wed, 02 Sep 2009)
New Revision: 15436
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/queue/QueueSettingsTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/queue/QueueTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/queue/locators.properties
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/queue/messages.properties
Log:
- refactored Queue test cases to follow conventions
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/queue/QueueSettingsTestCase.java
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/queue/QueueSettingsTestCase.java 2009-09-02 10:00:52 UTC (rev 15435)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/queue/QueueSettingsTestCase.java 2009-09-02 12:22:33 UTC (rev 15436)
@@ -1,13 +1,33 @@
+/**
+ * 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.queue;
-import junit.framework.Assert;
+import static org.testng.Assert.*;
import org.apache.commons.lang.StringUtils;
import org.jboss.richfaces.integrationTest.AbstractSeleniumRichfacesTestCase;
import org.jboss.test.selenium.dom.Event;
import org.jboss.test.selenium.utils.array.ArrayTransform;
-import org.jboss.test.selenium.waiting.Condition;
-import org.jboss.test.selenium.waiting.Wait;
+import org.jboss.test.selenium.waiting.*;
+import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
@@ -15,125 +35,125 @@
* @version $Revision$
*/
public class QueueSettingsTestCase extends AbstractSeleniumRichfacesTestCase {
+ private final String LOC_FIELDSET_HEADER = getLoc("FIELDSET_HEADER");
+ private final String LOC_INPUT_TYPED_TEXT = getLoc("INPUT_TYPED_TEXT");
+ private final String LOC_OUTPUT_TYPED_TEXT = getLoc("OUTPUT_TYPED_TEXT");
+ private final String LOC_OUTPUT_EVENTS_COUNT = getLoc("OUTPUT_EVENTS_COUNT");
+ private final String LOC_OUTPUT_REQUESTS_COUNT = getLoc("OUTPUT_REQUESTS_COUNT");
+ private final String LOC_OUTPUT_DOM_UPDATES_COUNT = getLoc("OUTPUT_DOM_UPDATES_COUNT");
+ private final String LOC_INPUT_REQUEST_DELAY = getLoc("INPUT_REQUEST_DELAY");
+ private final String LOC_CHECKBOX_IGNORE_DUP_RESPONSES = getLoc("CHECKBOX_IGNORE_DUP_RESPONSES");
+ private final String LOC_CHECKBOX_DISABLE_QUEUE = getLoc("CHECKBOX_DISABLE_QUEUE");
+ private final String LOC_BUTTON_APPLY_SETTINGS = getLoc("BUTTON_APPLY_SETTINGS");
+
+ private final String[] MSG_DELAY_LIST = StringUtils.split(getMsg("DELAY_LIST"), ',');
+ private final String MSG_CHAR_FAST_TYPING = getMsg("MSG_CHAR_FAST_TYPING");
+
/**
- * Opens specified page
+ * Set queue queue disabled and test it with typing as fast is possible and
+ * check that after typing is counters set right: DOM updates count ==
+ * Events count, Requests count is zero (queue disabled)
*/
- public void openPage() {
- selenium.allowNativeXpath("true");
+ @Test
+ public void testDisabledQueue() {
+ setQueue(10, false, true);
- selenium.open(format("{0}/{1}", contextPath, PAGE));
-
- scrollIntoView(header, true);
- }
-
- private final String PAGE = "richfaces/queue.jsf?c=queue&tab=queueSettings";
- private final String header = getLoc("queue-settings--header");
- private final String inputText = getLoc("queue-settings--input--text");
- private final String outputText = getLoc("queue-settings--output--text");
- private final String outputEventsCount = getLoc("queue-settings--output--events-count");
- private final String outputRequestsCount = getLoc("queue-settings--output--requests-count");
- private final String outputDOMUpdatesCount = getLoc("queue-settings--output--dom-updates-count");
-
-// @Test
- public void disabledQueueTest() {
- openPage();
-
- setQueue(10, false, true);
fastTyping();
- int eventsCount = Integer.valueOf(selenium.getText(outputEventsCount));
- int requestsCount = Integer.valueOf(selenium
- .getText(outputRequestsCount));
- int domUpdatesCount = Integer.valueOf(selenium
- .getText(outputDOMUpdatesCount));
+ int eventsCount = Integer.valueOf(selenium.getText(LOC_OUTPUT_EVENTS_COUNT));
+ int requestsCount = Integer.valueOf(selenium.getText(LOC_OUTPUT_REQUESTS_COUNT));
+ int domUpdatesCount = Integer.valueOf(selenium.getText(LOC_OUTPUT_DOM_UPDATES_COUNT));
- Assert.assertEquals(eventsCount, domUpdatesCount);
- Assert.assertEquals(0, requestsCount);
+ assertEquals(0, requestsCount, "Requests count should be 0 (queue disabled)");
+ assertTrue(eventsCount == domUpdatesCount, "Count of Events and Dom Updates should equal");
}
+ /**
+ * Set queue to NOT Ignore Duplicated Responses and test it with typing as
+ * fast is possible and check that after typing is counters set right: DOM
+ * updates count == Requests count, Requests count <= Events count
+ */
@Test
- public void dontIgnoreDuplicatedResponsesTest() {
- openPage();
+ public void testDontIgnoreDuplicatedResponses() {
+ setQueue(10, false, false);
- setQueue(10, false, false);
fastTyping();
- int eventsCount = Integer.valueOf(selenium.getText(outputEventsCount));
- int requestsCount = Integer.valueOf(selenium
- .getText(outputRequestsCount));
- int domUpdatesCount = Integer.valueOf(selenium
- .getText(outputDOMUpdatesCount));
+ int eventsCount = Integer.valueOf(selenium.getText(LOC_OUTPUT_EVENTS_COUNT));
+ int requestsCount = Integer.valueOf(selenium.getText(LOC_OUTPUT_REQUESTS_COUNT));
+ int domUpdatesCount = Integer.valueOf(selenium.getText(LOC_OUTPUT_DOM_UPDATES_COUNT));
- Assert.assertTrue(requestsCount <= eventsCount);
- Assert.assertEquals(requestsCount, domUpdatesCount);
+ assertTrue(requestsCount == domUpdatesCount, "Count of Requests and Dom Updates should equal");
+ assertTrue(requestsCount <= eventsCount, "Count of Requests should be less than or equal Events count");
}
-// @Test
- public void ignoreDuplicatedResponsesTest() {
- openPage();
-
+ /**
+ * Set queue to Ignore Duplicated Responses and test it with typing as fast
+ * is possible and check that after typing is counters set right: DOM
+ * updates count <= Requests count, Requests count <= Events count
+ */
+ @Test
+ public void testIgnoreDuplicatedResponses() {
setQueue(10, true, false);
fastTyping();
- int eventsCount = Integer.valueOf(selenium.getText(outputEventsCount));
- int requestsCount = Integer.valueOf(selenium
- .getText(outputRequestsCount));
- int domUpdatesCount = Integer.valueOf(selenium
- .getText(outputDOMUpdatesCount));
+ int eventsCount = Integer.valueOf(selenium.getText(LOC_OUTPUT_EVENTS_COUNT));
+ int requestsCount = Integer.valueOf(selenium.getText(LOC_OUTPUT_REQUESTS_COUNT));
+ int domUpdatesCount = Integer.valueOf(selenium.getText(LOC_OUTPUT_DOM_UPDATES_COUNT));
- Assert.assertTrue(domUpdatesCount <= requestsCount);
- Assert.assertTrue(requestsCount <= eventsCount);
+ assertTrue(domUpdatesCount <= requestsCount, "Count of Dom Updates should be less than or equal Requests count");
+ assertTrue(requestsCount <= eventsCount, "Count of Requests should be less than or equal Events count");
}
-// @Test
- public void requestDelayTest() {
- openPage();
+ /**
+ * Types characters and check that output will not change for defined time
+ * (queue delay) and when it actually change, check that it have value of
+ * input and that counters are printed right.
+ */
+ @Test
+ public void testRequestDelay() {
+ Integer[] delays = stringsToInteger.transform(MSG_DELAY_LIST);
- Integer[] delays = new ArrayTransform<String, Integer>(Integer.class) {
- public Integer transformation(String source) {
- return Integer.valueOf(source);
- }
- }.transform(StringUtils.splitPreserveAllTokens(
- getMess("queue-settings--delays"), ','));
-
for (final int delay : delays) {
setQueue(delay, false, false);
- int count = 1;
+ // initiate time borders for the test
final long start = currentTime();
- long end = start + 10000;
- final StringBuffer text = new StringBuffer();
+ final long end = start + 10000;
+ // create a buffer for whole text in input
+ final StringBuffer typedText = new StringBuffer();
- while (count <= 3 || (count <= 100 && currentTime() < end)) {
- final String lastText = text.toString();
- text.append(Integer.toString(count % 10));
- selenium.type(inputText, text.toString());
+ // type at least 3 and at most 100 characters and don't exhause
+ // border of 10 sec. for this tests
+ while (typedText.length() <= 3 || (typedText.length() <= 100 && currentTime() < end)) {
+ final String lastText = typedText.toString();
+
+ // type char '1-9' like last decimal char of buffer's length
+ typedText.append(Integer.toString(typedText.length() % 10));
+ selenium.type(LOC_INPUT_TYPED_TEXT, typedText.toString());
+
final long eventTime = currentTime();
- selenium.fireEvent(inputText, Event.KEYUP);
- Wait.dontFail().interval(delay / 4).timeout(delay).until(
- new Condition() {
- public boolean isTrue() {
- String actualText = selenium
- .getText(outputText);
- long currentTime = currentTime();
- Assert.assertTrue(currentTime >= eventTime
- + delay
- || lastText.equals(actualText));
- return currentTime >= eventTime + delay;
- }
- });
- waitForTextEquals(outputText, text.toString());
+ selenium.fireEvent(LOC_INPUT_TYPED_TEXT, Event.KEYUP);
- String actualCount = Integer.toString(count);
- Assert.assertEquals(actualCount, selenium
- .getText(outputEventsCount));
- Assert.assertEquals(actualCount, selenium
- .getText(outputRequestsCount));
- Assert.assertEquals(actualCount, selenium
- .getText(outputDOMUpdatesCount));
+ // check that text will not change for defined time (delay)
+ Wait.dontFail().interval(delay / 4).timeout(delay).until(new Condition() {
+ public boolean isTrue() {
+ final String actualText = selenium.getText(LOC_OUTPUT_TYPED_TEXT);
+ long currentTime = currentTime();
+ assertTrue(currentTime >= eventTime + delay || lastText.equals(actualText));
+ return currentTime >= eventTime + delay;
+ }
+ });
- count++;
+ // wait for output actually changes to value of input
+ waitForTextEquals(LOC_OUTPUT_TYPED_TEXT, typedText.toString());
+
+ // check that all output counts are right
+ String actualCount = Integer.toString(typedText.length());
+ assertEquals(actualCount, selenium.getText(LOC_OUTPUT_EVENTS_COUNT));
+ assertEquals(actualCount, selenium.getText(LOC_OUTPUT_REQUESTS_COUNT));
+ assertEquals(actualCount, selenium.getText(LOC_OUTPUT_DOM_UPDATES_COUNT));
}
}
}
@@ -142,19 +162,15 @@
return System.currentTimeMillis();
}
- private void setQueue(int delay, boolean ignoreDuplicatedResponses,
- boolean disableQueue) {
- final String inputRequestDelay = getLoc("queue-settings--input--request-delay");
- final String checkboxIgnoreDupResponces = getLoc("queue-settings--checkbox--ignore-dup-responses");
- final String checkboxDisableQueue = getLoc("queue-settings--checkbox--disable-queue");
- final String buttonApply = getLoc("queue-settings--button--apply");
-
- selenium.type(inputRequestDelay, Integer.toString(delay));
- check(checkboxIgnoreDupResponces, ignoreDuplicatedResponses);
- check(checkboxDisableQueue, disableQueue);
- selenium.click(buttonApply);
+ private void setQueue(int delay, boolean ignoreDuplicatedResponses, boolean disableQueue) {
+ selenium.type(LOC_INPUT_REQUEST_DELAY, Integer.toString(delay));
+ check(LOC_CHECKBOX_IGNORE_DUP_RESPONSES, ignoreDuplicatedResponses);
+ check(LOC_CHECKBOX_DISABLE_QUEUE, disableQueue);
+
+ selenium.click(LOC_BUTTON_APPLY_SETTINGS);
selenium.waitForPageToLoad(Long.toString(Wait.DEFAULT_TIMEOUT));
- scrollIntoView(header, true);
+
+ scrollIntoView(LOC_FIELDSET_HEADER, true);
}
private void check(String locator, boolean check) {
@@ -167,14 +183,30 @@
private void fastTyping() {
StringBuffer text = new StringBuffer();
- final String charToType = getMess("queue-settings--char-to-type");
for (int i = 1; i <= 75; i++) {
- text.append(charToType);
- selenium.type(inputText, text.toString());
- selenium.fireEvent(inputText, Event.KEYUP);
+ text.append(MSG_CHAR_FAST_TYPING);
+
+ selenium.type(LOC_INPUT_TYPED_TEXT, text.toString());
+ selenium.fireEvent(LOC_INPUT_TYPED_TEXT, Event.KEYUP);
}
waitModelUpdate.waitForTimeout();
}
+
+ private final ArrayTransform<String, Integer> stringsToInteger = new ArrayTransform<String, Integer>(Integer.class) {
+ public Integer transformation(String source) {
+ return Integer.valueOf(source);
+ }
+ };
+
+ @SuppressWarnings("unused")
+ @BeforeMethod
+ private void loadPage() {
+ openComponent("Queue");
+ openTab("Queue Settings");
+
+ scrollIntoView(LOC_FIELDSET_HEADER, true);
+ }
+
}
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/queue/QueueTestCase.java
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/queue/QueueTestCase.java 2009-09-02 10:00:52 UTC (rev 15435)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/queue/QueueTestCase.java 2009-09-02 12:22:33 UTC (rev 15436)
@@ -1,8 +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.queue;
-import junit.framework.Assert;
+import static org.testng.Assert.*;
import org.jboss.richfaces.integrationTest.AbstractSeleniumRichfacesTestCase;
+import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
@@ -10,30 +31,38 @@
* @version $Revision$
*/
public class QueueTestCase extends AbstractSeleniumRichfacesTestCase {
+ private String LOC_BUTTON_IMAGE_PREFORMATTED = getLoc("BUTTON_IMAGE_PREFORMATTED");
+ private String LOC_OUTPUT_QUEUE_ITEM = getLoc("OUTPUT_QUEUE_ITEM");
+
/**
- * Opens specified page
+ * Enqueues several numbers (by clicking to numbered images) and waits for
+ * it it appears in the queue bottom.
*/
- private void openPage() {
- selenium.open(contextPath + "/richfaces/queue.jsf?c=queue&tab=usage");
- }
-
- private String tableHeader = getLoc("queue--table-header");
-
@Test
- public void simpleQueueImagesTest() {
- openPage();
-
- scrollIntoView(tableHeader, true);
-
+ public void testSimpleQueueImages() {
int[] order = new int[] { 3, 7, 15, 3, 15 };
for (int i = 0; i < order.length; i++) {
- selenium.click(formatLoc("queue--image-button", order[i]));
+ final String locButtonImage = format(LOC_BUTTON_IMAGE_PREFORMATTED, order[i]);
+ final String locQueueItem = format(LOC_OUTPUT_QUEUE_ITEM, order[i]);
+
+ selenium.click(locButtonImage);
+
+ scrollIntoView(locButtonImage, true);
waitFor(1000);
- Assert.assertTrue(selenium.isElementPresent(formatLoc(
- "queue--item", order[i])));
+ scrollIntoView(locQueueItem, false);
+
+ assertTrue(selenium.isElementPresent(locQueueItem), format("The enqueued item isn't present '{0}'",
+ locQueueItem));
}
}
+
+ @SuppressWarnings("unused")
+ @BeforeMethod
+ private void loadPage() {
+ openComponent("Queue");
+ openTab("Usage");
+ }
}
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/queue/locators.properties
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/queue/locators.properties 2009-09-02 10:00:52 UTC (rev 15435)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/queue/locators.properties 2009-09-02 12:22:33 UTC (rev 15436)
@@ -1,13 +1,12 @@
-queue--table-header=//th[text()\='Ajax Requests']
-queue--image-button=//*[@id\='_{0}']
-queue--item=//*[@id\='tr1']//*[starts-with(text(),'_{0}')]
-queue-settings--header=//legend[text()\='Queue demo']
-queue-settings--input--text=//*[text()\='Type here\:']/../*/*[@type\='text']
-queue-settings--output--text=//*[text()\='Repeated text\:']/../*/*
-queue-settings--output--events-count=//*[text()\='Events count\:']/../*/*
-queue-settings--output--requests-count=//*[text()\='Requests count\:']/../*/*
-queue-settings--output--dom-updates-count=//*[text()\='DOM updates count\:']/../*/*
-queue-settings--input--request-delay=//*[text()\='Request delay\:']/../*/*[@type\='text']
-queue-settings--checkbox--ignore-dup-responses=//*[text()\='Ignore Duplicated Responces']/../*/*[@type\='checkbox']
-queue-settings--checkbox--disable-queue=//*[text()\='Disable Queue']/../*/*[@type\='checkbox']
-queue-settings--button--apply=//*[@type\='submit' and @value\='Apply']
+BUTTON_IMAGE_PREFORMATTED=//*[@id\='_{0}']
+OUTPUT_QUEUE_ITEM=//*[@id\='tr1']//*[starts-with(text(),'_{0}')]
+FIELDSET_HEADER=//legend[text()\='Queue demo']
+INPUT_TYPED_TEXT=//*[text()\='Type here\:']/../*/*[@type\='text']
+OUTPUT_TYPED_TEXT=//*[text()\='Repeated text\:']/../*/*
+OUTPUT_EVENTS_COUNT=//*[text()\='Events count\:']/../*/*
+OUTPUT_REQUESTS_COUNT=//*[text()\='Requests count\:']/../*/*
+OUTPUT_DOM_UPDATES_COUNT=//*[text()\='DOM updates count\:']/../*/*
+INPUT_REQUEST_DELAY=//*[text()\='Request delay\:']/../*/*[@type\='text']
+CHECKBOX_IGNORE_DUP_RESPONSES=//*[text()\='Ignore Duplicated Responces']/../*/*[@type\='checkbox']
+CHECKBOX_DISABLE_QUEUE=//*[text()\='Disable Queue']/../*/*[@type\='checkbox']
+BUTTON_APPLY_SETTINGS=//*[@type\='submit' and @value\='Apply']
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/queue/messages.properties
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/queue/messages.properties 2009-09-02 10:00:52 UTC (rev 15435)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/queue/messages.properties 2009-09-02 12:22:33 UTC (rev 15436)
@@ -1,2 +1,2 @@
-queue-settings--delays=9000,1000,200,50,10
-queue-settings--char-to-type=B
+DELAY_LIST=9000,1000,200,50,10
+MSG_CHAR_FAST_TYPING=B
15 years, 3 months
JBoss Rich Faces SVN: r15435 - branches/community/3.3.X/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2009-09-02 06:00:52 -0400 (Wed, 02 Sep 2009)
New Revision: 15435
Modified:
branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_suggestionbox.xml
branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_virtualEarth.xml
Log:
https://jira.jboss.org/jira/browse/RF-7793 - XSLT problem is fixed
Modified: branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_suggestionbox.xml
===================================================================
--- branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_suggestionbox.xml 2009-09-02 09:14:50 UTC (rev 15434)
+++ branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_suggestionbox.xml 2009-09-02 10:00:52 UTC (rev 15435)
@@ -582,7 +582,7 @@
</table>
<table id="suggBoxC">
<title>Classes names with the corresponding skin parameters</title>
- <tgroup cols="2">
+ <tgroup cols="4">
<thead>
<row>
<entry>Class name</entry>
@@ -631,8 +631,8 @@
<entry>color</entry>
</row>
<row>
- <entry morerows="1">.rich-sb-ext-decor-2</entry>
- <entry morerows="1">Defines styles for the second
+ <entry>.rich-sb-ext-decor-2</entry>
+ <entry>Defines styles for the second
wrapper
<div>
element of
Modified: branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_virtualEarth.xml
===================================================================
--- branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_virtualEarth.xml 2009-09-02 09:14:50 UTC (rev 15434)
+++ branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_virtualEarth.xml 2009-09-02 10:00:52 UTC (rev 15435)
@@ -152,7 +152,7 @@
</table>
<table>
<title>Classes names that define a component appearance </title>
- <tgroup cols="2">
+ <tgroup cols="4">
<thead>
<row>
<entry>Class name</entry>
15 years, 3 months
JBoss Rich Faces SVN: r15434 - in branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test: resources/org/jboss/richfaces/integrationTest/push and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2009-09-02 05:14:50 -0400 (Wed, 02 Sep 2009)
New Revision: 15434
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/push/PushTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/push/locators.properties
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/push/messages.properties
Log:
- refactored Push test cases to follow conventions, extended to 2-cycle testPushingStartAndStop
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/push/PushTestCase.java
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/push/PushTestCase.java 2009-09-02 08:13:18 UTC (rev 15433)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/push/PushTestCase.java 2009-09-02 09:14:50 UTC (rev 15434)
@@ -1,3 +1,23 @@
+/**
+ * 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.push;
import org.apache.commons.lang.StringUtils;
@@ -2,5 +22,6 @@
import org.jboss.richfaces.integrationTest.AbstractSeleniumRichfacesTestCase;
-import org.jboss.test.selenium.waiting.Condition;
-import org.jboss.test.selenium.waiting.Wait;
-import org.testng.Assert;
+import org.jboss.test.selenium.waiting.*;
+import static org.testng.Assert.*;
+
+import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -12,95 +33,114 @@
* @version $Revision$
*/
public class PushTestCase extends AbstractSeleniumRichfacesTestCase {
+ private final String LOC_BUTTON_POLL_CONTROL = getLoc("BUTTON_POLL_CONTROL");
+ private final String LOC_OUTPUT_TEXT = getLoc("OUTPUT_TEXT");
+
+ private final String MSG_OUTPUT_PUSH_ACTIVE = getMsg("OUTPUT_PUSH_ACTIVE");
+ private final String MSG_OUTPUT_PUSH_INACTIVE = getMsg("OUTPUT_PUSH_INACTIVE");
+
/**
- * Opens specified page
+ * Start pushing and checks that new values are really pushed.
*/
- private void openPage() {
- selenium.open(contextPath + "/richfaces/push.jsf?c=push&tab=usage");
-
- scrollIntoView(control, false);
- }
-
- private String control = getLoc("push--control");
- private String outputText = getLoc("push--output-text");
-
@Test
public void testPushingProgress() {
- openPage();
-
setPushingStatus(true);
- pushingProgress();
+ checkPushingProgress();
}
+ /**
+ * Stop pushing and checks that pushing isn't in progress.
+ */
@Test
public void testPushingStop() {
- openPage();
-
setPushingStatus(false);
- pushingStopped();
+ checkPushingStopped();
}
+ /**
+ * Switches between active and inactive pushing states and checks that
+ * output behave appropriately.
+ */
@Test
public void testPushingStopAndStart() {
- openPage();
+ setPushingStatus(false);
+ checkPushingStopped();
+
+ setPushingStatus(true);
+
+ checkPushingProgress();
+
setPushingStatus(false);
- pushingStopped();
+ checkPushingStopped();
setPushingStatus(true);
- pushingProgress();
+ checkPushingProgress();
}
- public void pushingProgress() {
- Assert.assertTrue(isPushingActive());
+ private void checkPushingProgress() {
+ assertTrue(isPushingActive(), "Pushing was inactive but should be active");
- final String old = selenium.getText(outputText);
+ final String oldOutput = selenium.getText(LOC_OUTPUT_TEXT);
- Wait.interval(2500).timeout(20000).until(new Condition() {
- public boolean isTrue() {
- String actual = selenium.getText(outputText);
+ Wait.failWith("When waiting for text change, it never happen").interval(2500).timeout(20000).until(
+ new Condition() {
+ public boolean isTrue() {
+ String actualOutput = selenium.getText(LOC_OUTPUT_TEXT);
- return !old.equals(actual);
- }
- });
+ return !oldOutput.equals(actualOutput);
+ }
+ });
- String uuid = StringUtils.removeStart(selenium.getText(outputText),
- getMess("push--active"));
+ String uuid = selenium.getText(LOC_OUTPUT_TEXT);
- Assert.assertTrue(StringUtils.isNotBlank(uuid));
+ assertTrue(uuid.startsWith(MSG_OUTPUT_PUSH_ACTIVE));
+
+ uuid = StringUtils.removeStart(uuid, MSG_OUTPUT_PUSH_ACTIVE);
+
+ assertTrue(StringUtils.isNotBlank(uuid), "Generated UUID should not be blank");
}
- public void pushingStopped() {
- Assert.assertFalse(isPushingActive());
+ private void checkPushingStopped() {
+ assertFalse(isPushingActive(), "Pushing was active but expected to be inactive");
- String expected = getMess("push--inactive");
-
+ String expected = MSG_OUTPUT_PUSH_INACTIVE;
+
for (int i = 0; i < 7; i++) {
- if (i > 0) waitFor(2500);
- String actual = selenium.getText(outputText);
+ if (i > 0)
+ waitFor(2500);
+ String actual = selenium.getText(LOC_OUTPUT_TEXT);
- Assert.assertEquals(actual, expected);
+ assertEquals(actual, expected);
}
}
- public void setPushingStatus(final boolean pushingActive) {
- if (pushingActive != isPushingActive()) {
+ private void setPushingStatus(final boolean requiredPushingStatus) {
+ if (requiredPushingStatus != isPushingActive()) {
- selenium.click(control);
+ selenium.click(LOC_BUTTON_POLL_CONTROL);
Wait.until(new Condition() {
public boolean isTrue() {
- return pushingActive == isPushingActive();
+ return requiredPushingStatus == isPushingActive();
}
});
}
}
- public boolean isPushingActive() {
- return !getMess("push--inactive").equals(selenium.getText(outputText));
+ private boolean isPushingActive() {
+ return !MSG_OUTPUT_PUSH_INACTIVE.equals(selenium.getText(LOC_OUTPUT_TEXT));
}
+
+ @SuppressWarnings("unused")
+ @BeforeMethod
+ private void loadPage() {
+ openComponent("Push");
+
+ scrollIntoView(LOC_BUTTON_POLL_CONTROL, true);
+ }
}
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/push/locators.properties
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/push/locators.properties 2009-09-02 08:13:18 UTC (rev 15433)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/push/locators.properties 2009-09-02 09:14:50 UTC (rev 15434)
@@ -1,2 +1,2 @@
-push--control=//*[@type\='button' and (@value\='Start' or @value\='Stop')]
-push--output-text=//*[text()\='Press Start to run push example' or starts-with(text(), 'Generated UUID\:')]
+BUTTON_POLL_CONTROL=//*[@type\='button' and (@value\='Start' or @value\='Stop')]
+OUTPUT_TEXT=//*[text()\='Press Start to run push example' or starts-with(text(), 'Generated UUID\:')]
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/push/messages.properties
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/push/messages.properties 2009-09-02 08:13:18 UTC (rev 15433)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/push/messages.properties 2009-09-02 09:14:50 UTC (rev 15434)
@@ -1,2 +1,2 @@
-push--inactive=Press Start to run push example
-push--active=Generated UUID\:
+OUTPUT_PUSH_ACTIVE=Generated UUID\:
+OUTPUT_PUSH_INACTIVE=Press Start to run push example
15 years, 3 months
JBoss Rich Faces SVN: r15433 - branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/poll.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2009-09-02 04:13:18 -0400 (Wed, 02 Sep 2009)
New Revision: 15433
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/poll/PollTestCase.java
Log:
- add comments to PollTestCase and extend method testPollingStartAndStop() to 2 switch-cycles
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/poll/PollTestCase.java
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/poll/PollTestCase.java 2009-09-02 07:43:58 UTC (rev 15432)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/poll/PollTestCase.java 2009-09-02 08:13:18 UTC (rev 15433)
@@ -39,6 +39,10 @@
private final String MSG_POLLING_ACTIVE = getMsg("POLLING_ACTIVE");
private final String MSG_POLLING_INACTIVE = getMsg("POLLING_INACTIVE");
+ /**
+ * Set polling state to active and checks that status is showing as active
+ * and server date is really polled.
+ */
@Test
public void testPollingProgress() {
setPollingStatus(true);
@@ -46,6 +50,10 @@
checkPollingProgress();
}
+ /**
+ * Set polling state to inactive and checks that status is showing as
+ * inactive and server date isn't polled.
+ */
@Test
public void testPollingStop() {
setPollingStatus(false);
@@ -53,6 +61,10 @@
checkPollingStopped();
}
+ /**
+ * Switch between polling state active/inactive and checks that status is
+ * right and server date is/isn't polled.
+ */
@Test
public void testPollingStopAndStart() {
setPollingStatus(false);
@@ -62,6 +74,14 @@
setPollingStatus(true);
checkPollingProgress();
+
+ setPollingStatus(false);
+
+ checkPollingStopped();
+
+ setPollingStatus(true);
+
+ checkPollingProgress();
}
private void checkPollingProgress() {
15 years, 3 months
JBoss Rich Faces SVN: r15432 - in branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test: resources/org/jboss/richfaces/integrationTest/poll and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2009-09-02 03:43:58 -0400 (Wed, 02 Sep 2009)
New Revision: 15432
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/poll/PollTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/poll/locators.properties
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/poll/messages.properties
Log:
- refactored Poll test cases to follow conventions
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/poll/PollTestCase.java
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/poll/PollTestCase.java 2009-09-02 07:11:11 UTC (rev 15431)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/poll/PollTestCase.java 2009-09-02 07:43:58 UTC (rev 15432)
@@ -1,9 +1,30 @@
+/**
+ * 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.poll;
import org.jboss.richfaces.integrationTest.AbstractSeleniumRichfacesTestCase;
-import org.jboss.test.selenium.waiting.Condition;
-import org.jboss.test.selenium.waiting.Wait;
-import org.testng.Assert;
+import org.jboss.test.selenium.waiting.*;
+import static org.testng.Assert.*;
+
+import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
@@ -11,83 +32,83 @@
* @version $Revision$
*/
public class PollTestCase extends AbstractSeleniumRichfacesTestCase {
- /**
- * Opens specified page
- */
- private void openPage() {
- selenium.open(contextPath + "/richfaces/poll.jsf?c=poll&tab=usage");
- }
+ private final String LOC_BUTTON_POLL_CONTROL = getLoc("BUTTON_POLL_CONTROL");
+ private final String LOC_OUTPUT_POLL_STATUS = getLoc("OUTPUT_POLL_STATUS");
+ private final String LOC_OUTPUT_SERVER_DATE = getLoc("OUTPUT_SERVER_DATE");
- private String status = getLoc("poll--status");
- private String control = getLoc("poll--control");
- private String serverDate = getLoc("poll--server-date");
+ private final String MSG_POLLING_ACTIVE = getMsg("POLLING_ACTIVE");
+ private final String MSG_POLLING_INACTIVE = getMsg("POLLING_INACTIVE");
@Test
public void testPollingProgress() {
- openPage();
-
setPollingStatus(true);
- pollingProgress();
+ checkPollingProgress();
}
@Test
public void testPollingStop() {
- openPage();
-
setPollingStatus(false);
- pollingStopped();
+ checkPollingStopped();
}
@Test
public void testPollingStopAndStart() {
- openPage();
-
setPollingStatus(false);
- pollingStopped();
+ checkPollingStopped();
setPollingStatus(true);
- pollingProgress();
+ checkPollingProgress();
}
- public void pollingProgress() {
- final String old = selenium.getText(serverDate);
+ private void checkPollingProgress() {
+ assertEquals(selenium.getText(LOC_OUTPUT_POLL_STATUS), MSG_POLLING_ACTIVE, "Polling status should be active");
- Wait.timeout(3000).until(new Condition() {
+ final String oldServerDate = selenium.getText(LOC_OUTPUT_SERVER_DATE);
+
+ Wait.failWith("Server date didn't changed before timeout").timeout(3000).until(new Condition() {
public boolean isTrue() {
- String actual = selenium.getText(serverDate);
+ String currentServerDate = selenium.getText(LOC_OUTPUT_SERVER_DATE);
- return !old.equals(actual);
+ return !oldServerDate.equals(currentServerDate);
}
});
}
- public void pollingStopped() {
- Assert.assertEquals(selenium.getText(status),
- getMess("poll--polling-inactive"));
+ private void checkPollingStopped() {
+ assertEquals(selenium.getText(LOC_OUTPUT_POLL_STATUS), MSG_POLLING_INACTIVE,
+ "Polling status should be inactive");
- String expected = selenium.getText(serverDate);
+ String expected = selenium.getText(LOC_OUTPUT_SERVER_DATE);
waitFor(2000);
- String actual = selenium.getText(serverDate);
+ String actual = selenium.getText(LOC_OUTPUT_SERVER_DATE);
- Assert.assertEquals(actual, expected);
+ assertEquals(actual, expected, format("Actual server date '{0}' should equal '{1}' when polling is inactive",
+ actual, expected));
}
- public void setPollingStatus(final boolean pollingActive) {
- if (pollingActive != getMess("poll--polling-active").equals(
- selenium.getText(status))) {
+ private void setPollingStatus(final boolean requiredPollingStatus) {
+ // if polling status don't match required polling status, change it
+ if (requiredPollingStatus != MSG_POLLING_ACTIVE.equals(selenium.getText(LOC_OUTPUT_POLL_STATUS))) {
- selenium.click(control);
+ selenium.click(LOC_BUTTON_POLL_CONTROL);
- Wait.until(new Condition() {
+ Wait.failWith("Polling status didn't change").until(new Condition() {
public boolean isTrue() {
- return pollingActive == getMess("poll--polling-active")
- .equals(selenium.getText(status));
+ return requiredPollingStatus == MSG_POLLING_ACTIVE.equals(selenium.getText(LOC_OUTPUT_POLL_STATUS));
}
});
}
}
+
+ @SuppressWarnings("unused")
+ @BeforeMethod
+ private void loadPage() {
+ openComponent("Poll");
+
+ scrollIntoView(LOC_OUTPUT_POLL_STATUS, true);
+ }
}
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/poll/locators.properties
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/poll/locators.properties 2009-09-02 07:11:11 UTC (rev 15431)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/poll/locators.properties 2009-09-02 07:43:58 UTC (rev 15432)
@@ -1,3 +1,3 @@
-poll--status=//*[starts-with(text(), 'Polling')]
-poll--control=//*[@type\='button' and contains(@id, 'control')]
-poll--server-date=//*[starts-with(text(), 'Server Date\:')]
+OUTPUT_POLL_STATUS=//*[starts-with(text(), 'Polling')]
+BUTTON_POLL_CONTROL=//*[@type\='button' and contains(@id, 'control')]
+OUTPUT_SERVER_DATE=//*[starts-with(text(), 'Server Date\:')]
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/poll/messages.properties
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/poll/messages.properties 2009-09-02 07:11:11 UTC (rev 15431)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/poll/messages.properties 2009-09-02 07:43:58 UTC (rev 15432)
@@ -1,3 +1,2 @@
-poll--server-date=Server Date\: {0}
-poll--polling-active=Polling Active
-poll--polling-inactive=Polling Inactive
+POLLING_ACTIVE=Polling Active
+POLLING_INACTIVE=Polling Inactive
15 years, 3 months
JBoss Rich Faces SVN: r15431 - in branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test: resources/org/jboss/richfaces/integrationTest/jsFunction and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2009-09-02 03:11:11 -0400 (Wed, 02 Sep 2009)
New Revision: 15431
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/jsFunction/JSFunctionTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/jsFunction/locators.properties
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/jsFunction/messages.properties
Log:
- refactored JS Function test cases to follow conventions
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/jsFunction/JSFunctionTestCase.java
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/jsFunction/JSFunctionTestCase.java 2009-09-02 06:55:53 UTC (rev 15430)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/jsFunction/JSFunctionTestCase.java 2009-09-02 07:11:11 UTC (rev 15431)
@@ -1,3 +1,23 @@
+/**
+ * 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.jsFunction;
import org.apache.commons.lang.StringUtils;
@@ -4,7 +24,9 @@
import org.jboss.richfaces.integrationTest.AbstractSeleniumRichfacesTestCase;
import org.jboss.test.selenium.dom.Event;
import org.jboss.test.selenium.waiting.Condition;
-import org.testng.Assert;
+import static org.testng.Assert.*;
+
+import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
@@ -12,41 +34,45 @@
* @version $Revision$
*/
public class JSFunctionTestCase extends AbstractSeleniumRichfacesTestCase {
+ private final String LOC_SPAN_HOVER_ACTIVATED = getLoc("SPAN_HOVER_ACTIVATED");
+ private final String LOC_OUTPUT_NAME = getLoc("OUTPUT_NAME");
+
+ private final String[] MSG_NAMES = StringUtils.split(getMsg("NAMES"), ',');
+
/**
- * Opens specified page
+ * Hovers over all of the hover activated spans and waits for output name
+ * changed right followed by hovering out and waiting for output will be
+ * blank.
*/
- private void openPage() {
- selenium.open(contextPath
- + "/richfaces/jsFunction.jsf?c=jsFunction&tab=usage");
- }
-
@Test
- public void hoveringNames() {
- openPage();
-
- final String showName = getLoc("js-function--show-name");
- String[] names = new String[] {getMess("js-function--name1"), getMess("js-function--name2"), getMess("js-function--name3")};
+ public void testHoveringNames() {
+ for (final String msgName : MSG_NAMES) {
+ final String span = format(LOC_SPAN_HOVER_ACTIVATED, msgName);
- for (final String name : names) {
- String span = formatLoc("js-function--active-span", name);
+ assertTrue(StringUtils.isBlank(selenium.getText(LOC_OUTPUT_NAME)), "Output name should be blank");
- Assert.assertTrue(StringUtils.isBlank(selenium.getText(showName)));
-
selenium.fireEvent(span, Event.MOUSEOVER);
- waitModelUpdate.until(new Condition() {
+ waitModelUpdate.failWith(format("Output name never changed to '{0}'", msgName)).until(new Condition() {
public boolean isTrue() {
- return name.equals(selenium.getText(showName));
+ return msgName.equals(selenium.getText(LOC_OUTPUT_NAME));
}
});
-
+
selenium.fireEvent(span, Event.MOUSEOUT);
-
- waitModelUpdate.until(new Condition() {
+
+ waitModelUpdate.failWith("Output name never changed to blank").until(new Condition() {
public boolean isTrue() {
- return StringUtils.isBlank(selenium.getText(showName));
+ return StringUtils.isBlank(selenium.getText(LOC_OUTPUT_NAME));
}
});
}
}
+
+ @SuppressWarnings("unused")
+ @BeforeMethod
+ private void loadPage() {
+ openComponent("JS Function");
+
+ }
}
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/jsFunction/locators.properties
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/jsFunction/locators.properties 2009-09-02 06:55:53 UTC (rev 15430)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/jsFunction/locators.properties 2009-09-02 07:11:11 UTC (rev 15431)
@@ -1,2 +1,2 @@
-js-function--active-span=//fieldset[1]/div[1]/table[1]//span[text()\='{0}']
-js-function--show-name=//*[@id\='showname']
+SPAN_HOVER_ACTIVATED=//fieldset[1]/div[1]/table[1]//span[text()\='{0}']
+OUTPUT_NAME=//*[@id\='showname']
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/jsFunction/messages.properties
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/jsFunction/messages.properties 2009-09-02 06:55:53 UTC (rev 15430)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/jsFunction/messages.properties 2009-09-02 07:11:11 UTC (rev 15431)
@@ -1,3 +1 @@
-js-function--name1=Kate
-js-function--name2=John
-js-function--name3=Alex
+NAMES=Kate,John,Alex
15 years, 3 months
JBoss Rich Faces SVN: r15430 - in branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test: resources/org/jboss/richfaces/integrationTest/commandLink and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2009-09-02 02:55:53 -0400 (Wed, 02 Sep 2009)
New Revision: 15430
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/commandLink/CommandLinkTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/commandLink/locators.properties
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/commandLink/messages.properties
Log:
- refactored Command Link test cases to follow conventions
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/commandLink/CommandLinkTestCase.java
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/commandLink/CommandLinkTestCase.java 2009-09-02 06:46:44 UTC (rev 15429)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/commandLink/CommandLinkTestCase.java 2009-09-02 06:55:53 UTC (rev 15430)
@@ -1,8 +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.commandLink;
import org.jboss.richfaces.integrationTest.AbstractSeleniumRichfacesTestCase;
-import org.jboss.test.selenium.waiting.Wait;
-import org.testng.Assert;
+import org.jboss.test.selenium.waiting.*;
+
+import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
@@ -10,57 +31,66 @@
* @version $Revision$
*/
public class CommandLinkTestCase extends AbstractSeleniumRichfacesTestCase {
+ private final String LOC_INPUT_TEXT = getLoc("INPUT_TEXT");
+ private final String LOC_OUTPUT_TEXT = getLoc("OUTPUT_TEXT");
+ private final String LOC_LINK_SAY_HELLO = getLoc("LINK_SAY_HELLO");
+
+ private final String MSG_INPUT_NON_EMPTY = getMsg("INPUT_NON_EMPTY");
+ private final String MSG_OUTPUT_TEXT_PREFORMATTED = getMsg("OUTPUT_TEXT_PREFORMATTED");
+
/**
- * Opens specified page
+ * Test that after non-empty input will be shown hello message.
*/
- private void openPage() {
- selenium.open(contextPath
- + "/richfaces/commandLink.jsf?c=commandLink&tab=usage");
- }
-
- private String textInput = getLoc("ajax-support--input");
- private String textOutput = formatLoc("command-button--text", 2);
- private String helloOutput = formatLoc("command-button--text", 1);
- private String exclamationOutput = formatLoc("command-button--text", 3);
- private String hello = formatMess("command-button--hello");
- private String exclamation = formatMess("command-button--exclamation");
- private String commandLink = getLoc("command-link--link");
- private String nonEmpty = getMess("ajax-support--non-empty");
-
@Test
public void testNonEmpty() {
- openPage();
nonEmpty();
}
+ /**
+ * Test that after empty input will not shown any message.
+ */
@Test
public void testEmpty() {
- openPage();
empty();
}
+ /**
+ * Test that after switching between empty and non-empty input is hello
+ * message shown only if input is non-empty.
+ */
@Test
public void testInterleaving() {
- openPage();
nonEmpty();
empty();
nonEmpty();
empty();
}
- public void nonEmpty() {
- selenium.type(textInput, nonEmpty);
- selenium.click(commandLink);
+ private void nonEmpty() {
+ final String expectedOutputText = format(MSG_OUTPUT_TEXT_PREFORMATTED, MSG_INPUT_NON_EMPTY);
+
+ selenium.type(LOC_INPUT_TEXT, MSG_INPUT_NON_EMPTY);
+ selenium.click(LOC_LINK_SAY_HELLO);
+
waitFor(Wait.DEFAULT_INTERVAL);
- waitForTextEquals(textOutput, nonEmpty);
- Assert.assertEquals(selenium.getText(helloOutput), hello);
- Assert.assertEquals(selenium.getText(exclamationOutput), exclamation);
+ waitForTextEquals(LOC_OUTPUT_TEXT, expectedOutputText);
}
- public void empty() {
- selenium.type(textInput, "");
- selenium.click(commandLink);
+ private void empty() {
+ final String expectedOutputText = "";
+
+ selenium.type(LOC_INPUT_TEXT, "");
+ selenium.click(LOC_LINK_SAY_HELLO);
+
waitFor(Wait.DEFAULT_INTERVAL);
- Assert.assertFalse(selenium.isElementPresent(textOutput));
+ waitForTextEquals(LOC_OUTPUT_TEXT, expectedOutputText);
}
+
+ @SuppressWarnings("unused")
+ @BeforeMethod
+ private void loadPage() {
+ openComponent("Command Link");
+
+ scrollIntoView(LOC_LINK_SAY_HELLO, true);
+ }
}
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/commandLink/locators.properties
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/commandLink/locators.properties 2009-09-02 06:46:44 UTC (rev 15429)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/commandLink/locators.properties 2009-09-02 06:55:53 UTC (rev 15430)
@@ -1,4 +1,3 @@
-
-ajax-support--input=//input[@type\='text']
-command-button--text=//*[@id\='out']/*[{0}]/text()
-command-link--link=//a[text()\='Say Hello']
+INPUT_TEXT=//input[@type\='text']
+LINK_SAY_HELLO=//a[text()\='Say Hello']
+OUTPUT_TEXT=//*[@id\='out']
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/commandLink/messages.properties
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/commandLink/messages.properties 2009-09-02 06:46:44 UTC (rev 15429)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/commandLink/messages.properties 2009-09-02 06:55:53 UTC (rev 15430)
@@ -1,4 +1,2 @@
-
-ajax-support--non-empty=abc
-command-button--hello=Hello
-command-button--exclamation=\!
+INPUT_NON_EMPTY=abc
+OUTPUT_TEXT_PREFORMATTED=Hello {0}\!
15 years, 3 months