Author: lfryc(a)redhat.com
Date: 2010-09-16 10:45:37 -0400 (Thu, 16 Sep 2010)
New Revision: 19223
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPoll/IntervalAttributes.java
Modified:
modules/tests/metamer/trunk/ftest-source/.gitignore
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractComponentAttributes.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPoll/TestInterval.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/TestInterval.java
Log:
fix and stabilized tests for a4j:poll and a4j:push
Modified: modules/tests/metamer/trunk/ftest-source/.gitignore
===================================================================
--- modules/tests/metamer/trunk/ftest-source/.gitignore 2010-09-16 14:44:19 UTC (rev
19222)
+++ modules/tests/metamer/trunk/ftest-source/.gitignore 2010-09-16 14:45:37 UTC (rev
19223)
@@ -2,4 +2,5 @@
/.project
/.settings
/target
+/test-output
/profiles.xml
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractComponentAttributes.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractComponentAttributes.java 2010-09-16
14:44:19 UTC (rev 19222)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractComponentAttributes.java 2010-09-16
14:45:37 UTC (rev 19223)
@@ -35,6 +35,8 @@
import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardHttp;
import static org.richfaces.tests.metamer.ftest.AbstractMetamerTest.pjq;
import static
org.jboss.test.selenium.locator.reference.ReferencedLocator.referenceInferred;
+import static org.jboss.test.selenium.waiting.WaitFactory.waitGui;
+import static org.jboss.test.selenium.waiting.WaitFactory.elementPresent;
/**
* @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
@@ -64,6 +66,7 @@
final ElementLocator<?> locator = propertyLocator.format(propertyName);
final AttributeLocator<?> typeLocator =
locator.getAttribute(Attribute.TYPE);
+ waitGui.until(elementPresent.locator(locator));
String inputType = selenium.getAttribute(typeLocator);
if (value == null) {
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPoll/IntervalAttributes.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPoll/IntervalAttributes.java
(rev 0)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPoll/IntervalAttributes.java 2010-09-16
14:45:37 UTC (rev 19223)
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.ftest.a4jPoll;
+
+import org.richfaces.tests.metamer.ftest.AbstractComponentAttributes;
+
+/**
+ * Tests the a4j:poll component.
+ *
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public class IntervalAttributes extends AbstractComponentAttributes {
+ public void setEnabled(boolean enabled) {
+ setProperty("enabled", enabled);
+ }
+
+ public void setInterval(long interval) {
+ setProperty("interval", interval);
+ }
+}
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPoll/TestInterval.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPoll/TestInterval.java 2010-09-16
14:44:19 UTC (rev 19222)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPoll/TestInterval.java 2010-09-16
14:45:37 UTC (rev 19223)
@@ -56,8 +56,8 @@
@Inject
int interval;
- IdLocator attributeEnabled = id("form:attributes:enabledInput");
- IdLocator attributeInterval = id("form:attributes:intervalInput");
+ IntervalAttributes attributes = new IntervalAttributes();
+
JQueryLocator time = pjq("span[id$=time]");
AttributeLocator<?> clientTime =
pjq("span[id$=clientDate]").getAttribute(Attribute.TITLE);
@@ -109,11 +109,9 @@
* </p>
*/
public void testClient() {
- guardHttp(selenium).type(attributeInterval, String.valueOf(interval));
+ attributes.setEnabled(true);
+ attributes.setInterval(interval);
- selenium.check(attributeEnabled);
- guardHttp(selenium).fireEvent(attributeEnabled, Event.CHANGE);
-
waitForPoll();
for (int i = 0; i < ITERATION_COUNT; i++) {
startInterval();
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/TestInterval.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/TestInterval.java 2010-09-16
14:44:19 UTC (rev 19222)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/TestInterval.java 2010-09-16
14:45:37 UTC (rev 19223)
@@ -51,7 +51,7 @@
@Inject
int interval;
- AttributeLocator<?> clientTime =
pjq("span[id$=metamerOutputTime]").getAttribute(Attribute.TITLE);
+ AttributeLocator<?> clientTime =
pjq("span[id$=clientDate\\:outputTime]").getAttribute(Attribute.TITLE);
long startTime;
int counter;
@@ -193,6 +193,7 @@
* @return the time of push event (the time when arrived the response from server)
*/
private long getClientTime() {
+ waitGui.until(attributePresent.locator(clientTime));
return asLong(selenium.getAttribute(clientTime));
}
}