Author: ppitonak(a)redhat.com
Date: 2011-10-12 10:58:33 -0400 (Wed, 12 Oct 2011)
New Revision: 22789
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInputNumberSpinner/TestRichSpinner.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInputNumberSpinner/TestRichSpinnerWithJSR303.java
Log:
tests for spinner fixed
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInputNumberSpinner/TestRichSpinner.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInputNumberSpinner/TestRichSpinner.java 2011-10-12
13:41:54 UTC (rev 22788)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInputNumberSpinner/TestRichSpinner.java 2011-10-12
14:58:33 UTC (rev 22789)
@@ -38,6 +38,7 @@
import org.jboss.test.selenium.locator.AttributeLocator;
import org.jboss.test.selenium.locator.JQueryLocator;
import org.richfaces.tests.metamer.ftest.annotations.IssueTracking;
+import org.richfaces.tests.metamer.ftest.annotations.Templates;
import org.richfaces.tests.metamer.ftest.annotations.Use;
import org.testng.annotations.Test;
@@ -110,11 +111,18 @@
}
@Test
- @IssueTracking("https://issues.jboss.org/browse/RF-11315")
+ @Templates(exclude = { "richPopupPanel" })
public void testAccesskey() {
testHtmlAttribute(input, "accesskey", "x");
}
+ @Test(groups = { "4.Future" })
+ @Templates(value = { "richPopupPanel" })
+ @IssueTracking("https://issues.jboss.org/browse/RF-11315")
+ public void testAccesskeyInPopupPanel() {
+ testHtmlAttribute(input, "accesskey", "x");
+ }
+
@Test
public void testCycled() {
JQueryLocator selectOption =
pjq("input[type=radio][name$=cycledInput][value=true]");
@@ -183,7 +191,7 @@
assertEquals(selenium.getText(output), "4", "Output was not
updated.");
phaseInfo.assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES,
PhaseId.PROCESS_VALIDATIONS,
- PhaseId.UPDATE_MODEL_VALUES, PhaseId.INVOKE_APPLICATION,
PhaseId.RENDER_RESPONSE);
+ PhaseId.UPDATE_MODEL_VALUES, PhaseId.INVOKE_APPLICATION,
PhaseId.RENDER_RESPONSE);
phaseInfo.assertListener(PhaseId.APPLY_REQUEST_VALUES, "value changed: 2
-> 4");
}
@@ -478,11 +486,17 @@
}
@Test
- @IssueTracking("https://issues.jboss.org/browse/RF-10980")
+ @Templates(exclude = { "richPopupPanel" })
public void testTabindex() {
testHtmlAttribute(input, "tabindex", "57");
}
+ @Test(groups = { "4.Future" })
+ @Templates(value = { "richPopupPanel" })
+ public void testTabindexInPopupPanel() {
+ testHtmlAttribute(input, "tabindex", "57");
+ }
+
@Test
@Use(field = "number", value = "correctNumbers")
public void testValueCorrect() {
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInputNumberSpinner/TestRichSpinnerWithJSR303.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInputNumberSpinner/TestRichSpinnerWithJSR303.java 2011-10-12
13:41:54 UTC (rev 22788)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInputNumberSpinner/TestRichSpinnerWithJSR303.java 2011-10-12
14:58:33 UTC (rev 22789)
@@ -31,49 +31,49 @@
import org.jboss.test.selenium.waiting.TextContainsCondition;
import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
import org.richfaces.tests.metamer.ftest.annotations.IssueTracking;
+import org.richfaces.tests.metamer.ftest.annotations.Templates;
import org.testng.Assert;
import org.testng.annotations.Test;
/**
* Test for faces/components/richInputNumberSpinner/jsr303.xhtml page
- *
+ *
* @author <a href="mailto:jjamrich@redhat.com">Jan Jamrich</a>
* @version $Revision$
*/
public class TestRichSpinnerWithJSR303 extends AbstractMetamerTest {
-
+
/** Wrong value for input validated to min value */
public static final String WRONG_MIN_VAL = "1";
/** Wrong value for input validated to max value */
public static final String WRONG_MAX_VAL = "5";
/** Wrong value for input validated to custom value */
public static final String WRONG_CUSTOM_VAL = "-1";
-
+
/** Wrong value for input validated to min value */
public static final String CORRECT_MIN_VAL = "3";
/** Wrong value for input validated to max value */
public static final String CORRECT_MAX_VAL = "1";
/** Wrong value for input validated to custom value */
public static final String CORRECT_CUSTOM_VAL = "5";
-
-
+
/** validation message for input validated to min value */
public static final String MSG_MIN = "must be greater than or equal to 2";
/** validation message for input validated to max value */
public static final String MSG_MAX = "must be less than or equal to 2";
/** validation message for input validated to custom value */
public static final String MSG_CUSTOM = "must be a positive number";
-
+
private JQueryLocator inputFormat = pjq("span[id$=:input{0}] > input");
private JQueryLocator msgFormat = pjq("span.rf-msg[id$=:inputMsg{0}]
span.rf-msg-det");
private JQueryLocator outputFormat = pjq("span[id$=:output{0}]");
-
+
private JQueryLocator hCommandBtn = pjq("input[id$=:hButton]");
private JQueryLocator a4jCommandBtn = pjq("input[id$=:a4jButton]");
-
+
private JQueryLocator spinnerIncFormat = jq("span[id$=:input{0}]
span.rf-insp-inc");
private JQueryLocator spinnerDecFormat = jq("span[id$=:input{0}]
span.rf-insp-dec");
-
+
/** Codes for inputs */
private enum ID {
/** input validated to min val */
@@ -82,16 +82,18 @@
MAX(2),
/** input validated to custom (positive) val */
CUSTOM(3);
-
+
private int id;
+
private ID(int i) {
this.id = i;
}
+
public int val() {
return id;
}
}
-
+
private void setAllCorrect() {
selenium.type(inputFormat.format(ID.MIN.val()), CORRECT_MIN_VAL);
selenium.fireEvent(inputFormat.format(ID.MIN.val()), Event.BLUR);
@@ -100,7 +102,7 @@
selenium.type(inputFormat.format(ID.CUSTOM.val()), CORRECT_CUSTOM_VAL);
selenium.fireEvent(inputFormat.format(ID.CUSTOM.val()), Event.BLUR);
}
-
+
private void setAllWrong() {
selenium.type(inputFormat.format(ID.MIN.val()), WRONG_MIN_VAL);
selenium.fireEvent(inputFormat.format(ID.MIN.val()), Event.BLUR);
@@ -108,32 +110,32 @@
selenium.fireEvent(inputFormat.format(ID.MAX.val()), Event.BLUR);
selenium.type(inputFormat.format(ID.CUSTOM.val()), WRONG_CUSTOM_VAL);
selenium.fireEvent(inputFormat.format(ID.CUSTOM.val()), Event.BLUR);
-
+
// wait until validation appears on last input before go ahead (e.g. submit
form)
waitGui.until(TextContainsCondition.getInstance().text(MSG_CUSTOM).locator(msgFormat.format(ID.CUSTOM.val())));
}
-
+
private void spinUp(ID inputId, String toValue) {
int currentVal =
Integer.parseInt(selenium.getValue(inputFormat.format(inputId.val())));
int diff = Integer.parseInt(toValue) - currentVal;
-
+
if (diff < 0) {
throw new IllegalArgumentException("Cannot spin from " + currentVal
+ " to " + toValue);
}
-
- for (int i = 0; i < diff; ++i) {
+
+ for (int i = 0; i < diff; ++i) {
selenium.clickAt(spinnerIncFormat.format(inputId.val()), new Point(1, 1));
- }
+ }
}
-
+
private void spinDown(ID inputId, String toValue) {
int currentVal =
Integer.parseInt(selenium.getValue(inputFormat.format(inputId.val())));
int diff = currentVal - Integer.parseInt(toValue);
-
+
if (diff < 0) {
throw new IllegalArgumentException("Cannot spin from " + currentVal
+ " to " + toValue);
}
-
+
for (int i = 0; i < diff; ++i) {
selenium.clickAt(spinnerDecFormat.format(inputId.val()), new Point(1, 1));
}
@@ -143,83 +145,86 @@
public URL getTestUrl() {
return URLUtils.buildUrl(contextPath,
"faces/components/richInputNumberSpinner/jsr303.xhtml");
}
-
+
@Test
public void testMin() {
selenium.type(inputFormat.format(ID.MIN.val()), WRONG_MIN_VAL);
selenium.fireEvent(inputFormat.format(ID.MIN.val()), Event.BLUR);
waitGui.until(TextContainsCondition.getInstance().locator(msgFormat.format(ID.MIN.val())).text(MSG_MIN));
}
-
+
@Test
public void testSpinToMin() {
selenium.type(inputFormat.format(ID.MIN.val()), CORRECT_MIN_VAL);
selenium.fireEvent(inputFormat.format(ID.MIN.val()), Event.BLUR);
-
+
spinDown(ID.MIN, WRONG_MIN_VAL);
waitGui.until(TextContainsCondition.getInstance().locator(msgFormat.format(ID.MIN.val())).text(MSG_MIN));
}
-
+
@Test
public void testMax() {
selenium.type(inputFormat.format(ID.MAX.val()), WRONG_MAX_VAL);
selenium.fireEvent(inputFormat.format(ID.MAX.val()), Event.BLUR);
waitGui.until(TextContainsCondition.getInstance().locator(msgFormat.format(ID.MAX.val())).text(MSG_MAX));
}
-
+
@Test
public void testSpinToMax() {
selenium.type(inputFormat.format(ID.MAX.val()), CORRECT_MAX_VAL);
selenium.fireEvent(inputFormat.format(ID.MAX.val()), Event.BLUR);
-
+
spinUp(ID.MAX, WRONG_MAX_VAL);
waitGui.until(TextContainsCondition.getInstance().locator(msgFormat.format(ID.MAX.val())).text(MSG_MAX));
}
-
+
@Test
public void testCustom() {
selenium.type(inputFormat.format(ID.CUSTOM.val()), WRONG_CUSTOM_VAL);
selenium.fireEvent(inputFormat.format(ID.CUSTOM.val()), Event.BLUR);
waitGui.until(TextContainsCondition.getInstance().text(MSG_CUSTOM).locator(msgFormat.format(ID.CUSTOM.val())));
}
-
+
@Test
public void testSpinToNegative() {
selenium.type(inputFormat.format(ID.CUSTOM.val()), CORRECT_CUSTOM_VAL);
selenium.fireEvent(inputFormat.format(ID.CUSTOM.val()), Event.BLUR);
-
+
spinDown(ID.CUSTOM, WRONG_CUSTOM_VAL);
waitGui.until(TextContainsCondition.getInstance().text(MSG_CUSTOM).locator(msgFormat.format(ID.CUSTOM.val())));
}
-
- @Test
+
+ @Test
+ @Templates(exclude = { "a4jRegion" })
public void testAllCorrect() {
-
+
setAllCorrect();
-
-
waitGui.until(TextContainsCondition.getInstance().text(CORRECT_MIN_VAL).locator(outputFormat.format(ID.MIN.val())));
+
+ waitGui.until(TextContainsCondition.getInstance().text(CORRECT_MIN_VAL)
+ .locator(outputFormat.format(ID.MIN.val())));
Assert.assertEquals(selenium.getText(outputFormat.format(ID.MAX.val())),
CORRECT_MAX_VAL);
Assert.assertEquals(selenium.getText(outputFormat.format(ID.CUSTOM.val())),
CORRECT_CUSTOM_VAL);
}
-
+
@Test
@IssueTracking("https://issues.jboss.org/browse/RF-11264")
+ @Templates(exclude = { "a4jRegion" })
public void testAllWrong() {
-
+
setAllCorrect();
setAllWrong();
-
+
selenium.click(hCommandBtn);
-
+
waitGui.until(TextContainsCondition.getInstance().locator(msgFormat.format(ID.MIN.val())).text(MSG_MIN));
Assert.assertEquals(selenium.getText(msgFormat.format(ID.MAX.val())), MSG_MAX);
Assert.assertEquals(selenium.getText(msgFormat.format(ID.CUSTOM.val())),
MSG_CUSTOM);
-
+
setAllCorrect();
setAllWrong();
-
+
selenium.click(a4jCommandBtn);
-
+
waitGui.until(TextContainsCondition.getInstance().locator(msgFormat.format(ID.MIN.val())).text(MSG_MIN));
Assert.assertEquals(selenium.getText(msgFormat.format(ID.MAX.val())), MSG_MAX);
Assert.assertEquals(selenium.getText(msgFormat.format(ID.CUSTOM.val())),
MSG_CUSTOM);