Author: ppitonak(a)redhat.com
Date: 2010-12-17 07:44:42 -0500 (Fri, 17 Dec 2010)
New Revision: 20643
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCalendar/TestRichCalendarAttributes.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCalendar/TestRichCalendarBasic.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsiblePanel/TestRichCollapsiblePanel.java
Log:
* fixed tests for calendar and collapsible panel
* refactoring
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCalendar/TestRichCalendarAttributes.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCalendar/TestRichCalendarAttributes.java 2010-12-17
11:39:38 UTC (rev 20642)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCalendar/TestRichCalendarAttributes.java 2010-12-17
12:44:42 UTC (rev 20643)
@@ -22,6 +22,7 @@
package org.richfaces.tests.metamer.ftest.richCalendar;
import static
org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardNoRequest;
+import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardXhr;
import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
@@ -37,7 +38,6 @@
import org.jboss.test.selenium.dom.Event;
import org.jboss.test.selenium.locator.Attribute;
import org.jboss.test.selenium.locator.AttributeLocator;
-import org.jboss.test.selenium.locator.JQueryLocator;
import org.jboss.test.selenium.waiting.EventFiredCondition;
import org.richfaces.tests.metamer.ftest.annotations.IssueTracking;
import org.testng.annotations.Test;
@@ -76,8 +76,7 @@
@Test
public void testBoundaryDatesModeInactive() {
- JQueryLocator selectOption =
pjq("input[name$=boundaryDatesModeInput][value=inactive]");
- selenium.click(selectOption);
+
selenium.click(pjq("input[name$=boundaryDatesModeInput][value=inactive]"));
selenium.waitForPageToLoad();
testBoundaryDatesModeNull();
@@ -85,8 +84,7 @@
@Test
public void testBoundaryDatesModeScroll() {
- JQueryLocator selectOption =
pjq("input[name$=boundaryDatesModeInput][value=scroll]");
- selenium.click(selectOption);
+
selenium.click(pjq("input[name$=boundaryDatesModeInput][value=scroll]"));
selenium.waitForPageToLoad();
selenium.click(input);
@@ -119,8 +117,7 @@
@Test
public void testBoundaryDatesModeSelect() {
- JQueryLocator selectOption =
pjq("input[name$=boundaryDatesModeInput][value=select]");
- selenium.click(selectOption);
+
selenium.click(pjq("input[name$=boundaryDatesModeInput][value=select]"));
selenium.waitForPageToLoad();
selenium.click(input);
@@ -168,8 +165,7 @@
@Test
public void testButtonClassIcon() {
- JQueryLocator selectOption = pjq("td:has(label:contains(heart)) >
input[name$=buttonIconInput]");
- selenium.click(selectOption);
+ selenium.click(pjq("td:has(label:contains(heart)) >
input[name$=buttonIconInput]"));
selenium.waitForPageToLoad();
testStyleClass(image, "buttonClass");
@@ -177,16 +173,14 @@
@Test
public void testButtonIcon() {
- JQueryLocator selectOption = pjq("td:has(label:contains(star)) >
input[name$=buttonIconInput]");
- selenium.click(selectOption);
+ selenium.click(pjq("td:has(label:contains(star)) >
input[name$=buttonIconInput]"));
selenium.waitForPageToLoad();
AttributeLocator attr = image.getAttribute(Attribute.SRC);
String src = selenium.getAttribute(attr);
assertTrue(src.contains("star.png"), "Calendar's icon was not
updated.");
- selectOption = pjq("td:has(label:contains(null)) >
input[name$=buttonIconInput]");
- selenium.click(selectOption);
+ selenium.click(pjq("td:has(label:contains(null)) >
input[name$=buttonIconInput]"));
selenium.waitForPageToLoad();
src = selenium.getAttribute(attr);
@@ -195,20 +189,17 @@
@Test
public void testButtonIconDisabled() {
- JQueryLocator selectOption =
pjq("input[name$=disabledInput][value=true]");
- selenium.click(selectOption);
+ selenium.click(pjq("input[name$=disabledInput][value=true]"));
selenium.waitForPageToLoad();
- selectOption = pjq("td:has(label:contains(heart)) >
input[name$=buttonIconDisabledInput]");
- selenium.click(selectOption);
+ selenium.click(pjq("td:has(label:contains(heart)) >
input[name$=buttonIconDisabledInput]"));
selenium.waitForPageToLoad();
AttributeLocator attr = image.getAttribute(Attribute.SRC);
String src = selenium.getAttribute(attr);
assertTrue(src.contains("heart.png"), "Calendar's icon was not
updated.");
- selectOption = pjq("td:has(label:contains(null)) >
input[name$=buttonIconDisabledInput]");
- selenium.click(selectOption);
+ selenium.click(pjq("td:has(label:contains(null)) >
input[name$=buttonIconDisabledInput]"));
selenium.waitForPageToLoad();
src = selenium.getAttribute(attr);
@@ -226,8 +217,7 @@
assertFalse(selenium.isDisplayed(image), "Image should not be
displayed.");
}
- JQueryLocator selectOption = pjq("td:has(label:contains(star)) >
input[name$=buttonIconInput]");
- selenium.click(selectOption);
+ selenium.click(pjq("td:has(label:contains(star)) >
input[name$=buttonIconInput]"));
selenium.waitForPageToLoad();
if (selenium.isElementPresent(image)) {
@@ -262,9 +252,8 @@
}
@Test
- public void testDayStyleClass() {
- JQueryLocator selectOption =
pjq("input[name$=dayStyleClassInput][value=yellowTuesdays]");
- selenium.click(selectOption);
+ public void testDayClassFunction() {
+
selenium.click(pjq("input[name$=dayClassFunctionInput][value=yellowTuesdays]"));
selenium.waitForPageToLoad();
selenium.click(input);
@@ -275,8 +264,7 @@
}
}
- selectOption = pjq("input[name$=dayStyleClassInput][value=]");
- selenium.click(selectOption);
+ selenium.click(pjq("input[name$=dayClassFunctionInput][value=]"));
selenium.waitForPageToLoad();
selenium.click(input);
@@ -303,8 +291,7 @@
@Test
public void testDisabled() {
- JQueryLocator selectOption =
pjq("input[name$=disabledInput][value=true]");
- selenium.click(selectOption);
+ selenium.click(pjq("input[name$=disabledInput][value=true]"));
selenium.waitForPageToLoad();
AttributeLocator disabledAttr = input.getAttribute(new
Attribute("disabled"));
@@ -324,8 +311,7 @@
assertTrue(selenium.isAttributePresent(readonlyAttr), "Readonly attribute of
input should be defined.");
assertEquals(selenium.getAttribute(readonlyAttr), "readonly",
"Input should be read-only.");
- JQueryLocator selectOption =
pjq("input[name$=enableManualInputInput][value=true]");
- selenium.click(selectOption);
+
selenium.click(pjq("input[name$=enableManualInputInput][value=true]"));
selenium.waitForPageToLoad();
assertFalse(selenium.isAttributePresent(readonlyAttr), "Readonly attribute
of input should not be defined.");
@@ -419,13 +405,14 @@
@Test
@IssueTracking("https://jira.jboss.org/browse/RF-9602")
public void testOninputchange() {
+
selenium.click(pjq("input[name$=enableManualInputInput][value=true]"));
+ selenium.waitForPageToLoad();
+
selenium.type(pjq("input[id$=oninputchangeInput]"), "metamerEvents
+= \"inputchange \"");
selenium.waitForPageToLoad(TIMEOUT);
- selenium.click(input);
- selenium.click(cellDay.format(6));
- selenium.click(applyButton);
-
+ selenium.type(input, "Dec 23, 2010 19:27");
+
waitGui.failWith("Attribute oninputchange does not work
correctly").until(
new EventFiredCondition(new Event("inputchange")));
}
@@ -533,7 +520,7 @@
assertFalse(selenium.isDisplayed(applyButton), "Apply button should not
be displayed.");
}
- guardNoRequest(selenium).click(cellDay.format(6));
+ guardXhr(selenium).click(cellDay.format(6));
String day = selenium.getText(cellDay.format(6));
String month = selenium.getText(monthLabel);
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCalendar/TestRichCalendarBasic.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCalendar/TestRichCalendarBasic.java 2010-12-17
11:39:38 UTC (rev 20642)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCalendar/TestRichCalendarBasic.java 2010-12-17
12:44:42 UTC (rev 20643)
@@ -23,6 +23,7 @@
import java.text.ParseException;
import static
org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardNoRequest;
+import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardXhr;
import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
@@ -69,15 +70,13 @@
@Test
public void testOpenPopupClickOnInput() {
guardNoRequest(selenium).click(input);
- boolean displayed = selenium.isDisplayed(popup);
- assertTrue(displayed, "Popup should be visible.");
+ assertTrue(selenium.isDisplayed(popup), "Popup should be visible.");
}
@Test
public void testOpenPopupClickOnImage() {
guardNoRequest(selenium).click(image);
- boolean displayed = selenium.isDisplayed(popup);
- assertTrue(displayed, "Popup should be visible.");
+ assertTrue(selenium.isDisplayed(popup), "Popup should be visible.");
}
@Test
@@ -112,8 +111,7 @@
@Test
public void testHeaderMonth() {
- SimpleDateFormat formatter = new SimpleDateFormat("MMMM, yyyy");
- String month = formatter.format(new Date());
+ String month = new SimpleDateFormat("MMMM, yyyy").format(new Date());
selenium.click(input);
String month2 = selenium.getText(monthLabel);
@@ -327,7 +325,7 @@
fail(ex.getMessage());
}
- guardNoRequest(selenium).click(applyButton);
+ guardXhr(selenium).click(applyButton);
assertFalse(selenium.isDisplayed(popup), "Popup should not be
displayed.");
String inputDate = selenium.getValue(input);
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsiblePanel/TestRichCollapsiblePanel.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsiblePanel/TestRichCollapsiblePanel.java 2010-12-17
11:39:38 UTC (rev 20642)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsiblePanel/TestRichCollapsiblePanel.java 2010-12-17
12:44:42 UTC (rev 20643)
@@ -29,7 +29,6 @@
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.assertSame;
import java.net.URL;
@@ -87,8 +86,7 @@
@Test
public void testSwitchTypeAjax() {
- JQueryLocator selectOption =
pjq("input[name$=switchTypeInput][value=ajax]");
- selenium.click(selectOption);
+ selenium.click(pjq("input[name$=switchTypeInput][value=ajax]"));
selenium.waitForPageToLoad();
testSwitchTypeNull();
@@ -96,8 +94,7 @@
@Test
public void testSwitchTypeClient() {
- JQueryLocator selectOption =
pjq("input[name$=switchTypeInput][value=client]");
- selenium.click(selectOption);
+ selenium.click(pjq("input[name$=switchTypeInput][value=client]"));
selenium.waitForPageToLoad();
// click to collapse
@@ -111,8 +108,7 @@
@Test
public void testSwitchTypeServer() {
- JQueryLocator selectOption =
pjq("input[name$=switchTypeInput][value=server]");
- selenium.click(selectOption);
+ selenium.click(pjq("input[name$=switchTypeInput][value=server]"));
selenium.waitForPageToLoad();
// click to collapse
@@ -127,8 +123,7 @@
@Test
@IssueTracking("https://jira.jboss.org/browse/RF-9421")
public void testBypassUpdates() {
- JQueryLocator input =
pjq("input[type=radio][name$=bypassUpdatesInput][value=true]");
- selenium.click(input);
+
selenium.click(pjq("input[type=radio][name$=bypassUpdatesInput][value=true]"));
selenium.waitForPageToLoad();
String timeValue = selenium.getText(time);
@@ -155,8 +150,7 @@
@Test
@IssueTracking("https://jira.jboss.org/browse/RF-9421")
public void testImmediate() {
- JQueryLocator input =
pjq("input[type=radio][name$=immediateInput][value=true]");
- selenium.click(input);
+
selenium.click(pjq("input[type=radio][name$=immediateInput][value=true]"));
selenium.waitForPageToLoad();
String timeValue = selenium.getText(time);
@@ -168,13 +162,13 @@
@Test
@IssueTracking("https://jira.jboss.org/browse/RF-9535")
- public void testLimitToList() {
+ public void testLimitRender() {
JQueryLocator timeLoc = jq("span[id$=requestTime]");
selenium.type(pjq("input[type=text][id$=renderInput]"),
"@this");
selenium.waitForPageToLoad();
-
selenium.click(pjq("input[type=radio][name$=limitToListInput][value=true]"));
+
selenium.click(pjq("input[type=radio][name$=limitRenderInput][value=true]"));
selenium.waitForPageToLoad();
String timeValue = selenium.getText(timeLoc);
@@ -183,13 +177,12 @@
waitGui.failWith("Panel should be
collapsed.").until(isDisplayed.locator(headerColps));
String newTime = selenium.getText(timeLoc);
- assertSame(newTime, timeValue, "Panel with ajaxRendered=true should not be
rerendered.");
+ assertTrue(newTime.equals(timeValue), "Panel with ajaxRendered=true should
not be rerendered (old and new time should be same).");
}
@Test
public void testRendered() {
- JQueryLocator input =
pjq("input[type=radio][name$=renderedInput][value=false]");
- selenium.click(input);
+
selenium.click(pjq("input[type=radio][name$=renderedInput][value=false]"));
selenium.waitForPageToLoad();
assertFalse(selenium.isElementPresent(panel), "Panel should not be rendered
when rendered=false.");