JBoss Rich Faces SVN: r22730 - modules/tests/metamer/trunk/application/src/main/webapp/components/richOrderingList.
by richfaces-svn-commits@lists.jboss.org
Author: jpapouse
Date: 2011-09-22 05:49:59 -0400 (Thu, 22 Sep 2011)
New Revision: 22730
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richOrderingList/simple.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/richOrderingList/withColumn.xhtml
Log:
RFPL-1354: set value to valueChangeListener attribute in ordering list samples
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/richOrderingList/simple.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richOrderingList/simple.xhtml 2011-09-22 08:14:55 UTC (rev 22729)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richOrderingList/simple.xhtml 2011-09-22 09:49:59 UTC (rev 22730)
@@ -84,6 +84,7 @@
upText="#{richOrderingListBean.attributes['upText'].value}"
upTopText="#{richOrderingListBean.attributes['upTopText'].value}"
value="#{richOrderingListBean.capitals}"
+ valueChangeListener="#{richBean.valueChangeListenerImproved}"
var="capital"
>
<f:converter converterId="capitalConverter" />
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/richOrderingList/withColumn.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richOrderingList/withColumn.xhtml 2011-09-22 08:14:55 UTC (rev 22729)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richOrderingList/withColumn.xhtml 2011-09-22 09:49:59 UTC (rev 22730)
@@ -83,6 +83,7 @@
upText="#{richOrderingListBean.attributes['upText'].value}"
upTopText="#{richOrderingListBean.attributes['upTopText'].value}"
value="#{richOrderingListBean.capitals}"
+ valueChangeListener="#{richBean.valueChangeListenerImproved}"
var="capital"
>
<f:converter converterId="capitalConverter" />
13 years, 3 months
JBoss Rich Faces SVN: r22729 - in modules/tests/metamer/trunk: ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAttachQueue and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: jpapouse
Date: 2011-09-22 04:14:55 -0400 (Thu, 22 Sep 2011)
New Revision: 22729
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAttachQueue/AbstractAttachQueueTest.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAttachQueue/TestExtendingAttachQueue.java
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAttachQueue/extending.xhtml
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAttachQueue/TestNestedAttachQueue.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jQueue/QueueModel.java
Log:
RFPL-927 (a4j:attachQueue): updated 'extending' sample and created selenium test for it
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAttachQueue/extending.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAttachQueue/extending.xhtml 2011-09-20 13:18:45 UTC (rev 22728)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAttachQueue/extending.xhtml 2011-09-22 08:14:55 UTC (rev 22729)
@@ -62,12 +62,12 @@
<fieldset>
<legend><a4j:ajax event="keyup" ></legend>
- <a4j:ajax event="keyup" render="output1, output2" execute="@form" onbegin="add(#{rich:element('requests')}); #{rich:element('timeWatcher:grid')}.begin(); "
+ <a4j:ajax event="keypress" render="output1" execute="@form" onbegin="add(#{rich:element('requests')}); #{rich:element('timeWatcher:grid')}.begin(); "
oncomplete="#{rich:element('timeWatcher:grid')}.complete(); #{rich:element('timeWatcher:grid')}.difference();" onbeforedomupdate="add(#{rich:element('updates')});">
- <div><a4j:attachQueue /></div>
+ <div><a4j:attachQueue 1 /></div>
- <a4j:attachQueue id="a4jAttachQueue"
+ <a4j:attachQueue id="a4jAttachQueue1"
ignoreDupResponses="#{a4jAttachQueueBean.attributes['ignoreDupResponses'].value}"
name="#{a4jAttachQueueBean.attributes['name'].value}"
onrequestdequeue="#{a4jAttachQueueBean.attributes['onrequestdequeue'].value}"
@@ -77,10 +77,26 @@
requestGroupingId="#{a4jAttachQueueBean.attributes['requestGroupingId'].value}"
/>
- <h:inputText id="input1" value="#{a4jAttachQueueBean.text1}" onkeyup="add(#{rich:element('events')}); #{rich:element('timeWatcher:grid')}.event();"/>
- <h:inputText id="input2" value="#{a4jAttachQueueBean.text2}" onkeyup="add(#{rich:element('events')}); #{rich:element('timeWatcher:grid')}.event();"/>
+ <h:inputText id="input1" value="#{a4jAttachQueueBean.text1}" onkeypress="add(#{rich:element('events1')}); #{rich:element('timeWatcher:grid')}.event(1); " />
</a4j:ajax>
+ <a4j:ajax event="keypress" render="output2" execute="@form" onbegin="add(#{rich:element('requests')}); #{rich:element('timeWatcher:grid')}.begin(); "
+ oncomplete="#{rich:element('timeWatcher:grid')}.complete(); #{rich:element('timeWatcher:grid')}.difference();" onbeforedomupdate="add(#{rich:element('updates')});">
+ <div><a4j:attachQueue 2 /></div>
+
+ <a4j:attachQueue id="a4jAttachQueue2"
+ ignoreDupResponses="#{a4jAttachQueueBean.attributes['ignoreDupResponses'].value}"
+ name="#{a4jAttachQueueBean.attributes['name'].value}"
+ onrequestdequeue="#{a4jAttachQueueBean.attributes['onrequestdequeue'].value}"
+ onrequestqueue="#{a4jAttachQueueBean.attributes['onrequestqueue'].value}"
+ rendered="#{a4jAttachQueueBean.attributes['rendered'].value}"
+ requestDelay="#{a4jAttachQueueBean.attributes['requestDelay'].value}"
+ requestGroupingId="#{a4jAttachQueueBean.attributes['requestGroupingId'].value}"
+ />
+ <h:inputText id="input2" value="#{a4jAttachQueueBean.text2}" onkeypress="add(#{rich:element('events2')}); #{rich:element('timeWatcher:grid')}.event(2); " />
+ </a4j:ajax>
+
+
</fieldset>
<h:panelGrid columns="2">
@@ -88,24 +104,29 @@
<h:outputText id="output1" value="#{a4jAttachQueueBean.text1}" style="font-weight:bold;"/>
Output 2:
<h:outputText id="output2" value="#{a4jAttachQueueBean.text2}" style="font-weight:bold;"/>
- Events count:
- <h:outputText value="0" id="events" />
+ Event 1 count:
+ <h:outputText value="0" id="events1" />
+ Event 2 count:
+ <h:outputText value="0" id="events2" />
Requests count:
<h:outputText value="0" id="requests" />
DOM updates count:
<h:outputText value="0" id="updates" />
</h:panelGrid>
- <metamer:clientTimeWatcher id="timeWatcher" />
+ <metamer:clientTimeWatcher id="timeWatcher" events="2" />
</ui:define>
<ui:define name="outOfTemplateAfter">
- Attributes for wrapping attach queue
- <metamer:attributes value="#{a4jAttachQueueBean.attributes}" id="attributes" />
+ Attributes for wrapping attach queue 1
+ <metamer:attributes value="#{a4jAttachQueueBean.attributes}" id="attributes1" />
<br />
+ Attributes for wrapping attach queue 2
+ <metamer:attributes value="#{a4jAttachQueueBean.attributes2}" id="attributes2" />
+ <br />
Attributes for queue1
<br />
<metamer:attributes value="#{a4jQueueBean.attributes}" id="queueAttributes" />
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAttachQueue/AbstractAttachQueueTest.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAttachQueue/AbstractAttachQueueTest.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAttachQueue/AbstractAttachQueueTest.java 2011-09-22 08:14:55 UTC (rev 22729)
@@ -0,0 +1,129 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010-2011, 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.a4jAttachQueue;
+
+import static org.richfaces.tests.metamer.ftest.a4jAttachQueue.AttachQueueAttributes.onrequestdequeue;
+import static org.richfaces.tests.metamer.ftest.a4jAttachQueue.AttachQueueAttributes.onrequestqueue;
+import static org.richfaces.tests.metamer.ftest.a4jAttachQueue.AttachQueueAttributes.rendered;
+import static org.richfaces.tests.metamer.ftest.attributes.AttributeList.attachQueueAttrs1;
+import static org.richfaces.tests.metamer.ftest.attributes.AttributeList.attachQueueAttrs2;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+
+import org.jboss.cheiron.halt.XHRHalter;
+import org.jboss.test.selenium.encapsulated.JavaScript;
+import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
+import org.richfaces.tests.metamer.ftest.a4jQueue.QueueModel;
+import org.richfaces.tests.metamer.ftest.a4jQueue.QueueModel.Input;
+
+/**
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @author <a href="mailto:jpapouse@redhat.com">Jan Papousek</a>
+ */
+public abstract class AbstractAttachQueueTest extends AbstractMetamerTest {
+
+ protected static final Long GLOBAL_DELAY = 10000L;
+ protected static final Long DELAY_A = 3000L;
+ protected static final Long DELAY_B = 5000L;
+
+ private QueueModel queue = new QueueModel();
+
+ protected QueueModel getQueue() {
+ return queue;
+ }
+
+ protected void testDelay() {
+ queue.initializeTimes();
+ queue.fireEvent(Input.FIRST, 1);
+ queue.checkTimes(Input.FIRST, DELAY_A);
+ }
+
+ protected void testNoDelay() {
+ attachQueueAttrs1.set(AttachQueueAttributes.requestDelay, 0);
+
+ queue.initializeCounts();
+
+ XHRHalter.enable();
+
+ queue.fireEvent(Input.FIRST, 4);
+ queue.checkCounts(4, 0, 1, 0);
+
+ XHRHalter halter = XHRHalter.getHandleBlocking();
+ queue.checkCounts(4, 0, 1, 0);
+
+ halter.complete();
+ queue.checkCounts(4, 0, 2, 1);
+
+ halter.waitForOpen();
+ queue.checkCounts(4, 0, 2, 1);
+
+ halter.complete();
+ queue.checkCounts(4, 0, 2, 2);
+ }
+
+ protected void testTimingOneQueueTwoEvents() {
+ queue.initializeTimes();
+
+ XHRHalter.enable();
+
+ queue.fireEvent(Input.FIRST, 3);
+ queue.fireEvent(Input.SECOND, 1);
+
+ XHRHalter halter = XHRHalter.getHandleBlocking();
+ halter.complete();
+ halter.waitForOpen();
+ halter.complete();
+
+ queue.checkTimes(Input.SECOND, DELAY_B);
+ queue.checkNoDelayBetweenEvents();
+ }
+
+ protected void testRendered() {
+ attachQueueAttrs1.set(AttachQueueAttributes.requestDelay, 1500);
+ attachQueueAttrs1.set(onrequestqueue, JavaScript.js("alert('requestQueued')"));
+ attachQueueAttrs1.set(onrequestdequeue, JavaScript.js("alert('requestDequeued')"));
+ attachQueueAttrs1.set(rendered, false);
+
+ queue.initializeTimes();
+ queue.fireEvent(1);
+
+ // check that no requestDelay is applied while renderer=false
+ queue.checkTimes(0);
+ assertFalse(selenium.isAlertPresent());
+ }
+
+ protected void testQueueAndDequeueEvents() {
+ attachQueueAttrs1.set(AttachQueueAttributes.requestDelay, 0);
+ attachQueueAttrs2.set(AttachQueueAttributes.requestDelay, 0);
+
+ attachQueueAttrs1.set(AttachQueueAttributes.onrequestqueue, "metamerEvents += \"requestqueue \"");
+ attachQueueAttrs1.set(AttachQueueAttributes.onrequestdequeue, "metamerEvents += \"requestdequeue \"");
+ selenium.getEval(new JavaScript("window.metamerEvents = \"\";"));
+
+ queue.fireEvent(Input.FIRST, 1);
+
+ String[] events = selenium.getEval(new JavaScript("window.metamerEvents")).split(" ");
+ assertEquals(events.length, 2, "2 events should be fired, was [" + selenium.getEval(new JavaScript("window.metamerEvents")) + "]");
+ assertEquals(events[0], "requestqueue", "Attribute onrequestqueue doesn't work");
+ assertEquals(events[1], "requestdequeue", "Attribute onrequestdequeue doesn't work");
+ }
+}
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAttachQueue/TestExtendingAttachQueue.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAttachQueue/TestExtendingAttachQueue.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAttachQueue/TestExtendingAttachQueue.java 2011-09-22 08:14:55 UTC (rev 22729)
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010-2011, 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.a4jAttachQueue;
+
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.richfaces.tests.metamer.ftest.attributes.AttributeList.attachQueueAttrs1;
+import static org.richfaces.tests.metamer.ftest.attributes.AttributeList.attachQueueAttrs2;
+import static org.richfaces.tests.metamer.ftest.attributes.AttributeList.queueAttributes;
+
+import java.net.URL;
+
+import org.richfaces.tests.metamer.ftest.a4jQueue.QueueAttributes;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+/**
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @author <a href="mailto:jpapouse@redhat.com">Jan Papousek</a>
+ */
+public class TestExtendingAttachQueue extends AbstractAttachQueueTest {
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/a4jAttachQueue/extending.xhtml");
+ }
+
+ @BeforeMethod
+ public void setupDelays() {
+ attachQueueAttrs1.set(AttachQueueAttributes.requestDelay, DELAY_A);
+ attachQueueAttrs2.set(AttachQueueAttributes.requestDelay, DELAY_B);
+ queueAttributes.set(QueueAttributes.requestDelay, GLOBAL_DELAY);
+ }
+
+ @Test
+ public void testDelay() {
+ super.testDelay();
+ }
+
+ @Test
+ public void testNoDelay() {
+ super.testNoDelay();
+ }
+
+ @Test
+ public void testTimingOneQueueTwoEvents() {
+ super.testTimingOneQueueTwoEvents();
+ }
+
+ @Test
+ public void testRendered() {
+ super.testRendered();
+ }
+
+ @Test
+ public void testQueueAndDequeueEvents() {
+ super.testQueueAndDequeueEvents();
+ }
+}
\ No newline at end of file
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAttachQueue/TestNestedAttachQueue.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAttachQueue/TestNestedAttachQueue.java 2011-09-20 13:18:45 UTC (rev 22728)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAttachQueue/TestNestedAttachQueue.java 2011-09-22 08:14:55 UTC (rev 22729)
@@ -22,38 +22,21 @@
package org.richfaces.tests.metamer.ftest.a4jAttachQueue;
import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
-import static org.richfaces.tests.metamer.ftest.a4jAttachQueue.AttachQueueAttributes.onrequestdequeue;
-import static org.richfaces.tests.metamer.ftest.a4jAttachQueue.AttachQueueAttributes.onrequestqueue;
-import static org.richfaces.tests.metamer.ftest.a4jAttachQueue.AttachQueueAttributes.rendered;
import static org.richfaces.tests.metamer.ftest.attributes.AttributeList.attachQueueAttrs1;
import static org.richfaces.tests.metamer.ftest.attributes.AttributeList.attachQueueAttrs2;
import static org.richfaces.tests.metamer.ftest.attributes.AttributeList.queueAttributes;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import java.io.InputStream;
import java.net.URL;
-import org.jboss.cheiron.halt.XHRHalter;
-import org.jboss.test.selenium.encapsulated.JavaScript;
-import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
import org.richfaces.tests.metamer.ftest.a4jQueue.QueueAttributes;
-import org.richfaces.tests.metamer.ftest.a4jQueue.QueueModel;
-import org.richfaces.tests.metamer.ftest.a4jQueue.QueueModel.Input;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
* @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
- * @version $Revision$
+ * @author <a href="mailto:jpapouse@redhat.com">Jan Papousek</a>
*/
-public class TestNestedAttachQueue extends AbstractMetamerTest {
-
- static final Long GLOBAL_DELAY = 10000L;
- static final Long DELAY_A = 3000L;
- static final Long DELAY_B = 5000L;
-
- QueueModel queue = new QueueModel();
+public class TestNestedAttachQueue extends AbstractAttachQueueTest {
@Override
public URL getTestUrl() {
@@ -66,87 +49,29 @@
attachQueueAttrs2.set(AttachQueueAttributes.requestDelay, DELAY_B);
queueAttributes.set(QueueAttributes.requestDelay, GLOBAL_DELAY);
}
-
+
@Test
public void testDelay() {
- queue.initializeTimes();
-
- queue.fireEvent(Input.FIRST, 1);
-
- queue.checkTimes(Input.FIRST, DELAY_A);
+ super.testDelay();
}
@Test
public void testNoDelay() {
- attachQueueAttrs1.set(AttachQueueAttributes.requestDelay, 0);
-
- queue.initializeCounts();
-
- XHRHalter.enable();
-
- queue.fireEvent(Input.FIRST, 4);
- queue.checkCounts(4, 0, 1, 0);
-
- XHRHalter halter = XHRHalter.getHandleBlocking();
- queue.checkCounts(4, 0, 1, 0);
-
- halter.complete();
- queue.checkCounts(4, 0, 2, 1);
-
- halter.waitForOpen();
- queue.checkCounts(4, 0, 2, 1);
-
- halter.complete();
- queue.checkCounts(4, 0, 2, 2);
+ super.testNoDelay();
}
@Test
public void testTimingOneQueueTwoEvents() {
- queue.initializeTimes();
-
- XHRHalter.enable();
-
- queue.fireEvent(Input.FIRST, 3);
- queue.fireEvent(Input.SECOND, 1);
-
- XHRHalter halter = XHRHalter.getHandleBlocking();
- halter.complete();
- halter.waitForOpen();
- halter.complete();
-
- queue.checkTimes(Input.SECOND, DELAY_B);
- queue.checkNoDelayBetweenEvents();
+ super.testTimingOneQueueTwoEvents();
}
@Test
public void testRendered() {
- attachQueueAttrs1.set(AttachQueueAttributes.requestDelay, 1500);
- attachQueueAttrs1.set(onrequestqueue, JavaScript.js("alert('requestQueued')"));
- attachQueueAttrs1.set(onrequestdequeue, JavaScript.js("alert('requestDequeued')"));
- attachQueueAttrs1.set(rendered, false);
-
- queue.initializeTimes();
- queue.fireEvent(1);
-
- // check that no requestDelay is applied while renderer=false
- queue.checkTimes(0);
- assertFalse(selenium.isAlertPresent());
+ super.testRendered();
}
@Test
public void testQueueAndDequeueEvents() {
- attachQueueAttrs1.set(AttachQueueAttributes.requestDelay, 0);
- attachQueueAttrs2.set(AttachQueueAttributes.requestDelay, 0);
-
- attachQueueAttrs1.set(AttachQueueAttributes.onrequestqueue, "metamerEvents += \"requestqueue \"");
- attachQueueAttrs1.set(AttachQueueAttributes.onrequestdequeue, "metamerEvents += \"requestdequeue \"");
- selenium.getEval(new JavaScript("window.metamerEvents = \"\";"));
-
- queue.fireEvent(Input.FIRST, 1);
-
- String[] events = selenium.getEval(new JavaScript("window.metamerEvents")).split(" ");
- assertEquals(events.length, 2, "2 events should be fired, was [" + selenium.getEval(new JavaScript("window.metamerEvents")) + "]");
- assertEquals(events[0], "requestqueue", "Attribute onrequestqueue doesn't work");
- assertEquals(events[1], "requestdequeue", "Attribute onrequestdequeue doesn't work");
- }
+ super.testQueueAndDequeueEvents();
+ }
}
\ No newline at end of file
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jQueue/QueueModel.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jQueue/QueueModel.java 2011-09-20 13:18:45 UTC (rev 22728)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jQueue/QueueModel.java 2011-09-22 08:14:55 UTC (rev 22729)
@@ -157,7 +157,8 @@
long actualDelay = beginTime - eventTime;
long deviation = Math.abs(actualDelay - requestDelay);
long maxDeviation = Math.max(300, requestDelay / 2);
-
+ System.err.println(actualDelay);
+ System.err.println(requestDelay);
checkDeviation(deviation, maxDeviation);
deviations.add(deviation);
13 years, 3 months
JBoss Rich Faces SVN: r22728 - in modules/tests/metamer/trunk/ftest-source/src/main/java/org: jboss/test/selenium and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2011-09-20 09:18:45 -0400 (Tue, 20 Sep 2011)
New Revision: 22728
Removed:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/testng/
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/jboss/test/selenium/SeleniumGetter.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractMetamerTest.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/MatrixConfigurator.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/MetamerFailureLoggingTestListener.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandLink/TestA4JCommandLink.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richEditor/TestRichEditor.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMenuItem/TestRichMenuItem.java
Log:
unused logger removed from rich:editor test
empty testng directory removed
tests refactored in order not to use deprecated methods
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/jboss/test/selenium/SeleniumGetter.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/jboss/test/selenium/SeleniumGetter.java 2011-09-19 17:09:40 UTC (rev 22727)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/jboss/test/selenium/SeleniumGetter.java 2011-09-20 13:18:45 UTC (rev 22728)
@@ -69,11 +69,11 @@
return converter.forwardConversion(obtainValue());
}
- public static ValueGetter getValue(ElementLocator elementLocator) {
+ public static ValueGetter getValue(ElementLocator<?> elementLocator) {
return new ValueGetter(elementLocator);
}
- public static TextGetter getText(ElementLocator elementLocator) {
+ public static TextGetter getText(ElementLocator<?> elementLocator) {
return new TextGetter(elementLocator);
}
@@ -81,9 +81,9 @@
return new Evaluator(script);
}
- public static class ValueGetter extends SeleniumGetter<ElementLocator> {
+ public static class ValueGetter extends SeleniumGetter<ElementLocator<?>> {
- public ValueGetter(ElementLocator parameter) {
+ public ValueGetter(ElementLocator<?> parameter) {
super(parameter);
}
@@ -94,9 +94,9 @@
}
- public static class TextGetter extends SeleniumGetter<ElementLocator> {
+ public static class TextGetter extends SeleniumGetter<ElementLocator<?>> {
- public TextGetter(ElementLocator parameter) {
+ public TextGetter(ElementLocator<?> parameter) {
super(parameter);
}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractMetamerTest.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractMetamerTest.java 2011-09-19 17:09:40 UTC (rev 22727)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractMetamerTest.java 2011-09-20 13:18:45 UTC (rev 22728)
@@ -46,8 +46,6 @@
import java.util.List;
import java.util.Locale;
-import javax.faces.event.PhaseId;
-
import org.apache.commons.lang.LocaleUtils;
import org.jboss.cheiron.retriever.ScriptEvaluationRetriever;
import org.jboss.test.selenium.AbstractTestCase;
@@ -80,7 +78,7 @@
* @version $Revision$
*/
public abstract class AbstractMetamerTest extends AbstractTestCase {
-
+
/**
* timeout in miliseconds
*/
@@ -97,8 +95,8 @@
protected TextRetriever retrieveStatusChecker = retrieveText.locator(jq("#statusCheckerOutput"));
protected PhaseInfo phaseInfo = new PhaseInfo();
protected LocatorReference<JQueryLocator> attributesRoot = new LocatorReference<JQueryLocator>(
- pjq("span[id$=:attributes:panel]"));
-
+ pjq("span[id$=:attributes:panel]"));
+
@Inject
@Templates({ "plain", "richAccordion", "richDataTable", "richCollapsibleSubTable", "richExtendedDataTable",
"richDataGrid", "richList", "richCollapsiblePanel", "richPanel", "richTabPanel", "richTogglePanel",
@@ -152,7 +150,7 @@
/**
* Do a full page refresh (regular HTTP request) by triggering a command with no action bound.
*/
- public void fullPageRefresh() {
+ public void fullPageRefresh() {
waitGui.until(elementPresent.locator(fullPageRefreshIcon));
guardHttp(selenium).click(fullPageRefreshIcon);
}
@@ -160,7 +158,7 @@
/**
* Rerender all content of the page (AJAX request) by trigerring a command with no action but render bound.
*/
- public void rerenderAll() {
+ public void rerenderAll() {
waitGui.until(elementPresent.locator(rerenderAllIcon));
guardXhr(selenium).click(rerenderAllIcon);
}
@@ -212,7 +210,7 @@
selenium.fireEvent(element, event);
waitGui.failWith("Attribute on" + attributeName + " does not work correctly").until(
- new EventFiredCondition(event));
+ new EventFiredCondition(event));
}
/**
@@ -287,9 +285,9 @@
public void testRequestEventsAfter(String... events) {
String[] actualEvents = selenium.getEval(new JavaScript("window.metamerEvents")).split(" ");
assertEquals(
- actualEvents,
- events,
- format("The events ({0}) don't came in right order ({1})", Arrays.deepToString(actualEvents),
+ actualEvents,
+ events,
+ format("The events ({0}) don't came in right order ({1})", Arrays.deepToString(actualEvents),
Arrays.deepToString(events)));
}
@@ -305,9 +303,9 @@
String[] actualEvents = list.toArray(new String[list.size()]);
assertEquals(
- actualEvents,
- events,
- format("The events ({0}) don't came in right order ({1})", Arrays.deepToString(actualEvents),
+ actualEvents,
+ events,
+ format("The events ({0}) don't came in right order ({1})", Arrays.deepToString(actualEvents),
Arrays.deepToString(events)));
}
@@ -406,7 +404,7 @@
selenium.waitForPageToLoad();
assertTrue(selenium.getAttribute(attr).contains(value), "Attribute " + attribute + " should contain \"" + value
- + "\".");
+ + "\".");
}
/**
@@ -423,17 +421,6 @@
selenium.getEval(new JavaScript("window.showControls()"));
}
- /**
- * Verifies that only given phases were executed. It uses the list of phases in the header of the page.
- *
- * @param phases
- * phases that are expected to have been executed
- */
- @Deprecated
- protected void assertPhases(PhaseId... phases) {
- phaseInfo.assertPhases(phases);
- }
-
protected void fireEventNatively(ElementLocator<?> target, Event event) {
if (event == CLICK) {
selenium.click(target);
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/MatrixConfigurator.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/MatrixConfigurator.java 2011-09-19 17:09:40 UTC (rev 22727)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/MatrixConfigurator.java 2011-09-20 13:18:45 UTC (rev 22728)
@@ -82,7 +82,7 @@
for (IMethodInstance methodInstance : methodInstances) {
for (int i = 0; i < methodInstance.getMethod().getInvocationCount(); i++) {
- methods.add(methodInstance.getMethod().getMethod());
+ methods.add(methodInstance.getMethod().getConstructorOrMethod().getMethod());
}
if (methodInstance.getMethod().getInvocationCount() > 0) {
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/MetamerFailureLoggingTestListener.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/MetamerFailureLoggingTestListener.java 2011-09-19 17:09:40 UTC (rev 22727)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/MetamerFailureLoggingTestListener.java 2011-09-20 13:18:45 UTC (rev 22728)
@@ -55,7 +55,7 @@
super.onFailure(result);
List<String> issueList = new LinkedList<String>();
- IssueTracking issueTracking = result.getMethod().getMethod().getAnnotation(IssueTracking.class);
+ IssueTracking issueTracking = result.getMethod().getConstructorOrMethod().getMethod().getAnnotation(IssueTracking.class);
if (issueTracking != null) {
issueList.addAll(asList(issueTracking.value()));
}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandLink/TestA4JCommandLink.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandLink/TestA4JCommandLink.java 2011-09-19 17:09:40 UTC (rev 22727)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandLink/TestA4JCommandLink.java 2011-09-20 13:18:45 UTC (rev 22728)
@@ -101,21 +101,24 @@
selenium.typeKeys(input, "RichFaces 4");
guardXhr(selenium).click(link);
waitGui.until(textEquals.locator(output1).text("RichFaces 4"));
- assertEquals(selenium.getText(output2), "RichFaces 4RichFaces 4", "output2 when 'RichFaces 4' in input and doubleStringAction selected");
+ assertEquals(selenium.getText(output2), "RichFaces 4RichFaces 4",
+ "output2 when 'RichFaces 4' in input and doubleStringAction selected");
selenium.click(pjq("input[name$=actionInput][value=first6CharsAction]"));
selenium.waitForPageToLoad();
selenium.typeKeys(input, "RichFaces 4ň");
guardXhr(selenium).click(link);
waitGui.until(textEquals.locator(output1).text("RichFaces 4ň"));
- assertEquals(selenium.getText(output2), "RichFa", "output2 when 'RichFaces 4ň' in input and first6CharsAction selected");
+ assertEquals(selenium.getText(output2), "RichFa",
+ "output2 when 'RichFaces 4ň' in input and first6CharsAction selected");
selenium.click(pjq("input[name$=actionInput][value=toUpperCaseAction]"));
selenium.waitForPageToLoad();
selenium.typeKeys(input, "RichFaces 4ě");
guardXhr(selenium).click(link);
waitGui.until(textEquals.locator(output1).text("RichFaces 4ě"));
- assertEquals(selenium.getText(output2), "RICHFACES 4Ě", "output2 when 'RichFaces 4ě' in input and toUpperCaseAction selected");
+ assertEquals(selenium.getText(output2), "RICHFACES 4Ě",
+ "output2 when 'RichFaces 4ě' in input and toUpperCaseAction selected");
}
@Test
@@ -126,21 +129,23 @@
guardXhr(selenium).click(link);
waitGui.until(textEquals.locator(output1).text("RichFaces 4"));
assertEquals(selenium.getText(output3), "RichFaces 4RichFaces 4",
- "output3 when 'RichFaces 4' in input and doubleStringActionListener selected");
+ "output3 when 'RichFaces 4' in input and doubleStringActionListener selected");
selenium.click(pjq("input[name$=actionListenerInput][value=first6CharsActionListener]"));
selenium.waitForPageToLoad();
selenium.typeKeys(input, "RichFaces 4ň");
guardXhr(selenium).click(link);
waitGui.until(textEquals.locator(output1).text("RichFaces 4ň"));
- assertEquals(selenium.getText(output3), "RichFa", "output3 when 'RichFaces 4ň' in input and first6CharsActionListener selected");
+ assertEquals(selenium.getText(output3), "RichFa",
+ "output3 when 'RichFaces 4ň' in input and first6CharsActionListener selected");
selenium.click(pjq("input[name$=actionListenerInput][value=toUpperCaseActionListener]"));
selenium.waitForPageToLoad();
selenium.typeKeys(input, "RichFaces 4ě");
guardXhr(selenium).click(link);
waitGui.until(textEquals.locator(output1).text("RichFaces 4ě"));
- assertEquals(selenium.getText(output3), "RICHFACES 4Ě", "output3 when 'RichFaces 4ě' in input and toUpperCaseActionListener selected");
+ assertEquals(selenium.getText(output3), "RICHFACES 4Ě",
+ "output3 when 'RichFaces 4ě' in input and toUpperCaseActionListener selected");
}
@Test
@@ -155,8 +160,8 @@
assertEquals(selenium.getText(output1), "", "Output 1 should not change");
assertEquals(selenium.getText(output2), "", "Output 2 should not change");
assertEquals(selenium.getText(output3), "", "Output 3 should not change");
- assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.PROCESS_VALIDATIONS,
- PhaseId.RENDER_RESPONSE);
+ phaseInfo.assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.PROCESS_VALIDATIONS,
+ PhaseId.RENDER_RESPONSE);
String listenerOutput = selenium.getText(jq("div#phasesPanel li:eq(3)"));
assertEquals(listenerOutput, "* action listener invoked", "Action listener's output");
@@ -199,8 +204,10 @@
selenium.click(pjq("input[name$=disabledInput][value=true]"));
selenium.waitForPageToLoad();
- assertFalse(selenium.isElementPresent(link), link.getAsString() + " should not be on page when the link is disabled");
- assertTrue(selenium.isElementPresent(newLink), newLink.getAsString() + " should be on page when the link is disabled");
+ assertFalse(selenium.isElementPresent(link), link.getAsString()
+ + " should not be on page when the link is disabled");
+ assertTrue(selenium.isElementPresent(newLink), newLink.getAsString()
+ + " should be on page when the link is disabled");
}
@Test
@@ -239,8 +246,8 @@
assertEquals(selenium.getText(output1), "", "Output 1 should not change");
assertEquals(selenium.getText(output2), "", "Output 2 should not change");
assertEquals(selenium.getText(output3), "", "Output 3 should not change");
- assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.RENDER_RESPONSE);
-
+ phaseInfo.assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.RENDER_RESPONSE);
+
String listenerOutput = selenium.getText(jq("div#phasesPanel li:eq(2)"));
assertEquals(listenerOutput, "* action listener invoked", "Action listener's output");
listenerOutput = selenium.getText(jq("div#phasesPanel li:eq(3)"));
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richEditor/TestRichEditor.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richEditor/TestRichEditor.java 2011-09-19 17:09:40 UTC (rev 22727)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richEditor/TestRichEditor.java 2011-09-20 13:18:45 UTC (rev 22728)
@@ -20,8 +20,6 @@
import org.jboss.test.selenium.waiting.selenium.SeleniumCondition;
import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
import org.richfaces.tests.metamer.ftest.annotations.IssueTracking;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -33,8 +31,6 @@
*/
public class TestRichEditor extends AbstractMetamerTest {
- private static final Logger LOG = LoggerFactory.getLogger(TestRichEditor.class);
-
private JQueryLocator editor = pjq("span[id$=editor:inp]");
private JQueryLocator editorTextArea = pjq("textarea[id$=editor:inp]");
private JQueryLocator editorArea = jq("body");
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMenuItem/TestRichMenuItem.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMenuItem/TestRichMenuItem.java 2011-09-19 17:09:40 UTC (rev 22727)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMenuItem/TestRichMenuItem.java 2011-09-20 13:18:45 UTC (rev 22728)
@@ -83,7 +83,8 @@
assertTrue(selenium.isElementPresent(menuItem2), "Menu item \"Open\" should be present on the page.");
assertTrue(selenium.isVisible(menuItem2), "Menu item \"Open\" should be visible on the page.");
- assertTrue(selenium.isElementPresent(menuGroup3), "Menu group \"Open Recent...\" should be present on the page.");
+ assertTrue(selenium.isElementPresent(menuGroup3),
+ "Menu group \"Open Recent...\" should be present on the page.");
assertTrue(selenium.isVisible(menuGroup3), "Menu group \"Open Recent...\" should be visible on the page.");
assertTrue(selenium.isElementPresent(image), "Icon of menu item 1 should be present on the page.");
@@ -93,8 +94,9 @@
assertTrue(selenium.isVisible(label), "Label of menu item 1 should be visible on the page.");
assertEquals(selenium.getText(label), "New", "Label of first menu item.");
- AttributeLocator attr = image.getAttribute(Attribute.SRC);
- assertTrue(selenium.getAttribute(attr).contains("create_doc.gif"), "Image's src attribute should contain \"create_doc.gif\".");
+ AttributeLocator<?> attr = image.getAttribute(Attribute.SRC);
+ assertTrue(selenium.getAttribute(attr).contains("create_doc.gif"),
+ "Image's src attribute should contain \"create_doc.gif\".");
}
@Test
@@ -129,8 +131,8 @@
guardXhr(selenium).click(menuItem1);
waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
- assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.PROCESS_VALIDATIONS,
- PhaseId.RENDER_RESPONSE);
+ phaseInfo.assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.PROCESS_VALIDATIONS,
+ PhaseId.RENDER_RESPONSE);
String listenerOutput = selenium.getText(jq("div#phasesPanel li:eq(3)"));
assertEquals(listenerOutput, "* action listener invoked", "Action listener's output");
@@ -165,8 +167,10 @@
selenium.click(pjq("input[type=radio][name$=disabledInput][value=true]"));
selenium.waitForPageToLoad();
- assertTrue(selenium.belongsClass(menuItem1, "rf-ddm-itm-dis"), "Menu item should have class \"rf-ddm-itm-dis\".");
- assertTrue(selenium.isElementPresent(menuItem1.getDescendant(jq("div.rf-ddm-emptyIcon"))), "Empty icon should be present.");
+ assertTrue(selenium.belongsClass(menuItem1, "rf-ddm-itm-dis"),
+ "Menu item should have class \"rf-ddm-itm-dis\".");
+ assertTrue(selenium.isElementPresent(menuItem1.getDescendant(jq("div.rf-ddm-emptyIcon"))),
+ "Empty icon should be present.");
assertFalse(selenium.isElementPresent(image), "Icon should not be present.");
}
@@ -192,20 +196,23 @@
@Test
public void testIcon() {
- AttributeLocator attr = image.getAttribute(Attribute.SRC);
+ AttributeLocator<?> attr = image.getAttribute(Attribute.SRC);
selenium.select(pjq("select[id$=iconInput]"), optionLabel("star"));
selenium.waitForPageToLoad();
- assertTrue(selenium.getAttribute(attr).contains("star.png"), "Image's src attribute should contain \"star.png\".");
+ assertTrue(selenium.getAttribute(attr).contains("star.png"),
+ "Image's src attribute should contain \"star.png\".");
selenium.select(pjq("select[id$=iconInput]"), optionLabel("nonexisting"));
selenium.waitForPageToLoad();
- assertTrue(selenium.getAttribute(attr).contains("nonexisting"), "Image's src attribute should contain \"nonexisting\".");
+ assertTrue(selenium.getAttribute(attr).contains("nonexisting"),
+ "Image's src attribute should contain \"nonexisting\".");
selenium.select(pjq("select[id$=iconInput]"), optionLabel("null"));
selenium.waitForPageToLoad();
assertFalse(selenium.isElementPresent(image), "Icon should not be present.");
- assertTrue(selenium.isElementPresent(menuItem1.getDescendant(jq("div.rf-ddm-emptyIcon"))), "Empty icon should be present.");
+ assertTrue(selenium.isElementPresent(menuItem1.getDescendant(jq("div.rf-ddm-emptyIcon"))),
+ "Empty icon should be present.");
}
@Test
@@ -213,18 +220,21 @@
selenium.click(pjq("input[type=radio][name$=disabledInput][value=true]"));
selenium.waitForPageToLoad();
- AttributeLocator attr = image.getAttribute(Attribute.SRC);
+ AttributeLocator<?> attr = image.getAttribute(Attribute.SRC);
assertFalse(selenium.isElementPresent(image), "Icon should not be present.");
- assertTrue(selenium.isElementPresent(menuItem1.getDescendant(jq("div.rf-ddm-emptyIcon"))), "Empty icon should be present.");
+ assertTrue(selenium.isElementPresent(menuItem1.getDescendant(jq("div.rf-ddm-emptyIcon"))),
+ "Empty icon should be present.");
selenium.select(pjq("select[id$=iconDisabledInput]"), optionLabel("star"));
selenium.waitForPageToLoad();
- assertTrue(selenium.getAttribute(attr).contains("star.png"), "Image's src attribute should contain \"star.png\".");
+ assertTrue(selenium.getAttribute(attr).contains("star.png"),
+ "Image's src attribute should contain \"star.png\".");
selenium.select(pjq("select[id$=iconDisabledInput]"), optionLabel("nonexisting"));
selenium.waitForPageToLoad();
- assertTrue(selenium.getAttribute(attr).contains("nonexisting"), "Image's src attribute should contain \"nonexisting\".");
+ assertTrue(selenium.getAttribute(attr).contains("nonexisting"),
+ "Image's src attribute should contain \"nonexisting\".");
}
@Test
@@ -237,7 +247,7 @@
guardXhr(selenium).click(menuItem1);
waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
- assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.RENDER_RESPONSE);
+ phaseInfo.assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.RENDER_RESPONSE);
String listenerOutput = selenium.getText(jq("div#phasesPanel li:eq(2)"));
assertEquals(listenerOutput, "* action listener invoked", "Action listener's output");
@@ -278,8 +288,8 @@
guardXhr(selenium).click(menuItem1);
waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
- assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.PROCESS_VALIDATIONS,
- PhaseId.UPDATE_MODEL_VALUES, PhaseId.INVOKE_APPLICATION, PhaseId.RENDER_RESPONSE);
+ phaseInfo.assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.PROCESS_VALIDATIONS,
+ PhaseId.UPDATE_MODEL_VALUES, PhaseId.INVOKE_APPLICATION, PhaseId.RENDER_RESPONSE);
String listenerOutput = selenium.getText(jq("div#phasesPanel li:eq(5)"));
assertEquals(listenerOutput, "* action listener invoked", "Action listener's output");
@@ -293,7 +303,7 @@
guardHttp(selenium).click(menuItem1);
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);
listenerOutput = selenium.getText(jq("div#phasesPanel li:eq(5)"));
assertEquals(listenerOutput, "* action listener invoked", "Action listener's output");
13 years, 3 months
JBoss Rich Faces SVN: r22727 - in modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest: checker and 5 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: jpapouse
Date: 2011-09-19 13:09:40 -0400 (Mon, 19 Sep 2011)
New Revision: 22727
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/checker/
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/checker/IconsChecker.java
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAccordion/TestRichAccordion.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAccordionItem/TestRichAccordionItem.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPanelMenu/TestPanelMenuIcon.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPanelMenuGroup/TestPanelMenuGroupSimple.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPanelMenuItem/TestPanelMenuItemSimple.java
Log:
RFPL-1667: added transparent icon to the tests, unified tests for icon
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/checker/IconsChecker.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/checker/IconsChecker.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/checker/IconsChecker.java 2011-09-19 17:09:40 UTC (rev 22727)
@@ -0,0 +1,185 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010-2011, 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.checker;
+
+import static org.jboss.test.selenium.locator.option.OptionLocatorFactory.optionLabel;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.commons.lang.Validate;
+import org.jboss.test.selenium.css.CssProperty;
+import org.jboss.test.selenium.framework.AjaxSelenium;
+import org.jboss.test.selenium.locator.Attribute;
+import org.jboss.test.selenium.locator.ElementLocator;
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.jboss.test.selenium.locator.option.OptionLabelLocator;
+
+/**
+ * Checker for icon attributes (e.g. rich:accordion, rich:panelMenu)
+ *
+ * @author <a href="mailto:jpapouse@redhat.com">Jan Papousek</a>
+ */
+public class IconsChecker {
+
+ private String iconPrefix;
+ private String iconSuffix;
+ private AjaxSelenium selenium;
+
+ /**
+ * Create a new instance of icons checker
+ *
+ * @param selenium instance of ajax selenium
+ * @param iconPrefix prefix used for icon elements
+ * @param iconSuffix suffix used for icon elements
+ */
+ public IconsChecker(AjaxSelenium selenium, String iconPrefix, String iconSuffix) {
+ Validate.notNull(iconPrefix);
+ Validate.notNull(iconSuffix);
+ Validate.notNull(selenium);
+ this.iconPrefix = iconPrefix;
+ this.iconSuffix = iconSuffix;
+ this.selenium = selenium;
+ }
+
+ /**
+ * Checks whether icons controlled by CSS work properly (only icons which produce an image)
+ *
+ * @param attributeInput
+ * @param icon
+ * @param classSuffix
+ */
+ public void checkCssImageIcons(ElementLocator<JQueryLocator> attributeInput, ElementLocator<JQueryLocator> icon, String classSuffix) {
+ String imageNameSuffix = "";
+ if (classSuffix.contains("dis")) {
+ imageNameSuffix = "Disabled";
+ }
+ // option -> css class
+ Map<String, String> cssImageIcons = new HashMap<String, String>();
+ cssImageIcons.put("chevron", "chevron");
+ cssImageIcons.put("chevronDown", "chevron-down");
+ cssImageIcons.put("chevronUp", "chevron-up");
+ cssImageIcons.put("disc", "disc");
+ cssImageIcons.put("grid", "grid");
+ cssImageIcons.put("triangle", "triangle");
+ cssImageIcons.put("triangleDown", "triangle-down");
+ cssImageIcons.put("triangleUp", "triangle-up");
+ for(String cssIcon : cssImageIcons.keySet()) {
+ if (!selectOptionSilently(attributeInput, cssIcon)) {
+ continue;
+ }
+ assertTrue(selenium.belongsClass(icon, iconPrefix + cssImageIcons.get(cssIcon) + iconSuffix + classSuffix),
+ "Div should have set class " + iconPrefix + cssImageIcons.get(cssIcon) + iconSuffix + classSuffix + ".");
+ assertTrue(
+ selenium.getStyle(icon, CssProperty.BACKGROUND_IMAGE).contains(cssIcon + imageNameSuffix),
+ "Icon should contain a " + cssIcon + ".");
+ }
+ }
+
+ /**
+ * Checks whether icons controlled by CSS work properly (only icons which don't produce any image)
+ *
+ * @param attributeInput
+ * @param icon
+ * @param classSuffix
+ */
+ public void checkCssNoImageIcons(ElementLocator<JQueryLocator> attributeInput, ElementLocator<JQueryLocator> icon, String classSuffix) {
+ String[] cssNoImageIcons = new String[] { "transparent" };
+ for(String cssIcon : cssNoImageIcons) {
+ if (!selectOptionSilently(attributeInput, cssIcon)) {
+ continue;
+ }
+ assertTrue(selenium.belongsClass(icon, iconPrefix + cssIcon + iconSuffix + classSuffix),
+ "Div should have set class " + iconPrefix + cssIcon + iconSuffix + classSuffix +".");
+ assertTrue(selenium.getStyle(icon, CssProperty.BACKGROUND_IMAGE).equals("none"),
+ "Icon should not contain any image.");
+ }
+ }
+
+ /**
+ * Checks whether icon with custom URL works properly
+ *
+ * @param attributeInput
+ * @param icon
+ * @param image
+ * @param classSuffix
+ */
+ public void checkImageIcons(ElementLocator<JQueryLocator> attributeInput, ElementLocator<JQueryLocator> icon, ElementLocator<JQueryLocator> image, String classSuffix) {
+ checkImageIcons(attributeInput, icon, image, classSuffix, true);
+ }
+
+ /**
+ * Checks whether icon with custom URL works properly
+ *
+ * @param attributeInput
+ * @param icon
+ * @param image
+ * @param classSuffix
+ * @param disableIcon set to TRUE if the presence of image element causes that icon element shouldn't be present
+ */
+ public void checkImageIcons(ElementLocator<JQueryLocator> attributeInput, ElementLocator<JQueryLocator> icon, ElementLocator<JQueryLocator> image, String classSuffix, boolean disableIcon) {
+ // option -> image
+ Map<String, String> imageIcons = new HashMap<String, String>();
+ imageIcons.put("nonexisting", "nonexisting");
+ imageIcons.put("star", "star.png");
+ for(String imageIcon : imageIcons.keySet()) {
+ if (!selectOptionSilently(attributeInput, imageIcon)) {
+ continue;
+ }
+ if (disableIcon) {
+ assertFalse(selenium.isElementPresent(icon), "Icon's div (" + icon.getRawLocator() + ") should not be present when icon=" + imageIcon + ".");
+ }
+ assertTrue(selenium.isElementPresent(image), "Icon's image should be rendered (" + image.getRawLocator() + ") when icon=" + imageIcon + ".");
+ assertTrue(selenium.getAttribute(image.getAttribute(Attribute.SRC)).contains(imageIcons.get(imageIcon)),
+ "Icon's src attribute (" + image.getRawLocator() + ") should contain " + imageIcons.get(imageIcon) + " when icon=" + imageIcon + ".");
+ }
+ }
+
+ public void checkNone(ElementLocator<JQueryLocator> attributeInput, ElementLocator<JQueryLocator> icon, String classSuffix) {
+ if (!selectOptionSilently(attributeInput, "none")) {
+ return;
+ }
+ assertFalse(selenium.isElementPresent(icon), "Icon should not be present when icon=none.");
+ }
+
+ public String getIconPrefix() {
+ return iconPrefix;
+ }
+
+ public String getIconSuffix() {
+ return iconSuffix;
+ }
+
+ private boolean selectOptionSilently(ElementLocator<?> selectLocator, String label) {
+ OptionLabelLocator optionLocator = optionLabel(label);
+ try {
+ selenium.select(selectLocator, optionLocator);
+ selenium.waitForPageToLoad();
+ return true;
+ } catch(RuntimeException e) {
+ // silent
+ return false;
+ }
+ }
+}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAccordion/TestRichAccordion.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAccordion/TestRichAccordion.java 2011-09-19 17:04:58 UTC (rev 22726)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAccordion/TestRichAccordion.java 2011-09-19 17:09:40 UTC (rev 22727)
@@ -32,6 +32,8 @@
import static org.testng.Assert.assertTrue;
import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
import javax.faces.event.PhaseId;
@@ -45,6 +47,7 @@
import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
import org.richfaces.tests.metamer.ftest.annotations.IssueTracking;
import org.richfaces.tests.metamer.ftest.annotations.RegressionTest;
+import org.richfaces.tests.metamer.ftest.checker.IconsChecker;
import org.testng.annotations.Test;
/**
@@ -181,7 +184,6 @@
}
@Test
- @RegressionTest("https://issues.jboss.org/browse/RF-10054")
public void testImmediate() {
selenium.click(pjq("input[type=radio][name$=immediateInput][value=true]"));
selenium.waitForPageToLoad();
@@ -207,7 +209,7 @@
}
@Test
- @IssueTracking("https://issues.jboss.org/browse/RF-10352")
+ @RegressionTest("https://issues.jboss.org/browse/RF-10352")
public void testItemActiveLeftIcon() {
JQueryLocator icon = leftIcon.format(1).getDescendant(jq("div.rf-ac-itm-ico-act"));
JQueryLocator input = pjq("select[id$=itemActiveLeftIconInput]");
@@ -219,7 +221,7 @@
+ " should not be present on the page.");
}
- verifyStandardIcons(input, icon, image, "-hdr");
+ verifyStandardIcons(input, icon, image, "");
}
@Test
@@ -234,7 +236,7 @@
+ " should not be present on the page.");
}
- verifyStandardIcons(input, icon, image, "-hdr");
+ verifyStandardIcons(input, icon, image, "");
}
@Test
@@ -253,7 +255,7 @@
JQueryLocator input = pjq("select[id$=itemDisabledLeftIconInput]");
JQueryLocator image = leftIcon.format(4).getChild(jq("img"));
- verifyStandardIcons(input, icon, image, "-hdr-dis");
+ verifyStandardIcons(input, icon, image, "-dis");
}
@Test
@@ -262,7 +264,7 @@
JQueryLocator input = pjq("select[id$=itemDisabledRightIconInput]");
JQueryLocator image = rightIcon.format(4).getChild(jq("img"));
- verifyStandardIcons(input, icon, image, "-hdr-dis");
+ verifyStandardIcons(input, icon, image, "-dis");
}
@Test
@@ -282,7 +284,7 @@
JQueryLocator input = pjq("select[id$=itemInactiveLeftIconInput]");
JQueryLocator image = leftIcon.format(3).getChild(jq("img"));
- verifyStandardIcons(input, icon, image, "-hdr");
+ verifyStandardIcons(input, icon, image, "");
}
@Test
@@ -291,7 +293,7 @@
JQueryLocator input = pjq("select[id$=itemInactiveRightIconInput]");
JQueryLocator image = rightIcon.format(3).getChild(jq("img"));
- verifyStandardIcons(input, icon, image, "-hdr");
+ verifyStandardIcons(input, icon, image, "");
}
@Test
@@ -459,87 +461,10 @@
}
private void verifyStandardIcons(JQueryLocator input, JQueryLocator icon, JQueryLocator image, String classSuffix) {
- String imageNameSuffix = "";
- if (classSuffix.contains("dis")) {
- imageNameSuffix = "Disabled";
- }
-
- selenium.select(input, optionLabel("chevron"));
- selenium.waitForPageToLoad();
- assertTrue(selenium.belongsClass(icon, "rf-ico-chevron" + classSuffix),
- "Div should have set class rf-ico-chevron" + classSuffix + ".");
- assertTrue(
- selenium.getStyle(icon, CssProperty.BACKGROUND_IMAGE).contains("chevron" + imageNameSuffix + ".png"),
- "Icon should contain a chevron.");
-
- selenium.select(input, optionLabel("chevronDown"));
- selenium.waitForPageToLoad();
- assertTrue(selenium.belongsClass(icon, "rf-ico-chevron-down" + classSuffix),
- "Div should have set class rf-ico-chevron-down" + classSuffix + ".");
- assertTrue(
- selenium.getStyle(icon, CssProperty.BACKGROUND_IMAGE).contains("chevronDown" + imageNameSuffix + ".png"),
- "Icon should contain a chevron down.");
-
- selenium.select(input, optionLabel("chevronUp"));
- selenium.waitForPageToLoad();
- assertTrue(selenium.belongsClass(icon, "rf-ico-chevron-up" + classSuffix),
- "Div should have set class rf-ico-chevron-up" + classSuffix + ".");
- assertTrue(
- selenium.getStyle(icon, CssProperty.BACKGROUND_IMAGE).contains("chevronUp" + imageNameSuffix + ".png"),
- "Icon should contain a chevron up.");
-
- selenium.select(input, optionLabel("disc"));
- selenium.waitForPageToLoad();
- assertTrue(selenium.belongsClass(icon, "rf-ico-disc" + classSuffix), "Div should have set class rf-ico-disc"
- + classSuffix + ".");
- assertTrue(selenium.getStyle(icon, CssProperty.BACKGROUND_IMAGE).contains("disc" + imageNameSuffix + ".png"),
- "Icon should contain a disc.");
-
- selenium.select(input, optionLabel("grid"));
- selenium.waitForPageToLoad();
- assertTrue(selenium.belongsClass(icon, "rf-ico-grid" + classSuffix), "Div should have set class rf-ico-grid"
- + classSuffix + ".");
- assertTrue(selenium.getStyle(icon, CssProperty.BACKGROUND_IMAGE).contains("grid" + imageNameSuffix + ".png"),
- "Icon should contain a grid.");
-
- selenium.select(input, optionLabel("triangle"));
- selenium.waitForPageToLoad();
- assertTrue(selenium.belongsClass(icon, "rf-ico-triangle" + classSuffix),
- "Div should have set class rf-ico-triangle" + classSuffix + ".");
- assertTrue(selenium.getStyle(icon, CssProperty.BACKGROUND_IMAGE).contains("triangle" + imageNameSuffix + ".png"), "Icon should contain a triangle.");
-
- selenium.select(input, optionLabel("triangleDown"));
- selenium.waitForPageToLoad();
- assertTrue(selenium.belongsClass(icon, "rf-ico-triangle-down" + classSuffix),
- "Div should have set class rf-ico-triangle-down" + classSuffix + ".");
- assertTrue(
- selenium.getStyle(icon, CssProperty.BACKGROUND_IMAGE).contains("triangleDown" + imageNameSuffix + ".png"),
- "Icon should contain a triangle down.");
-
- selenium.select(input, optionLabel("triangleUp"));
- selenium.waitForPageToLoad();
- assertTrue(selenium.belongsClass(icon, "rf-ico-triangle-up" + classSuffix),
- "Div should have set class rf-ico-triangle-up" + classSuffix + ".");
- assertTrue(
- selenium.getStyle(icon, CssProperty.BACKGROUND_IMAGE).contains("triangleUp" + imageNameSuffix + ".png"),
- "Icon should contain a triangle up.");
-
- selenium.select(input, optionLabel("none"));
- selenium.waitForPageToLoad();
- assertFalse(selenium.isElementPresent(icon), "Icon should not be present when icon=none.");
-
- selenium.select(input, optionLabel("star"));
- selenium.waitForPageToLoad();
- assertFalse(selenium.isElementPresent(icon), "Icon's div should not be present when icon=star.");
- assertTrue(selenium.isElementPresent(image), "Icon's image should be rendered.");
- assertTrue(selenium.getAttribute(image.getAttribute(Attribute.SRC)).contains("star.png"),
- "Icon's src attribute should contain star.png.");
-
- selenium.select(input, optionLabel("nonexisting"));
- selenium.waitForPageToLoad();
- assertFalse(selenium.isElementPresent(icon), "Icon's div should not be present when icon=nonexisting.");
- assertTrue(selenium.isElementPresent(image), "Icon's image should be rendered.");
- assertTrue(selenium.getAttribute(image.getAttribute(Attribute.SRC)).contains("nonexisting"),
- "Icon's src attribute should contain nonexisting.");
+ IconsChecker checker = new IconsChecker(selenium, "rf-ico-", "-hdr");
+ checker.checkCssImageIcons(input, icon, classSuffix);
+ checker.checkCssNoImageIcons(input, icon, classSuffix);
+ checker.checkImageIcons(input, icon, image, classSuffix);
+ checker.checkNone(input, icon, classSuffix);
}
}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAccordionItem/TestRichAccordionItem.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAccordionItem/TestRichAccordionItem.java 2011-09-19 17:04:58 UTC (rev 22726)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAccordionItem/TestRichAccordionItem.java 2011-09-19 17:09:40 UTC (rev 22727)
@@ -32,6 +32,9 @@
import static org.testng.Assert.assertTrue;
import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
import org.jboss.test.selenium.css.CssProperty;
import org.jboss.test.selenium.dom.Event;
@@ -40,6 +43,8 @@
import org.jboss.test.selenium.locator.JQueryLocator;
import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
import org.richfaces.tests.metamer.ftest.annotations.IssueTracking;
+import org.richfaces.tests.metamer.ftest.annotations.RegressionTest;
+import org.richfaces.tests.metamer.ftest.checker.IconsChecker;
import org.testng.annotations.Test;
/**
@@ -164,7 +169,7 @@
}
@Test
- @IssueTracking("https://issues.jboss.org/browse/RF-10488")
+ @RegressionTest("https://issues.jboss.org/browse/RF-10488")
public void testLeftActiveIcon() {
JQueryLocator icon = leftIcon.format(1).getDescendant(jq("div.rf-ac-itm-ico-act"));
JQueryLocator input = pjq("select[id$=leftActiveIconInput]");
@@ -213,7 +218,7 @@
}
@Test
- @IssueTracking("https://issues.jboss.org/browse/RF-10488")
+ @RegressionTest("https://issues.jboss.org/browse/RF-10488")
public void testName() {
selenium.type(pjq("input[id$=nameInput]"), "new name");
selenium.waitForPageToLoad();
@@ -233,7 +238,6 @@
}
@Test
- @IssueTracking("https://issues.jboss.org/browse/RF-9821 https://issues.jboss.org/browse/RF-10488")
public void testOnenter() {
testFireEvent(Event.CLICK, itemHeaders[0], "enter");
}
@@ -264,7 +268,7 @@
}
@Test
- @IssueTracking("https://issues.jboss.org/browse/RF-9821 https://issues.jboss.org/browse/RF-10488")
+ @RegressionTest("https://issues.jboss.org/browse/RF-9821 https://issues.jboss.org/browse/RF-10488")
public void testOnleave() {
selenium.type(pjq("input[type=text][id$=onleaveInput]"), "metamerEvents += \"leave \"");
selenium.waitForPageToLoad();
@@ -317,7 +321,6 @@
}
@Test
- @IssueTracking("https://issues.jboss.org/browse/RF-10488")
public void testRightActiveIcon() {
JQueryLocator icon = rightIcon.format(1).getDescendant(jq("div.rf-ac-itm-ico-act"));
JQueryLocator input = pjq("select[id$=rightActiveIconInput]");
@@ -376,7 +379,6 @@
}
@Test
- @IssueTracking("https://issues.jboss.org/browse/RF-10488")
public void testSwitchTypeNull() {
guardXhr(selenium).click(itemHeaders[0]);
waitGui.failWith("Item 1 is not displayed.").until(isDisplayed.locator(itemContents[0]));
@@ -414,69 +416,10 @@
}
private void verifyStandardIcons(JQueryLocator input, JQueryLocator icon, JQueryLocator image, String classSuffix) {
- String imageNameSuffix = "";
- if (classSuffix.contains("dis")) {
- imageNameSuffix = "Disabled";
- }
-
- selenium.select(input, optionLabel("chevron"));
- selenium.waitForPageToLoad();
- assertTrue(selenium.belongsClass(icon, "rf-ico-chevron-hdr" + classSuffix), "Div should have set class rf-ico-chevron" + classSuffix + ".");
- assertTrue(selenium.getStyle(icon, CssProperty.BACKGROUND_IMAGE).contains("chevron" + imageNameSuffix + ".png"), "Icon should contain a chevron.");
-
- selenium.select(input, optionLabel("chevronDown"));
- selenium.waitForPageToLoad();
- assertTrue(selenium.belongsClass(icon, "rf-ico-chevron-down-hdr" + classSuffix), "Div should have set class rf-ico-chevron-down" + classSuffix + ".");
- assertTrue(selenium.getStyle(icon, CssProperty.BACKGROUND_IMAGE).contains("chevronDown" + imageNameSuffix + ".png"), "Icon should contain a chevron down.");
-
- selenium.select(input, optionLabel("chevronUp"));
- selenium.waitForPageToLoad();
- assertTrue(selenium.belongsClass(icon, "rf-ico-chevron-up-hdr" + classSuffix), "Div should have set class rf-ico-chevron-up" + classSuffix + ".");
- assertTrue(selenium.getStyle(icon, CssProperty.BACKGROUND_IMAGE).contains("chevronUp" + imageNameSuffix + ".png"), "Icon should contain a chevron up.");
-
- selenium.select(input, optionLabel("disc"));
- selenium.waitForPageToLoad();
- assertTrue(selenium.belongsClass(icon, "rf-ico-disc-hdr" + classSuffix), "Div should have set class rf-ico-disc" + classSuffix + ".");
- assertTrue(selenium.getStyle(icon, CssProperty.BACKGROUND_IMAGE).contains("disc" + imageNameSuffix + ".png"), "Icon should contain a disc.");
-
- for (int i = 2; i < 6; i++) {
- assertFalse(selenium.isElementPresent(leftIcon.format(i)), "Left icon of item" + i + " should not be present on the page.");
- }
-
- selenium.select(input, optionLabel("grid"));
- selenium.waitForPageToLoad();
- assertTrue(selenium.belongsClass(icon, "rf-ico-grid-hdr" + classSuffix), "Div should have set class rf-ico-grid" + classSuffix + ".");
- assertTrue(selenium.getStyle(icon, CssProperty.BACKGROUND_IMAGE).contains("grid" + imageNameSuffix + ".png"), "Icon should contain a grid.");
-
- selenium.select(input, optionLabel("triangle"));
- selenium.waitForPageToLoad();
- assertTrue(selenium.belongsClass(icon, "rf-ico-triangle-hdr" + classSuffix), "Div should have set class rf-ico-triangle" + classSuffix + ".");
- assertTrue(selenium.getStyle(icon, CssProperty.BACKGROUND_IMAGE).contains("triangle" + imageNameSuffix + ".png"), "Icon should contain a triangle.");
-
- selenium.select(input, optionLabel("triangleDown"));
- selenium.waitForPageToLoad();
- assertTrue(selenium.belongsClass(icon, "rf-ico-triangle-down-hdr" + classSuffix), "Div should have set class rf-ico-triangle-down" + classSuffix + ".");
- assertTrue(selenium.getStyle(icon, CssProperty.BACKGROUND_IMAGE).contains("triangleDown" + imageNameSuffix + ".png"), "Icon should contain a triangle down.");
-
- selenium.select(input, optionLabel("triangleUp"));
- selenium.waitForPageToLoad();
- assertTrue(selenium.belongsClass(icon, "rf-ico-triangle-up-hdr" + classSuffix), "Div should have set class rf-ico-triangle-up" + classSuffix + ".");
- assertTrue(selenium.getStyle(icon, CssProperty.BACKGROUND_IMAGE).contains("triangleUp" + imageNameSuffix + ".png"), "Icon should contain a triangle up.");
-
- selenium.select(input, optionLabel("none"));
- selenium.waitForPageToLoad();
- assertFalse(selenium.isElementPresent(icon), "Icon should not be present when icon=none.");
-
- selenium.select(input, optionLabel("star"));
- selenium.waitForPageToLoad();
- assertFalse(selenium.isElementPresent(icon), "Icon's div should not be present when icon=star.");
- assertTrue(selenium.isElementPresent(image), "Icon's image should be rendered.");
- assertTrue(selenium.getAttribute(image.getAttribute(Attribute.SRC)).contains("star.png"), "Icon's src attribute should contain star.png.");
-
- selenium.select(input, optionLabel("nonexisting"));
- selenium.waitForPageToLoad();
- assertFalse(selenium.isElementPresent(icon), "Icon's div should not be present when icon=nonexisting.");
- assertTrue(selenium.isElementPresent(image), "Icon's image should be rendered.");
- assertTrue(selenium.getAttribute(image.getAttribute(Attribute.SRC)).contains("nonexisting"), "Icon's src attribute should contain nonexisting.");
+ IconsChecker checker = new IconsChecker(selenium, "rf-ico-", "-hdr");
+ checker.checkCssImageIcons(input, icon, classSuffix);
+ checker.checkCssNoImageIcons(input, icon, classSuffix);
+ checker.checkImageIcons(input, icon, image, classSuffix);
+ checker.checkNone(input, icon, classSuffix);
}
}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPanelMenu/TestPanelMenuIcon.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPanelMenu/TestPanelMenuIcon.java 2011-09-19 17:04:58 UTC (rev 22726)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPanelMenu/TestPanelMenuIcon.java 2011-09-19 17:09:40 UTC (rev 22727)
@@ -21,10 +21,11 @@
*******************************************************************************/
package org.richfaces.tests.metamer.ftest.richPanelMenu;
-import static org.testng.Assert.assertTrue;
-
-import org.richfaces.tests.metamer.ftest.model.PanelMenu.Icon;
+import org.jboss.test.selenium.locator.ElementLocator;
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.richfaces.tests.metamer.ftest.checker.IconsChecker;
import org.testng.annotations.Test;
+import static org.jboss.test.selenium.locator.LocatorFactory.jq;
/**
* @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
@@ -32,146 +33,185 @@
*/
public class TestPanelMenuIcon extends AbstractPanelMenuTest {
- private static String customURL = "/resources/images/loading.gif";
-
@Test
public void testGroupCollapsedLeftIcon() {
- attributes.setGroupCollapsedLeftIcon(customURL);
- group2.toggle();
- verifyIcon(group24.getLeftIcon());
+ group2.toggle();
+ JQueryLocator input = pjq("select[id$=groupCollapsedLeftIcon]");
+ ElementLocator<JQueryLocator> icon = group24.getLeftIcon().getIcon();
+ ElementLocator<JQueryLocator> image = jq(group24.getLeftIcon().getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
}
@Test
public void testGroupCollapsedRightIcon() {
- attributes.setGroupCollapsedRightIcon(customURL);
- group2.toggle();
- verifyIcon(group24.getRightIcon());
+ group2.toggle();
+ JQueryLocator input = pjq("select[id$=groupCollapsedRightIcon]");
+ ElementLocator<JQueryLocator> icon = group24.getRightIcon().getIcon();
+ ElementLocator<JQueryLocator> image = jq(group24.getRightIcon().getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
}
@Test
public void testGroupDisabledLeftIcon() {
- attributes.setGroupDisabledLeftIcon(customURL);
- group2.toggle();
- assertTrue(group26.getLeftIcon().isCustomURL());
- assertTrue(group26.getLeftIcon().getCustomURL().endsWith(customURL));
- verifyIcon(group26.getLeftIcon());
+ group2.toggle();
+ JQueryLocator input = pjq("select[id$=groupDisabledLeftIcon]");
+ ElementLocator<JQueryLocator> icon = group26.getRightIcon().getIcon();
+ ElementLocator<JQueryLocator> image = jq(group26.getRightIcon().getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
}
@Test
public void testDisabledRightIcon() {
- attributes.setGroupDisabledRightIcon(customURL);
- group2.toggle();
- verifyIcon(group26.getRightIcon());
+ group2.toggle();
+ JQueryLocator input = pjq("select[id$=disabledRightIcon]");
+ ElementLocator<JQueryLocator> icon = group26.getRightIcon().getIcon();
+ ElementLocator<JQueryLocator> image = jq(group26.getRightIcon().getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
}
@Test
public void testGroupExpandedLeftIcon() {
- attributes.setGroupExpandedLeftIcon(customURL);
group2.toggle();
- group24.toggle();
- verifyIcon(group24.getLeftIcon());
+ group24.toggle();
+ JQueryLocator input = pjq("select[id$=groupExpandedLeftIcon]");
+ ElementLocator<JQueryLocator> icon = group24.getLeftIcon().getIcon();
+ ElementLocator<JQueryLocator> image = jq(group24.getLeftIcon().getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
}
@Test
public void testGroupExpandedRightIcon() {
- attributes.setGroupExpandedRightIcon(customURL);
group2.toggle();
- group24.toggle();
- verifyIcon(group24.getRightIcon());
+ group24.toggle();
+ JQueryLocator input = pjq("select[id$=groupExpandedRightIcon]");
+ ElementLocator<JQueryLocator> icon = group24.getRightIcon().getIcon();
+ ElementLocator<JQueryLocator> image = jq(group24.getRightIcon().getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
}
@Test
public void testItemDisabledLeftIcon() {
- attributes.setItemDisabledLeftIcon(customURL);
group2.toggle();
- verifyIcon(item25.getLeftIcon());
+ JQueryLocator input = pjq("select[id$=itemDisabledLeftIcon]");
+ ElementLocator<JQueryLocator> icon = item25.getLeftIcon().getIcon();
+ ElementLocator<JQueryLocator> image = jq(item25.getLeftIcon().getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
}
@Test
public void testItemDisabledRightIcon() {
- attributes.setItemDisabledRightIcon(customURL);
group2.toggle();
- verifyIcon(item25.getRightIcon());
+ JQueryLocator input = pjq("select[id$=itemDisabledRightIcon]");
+ ElementLocator<JQueryLocator> icon = item25.getRightIcon().getIcon();
+ ElementLocator<JQueryLocator> image = jq(item25.getRightIcon().getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
}
@Test
public void testItemLeftIcon() {
- attributes.setItemLeftIcon(customURL);
group2.toggle();
- verifyIcon(item22.getLeftIcon());
+ JQueryLocator input = pjq("select[id$=itemLeftIcon]");
+ ElementLocator<JQueryLocator> icon = item22.getLeftIcon().getIcon();
+ ElementLocator<JQueryLocator> image = jq(item22.getLeftIcon().getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
}
@Test
public void testItemRightIcon() {
- attributes.setItemRightIcon(customURL);
group2.toggle();
- verifyIcon(item22.getRightIcon());
+ JQueryLocator input = pjq("select[id$=itemRightIcon]");
+ ElementLocator<JQueryLocator> icon = item22.getRightIcon().getIcon();
+ ElementLocator<JQueryLocator> image = jq(item22.getRightIcon().getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
}
@Test
public void testTopGroupCollapsedLeftIcon() {
- attributes.setTopGroupCollapsedLeftIcon(customURL);
- verifyIcon(group1.getLeftIcon());
+ JQueryLocator input = pjq("select[id$=topGroupCollapsedLeftIcon]");
+ ElementLocator<JQueryLocator> icon = group1.getLeftIcon().getIcon();
+ ElementLocator<JQueryLocator> image = jq(group1.getLeftIcon().getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
}
@Test
public void testTopGroupCollapsedRightIcon() {
- attributes.setTopGroupCollapsedRightIcon(customURL);
- verifyIcon(group1.getRightIcon());
+ JQueryLocator input = pjq("select[id$=topGroupCollapsedRightIcon]");
+ ElementLocator<JQueryLocator> icon = group1.getRightIcon().getIcon();
+ ElementLocator<JQueryLocator> image = jq(group1.getRightIcon().getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
}
@Test
public void testTopGroupDisabledLeftIcon() {
- attributes.setTopGroupDisabledLeftIcon(customURL);
- verifyIcon(group4.getLeftIcon());
+ JQueryLocator input = pjq("select[id$=topGroupDisabledLeftIcon]");
+ ElementLocator<JQueryLocator> icon = group4.getLeftIcon().getIcon();
+ ElementLocator<JQueryLocator> image = jq(group4.getLeftIcon().getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
}
@Test
public void testTopGroupDisabledRightIcon() {
- attributes.setTopGroupDisabledRightIcon(customURL);
- verifyIcon(group4.getRightIcon());
+ JQueryLocator input = pjq("select[id$=topGroupDisabledRightIcon]");
+ ElementLocator<JQueryLocator> icon = group4.getRightIcon().getIcon();
+ ElementLocator<JQueryLocator> image = jq(group4.getRightIcon().getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
}
@Test
public void testTopGroupExpandedLeftIcon() {
- attributes.setTopGroupExpandedLeftIcon(customURL);
group1.toggle();
- verifyIcon(group1.getLeftIcon());
+ JQueryLocator input = pjq("select[id$=topGroupExpandedLeftIcon]");
+ ElementLocator<JQueryLocator> icon = group1.getLeftIcon().getIcon();
+ ElementLocator<JQueryLocator> image = jq(group1.getLeftIcon().getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
}
@Test
public void testTopGroupExpandedRightIcon() {
- attributes.setTopGroupExpandedRightIcon(customURL);
group1.toggle();
- verifyIcon(group1.getRightIcon());
+ JQueryLocator input = pjq("select[id$=topGroupExpandedRightIcon]");
+ ElementLocator<JQueryLocator> icon = group1.getRightIcon().getIcon();
+ ElementLocator<JQueryLocator> image = jq(group1.getRightIcon().getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
}
@Test
public void testTopItemDisabledLeftIcon() {
- attributes.setTopItemDisabledLeftIcon(customURL);
- verifyIcon(item4.getLeftIcon());
+ JQueryLocator input = pjq("select[id$=topItemDisabledLeftIcon]");
+ ElementLocator<JQueryLocator> icon = item4.getLeftIcon().getIcon();
+ ElementLocator<JQueryLocator> image = jq(item4.getLeftIcon().getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
}
@Test
public void testTopItemDisabledRightIcon() {
- attributes.setTopItemDisabledRightIcon(customURL);
- verifyIcon(item4.getRightIcon());
+ JQueryLocator input = pjq("select[id$=topItemDisabledRightIcon]");
+ ElementLocator<JQueryLocator> icon = item4.getRightIcon().getIcon();
+ ElementLocator<JQueryLocator> image = jq(item4.getRightIcon().getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
}
@Test
public void testTopItemLeftIcon() {
- attributes.setTopItemLeftIcon(customURL);
- verifyIcon(item3.getLeftIcon());
+ JQueryLocator input = pjq("select[id$=topItemLefttIconInput]");
+ ElementLocator<JQueryLocator> icon = item3.getLeftIcon().getIcon();
+ ElementLocator<JQueryLocator> image = jq(item3.getLeftIcon().getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
}
@Test
public void testTopItemRightIcon() {
- attributes.setTopItemRightIcon(customURL);
- verifyIcon(item3.getRightIcon());
+ JQueryLocator input = pjq("select[id$=topItemRightIconInput]");
+ ElementLocator<JQueryLocator> icon = item3.getRightIcon().getIcon();
+ ElementLocator<JQueryLocator> image = jq(item3.getRightIcon().getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
}
- private void verifyIcon(Icon icon) {
- assertTrue(icon.isCustomURL());
- assertTrue(icon.getCustomURL().endsWith(customURL));
+ private void verifyStandardIcons(ElementLocator<JQueryLocator> input, ElementLocator<JQueryLocator> icon, ElementLocator<JQueryLocator> image, String classSuffix) {
+ IconsChecker checker = new IconsChecker(selenium, "rf-ico-", "");
+ checker.checkCssImageIcons(input, icon, classSuffix);
+ checker.checkCssNoImageIcons(input, icon, classSuffix);
+ checker.checkImageIcons(input, icon, image, classSuffix, false);
+ checker.checkNone(input, icon, classSuffix);
}
}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPanelMenuGroup/TestPanelMenuGroupSimple.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPanelMenuGroup/TestPanelMenuGroupSimple.java 2011-09-19 17:04:58 UTC (rev 22726)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPanelMenuGroup/TestPanelMenuGroupSimple.java 2011-09-19 17:09:40 UTC (rev 22727)
@@ -1,13 +1,17 @@
package org.richfaces.tests.metamer.ftest.richPanelMenuGroup;
+import static org.jboss.test.selenium.locator.LocatorFactory.jq;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
import org.jboss.test.selenium.GuardRequest;
+import org.jboss.test.selenium.locator.ElementLocator;
+import org.jboss.test.selenium.locator.JQueryLocator;
import org.jboss.test.selenium.request.RequestType;
import org.richfaces.PanelMenuMode;
-import org.richfaces.tests.metamer.ftest.annotations.IssueTracking;
+import org.richfaces.tests.metamer.ftest.annotations.RegressionTest;
+import org.richfaces.tests.metamer.ftest.checker.IconsChecker;
import org.testng.annotations.Test;
/**
@@ -60,39 +64,34 @@
@Test
public void testLeftDisabledIcon() {
- attributes.setLeftDisabledIcon(sampleImage);
-
- assertTrue(leftIcon.isTransparent());
- assertFalse(leftIcon.isCustomURL());
-
attributes.setDisabled(true);
-
- assertTrue(leftIcon.isCustomURL());
- assertTrue(leftIcon.getCustomURL().endsWith(sampleImage));
+ JQueryLocator input = pjq("select[id$=lefttDisabledIcon]");
+ ElementLocator<JQueryLocator> icon = leftIcon.getIcon();
+ ElementLocator<JQueryLocator> image = jq(leftIcon.getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
}
@Test
public void testLeftCollapsedIcon() {
- attributes.setLeftCollapsedIcon(chevronDown);
-
topGroup.toggle();
+ JQueryLocator input = pjq("select[id$=leftCollapsedIcon]");
+ ElementLocator<JQueryLocator> icon = leftIcon.getIcon();
+ ElementLocator<JQueryLocator> image = jq(leftIcon.getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
- assertTrue(leftIcon.containsClass(chevronDownClass));
-
attributes.setDisabled(true);
-
assertTrue(leftIcon.isTransparent());
}
@Test
public void testLeftExpandedIcon() {
- attributes.setLeftExpandedIcon(chevronDown);
+ JQueryLocator input = pjq("select[id$=leftExpandedIcon]");
+ ElementLocator<JQueryLocator> icon = leftIcon.getIcon();
+ ElementLocator<JQueryLocator> image = jq(leftIcon.getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
- assertTrue(leftIcon.containsClass(chevronDownClass));
-
attributes.setDisabled(true);
-
- assertTrue(leftIcon.isTransparent());
+ assertTrue(rightIcon.isTransparent());
}
@Test
@@ -118,38 +117,33 @@
@Test
public void testRightDisabledIcon() {
- attributes.setRightDisabledIcon(sampleImage);
-
- assertTrue(rightIcon.isTransparent());
- assertFalse(rightIcon.isCustomURL());
-
attributes.setDisabled(true);
-
- assertTrue(rightIcon.isCustomURL());
- assertTrue(rightIcon.getCustomURL().endsWith(sampleImage));
+ JQueryLocator input = pjq("select[id$=rightDisabledIcon]");
+ ElementLocator<JQueryLocator> icon = rightIcon.getIcon();
+ ElementLocator<JQueryLocator> image = jq(rightIcon.getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
}
@Test
public void testRightExpandedIcon() {
- attributes.setRightExpandedIcon(chevronDown);
+ JQueryLocator input = pjq("select[id$=rightExpandedIcon]");
+ ElementLocator<JQueryLocator> icon = rightIcon.getIcon();
+ ElementLocator<JQueryLocator> image = jq(rightIcon.getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
- assertTrue(rightIcon.containsClass(chevronDownClass));
-
attributes.setDisabled(true);
-
assertTrue(rightIcon.isTransparent());
}
@Test
public void testRightCollapsedIcon() {
- attributes.setRightCollapsedIcon(chevronDown);
-
topGroup.toggle();
-
- assertTrue(rightIcon.containsClass(chevronDownClass));
-
+ JQueryLocator input = pjq("select[id$=rightCollapsedIcon]");
+ ElementLocator<JQueryLocator> icon = rightIcon.getIcon();
+ ElementLocator<JQueryLocator> image = jq(rightIcon.getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
+
attributes.setDisabled(true);
-
assertTrue(rightIcon.isTransparent());
}
@@ -176,13 +170,21 @@
}
@Test
- @IssueTracking("https://issues.jboss.org/browse/RF-10485")
public void testStyle() {
super.testStyle(topGroup, "style");
}
@Test
+ @RegressionTest("https://issues.jboss.org/browse/RF-10485")
public void testStyleClass() {
super.testStyleClass(topGroup, "styleClass");
}
+
+ private void verifyStandardIcons(ElementLocator<JQueryLocator> input, ElementLocator<JQueryLocator> icon, ElementLocator<JQueryLocator> image, String classSuffix) {
+ IconsChecker checker = new IconsChecker(selenium, "rf-ico-", "");
+ checker.checkCssImageIcons(input, icon, classSuffix);
+ checker.checkCssNoImageIcons(input, icon, classSuffix);
+ checker.checkImageIcons(input, icon, image, classSuffix, false);
+ checker.checkNone(input, icon, classSuffix);
+ }
}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPanelMenuItem/TestPanelMenuItemSimple.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPanelMenuItem/TestPanelMenuItemSimple.java 2011-09-19 17:04:58 UTC (rev 22726)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPanelMenuItem/TestPanelMenuItemSimple.java 2011-09-19 17:09:40 UTC (rev 22727)
@@ -1,5 +1,6 @@
package org.richfaces.tests.metamer.ftest.richPanelMenuItem;
+import static org.jboss.test.selenium.locator.LocatorFactory.jq;
import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
@@ -8,10 +9,14 @@
import java.net.URL;
import org.jboss.test.selenium.GuardRequest;
+import org.jboss.test.selenium.locator.ElementLocator;
+import org.jboss.test.selenium.locator.JQueryLocator;
import org.jboss.test.selenium.request.RequestType;
import org.richfaces.PanelMenuMode;
import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
import org.richfaces.tests.metamer.ftest.annotations.IssueTracking;
+import org.richfaces.tests.metamer.ftest.annotations.RegressionTest;
+import org.richfaces.tests.metamer.ftest.checker.IconsChecker;
import org.richfaces.tests.metamer.ftest.model.PanelMenu;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -83,25 +88,21 @@
@Test
public void testLeftDisabledIcon() {
- attributes.setLeftDisabledIcon(sampleImage);
-
- assertTrue(leftIcon.isTransparent());
- assertFalse(leftIcon.isCustomURL());
-
attributes.setDisabled(true);
-
- assertTrue(leftIcon.isCustomURL());
- assertTrue(leftIcon.getCustomURL().endsWith(sampleImage));
+ JQueryLocator input = pjq("select[id$=leftDisabledIcon]");
+ ElementLocator<JQueryLocator> icon = leftIcon.getIcon();
+ ElementLocator<JQueryLocator> image = jq(leftIcon.getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
}
@Test
public void testLeftIcon() {
- attributes.setLeftIcon(chevronDown);
+ JQueryLocator input = pjq("select[id$=leftIcon]");
+ ElementLocator<JQueryLocator> icon = leftIcon.getIcon();
+ ElementLocator<JQueryLocator> image = jq(leftIcon.getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
- assertTrue(leftIcon.containsClass(chevronDownClass));
-
attributes.setDisabled(true);
-
assertTrue(leftIcon.isTransparent());
}
@@ -133,31 +134,27 @@
@Test
public void testRightDisabledIcon() {
- attributes.setRightDisabledIcon(sampleImage);
-
- assertTrue(rightIcon.isTransparent());
- assertFalse(rightIcon.isCustomURL());
-
attributes.setDisabled(true);
-
- assertTrue(rightIcon.isCustomURL());
- assertTrue(rightIcon.getCustomURL().endsWith(sampleImage));
+ JQueryLocator input = pjq("select[id$=rightDisabledIcon]");
+ ElementLocator<JQueryLocator> icon = rightIcon.getIcon();
+ ElementLocator<JQueryLocator> image = jq(rightIcon.getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
}
@Test
- @IssueTracking("https://issues.jboss.org/browse/RF-10519")
+ @RegressionTest("https://issues.jboss.org/browse/RF-10519")
public void testRightIcon() {
- attributes.setRightIcon(chevronDown);
+ JQueryLocator input = pjq("select[id$=rightIcon]");
+ ElementLocator<JQueryLocator> icon = rightIcon.getIcon();
+ ElementLocator<JQueryLocator> image = jq(rightIcon.getIcon().getRawLocator()).getChild(jq("img"));
+ verifyStandardIcons(input, icon, image, "");
- assertTrue(rightIcon.containsClass(chevronDownClass));
-
attributes.setDisabled(true);
-
assertTrue(rightIcon.isTransparent());
}
@Test
- @IssueTracking("https://issues.jboss.org/browse/RF-10519")
+ @RegressionTest("https://issues.jboss.org/browse/RF-10519")
public void testRightIconClass() {
super.testStyleClass(rightIcon, "rightIconClass");
}
@@ -204,4 +201,12 @@
public void testStyleClass() {
super.testStyleClass(item, "styleClass");
}
+
+ private void verifyStandardIcons(ElementLocator<JQueryLocator> input, ElementLocator<JQueryLocator> icon, ElementLocator<JQueryLocator> image, String classSuffix) {
+ IconsChecker checker = new IconsChecker(selenium, "rf-ico-", "");
+ checker.checkCssImageIcons(input, icon, classSuffix);
+ checker.checkCssNoImageIcons(input, icon, classSuffix);
+ checker.checkImageIcons(input, icon, image, classSuffix, false);
+ checker.checkNone(input, icon, classSuffix);
+ }
}
13 years, 3 months
JBoss Rich Faces SVN: r22726 - modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/rich.
by richfaces-svn-commits@lists.jboss.org
Author: jpapouse
Date: 2011-09-19 13:04:58 -0400 (Mon, 19 Sep 2011)
New Revision: 22726
Modified:
modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/rich/RichAccordionBean.properties
modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/rich/RichAccordionItemBean.properties
modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/rich/RichPanelMenuBean.properties
modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/rich/RichPanelMenuGroupBean.properties
modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/rich/RichPanelMenuItemBean.properties
Log:
RFPL-1667: added transparent icon and unified custom icon url
Modified: modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/rich/RichAccordionBean.properties
===================================================================
--- modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/rich/RichAccordionBean.properties 2011-09-19 13:48:46 UTC (rev 22725)
+++ modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/rich/RichAccordionBean.properties 2011-09-19 17:04:58 UTC (rev 22726)
@@ -13,6 +13,7 @@
attr.itemActiveLeftIcon.chevron=chevron
attr.itemActiveLeftIcon.chevronUp=chevronUp
attr.itemActiveLeftIcon.chevronDown=chevronDown
+attr.itemActiveLeftIcon.transparent=transparent
attr.itemActiveLeftIcon.triangle=triangle
attr.itemActiveLeftIcon.triangleUp=triangleUp
attr.itemActiveLeftIcon.triangleDown=triangleDown
@@ -26,6 +27,7 @@
attr.itemDisabledLeftIcon.chevron=chevron
attr.itemDisabledLeftIcon.chevronUp=chevronUp
attr.itemDisabledLeftIcon.chevronDown=chevronDown
+attr.itemDisabledLeftIcon.transparent=transparent
attr.itemDisabledLeftIcon.triangle=triangle
attr.itemDisabledLeftIcon.triangleUp=triangleUp
attr.itemDisabledLeftIcon.triangleDown=triangleDown
@@ -39,6 +41,7 @@
attr.itemInactiveLeftIcon.chevron=chevron
attr.itemInactiveLeftIcon.chevronUp=chevronUp
attr.itemInactiveLeftIcon.chevronDown=chevronDown
+attr.itemInactiveLeftIcon.transparent=transparent
attr.itemInactiveLeftIcon.triangle=triangle
attr.itemInactiveLeftIcon.triangleUp=triangleUp
attr.itemInactiveLeftIcon.triangleDown=triangleDown
@@ -52,6 +55,7 @@
attr.itemActiveRightIcon.chevron=chevron
attr.itemActiveRightIcon.chevronUp=chevronUp
attr.itemActiveRightIcon.chevronDown=chevronDown
+attr.itemActiveRightIcon.transparent=transparent
attr.itemActiveRightIcon.triangle=triangle
attr.itemActiveRightIcon.triangleUp=triangleUp
attr.itemActiveRightIcon.triangleDown=triangleDown
@@ -65,6 +69,7 @@
attr.itemDisabledRightIcon.chevron=chevron
attr.itemDisabledRightIcon.chevronUp=chevronUp
attr.itemDisabledRightIcon.chevronDown=chevronDown
+attr.itemDisabledRightIcon.transparent=transparent
attr.itemDisabledRightIcon.triangle=triangle
attr.itemDisabledRightIcon.triangleUp=triangleUp
attr.itemDisabledRightIcon.triangleDown=triangleDown
@@ -78,6 +83,7 @@
attr.itemInactiveRightIcon.chevron=chevron
attr.itemInactiveRightIcon.chevronUp=chevronUp
attr.itemInactiveRightIcon.chevronDown=chevronDown
+attr.itemInactiveRightIcon.transparent=transparent
attr.itemInactiveRightIcon.triangle=triangle
attr.itemInactiveRightIcon.triangleUp=triangleUp
attr.itemInactiveRightIcon.triangleDown=triangleDown
Modified: modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/rich/RichAccordionItemBean.properties
===================================================================
--- modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/rich/RichAccordionItemBean.properties 2011-09-19 13:48:46 UTC (rev 22725)
+++ modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/rich/RichAccordionItemBean.properties 2011-09-19 17:04:58 UTC (rev 22726)
@@ -26,6 +26,7 @@
attr.leftDisabledIcon.chevron=chevron
attr.leftDisabledIcon.chevronUp=chevronUp
attr.leftDisabledIcon.chevronDown=chevronDown
+attr.leftDisabledIcon.transparent=transparent
attr.leftDisabledIcon.triangle=triangle
attr.leftDisabledIcon.triangleUp=triangleUp
attr.leftDisabledIcon.triangleDown=triangleDown
@@ -39,6 +40,7 @@
attr.leftInactiveIcon.chevron=chevron
attr.leftInactiveIcon.chevronUp=chevronUp
attr.leftInactiveIcon.chevronDown=chevronDown
+attr.leftInactiveIcon.transparent=transparent
attr.leftInactiveIcon.triangle=triangle
attr.leftInactiveIcon.triangleUp=triangleUp
attr.leftInactiveIcon.triangleDown=triangleDown
@@ -52,6 +54,7 @@
attr.rightActiveIcon.chevron=chevron
attr.rightActiveIcon.chevronUp=chevronUp
attr.rightActiveIcon.chevronDown=chevronDown
+attr.rightActiveIcon.transparent=transparent
attr.rightActiveIcon.triangle=triangle
attr.rightActiveIcon.triangleUp=triangleUp
attr.rightActiveIcon.triangleDown=triangleDown
@@ -65,6 +68,7 @@
attr.rightDisabledIcon.chevron=chevron
attr.rightDisabledIcon.chevronUp=chevronUp
attr.rightDisabledIcon.chevronDown=chevronDown
+attr.rightDisabledIcon.transparent=transparent
attr.rightDisabledIcon.triangle=triangle
attr.rightDisabledIcon.triangleUp=triangleUp
attr.rightDisabledIcon.triangleDown=triangleDown
@@ -78,6 +82,7 @@
attr.rightInactiveIcon.chevron=chevron
attr.rightInactiveIcon.chevronUp=chevronUp
attr.rightInactiveIcon.chevronDown=chevronDown
+attr.rightInactiveIcon.transparent=transparent
attr.rightInactiveIcon.triangle=triangle
attr.rightInactiveIcon.triangleUp=triangleUp
attr.rightInactiveIcon.triangleDown=triangleDown
Modified: modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/rich/RichPanelMenuBean.properties
===================================================================
--- modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/rich/RichPanelMenuBean.properties 2011-09-19 13:48:46 UTC (rev 22725)
+++ modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/rich/RichPanelMenuBean.properties 2011-09-19 17:04:58 UTC (rev 22726)
@@ -13,10 +13,11 @@
attr.groupCollapsedLeftIcon.chevron=chevron
attr.groupCollapsedLeftIcon.chevronUp=chevronUp
attr.groupCollapsedLeftIcon.chevronDown=chevronDown
+attr.groupCollapsedLeftIcon.transparent=transparent
attr.groupCollapsedLeftIcon.triangle=triangle
attr.groupCollapsedLeftIcon.triangleUp=triangleUp
attr.groupCollapsedLeftIcon.triangleDown=triangleDown
-attr.groupCollapsedLeftIcon.customURL=/resources/images/loading.gif
+attr.groupCollapsedLeftIcon.star=/resources/images/star.png
attr.groupCollapsedLeftIcon.null=
attr.groupCollapsedRightIcon.grid=grid
@@ -24,10 +25,11 @@
attr.groupCollapsedRightIcon.chevron=chevron
attr.groupCollapsedRightIcon.chevronUp=chevronUp
attr.groupCollapsedRightIcon.chevronDown=chevronDown
+attr.groupCollapsedRightIcon.transparent=transparent
attr.groupCollapsedRightIcon.triangle=triangle
attr.groupCollapsedRightIcon.triangleUp=triangleUp
attr.groupCollapsedRightIcon.triangleDown=triangleDown
-attr.groupCollapsedRightIcon.customURL=/resources/images/loading.gif
+attr.groupCollapsedRightIcon.star=/resources/images/star.png
attr.groupCollapsedRightIcon.null=
attr.groupDisabledLeftIcon.grid=grid
@@ -35,10 +37,11 @@
attr.groupDisabledLeftIcon.chevron=chevron
attr.groupDisabledLeftIcon.chevronUp=chevronUp
attr.groupDisabledLeftIcon.chevronDown=chevronDown
+attr.groupDisabledLeftIcon.transparent=transparent
attr.groupDisabledLeftIcon.triangle=triangle
attr.groupDisabledLeftIcon.triangleUp=triangleUp
attr.groupDisabledLeftIcon.triangleDown=triangleDown
-attr.groupDisabledLeftIcon.customURL=/resources/images/loading.gif
+attr.groupDisabledLeftIcon.star=/resources/images/star.png
attr.groupDisabledLeftIcon.null=
attr.groupDisabledRightIcon.grid=grid
@@ -46,10 +49,11 @@
attr.groupDisabledRightIcon.chevron=chevron
attr.groupDisabledRightIcon.chevronUp=chevronUp
attr.groupDisabledRightIcon.chevronDown=chevronDown
+attr.groupDisabledRightIcon.transparent=transparent
attr.groupDisabledRightIcon.triangle=triangle
attr.groupDisabledRightIcon.triangleUp=triangleUp
attr.groupDisabledRightIcon.triangleDown=triangleDown
-attr.groupDisabledRightIcon.customURL=/resources/images/loading.gif
+attr.groupDisabledRightIcon.star=/resources/images/star.png
attr.groupDisabledRightIcon.null=
attr.groupExpandedLeftIcon.grid=grid
@@ -57,10 +61,11 @@
attr.groupExpandedLeftIcon.chevron=chevron
attr.groupExpandedLeftIcon.chevronUp=chevronUp
attr.groupExpandedLeftIcon.chevronDown=chevronDown
+attr.groupExpandedLeftIcon.transparent=transparent
attr.groupExpandedLeftIcon.triangle=triangle
attr.groupExpandedLeftIcon.triangleUp=triangleUp
attr.groupExpandedLeftIcon.triangleDown=triangleDown
-attr.groupExpandedLeftIcon.customURL=/resources/images/loading.gif
+attr.groupExpandedLeftIcon.star=/resources/images/star.png
attr.groupExpandedLeftIcon.null=
attr.groupExpandedRightIcon.grid=grid
@@ -68,10 +73,11 @@
attr.groupExpandedRightIcon.chevron=chevron
attr.groupExpandedRightIcon.chevronUp=chevronUp
attr.groupExpandedRightIcon.chevronDown=chevronDown
+attr.groupExpandedRightIcon.transparent=transparent
attr.groupExpandedRightIcon.triangle=triangle
attr.groupExpandedRightIcon.triangleUp=triangleUp
attr.groupExpandedRightIcon.triangleDown=triangleDown
-attr.groupExpandedRightIcon.customURL=/resources/images/loading.gif
+attr.groupExpandedRightIcon.star=/resources/images/star.png
attr.groupExpandedRightIcon.null=
attr.itemDisabledLeftIcon.grid=grid
@@ -79,10 +85,11 @@
attr.itemDisabledLeftIcon.chevron=chevron
attr.itemDisabledLeftIcon.chevronUp=chevronUp
attr.itemDisabledLeftIcon.chevronDown=chevronDown
+attr.itemDisabledLeftIcon.transparent=transparent
attr.itemDisabledLeftIcon.triangle=triangle
attr.itemDisabledLeftIcon.triangleUp=triangleUp
attr.itemDisabledLeftIcon.triangleDown=triangleDown
-attr.itemDisabledLeftIcon.customURL=/resources/images/loading.gif
+attr.itemDisabledLeftIcon.star=/resources/images/star.png
attr.itemDisabledLeftIcon.null=
attr.itemDisabledRightIcon.grid=grid
@@ -90,10 +97,11 @@
attr.itemDisabledRightIcon.chevron=chevron
attr.itemDisabledRightIcon.chevronUp=chevronUp
attr.itemDisabledRightIcon.chevronDown=chevronDown
+attr.itemDisabledRightIcon.transparent=transparent
attr.itemDisabledRightIcon.triangle=triangle
attr.itemDisabledRightIcon.triangleUp=triangleUp
attr.itemDisabledRightIcon.triangleDown=triangleDown
-attr.itemDisabledRightIcon.customURL=/resources/images/loading.gif
+attr.itemDisabledRightIcon.star=/resources/images/star.png
attr.itemDisabledRightIcon.null=
attr.itemLeftIcon.grid=grid
@@ -101,10 +109,11 @@
attr.itemLeftIcon.chevron=chevron
attr.itemLeftIcon.chevronUp=chevronUp
attr.itemLeftIcon.chevronDown=chevronDown
+attr.itemLeftIcon.transparent=transparent
attr.itemLeftIcon.triangle=triangle
attr.itemLeftIcon.triangleUp=triangleUp
attr.itemLeftIcon.triangleDown=triangleDown
-attr.itemLeftIcon.customURL=/resources/images/loading.gif
+attr.itemLeftIcon.star=/resources/images/star.png
attr.itemLeftIcon.null=
attr.itemRightIcon.grid=grid
@@ -112,10 +121,11 @@
attr.itemRightIcon.chevron=chevron
attr.itemRightIcon.chevronUp=chevronUp
attr.itemRightIcon.chevronDown=chevronDown
+attr.itemRightIcon.transparent=transparent
attr.itemRightIcon.triangle=triangle
attr.itemRightIcon.triangleUp=triangleUp
attr.itemRightIcon.triangleDown=triangleDown
-attr.itemRightIcon.customURL=/resources/images/loading.gif
+attr.itemRightIcon.star=/resources/images/star.png
attr.itemRightIcon.null=
attr.topGroupCollapsedLeftIcon.grid=grid
@@ -123,22 +133,23 @@
attr.topGroupCollapsedLeftIcon.chevron=chevron
attr.topGroupCollapsedLeftIcon.chevronUp=chevronUp
attr.topGroupCollapsedLeftIcon.chevronDown=chevronDown
+attr.topGroupCollapsedLeftIcon.transparent=transparent
attr.topGroupCollapsedLeftIcon.triangle=triangle
attr.topGroupCollapsedLeftIcon.triangleUp=triangleUp
attr.topGroupCollapsedLeftIcon.triangleDown=triangleDown
-attr.topGroupCollapsedLeftIcon.customURL=/resources/images/loading.gif
+attr.topGroupCollapsedLeftIcon.star=/resources/images/star.png
attr.topGroupCollapsedLeftIcon.null=
attr.topGroupCollapsedRightIcon.grid=grid
attr.topGroupCollapsedRightIcon.disc=disc
attr.topGroupCollapsedRightIcon.chevron=chevron
attr.topGroupCollapsedRightIcon.chevronUp=chevronUp
-attr.topGroupCollapsedRightIcon.chevronUp=chevronUp
attr.topGroupCollapsedRightIcon.chevronDown=chevronDown
+attr.topGroupCollapsedRightIcon.transparent=transparent
attr.topGroupCollapsedRightIcon.triangle=triangle
attr.topGroupCollapsedRightIcon.triangleUp=triangleUp
attr.topGroupCollapsedRightIcon.triangleDown=triangleDown
-attr.topGroupCollapsedRightIcon.customURL=/resources/images/loading.gif
+attr.topGroupCollapsedRightIcon.star=/resources/images/star.png
attr.topGroupCollapsedRightIcon.null=
attr.topGroupDisabledLeftIcon.grid=grid
@@ -146,10 +157,11 @@
attr.topGroupDisabledLeftIcon.chevron=chevron
attr.topGroupDisabledLeftIcon.chevronUp=chevronUp
attr.topGroupDisabledLeftIcon.chevronDown=chevronDown
+attr.topGroupDisabledLeftIcon.transparent=transparent
attr.topGroupDisabledLeftIcon.triangle=triangle
attr.topGroupDisabledLeftIcon.triangleUp=triangleUp
attr.topGroupDisabledLeftIcon.triangleDown=triangleDown
-attr.topGroupDisabledLeftIcon.customURL=/resources/images/loading.gif
+attr.topGroupDisabledLeftIcon.star=/resources/images/star.png
attr.topGroupDisabledLeftIcon.null=
attr.topGroupDisabledRightIcon.grid=grid
@@ -157,10 +169,11 @@
attr.topGroupDisabledRightIcon.chevron=chevron
attr.topGroupDisabledRightIcon.chevronUp=chevronUp
attr.topGroupDisabledRightIcon.chevronDown=chevronDown
+attr.topGroupDisabledRightIcon.transparent=transparent
attr.topGroupDisabledRightIcon.triangle=triangle
attr.topGroupDisabledRightIcon.triangleUp=triangleUp
attr.topGroupDisabledRightIcon.triangleDown=triangleDown
-attr.topGroupDisabledRightIcon.customURL=/resources/images/loading.gif
+attr.topGroupDisabledRightIcon.star=/resources/images/star.png
attr.topGroupDisabledRightIcon.null=
attr.topGroupExpandedLeftIcon.grid=grid
@@ -168,10 +181,11 @@
attr.topGroupExpandedLeftIcon.chevron=chevron
attr.topGroupExpandedLeftIcon.chevronUp=chevronUp
attr.topGroupExpandedLeftIcon.chevronDown=chevronDown
+attr.topGroupExpandedLeftIcon.transparent=transparent
attr.topGroupExpandedLeftIcon.triangle=triangle
attr.topGroupExpandedLeftIcon.triangleUp=triangleUp
attr.topGroupExpandedLeftIcon.triangleDown=triangleDown
-attr.topGroupExpandedLeftIcon.customURL=/resources/images/loading.gif
+attr.topGroupExpandedLeftIcon.star=/resources/images/star.png
attr.topGroupExpandedLeftIcon.null=
attr.topGroupExpandedRightIcon.grid=grid
@@ -179,10 +193,11 @@
attr.topGroupExpandedRightIcon.chevron=chevron
attr.topGroupExpandedRightIcon.chevronUp=chevronUp
attr.topGroupExpandedRightIcon.chevronDown=chevronDown
+attr.topGroupExpandedRightIcon.transparent=transparent
attr.topGroupExpandedRightIcon.triangle=triangle
attr.topGroupExpandedRightIcon.triangleUp=triangleUp
attr.topGroupExpandedRightIcon.triangleDown=triangleDown
-attr.topGroupExpandedRightIcon.customURL=/resources/images/loading.gif
+attr.topGroupExpandedRightIcon.star=/resources/images/star.png
attr.topGroupExpandedRightIcon.null=
attr.topItemDisabledLeftIcon.grid=grid
@@ -190,10 +205,11 @@
attr.topItemDisabledLeftIcon.chevron=chevron
attr.topItemDisabledLeftIcon.chevronUp=chevronUp
attr.topItemDisabledLeftIcon.chevronDown=chevronDown
+attr.topItemDisabledLeftIcon.transparent=transparent
attr.topItemDisabledLeftIcon.triangle=triangle
attr.topItemDisabledLeftIcon.triangleUp=triangleUp
attr.topItemDisabledLeftIcon.triangleDown=triangleDown
-attr.topItemDisabledLeftIcon.customURL=/resources/images/loading.gif
+attr.topItemDisabledLeftIcon.star=/resources/images/star.png
attr.topItemDisabledLeftIcon.null=
attr.topItemDisabledRightIcon.grid=grid
@@ -201,10 +217,11 @@
attr.topItemDisabledRightIcon.chevron=chevron
attr.topItemDisabledRightIcon.chevronUp=chevronUp
attr.topItemDisabledRightIcon.chevronDown=chevronDown
+attr.topItemDisabledRightIcon.transparent=transparent
attr.topItemDisabledRightIcon.triangle=triangle
attr.topItemDisabledRightIcon.triangleUp=triangleUp
attr.topItemDisabledRightIcon.triangleDown=triangleDown
-attr.topItemDisabledRightIcon.customURL=/resources/images/loading.gif
+attr.topItemDisabledRightIcon.star=/resources/images/star.png
attr.topItemDisabledRightIcon.null=
attr.topItemLeftIcon.grid=grid
@@ -212,10 +229,12 @@
attr.topItemLeftIcon.chevron=chevron
attr.topItemLeftIcon.chevronUp=chevronUp
attr.topItemLeftIcon.chevronDown=chevronDown
+attr.topItemLeftIcon.nonexisting=nonexisting
+attr.topItemLeftIcon.transparent=transparent
attr.topItemLeftIcon.triangle=triangle
attr.topItemLeftIcon.triangleUp=triangleUp
attr.topItemLeftIcon.triangleDown=triangleDown
-attr.topItemLeftIcon.customURL=/resources/images/loading.gif
+attr.topItemLeftIcon.star=/resources/images/star.png
attr.topItemLeftIcon.null=
attr.topItemRightIcon.grid=grid
@@ -223,8 +242,9 @@
attr.topItemRightIcon.chevron=chevron
attr.topItemRightIcon.chevronUp=chevronUp
attr.topItemRightIcon.chevronDown=chevronDown
+attr.topItemRightIcon.transparent=transparent
attr.topItemRightIcon.triangle=triangle
attr.topItemRightIcon.triangleUp=triangleUp
attr.topItemRightIcon.triangleDown=triangleDown
-attr.topItemRightIcon.customURL=/resources/images/loading.gif
+attr.topItemRightIcon.star=/resources/images/star.png
attr.topItemRightIcon.null=
\ No newline at end of file
Modified: modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/rich/RichPanelMenuGroupBean.properties
===================================================================
--- modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/rich/RichPanelMenuGroupBean.properties 2011-09-19 13:48:46 UTC (rev 22725)
+++ modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/rich/RichPanelMenuGroupBean.properties 2011-09-19 17:04:58 UTC (rev 22726)
@@ -19,6 +19,7 @@
attr.leftExpandedIcon.chevron=chevron
attr.leftExpandedIcon.chevronUp=chevronUp
attr.leftExpandedIcon.chevronDown=chevronDown
+attr.leftExpandedIcon.transparent=transparent
attr.leftExpandedIcon.triangle=triangle
attr.leftExpandedIcon.triangleUp=triangleUp
attr.leftExpandedIcon.triangleDown=triangleDown
@@ -30,6 +31,7 @@
attr.leftDisabledIcon.chevron=chevron
attr.leftDisabledIcon.chevronUp=chevronUp
attr.leftDisabledIcon.chevronDown=chevronDown
+attr.leftDisabledIcon.transparent=transparent
attr.leftDisabledIcon.triangle=triangle
attr.leftDisabledIcon.triangleUp=triangleUp
attr.leftDisabledIcon.triangleDown=triangleDown
@@ -52,6 +54,7 @@
attr.rightExpandedIcon.chevron=chevron
attr.rightExpandedIcon.chevronUp=chevronUp
attr.rightExpandedIcon.chevronDown=chevronDown
+attr.rightExpandedIcon.transparent=transparent
attr.rightExpandedIcon.triangle=triangle
attr.rightExpandedIcon.triangleUp=triangleUp
attr.rightExpandedIcon.triangleDown=triangleDown
@@ -63,6 +66,7 @@
attr.rightDisabledIcon.chevron=chevron
attr.rightDisabledIcon.chevronUp=chevronUp
attr.rightDisabledIcon.chevronDown=chevronDown
+attr.rightDisabledIcon.transparent=transparent
attr.rightDisabledIcon.triangle=triangle
attr.rightDisabledIcon.triangleUp=triangleUp
attr.rightDisabledIcon.triangleDown=triangleDown
Modified: modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/rich/RichPanelMenuItemBean.properties
===================================================================
--- modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/rich/RichPanelMenuItemBean.properties 2011-09-19 13:48:46 UTC (rev 22725)
+++ modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/rich/RichPanelMenuItemBean.properties 2011-09-19 17:04:58 UTC (rev 22726)
@@ -8,6 +8,7 @@
attr.leftIcon.chevron=chevron
attr.leftIcon.chevronUp=chevronUp
attr.leftIcon.chevronDown=chevronDown
+attr.leftIcon.transparent=transparent
attr.leftIcon.triangle=triangle
attr.leftIcon.triangleUp=triangleUp
attr.leftIcon.triangleDown=triangleDown
@@ -19,6 +20,7 @@
attr.leftDisabledIcon.chevron=chevron
attr.leftDisabledIcon.chevronUp=chevronUp
attr.leftDisabledIcon.chevronDown=chevronDown
+attr.leftDisabledIcon.transparent=transparent
attr.leftDisabledIcon.triangle=triangle
attr.leftDisabledIcon.triangleUp=triangleUp
attr.leftDisabledIcon.triangleDown=triangleDown
@@ -30,6 +32,7 @@
attr.rightIcon.chevron=chevron
attr.rightIcon.chevronUp=chevronUp
attr.rightIcon.chevronDown=chevronDown
+attr.rightIcon.transparent=transparent
attr.rightIcon.triangle=triangle
attr.rightIcon.triangleUp=triangleUp
attr.rightIcon.triangleDown=triangleDown
@@ -41,6 +44,7 @@
attr.rightDisabledIcon.chevron=chevron
attr.rightDisabledIcon.chevronUp=chevronUp
attr.rightDisabledIcon.chevronDown=chevronDown
+attr.rightDisabledIcon.transparent=transparent
attr.rightDisabledIcon.triangle=triangle
attr.rightDisabledIcon.triangleUp=triangleUp
attr.rightDisabledIcon.triangleDown=triangleDown
13 years, 3 months
JBoss Rich Faces SVN: r22725 - modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2011-09-19 09:48:46 -0400 (Mon, 19 Sep 2011)
New Revision: 22725
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/TestPickList.java
Log:
locator for error message fixed
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/TestPickList.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/TestPickList.java 2011-09-19 13:31:29 UTC (rev 22724)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/TestPickList.java 2011-09-19 13:48:46 UTC (rev 22725)
@@ -59,7 +59,7 @@
// sourcemouseover event
private JQueryLocator pickListTarget = pjq("div.rf-pick-target div.rf-pick-lst-dcrtn");
private JQueryLocator output = pjq("span[id$=output]");
- private JQueryLocator pickListMsgBox = pjq("span.rf-ntf-msg > span[id$=msg:form:pickList] > span.rf-msg-det");
+ private JQueryLocator pickListMsgBox = pjq("span.rf-msg-err[id$=pickList] > span.rf-msg-det");
private JQueryLocator targetCaptionLocator = pjq("div[id$=pickListTargetList] > div.rf-pick-target-caption");
private JQueryLocator sourceCaptionLocator = pjq("div[id$=pickListSourceList] > div.rf-pick-source-caption");
13 years, 3 months
JBoss Rich Faces SVN: r22724 - modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2011-09-19 09:31:29 -0400 (Mon, 19 Sep 2011)
New Revision: 22724
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/TestPickList.java
Log:
added 4 new tests for rich:pickList
issue tracking info updated
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/TestPickList.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/TestPickList.java 2011-09-15 13:32:21 UTC (rev 22723)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/TestPickList.java 2011-09-19 13:31:29 UTC (rev 22724)
@@ -55,7 +55,8 @@
private JQueryLocator a4jSubmit = pjq("input[id$=a4jButton]");
private JQueryLocator pickListTop = pjq("div.rf-pick[id$=pickList]");
- private JQueryLocator pickListSource = pjq("div.rf-pick-source div.rf-pick-lst-dcrtn"); // this locator works for sourcemouseover event
+ private JQueryLocator pickListSource = pjq("div.rf-pick-source div.rf-pick-lst-dcrtn"); // this locator works for
+ // sourcemouseover event
private JQueryLocator pickListTarget = pjq("div.rf-pick-target div.rf-pick-lst-dcrtn");
private JQueryLocator output = pjq("span[id$=output]");
private JQueryLocator pickListMsgBox = pjq("span.rf-ntf-msg > span[id$=msg:form:pickList] > span.rf-msg-det");
@@ -232,13 +233,11 @@
public void testHeaderClass() {
// move to columns layout test
/*
- String headerClass = "my-cool-header-class";
- attributes.setHeaderClass(headerClass);
-
- String found = selenium.getAttribute(pickListTop.getAttribute(classAttr));
- assertTrue(found != null);
- assertTrue(found.contains(headerClass));
- */
+ * String headerClass = "my-cool-header-class"; attributes.setHeaderClass(headerClass);
+ *
+ * String found = selenium.getAttribute(pickListTop.getAttribute(classAttr)); assertTrue(found != null);
+ * assertTrue(found.contains(headerClass));
+ */
}
@Test
@@ -316,13 +315,13 @@
}
@Test
- @IssueTracking("https://issues.jboss.org/browse/RFPL-1659")
+ @IssueTracking({ "https://issues.jboss.org/browse/RFPL-1659", "https://issues.jboss.org/browse/RF-11322" })
public void testOnblur() {
testFireEvent(Event.BLUR, pickListTop);
}
@Test
- public void testOnchange() {
+ public void testOnchange() {
testFireEvent(Event.CHANGE, pickListTop, "change");
}
@@ -337,7 +336,7 @@
}
@Test
- @IssueTracking("https://issues.jboss.org/browse/RFPL-1659")
+ @IssueTracking({ "https://issues.jboss.org/browse/RFPL-1659", "https://issues.jboss.org/browse/RF-11322" })
public void testOnfocus() {
testFireEvent(Event.FOCUS, pickListTop);
}
@@ -395,6 +394,12 @@
}
@Test
+ @IssueTracking("https://issues.jboss.org/browse/RF-11322")
+ public void testOnsourceblur() {
+ testFireEvent(Event.BLUR, pickListSource, "sourceblur");
+ }
+
+ @Test
public void testOnsourceclick() {
testFireEvent(Event.CLICK, pickListSource, "sourceclick");
}
@@ -405,19 +410,25 @@
}
@Test
- @IssueTracking("https://issues.jboss.org/browse/RFPL-1659")
+ @IssueTracking("https://issues.jboss.org/browse/RF-11322")
+ public void testOnsourcefocus() {
+ testFireEvent(Event.FOCUS, pickListSource, "sourcefocus");
+ }
+
+ @Test
+ @IssueTracking({ "https://issues.jboss.org/browse/RFPL-1659", "https://issues.jboss.org/browse/RF-11322" })
public void testOnsourcekeydown() {
testFireEvent(Event.KEYDOWN, pickListSource, "sourcekeydown");
}
@Test
- @IssueTracking("https://issues.jboss.org/browse/RFPL-1659")
+ @IssueTracking({ "https://issues.jboss.org/browse/RFPL-1659", "https://issues.jboss.org/browse/RF-11322" })
public void testOnsourcekeypress() {
testFireEvent(Event.KEYPRESS, pickListSource, "sourcekeypress");
}
@Test
- @IssueTracking("https://issues.jboss.org/browse/RFPL-1659")
+ @IssueTracking({ "https://issues.jboss.org/browse/RFPL-1659", "https://issues.jboss.org/browse/RF-11322" })
public void testOnsourcekeyup() {
testFireEvent(Event.KEYUP, pickListSource, "sourcekeyup");
}
@@ -448,6 +459,12 @@
}
@Test
+ @IssueTracking("https://issues.jboss.org/browse/RF-11322")
+ public void testOntargetblur() {
+ testFireEvent(Event.BLUR, pickListTarget, "targetblur");
+ }
+
+ @Test
public void testOntargetclick() {
testFireEvent(Event.CLICK, pickListTarget, "targetclick");
}
@@ -458,19 +475,25 @@
}
@Test
- @IssueTracking("https://issues.jboss.org/browse/RFPL-1659")
+ @IssueTracking("https://issues.jboss.org/browse/RF-11322")
+ public void testOntargetfocus() {
+ testFireEvent(Event.FOCUS, pickListTarget, "targetfocus");
+ }
+
+ @Test
+ @IssueTracking({ "https://issues.jboss.org/browse/RFPL-1659", "https://issues.jboss.org/browse/RF-11322" })
public void testOntargetkeydown() {
testFireEvent(Event.KEYDOWN, pickListTarget, "targetkeydown");
}
@Test
- @IssueTracking("https://issues.jboss.org/browse/RFPL-1659")
+ @IssueTracking({ "https://issues.jboss.org/browse/RFPL-1659", "https://issues.jboss.org/browse/RF-11322" })
public void testOntargetkeypress() {
testFireEvent(Event.KEYPRESS, pickListTarget, "targetkeypress");
}
@Test
- @IssueTracking("https://issues.jboss.org/browse/RFPL-1659")
+ @IssueTracking({ "https://issues.jboss.org/browse/RFPL-1659", "https://issues.jboss.org/browse/RF-11322" })
public void testOntargetkeyup() {
testFireEvent(Event.KEYUP, pickListTarget, "targetkeyup");
}
13 years, 3 months
JBoss Rich Faces SVN: r22723 - modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAttachQueue.
by richfaces-svn-commits@lists.jboss.org
Author: jpapouse
Date: 2011-09-15 09:32:21 -0400 (Thu, 15 Sep 2011)
New Revision: 22723
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAttachQueue/TestNestedAttachQueue.java
Log:
RFPL-1139 (attach queue): added test for onrequestqueue and onrequestdequeue attributes
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAttachQueue/TestNestedAttachQueue.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAttachQueue/TestNestedAttachQueue.java 2011-09-15 12:49:56 UTC (rev 22722)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAttachQueue/TestNestedAttachQueue.java 2011-09-15 13:32:21 UTC (rev 22723)
@@ -28,8 +28,10 @@
import static org.richfaces.tests.metamer.ftest.attributes.AttributeList.attachQueueAttrs1;
import static org.richfaces.tests.metamer.ftest.attributes.AttributeList.attachQueueAttrs2;
import static org.richfaces.tests.metamer.ftest.attributes.AttributeList.queueAttributes;
+import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
+import java.io.InputStream;
import java.net.URL;
import org.jboss.cheiron.halt.XHRHalter;
@@ -130,4 +132,21 @@
queue.checkTimes(0);
assertFalse(selenium.isAlertPresent());
}
+
+ @Test
+ public void testQueueAndDequeueEvents() {
+ attachQueueAttrs1.set(AttachQueueAttributes.requestDelay, 0);
+ attachQueueAttrs2.set(AttachQueueAttributes.requestDelay, 0);
+
+ attachQueueAttrs1.set(AttachQueueAttributes.onrequestqueue, "metamerEvents += \"requestqueue \"");
+ attachQueueAttrs1.set(AttachQueueAttributes.onrequestdequeue, "metamerEvents += \"requestdequeue \"");
+ selenium.getEval(new JavaScript("window.metamerEvents = \"\";"));
+
+ queue.fireEvent(Input.FIRST, 1);
+
+ String[] events = selenium.getEval(new JavaScript("window.metamerEvents")).split(" ");
+ assertEquals(events.length, 2, "2 events should be fired, was [" + selenium.getEval(new JavaScript("window.metamerEvents")) + "]");
+ assertEquals(events[0], "requestqueue", "Attribute onrequestqueue doesn't work");
+ assertEquals(events[1], "requestdequeue", "Attribute onrequestdequeue doesn't work");
+ }
}
\ No newline at end of file
13 years, 3 months
JBoss Rich Faces SVN: r22722 - modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDropTarget.
by richfaces-svn-commits@lists.jboss.org
Author: jpapouse
Date: 2011-09-15 08:49:56 -0400 (Thu, 15 Sep 2011)
New Revision: 22722
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDropTarget/DropTargetAttributes.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDropTarget/TestDropTarget.java
Log:
RFPL-1138 (drop target): added test for attributes onbegin, onbeforedomupdate and oncomplete
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDropTarget/DropTargetAttributes.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDropTarget/DropTargetAttributes.java 2011-09-15 11:59:57 UTC (rev 22721)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDropTarget/DropTargetAttributes.java 2011-09-15 12:49:56 UTC (rev 22722)
@@ -25,21 +25,17 @@
/**
* @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
- * @version $Revision$
+ * @author <a href="mailto:jpapouse@redhat.com">Jan Papousek</a>
*/
public class DropTargetAttributes extends AbstractComponentAttributes {
public void setAcceptedTypes(String acceptedTypes) {
setProperty("acceptedTypes", acceptedTypes);
}
- public void setRender(String render) {
- setProperty("render", render);
- }
+ public void setBypassUpdates(Boolean bypassUpdates) {
+ setProperty("bypassUpdates", bypassUpdates);
+ }
- public void setRendered(Boolean rendered) {
- setProperty("rendered", rendered);
- }
-
public void setExecute(String execute) {
setProperty("execute", execute);
}
@@ -48,7 +44,23 @@
setProperty("immediate", immediate);
}
- public void setBypassUpdates(Boolean bypassUpdates) {
- setProperty("bypassUpdates", bypassUpdates);
+ public void setOnbeforedomupdate(String onbeforedomupdate) {
+ setProperty("onbeforedomupdate", onbeforedomupdate);
+ }
+
+ public void setOnbegin(String onbegin) {
+ setProperty("onbegin", onbegin);
+ }
+
+ public void setOncomplete(String oncomplete) {
+ setProperty("oncomplete", oncomplete);
}
+
+ public void setRender(String render) {
+ setProperty("render", render);
+ }
+
+ public void setRendered(Boolean rendered) {
+ setProperty("rendered", rendered);
+ }
}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDropTarget/TestDropTarget.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDropTarget/TestDropTarget.java 2011-09-15 11:59:57 UTC (rev 22721)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDropTarget/TestDropTarget.java 2011-09-15 12:49:56 UTC (rev 22722)
@@ -41,8 +41,11 @@
import org.jboss.test.selenium.GuardRequest;
import org.jboss.test.selenium.actions.Drag;
+import org.jboss.test.selenium.dom.Event;
+import org.jboss.test.selenium.encapsulated.JavaScript;
import org.jboss.test.selenium.locator.JQueryLocator;
import org.jboss.test.selenium.request.RequestType;
+import org.jboss.test.selenium.waiting.EventFiredCondition;
import org.jboss.test.selenium.waiting.retrievers.TextRetriever;
import org.richfaces.tests.metamer.ftest.annotations.RegressionTest;
import org.richfaces.tests.metamer.ftest.richDragIndicator.AbstractDragNDropTest;
@@ -188,6 +191,23 @@
phaseInfo.assertPhases(RESTORE_VIEW, APPLY_REQUEST_VALUES, PROCESS_VALIDATIONS, RENDER_RESPONSE);
}
+ @Test
+ public void testEvents() {
+ attributes.setOnbeforedomupdate("metamerEvents += \"beforedomupdate \"");
+ attributes.setOnbegin("metamerEvents += \"begin \"");
+ attributes.setOncomplete("metamerEvents += \"complete \"");
+ selenium.getEval(new JavaScript("window.metamerEvents = \"\";"));
+
+ testAcception(drg1, ACCEPTING);
+ guardedDrop(RequestType.XHR);
+
+ String[] events = selenium.getEval(new JavaScript("window.metamerEvents")).split(" ");
+ assertEquals(events.length, 3, "3 events should be fired.");
+ assertEquals(events[0], "begin", "Attribute onbegin doesn't work");
+ assertEquals(events[1], "beforedomupdate", "Attribute onbeforedomupdate doesn't work");
+ assertEquals(events[2], "complete", "Attribute oncomplete doesn't work");
+ }
+
private void testAcceptedDropping(Draggable draggable) {
testAcception(draggable, ACCEPTING);
13 years, 3 months
JBoss Rich Faces SVN: r22721 - modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jMediaOutput.
by richfaces-svn-commits@lists.jboss.org
Author: jpapouse
Date: 2011-09-15 07:59:57 -0400 (Thu, 15 Sep 2011)
New Revision: 22721
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jMediaOutput/TestElementA.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jMediaOutput/TestElementLink.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jMediaOutput/TestElementScript.java
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jMediaOutput/AbstractMediaOutputTest.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jMediaOutput/TestImagePng.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jMediaOutput/TestTextHtml.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jMediaOutput/TestTextPlain.java
Log:
RFPL-1444 (media output): tests for other elements
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jMediaOutput/AbstractMediaOutputTest.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jMediaOutput/AbstractMediaOutputTest.java 2011-09-15 11:54:05 UTC (rev 22720)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jMediaOutput/AbstractMediaOutputTest.java 2011-09-15 11:59:57 UTC (rev 22721)
@@ -21,6 +21,14 @@
*******************************************************************************/
package org.richfaces.tests.metamer.ftest.a4jMediaOutput;
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.URL;
+
+import org.jboss.test.selenium.locator.AttributeLocator;
import org.jboss.test.selenium.locator.JQueryLocator;
import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
@@ -31,4 +39,22 @@
protected static final JQueryLocator MEDIA_OUTPUT = pjq("*[id$=mediaOutput]");
+ protected String getTextContentByUrlAttribute(AttributeLocator urlAttribute) throws IOException {
+ URL url = buildUrl(contextRoot, selenium.getAttribute(urlAttribute));
+ BufferedReader input = null;
+ StringBuilder foundContent = new StringBuilder();
+ try {
+ input = new BufferedReader(new InputStreamReader(url.openStream()));
+ String line;
+ while((line = input.readLine()) != null) {
+ foundContent.append(line);
+ }
+ } finally {
+ if (input != null) {
+ input.close();
+ }
+ }
+ return foundContent.toString();
+ }
+
}
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jMediaOutput/TestElementA.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jMediaOutput/TestElementA.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jMediaOutput/TestElementA.java 2011-09-15 11:59:57 UTC (rev 22721)
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010-2011, 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.a4jMediaOutput;
+
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.assertEquals;
+
+import java.io.IOException;
+import java.net.URL;
+
+import org.jboss.test.selenium.locator.Attribute;
+import org.richfaces.tests.metamer.bean.a4j.A4JMediaOutputBean;
+import org.testng.annotations.Test;
+
+/**
+ * Test case for page /faces/components/a4jMediaOutput/elementA.xhtml
+ *
+ * @author <a href="mailto:jpapouse@redhat.com">Jan Papousek</a>
+ */
+public class TestElementA extends AbstractMediaOutputTest {
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/a4jMediaOutput/elementA.xhtml");
+ }
+
+ @Test
+ public void init() throws IOException {
+ assertEquals(selenium.getText(MEDIA_OUTPUT), "This is a link", "The link text doesn't match.");
+ assertTrue(
+ getTextContentByUrlAttribute(MEDIA_OUTPUT.getAttribute(Attribute.HREF)).contains(A4JMediaOutputBean.HTML_TEXT),
+ "Target HTML page doesn't match."
+ );
+ }
+
+
+}
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jMediaOutput/TestElementLink.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jMediaOutput/TestElementLink.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jMediaOutput/TestElementLink.java 2011-09-15 11:59:57 UTC (rev 22721)
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010-2011, 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.a4jMediaOutput;
+
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.testng.Assert.assertEquals;
+
+import java.net.URL;
+
+import org.jboss.test.selenium.css.CssProperty;
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.testng.annotations.Test;
+
+/**
+ * Test case for page /faces/components/a4jMediaOutput/elementLink.xhtml
+ *
+ * @author <a href="mailto:jpapouse@redhat.com">Jan Papousek</a>
+ */
+public class TestElementLink extends AbstractMediaOutputTest {
+
+ private static final JQueryLocator MARKED_TEXT = pjq("*#mediaOutputMarked");
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/a4jMediaOutput/elementLink.xhtml");
+ }
+
+ @Test
+ public void init() {
+ assertEquals(selenium.getStyle(MARKED_TEXT, CssProperty.COLOR), "rgb(255, 0, 0)", "The marked text should be red.");
+ }
+
+
+}
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jMediaOutput/TestElementScript.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jMediaOutput/TestElementScript.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jMediaOutput/TestElementScript.java 2011-09-15 11:59:57 UTC (rev 22721)
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010-2011, 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.a4jMediaOutput;
+
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.assertEquals;
+
+import java.net.URL;
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.testng.annotations.Test;
+
+/**
+ * Test case for page /faces/components/a4jMediaOutput/elementScript.xhtml
+ *
+ * @author <a href="mailto:jpapouse@redhat.com">Jan Papousek</a>
+ */
+public class TestElementScript extends AbstractMediaOutputTest {
+
+ private static final JQueryLocator JAVASCRIPT_TEXT = pjq("*#mediaOutputJavascriptText");
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/a4jMediaOutput/elementScript.xhtml");
+ }
+
+ @Test
+ public void init() {
+ assertTrue(selenium.isElementPresent(JAVASCRIPT_TEXT), "The javascript text is not present.");
+ assertEquals(selenium.getText(JAVASCRIPT_TEXT), "JAVASCRIPT TEXT", "The javascript text doesn't match.");
+ }
+
+
+}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jMediaOutput/TestImagePng.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jMediaOutput/TestImagePng.java 2011-09-15 11:54:05 UTC (rev 22720)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jMediaOutput/TestImagePng.java 2011-09-15 11:59:57 UTC (rev 22721)
@@ -50,7 +50,7 @@
}
@Test
- public void testImage() {
+ public void init() {
AttributeLocator imageURLAttr = MEDIA_OUTPUT.getAttribute(Attribute.SRC);
URL imageURL = buildUrl(contextRoot, selenium.getAttribute(imageURLAttr));
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jMediaOutput/TestTextHtml.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jMediaOutput/TestTextHtml.java 2011-09-15 11:54:05 UTC (rev 22720)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jMediaOutput/TestTextHtml.java 2011-09-15 11:59:57 UTC (rev 22721)
@@ -46,22 +46,10 @@
@Test
public void testInit() throws IOException {
- AttributeLocator urlAttr = MEDIA_OUTPUT.getAttribute(Attribute.DATA);
- URL url = buildUrl(contextRoot, selenium.getAttribute(urlAttr));
- BufferedReader input = null;
- StringBuilder foundContent = new StringBuilder();
- try {
- input = new BufferedReader(new InputStreamReader(url.openStream()));
- String line;
- while((line = input.readLine()) != null) {
- foundContent.append(line);
- }
- } finally {
- if (input != null) {
- input.close();
- }
- }
- assertTrue(foundContent.toString().contains(A4JMediaOutputBean.HTML_TEXT));
+ assertTrue(
+ getTextContentByUrlAttribute(MEDIA_OUTPUT.getAttribute(Attribute.DATA)).toString().contains(A4JMediaOutputBean.HTML_TEXT),
+ "The HTML content doesn't match."
+ );
}
}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jMediaOutput/TestTextPlain.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jMediaOutput/TestTextPlain.java 2011-09-15 11:54:05 UTC (rev 22720)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jMediaOutput/TestTextPlain.java 2011-09-15 11:59:57 UTC (rev 22721)
@@ -23,13 +23,10 @@
import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
-import java.io.BufferedReader;
import java.io.IOException;
-import java.io.InputStreamReader;
import java.net.URL;
import org.jboss.test.selenium.locator.Attribute;
-import org.jboss.test.selenium.locator.AttributeLocator;
import org.richfaces.tests.metamer.bean.a4j.A4JMediaOutputBean;
import org.testng.annotations.Test;
import static org.testng.Assert.assertTrue;
@@ -46,22 +43,10 @@
@Test
public void testInit() throws IOException {
- AttributeLocator urlAttr = MEDIA_OUTPUT.getAttribute(Attribute.DATA);
- URL url = buildUrl(contextRoot, selenium.getAttribute(urlAttr));
- BufferedReader input = null;
- StringBuilder foundContent = new StringBuilder();
- try {
- input = new BufferedReader(new InputStreamReader(url.openStream()));
- String line;
- while((line = input.readLine()) != null) {
- foundContent.append(line);
- }
- } finally {
- if (input != null) {
- input.close();
- }
- }
- assertTrue(foundContent.toString().contains(A4JMediaOutputBean.PLAIN_TEXT));
+ assertTrue(
+ getTextContentByUrlAttribute(MEDIA_OUTPUT.getAttribute(Attribute.DATA)).toString().contains(A4JMediaOutputBean.PLAIN_TEXT),
+ "The plain text content doesn't match."
+ );
}
}
13 years, 3 months