Author: ppitonak(a)redhat.com
Date: 2011-10-13 08:30:04 -0400 (Thu, 13 Oct 2011)
New Revision: 22798
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richGraphValidator/TestRichGraphValidator.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richHashParam/TestRichHashParam.java
Log:
tests for graph validator and hash param fixed
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richGraphValidator/TestRichGraphValidator.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richGraphValidator/TestRichGraphValidator.java 2011-10-13
11:51:15 UTC (rev 22797)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richGraphValidator/TestRichGraphValidator.java 2011-10-13
12:30:04 UTC (rev 22798)
@@ -24,12 +24,14 @@
import static org.jboss.test.selenium.locator.LocatorFactory.jq;
import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
import static
org.richfaces.tests.metamer.ftest.attributes.AttributeList.graphValidatorAttributes;
-import static
org.richfaces.tests.metamer.ftest.richGraphValidator.GraphValidatorAttributes.*;
+import static
org.richfaces.tests.metamer.ftest.richGraphValidator.GraphValidatorAttributes.groups;
+import static
org.richfaces.tests.metamer.ftest.richGraphValidator.GraphValidatorAttributes.rendered;
+import static
org.richfaces.tests.metamer.ftest.richGraphValidator.GraphValidatorAttributes.summary;
+import static
org.richfaces.tests.metamer.ftest.richGraphValidator.GraphValidatorAttributes.value;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.Date;
-import java.util.GregorianCalendar;
import org.jboss.test.selenium.locator.JQueryLocator;
import org.jboss.test.selenium.locator.option.OptionValueLocator;
@@ -38,22 +40,20 @@
/**
* Test for page /faces/components/richGraphValidator/all.xhtml
- *
+ *
* @author <a href="mailto:jjamrich@redhat.com">Jan Jamrich</a>
* @version $Revision: 22622 $
*/
public class TestRichGraphValidator extends AbstractMetamerTest {
private static final String SMILE = ":-)";
-
- private static final String[] GROUPS = {"",
"javax.validation.groups.Default",
-
"org.richfaces.tests.metamer.validation.groups.ValidationGroupAllComponents",
-
"org.richfaces.tests.metamer.validation.groups.ValidationGroupBooleanInputs",
-
"org.richfaces.tests.metamer.validation.groups.ValidationGroupNumericInputs"};
-
+
+ private static final String[] GROUPS = { "Default", "null",
"ValidationGroupAllComponents",
+ "ValidationGroupBooleanInputs",
"ValidationGroupNumericInputs" };
+
private static final int BOOLEAN_INPUTS_GROUP = 3;
private static final int NUMERIC_INPUTS_GROUP = 4;
-
+
private JQueryLocator autocomplete = pjq("input[id$=autocompleteInput]");
private JQueryLocator inputSecret = pjq("input[id$=inputSecret]");
private JQueryLocator inputText = pjq("input[id$=inputText]");
@@ -67,27 +67,27 @@
private JQueryLocator selectBooleanCheckbox =
pjq("input[id$=selectBooleanCheckbox]");
private JQueryLocator inputNumberSliderInput = pjq("span[id$=inputNumberSlider]
input.rf-insl-inp");
private JQueryLocator inputNumberSpinnerInput =
pjq("span[id$=inputNumberSpinner] input.rf-insp-inp");
-
+
private JQueryLocator globalMessagesContainer =
pjq("span[id$=_globalMessages]");
private JQueryLocator errorMessagesContainer = pjq("span.rf-msgs");
private JQueryLocator header = pjq("div.rf-p-hdr[id$=gv1h_header]");
-
+
private OptionValueLocator optionSmile = new OptionValueLocator(SMILE);
-
+
private JQueryLocator applyChangesBtn = pjq("input[id$=applyChanges]");
@Override
public URL getTestUrl() {
return buildUrl(contextPath,
"faces/components/richGraphValidator/all.xhtml");
}
-
+
@Test
public void testGroups() {
- for (int i=0; i<GROUPS.length; ++i) {
+ for (int i = 0; i < GROUPS.length; ++i) {
graphValidatorAttributes.set(groups, GROUPS[i]);
-
+ waitFor(6000);
setAllValidatedFields();
-
+
if (i == BOOLEAN_INPUTS_GROUP) {
// only Boolean inputs validated
allFieldsSetToWrong();
@@ -98,83 +98,81 @@
selenium.type(inputNumberSliderInput, "10");
selenium.type(inputNumberSpinnerInput, "10");
}
-
+
// let's submit the form
selenium.click(applyChangesBtn);
-
+
// wait for success validation
- waitGui.until(textEquals
- .locator(globalMessagesContainer.getDescendant(jq("span.rf-msgs-inf
span.rf-msgs-sum")))
- .text("Action sucessfully done!"));
+ waitGui.until(textEquals.locator(
+ globalMessagesContainer.getDescendant(jq("span.rf-msgs-inf
span.rf-msgs-sum"))).text(
+ "Action sucessfully done!"));
}
}
-
+
@Test
public void testSummary() {
String msg = "My own validation message!";
graphValidatorAttributes.set(summary, msg);
-
+
setAllValidatedFields();
allFieldsSetToWrong();
-
+
selenium.click(applyChangesBtn);
-
- waitGui.until(textEquals
-
.locator(errorMessagesContainer.getDescendant(jq("span.rf-msgs-sum")))
- .text(msg));
+
+
waitGui.until(textEquals.locator(errorMessagesContainer.getDescendant(jq("span.rf-msgs-sum"))).text(msg));
}
@Test
public void testValue() {
-
+
graphValidatorAttributes.set(value, "testValue");
-
+
setAllValidatedFields();
-
+
// let's submit the form
selenium.click(applyChangesBtn);
-
+
// wait for success validation
waitGui.until(textEquals
- .locator(globalMessagesContainer.getDescendant(jq("span.rf-msgs-inf
span.rf-msgs-sum")))
- .text("Action sucessfully done!"));
+ .locator(globalMessagesContainer.getDescendant(jq("span.rf-msgs-inf
span.rf-msgs-sum"))).text(
+ "Action sucessfully done!"));
}
-
+
@Test
public void testRendered() {
setAllValidatedFields();
-
+
graphValidatorAttributes.set(rendered, Boolean.FALSE);
-
+
waitGui.until(isNotDisplayed.locator(header));
}
-
+
private void setAllValidatedFields() {
// inputSecret don't keed entered value after submit
selenium.type(inputSecret, SMILE);
-
+
// input returning List/Set are by default without any element checked
selenium.check(selectManyCheckbox, true);
- selenium.select(selectManyListbox, optionSmile);
- selenium.select(selectManyMenu, optionSmile);
+ selenium.select(selectManyListbox, optionSmile);
+ selenium.select(selectManyMenu, optionSmile);
}
-
+
private void allFieldsSetToWrong() {
String wrongString = "---";
SimpleDateFormat sdf = new SimpleDateFormat("MMM dd, yyyy");
- String wrongDate = sdf.format(new Date(System.currentTimeMillis() +
24*60*60*1000));
-
+ String wrongDate = sdf.format(new Date(System.currentTimeMillis() + 24 * 60 * 60
* 1000));
+
selenium.type(inplaceSelect, wrongString);
selenium.type(inplaceInput, wrongString);
selenium.type(inputNumberSpinnerInput, "10");
selenium.check(selectBooleanCheckbox, false);
selenium.type(inputSecret, wrongString);
-
+
selenium.type(inputNumberSliderInput, "15");
selenium.type(inputNumberSpinnerInput, "15");
selenium.type(autocomplete, wrongString);
selenium.type(inputText, wrongString);
- selenium.type(calendar, wrongDate);
+ selenium.type(calendar, wrongDate);
selenium.type(inputTextArea, wrongString);
}
}
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richHashParam/TestRichHashParam.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richHashParam/TestRichHashParam.java 2011-10-13
11:51:15 UTC (rev 22797)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richHashParam/TestRichHashParam.java 2011-10-13
12:30:04 UTC (rev 22798)
@@ -33,6 +33,7 @@
import org.jboss.test.selenium.geometry.Offset;
import org.jboss.test.selenium.locator.JQueryLocator;
import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
+import org.richfaces.tests.metamer.ftest.annotations.Templates;
import org.testng.annotations.Test;
/**
@@ -93,14 +94,18 @@
int panelLeft = selenium.getElementPositionLeft(panelContainer);
int shadowLeft = selenium.getElementPositionLeft(shadow);
- assertEquals(selenium.getStyle(header, new CssProperty("cursor")),
"move", "Cursor used when mouse is over panel's header.");
+ assertEquals(selenium.getStyle(header, new CssProperty("cursor")),
"move",
+ "Cursor used when mouse is over panel's header.");
selenium.dragAndDrop(header, new Offset(20, 0));
- assertEquals(selenium.getElementPositionLeft(panelContainer), panelLeft + 20,
"Panel's position after move to the right (20px).");
- assertEquals(selenium.getElementPositionLeft(shadow), shadowLeft + 20,
"Shadow's position after move to the right (20px).");
+ assertEquals(selenium.getElementPositionLeft(panelContainer), panelLeft + 20,
+ "Panel's position after move to the right (20px).");
+ assertEquals(selenium.getElementPositionLeft(shadow), shadowLeft + 20,
+ "Shadow's position after move to the right (20px).");
}
@Test
+ @Templates(exclude = { "richPopupPanel" })
public void testPanelResizeHorizontal() {
selenium.click(openButton);
int panelWidth = selenium.getElementWidth(panelContainer);
@@ -108,18 +113,24 @@
int shadowWidth = selenium.getElementWidth(shadow);
int shadowHeight = selenium.getElementHeight(shadow);
- assertEquals(selenium.getStyle(resizerW, new CssProperty("cursor")),
"w-resize", "Cursor used when mouse is over panel's left
resizer.");
- assertEquals(selenium.getStyle(resizerE, new CssProperty("cursor")),
"e-resize", "Cursor used when mouse is over panel's right
resizer.");
+ assertEquals(selenium.getStyle(resizerW, new CssProperty("cursor")),
"w-resize",
+ "Cursor used when mouse is over panel's left resizer.");
+ assertEquals(selenium.getStyle(resizerE, new CssProperty("cursor")),
"e-resize",
+ "Cursor used when mouse is over panel's right resizer.");
selenium.dragAndDrop(resizerW, new Offset(100, 0));
- assertEquals(selenium.getElementWidth(panelContainer), panelWidth - 100,
"Panel's width after resizing horizontally (-100px).");
- assertEquals(selenium.getElementHeight(panelContainer), panelHeight,
"Panel's height after resizing horizontally.");
- assertEquals(selenium.getElementWidth(shadow), shadowWidth - 100,
"Shadow's width after resizing horizontally (-100px).");
+ assertEquals(selenium.getElementWidth(panelContainer), panelWidth - 100,
+ "Panel's width after resizing horizontally (-100px).");
+ assertEquals(selenium.getElementHeight(panelContainer), panelHeight,
+ "Panel's height after resizing horizontally.");
+ assertEquals(selenium.getElementWidth(shadow), shadowWidth - 100,
+ "Shadow's width after resizing horizontally (-100px).");
assertEquals(selenium.getElementHeight(shadow), shadowHeight, "Shadow's
height after resizing horizontally.");
}
@Test
+ @Templates(exclude = { "richPopupPanel" })
public void testPanelHeight() {
selenium.click(openButton);
waitGui.failWith("Panel was not
opened.").until(isDisplayed.locator(panel));
@@ -127,6 +138,7 @@
}
@Test
+ @Templates(exclude = { "richPopupPanel" })
public void testPanelLeft() {
selenium.click(openButton);
waitGui.failWith("Panel was not
opened.").until(isDisplayed.locator(panel));
@@ -134,6 +146,7 @@
}
@Test
+ @Templates(exclude = { "richPopupPanel" })
public void testPanelTop() {
selenium.click(openButton);
waitGui.failWith("Panel was not
opened.").until(isDisplayed.locator(panel));
@@ -141,6 +154,7 @@
}
@Test
+ @Templates(exclude = { "richPopupPanel" })
public void testPanelWidth() {
selenium.click(openButton);
waitGui.failWith("Panel was not
opened.").until(isDisplayed.locator(panel));