JBoss Rich Faces SVN: r17901 - in root/tests/metamer/trunk/ftest/test-source/src/main/java/org: jboss and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-07-10 17:09:23 -0400 (Sat, 10 Jul 2010)
New Revision: 17901
Added:
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/jboss/
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/jboss/test/
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/jboss/test/selenium/
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/jboss/test/selenium/javascript/
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/jboss/test/selenium/javascript/JavaScriptEvaluator.java
Log:
JavaScriptEvaluator - simplifies manipulation with results of evaluated JavaScript
Added: root/tests/metamer/trunk/ftest/test-source/src/main/java/org/jboss/test/selenium/javascript/JavaScriptEvaluator.java
===================================================================
--- root/tests/metamer/trunk/ftest/test-source/src/main/java/org/jboss/test/selenium/javascript/JavaScriptEvaluator.java (rev 0)
+++ root/tests/metamer/trunk/ftest/test-source/src/main/java/org/jboss/test/selenium/javascript/JavaScriptEvaluator.java 2010-07-10 21:09:23 UTC (rev 17901)
@@ -0,0 +1,131 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.selenium.javascript;
+
+import org.jboss.test.selenium.encapsulated.JavaScript;
+import org.jboss.test.selenium.framework.AjaxSelenium;
+import org.jboss.test.selenium.framework.AjaxSeleniumProxy;
+import org.jboss.test.selenium.waiting.conversion.Convertor;
+
+import static org.jboss.test.selenium.utils.PrimitiveUtils.*;
+
+/**
+ * Simplifies manipulation with results of evaluated JavaScript.
+ *
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public final class JavaScriptEvaluator {
+
+ private static final AjaxSelenium SELENIUM = AjaxSeleniumProxy.getInstance();
+
+ private JavaScriptEvaluator() {
+ }
+
+ /**
+ * Returns the evaluated JavaScript result.
+ *
+ * @param script
+ * to evaluate
+ * @return the evaluated JavaScript result.
+ */
+ public static String evaluateString(JavaScript script) {
+ return checkNull(SELENIUM.getEval(script));
+ }
+
+ /**
+ * Returns the evaluated JavaScript result as Boolean.
+ *
+ * @param script
+ * to evaluate
+ * @return the evaluated JavaScript result as Boolean.
+ */
+ public static Boolean evaluateBoolean(JavaScript script) {
+ return asBoolean(checkNull(SELENIUM.getEval(script)));
+ }
+
+ /**
+ * Returns the evaluated JavaScript result as Float.
+ *
+ * @param script
+ * to evaluate
+ * @return the evaluated JavaScript result as Float.
+ */
+ public static Float evaluateFloat(JavaScript script) {
+ return asFloat(checkNull(SELENIUM.getEval(script)));
+ }
+
+ /**
+ * Returns the evaluated JavaScript result as Double.
+ *
+ * @param script
+ * to evaluate
+ * @return the evaluated JavaScript result as Double.
+ */
+ public static Double evaluateDouble(JavaScript script) {
+ return asDouble(checkNull(SELENIUM.getEval(script)));
+ }
+
+ /**
+ * Returns the evaluated JavaScript result as Long.
+ *
+ * @param script
+ * to evaluate
+ * @return the evaluated JavaScript result as Long.
+ */
+ public static Long evaluateLong(JavaScript script) {
+ return asLong(checkNull(SELENIUM.getEval(script)));
+ }
+
+ /**
+ * Returns the evaluated JavaScript result as Integer.
+ *
+ * @param script
+ * to evaluate
+ * @return the evaluated JavaScript result as Integer.
+ */
+ public static Integer evaluateInteger(JavaScript script) {
+ return asInteger(checkNull(SELENIUM.getEval(script)));
+ }
+
+ /**
+ * Returns the evaluated JavaScript result converted to T by specified converter.
+ *
+ * @param script
+ * the script to evaluate
+ * @return the evaluated JavaScript result converted to T by specified converter.
+ */
+ public static <T> T evaluate(JavaScript script, Convertor<String, T> converter) {
+ String result = checkNull(SELENIUM.getEval(script));
+ if (result == null) {
+ return null;
+ }
+ return converter.forwardConversion(result);
+ }
+
+ private static String checkNull(String evaluatedResult) {
+ if ("null".equals(evaluatedResult) || "undefined".equals(evaluatedResult)) {
+ return null;
+ }
+ return evaluatedResult;
+ }
+}
14 years, 6 months
JBoss Rich Faces SVN: r17900 - root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jPoll.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-07-10 17:08:41 -0400 (Sat, 10 Jul 2010)
New Revision: 17900
Modified:
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jPoll/PollTestCase.java
Log:
Added logging for PollTestCase; added assertion on maximum particular deviation
Modified: root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jPoll/PollTestCase.java
===================================================================
--- root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jPoll/PollTestCase.java 2010-07-10 21:08:15 UTC (rev 17899)
+++ root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jPoll/PollTestCase.java 2010-07-10 21:08:41 UTC (rev 17900)
@@ -34,6 +34,7 @@
import static org.testng.Assert.*;
import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.*;
import static org.jboss.test.selenium.SystemProperties.isSeleniumDebug;
+import static org.jboss.test.selenium.utils.text.SimplifiedFormat.format;
/**
* @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
@@ -41,6 +42,9 @@
*/
public class PollTestCase extends AbstractTestappTestCase {
+ private final static int MAX_DEVIATION = 250;
+ private final static int MAX_AVERAGE_DEVIATION = 100;
+
ElementLocator attributeEnabled = id("form:attributes:enabledInput");
ElementLocator attributeInterval = id("form:attributes:intervalInput");
JQueryLocator time = pjq("span[id$=time]");
@@ -73,7 +77,11 @@
if (isSeleniumDebug()) {
System.out.println(time);
}
- total += Math.abs(interval - Math.abs(time));
+ long deviation = Math.abs(interval - Math.abs(time));
+ assertTrue(deviation <= MAX_DEVIATION, format(
+ "Particular deviation ({2}) for interval {0} was greater than {1}", interval, MAX_DEVIATION,
+ deviation));
+ total += deviation;
count += 1;
}
}
@@ -85,9 +93,11 @@
if (isSeleniumDebug()) {
System.out.println(total / count);
}
- // asserts that average deviation is not greater than 100
- assertTrue((total / count) <= 100);
+ long averageDeviation = (total / count);
+ assertTrue(averageDeviation <= MAX_AVERAGE_DEVIATION, format(
+ "Average deviation ({1}) was greater than given maximum {0}", MAX_AVERAGE_DEVIATION, averageDeviation));
+
}
}
14 years, 6 months
JBoss Rich Faces SVN: r17899 - root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jPoll.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-07-10 17:08:15 -0400 (Sat, 10 Jul 2010)
New Revision: 17899
Modified:
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jPoll/PollTestCase.java
Log:
added template provider to PollTestCase
Modified: root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jPoll/PollTestCase.java
===================================================================
--- root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jPoll/PollTestCase.java 2010-07-10 21:07:49 UTC (rev 17898)
+++ root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jPoll/PollTestCase.java 2010-07-10 21:08:15 UTC (rev 17899)
@@ -50,8 +50,8 @@
return buildUrl(contextPath, "faces/components/a4jPoll/simple.xhtml");
}
- @Test(groups = "client-side-perf")
- public void testPollInterval() {
+ @Test(dataProvider = "templates", groups = "client-side-perf")
+ public void testPollInterval(String templates) {
long total = 0;
long count = 0;
14 years, 6 months
JBoss Rich Faces SVN: r17898 - in root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp: a4jPoll and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-07-10 17:07:49 -0400 (Sat, 10 Jul 2010)
New Revision: 17898
Added:
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jPoll/
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jPoll/PollTestCase.java
Log:
added PollTestCase
Added: root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jPoll/PollTestCase.java
===================================================================
--- root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jPoll/PollTestCase.java (rev 0)
+++ root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jPoll/PollTestCase.java 2010-07-10 21:07:49 UTC (rev 17898)
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.testapp.a4jPoll;
+
+import java.net.URL;
+
+import org.jboss.test.selenium.dom.Event;
+import org.jboss.test.selenium.locator.ElementLocator;
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.richfaces.tests.testapp.AbstractTestappTestCase;
+import org.testng.annotations.Test;
+
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.jboss.test.selenium.locator.LocatorFactory.*;
+import static org.testng.Assert.*;
+import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.*;
+import static org.jboss.test.selenium.SystemProperties.isSeleniumDebug;
+
+/**
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public class PollTestCase extends AbstractTestappTestCase {
+
+ ElementLocator attributeEnabled = id("form:attributes:enabledInput");
+ ElementLocator attributeInterval = id("form:attributes:intervalInput");
+ JQueryLocator time = pjq("span[id$=time]");
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/a4jPoll/simple.xhtml");
+ }
+
+ @Test(groups = "client-side-perf")
+ public void testPollInterval() {
+
+ long total = 0;
+ long count = 0;
+ for (int interval : new Integer[]{1000, 5000, 500}) {
+ selenium.type(attributeInterval, String.valueOf(interval));
+ waitHttp(selenium).fireEvent(attributeInterval, Event.BLUR);
+
+ selenium.check(attributeEnabled);
+ waitHttp(selenium).fireEvent(attributeEnabled, Event.CHANGE);
+
+ selenium.getPageExtensions().install();
+
+ for (int i = 0; i <= 5; i++) {
+ long time = System.currentTimeMillis();
+ selenium.getRequestInterceptor().clearRequestTypeDone();
+ selenium.getRequestInterceptor().waitForRequestTypeChange();
+ time -= System.currentTimeMillis();
+ if (i > 0) {
+ if (isSeleniumDebug()) {
+ System.out.println(time);
+ }
+ total += Math.abs(interval - Math.abs(time));
+ count += 1;
+ }
+ }
+
+ selenium.uncheck(attributeEnabled);
+ guardHttp(selenium).fireEvent(attributeEnabled, Event.CHANGE);
+ }
+
+ if (isSeleniumDebug()) {
+ System.out.println(total / count);
+ }
+ // asserts that average deviation is not greater than 100
+ assertTrue((total / count) <= 100);
+
+ }
+
+}
14 years, 6 months
JBoss Rich Faces SVN: r17897 - in root/tests/metamer/trunk/ftest: test-source and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-07-10 17:06:54 -0400 (Sat, 10 Jul 2010)
New Revision: 17897
Added:
root/tests/metamer/trunk/ftest/.gitignore
root/tests/metamer/trunk/ftest/test-source/.gitignore
Log:
created .gitignore according to svn:ignore
Added: root/tests/metamer/trunk/ftest/.gitignore
===================================================================
--- root/tests/metamer/trunk/ftest/.gitignore (rev 0)
+++ root/tests/metamer/trunk/ftest/.gitignore 2010-07-10 21:06:54 UTC (rev 17897)
@@ -0,0 +1,5 @@
+/.classpath
+/.project
+/.settings
+/target
+/profiles.xml
Added: root/tests/metamer/trunk/ftest/test-source/.gitignore
===================================================================
--- root/tests/metamer/trunk/ftest/test-source/.gitignore (rev 0)
+++ root/tests/metamer/trunk/ftest/test-source/.gitignore 2010-07-10 21:06:54 UTC (rev 17897)
@@ -0,0 +1,5 @@
+/.classpath
+/.project
+/.settings
+/target
+/profiles.xml
14 years, 6 months
JBoss Rich Faces SVN: r17896 - in root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp: a4jOutputPanel and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-07-10 17:06:33 -0400 (Sat, 10 Jul 2010)
New Revision: 17896
Added:
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jOutputPanel/
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jOutputPanel/A4JOutputPanelTestCase.java
Modified:
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/AbstractTestappTestCase.java
Log:
RFPL-466
* added test case for a4j:outputPanel
* method testFireEvent refactored
* added methods for hiding and showing controls on page
Modified: root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/AbstractTestappTestCase.java
===================================================================
--- root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/AbstractTestappTestCase.java 2010-07-10 21:04:35 UTC (rev 17895)
+++ root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/AbstractTestappTestCase.java 2010-07-10 21:06:33 UTC (rev 17896)
@@ -29,6 +29,7 @@
import org.jboss.test.selenium.AbstractTestCase;
import org.jboss.test.selenium.dom.Event;
+import org.jboss.test.selenium.encapsulated.JavaScript;
import org.jboss.test.selenium.locator.ElementLocator;
import org.jboss.test.selenium.locator.JQueryLocator;
import org.testng.SkipException;
@@ -164,7 +165,6 @@
final String value = "alert('" + event.getEventName() + "')";
selenium.type(eventInput, value);
- selenium.fireEvent(eventInput, Event.BLUR);
selenium.waitForPageToLoad(TIMEOUT);
selenium.fireEvent(element, event);
@@ -172,5 +172,19 @@
assertEquals(selenium.getAlert(), event.getEventName(), event.getEventName()
+ " attribute did not change correctly");
}
+
+ /**
+ * Hides header, footer and inputs for attributes.
+ */
+ protected void hideControls() {
+ selenium.getEval(new JavaScript("window.hideControls()"));
+ }
+
+ /**
+ * Shows header, footer and inputs for attributes.
+ */
+ protected void showControls() {
+ selenium.getEval(new JavaScript("window.showControls()"));
+ }
}
Added: root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jOutputPanel/A4JOutputPanelTestCase.java
===================================================================
--- root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jOutputPanel/A4JOutputPanelTestCase.java (rev 0)
+++ root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jOutputPanel/A4JOutputPanelTestCase.java 2010-07-10 21:06:33 UTC (rev 17896)
@@ -0,0 +1,307 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *******************************************************************************/
+
+package org.richfaces.tests.testapp.a4jOutputPanel;
+
+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;
+import static org.testng.Assert.assertTrue;
+
+import java.net.URL;
+
+import org.jboss.test.selenium.dom.Event;
+import org.jboss.test.selenium.locator.Attribute;
+import org.jboss.test.selenium.locator.AttributeLocator;
+import org.jboss.test.selenium.locator.ElementLocator;
+import org.richfaces.tests.testapp.AbstractTestappTestCase;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/**
+ * Test case for page /faces/components/a4jOutputPanel/simple.xhtml
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public class A4JOutputPanelTestCase extends AbstractTestappTestCase {
+
+ private ElementLocator increaseCounterButton = pjq("input[id$=button]");
+ private ElementLocator outputDiv = pjq("div[id$=outputPanel]");
+ private ElementLocator outputSpan = pjq("span[id$=outputPanel]");
+ private ElementLocator optionBlue = pjq("input[name$=styleClassInput][value=blue-background]");
+ private ElementLocator optionGray = pjq("input[name$=styleClassInput][value=gray-background]");
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/a4jOutputPanel/simple.xhtml");
+ }
+
+ @Override
+ @AfterMethod(alwaysRun = true)
+ public void invalidateSession() {
+ super.invalidateSession();
+ }
+
+ /**
+ * Data provider for templates, events and layout of output panel.
+ *
+ * @return array containing templates that should be used (defined in testng.xml) or default array (containing only
+ * plain template) if nothing is defined, JavaScript events that are defined for output panel and layout of
+ * panel (block or inline)
+ */
+ @DataProvider(name = "templatesEventsLayouts")
+ private Object[][] getTemplatesEventsLayouts() {
+ final int layoutsCount = 2;
+ // list of templates, e.g. {{"plain"}, {"richDataTable1,redDiv"}}
+ Object[][] templates = getTemplates();
+ // list of events that will be tested
+ Event[] events = new Event[]{Event.CLICK, Event.DBLCLICK, Event.KEYDOWN, Event.KEYPRESS, Event.KEYUP,
+ Event.MOUSEDOWN, Event.MOUSEMOVE, Event.MOUSEOUT, Event.MOUSEOVER, Event.MOUSEUP};
+
+ Object[][] result = new Object[templates.length * events.length * layoutsCount][];
+ int index = 0;
+
+ for (int i = 0; i < templates.length; i++) {
+ for (int j = 0; j < events.length; j++) {
+ for (int k = 0; k < layoutsCount; k++) {
+ index = i * events.length * layoutsCount + j * layoutsCount + k;
+ result[index] = new Object[]{templates[i][0], events[j], k == 0 ? "block" : "inline"};
+ }
+ }
+ }
+
+ return result;
+ }
+
+ @Test(dataProvider = "templatesEventsLayouts")
+ public void testEvent(String templates, Event event, String type) {
+ ElementLocator element = null;
+
+ if ("inline".equals(type)) {
+ // for inline layout set background to blue
+ selenium.click(pjq("input[name$=layoutInput][value=inline]"));
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ selenium.click(optionBlue);
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ element = outputSpan;
+ } else {
+ // for inline layout set background to gray
+ selenium.click(optionGray);
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ element = outputDiv;
+ }
+
+ testFireEvent(event, element);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testClick(String templates) {
+ selenium.click(increaseCounterButton);
+ waitGui.until(textEquals.locator(outputDiv).text("1"));
+
+ selenium.click(increaseCounterButton);
+ waitGui.until(textEquals.locator(outputDiv).text("2"));
+ }
+
+ @Test(dataProvider = "templates")
+ public void testAjaxRendered(String templates) {
+ ElementLocator ajaxRenderedCheckbox = pjq("input[id$=ajaxRenderedInput]");
+ ElementLocator reRenderAllImage = jq("div.header img[id$=reRenderAllImage]");
+
+ selenium.click(ajaxRenderedCheckbox);
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ selenium.click(increaseCounterButton);
+ selenium.click(increaseCounterButton);
+
+ String output = selenium.getText(outputDiv);
+ assertEquals(output, "0", "Output after two clicks when ajaxRendered is set to false.");
+
+ selenium.click(reRenderAllImage);
+ waitGui.until(textEquals.locator(outputDiv).text("2"));
+ }
+
+ @Test(dataProvider = "templates")
+ public void testDir(String templates) {
+ ElementLocator optionLtr = pjq("input[name$=dirInput][value=ltr]");
+ ElementLocator optionRtl = pjq("input[name$=dirInput][value=rtl]");
+ ElementLocator optionNone = pjq("input[name$=dirInput][value=]");
+ AttributeLocator attributeDir = outputDiv.getAttribute(new Attribute("dir"));
+
+ // right-to-left
+ selenium.click(optionRtl);
+ selenium.waitForPageToLoad(TIMEOUT);
+ String attributeValue = selenium.getAttribute(attributeDir);
+ assertEquals(attributeValue, "rtl", "Attribute dir after rtl was set.");
+
+ // left-to-right
+ selenium.click(optionLtr);
+ selenium.waitForPageToLoad(TIMEOUT);
+ attributeValue = selenium.getAttribute(attributeDir);
+ assertEquals(attributeValue, "ltr", "Attribute dir after ltr was set.");
+
+ // not specified
+ selenium.click(optionNone);
+ selenium.waitForPageToLoad(TIMEOUT);
+ if (selenium.isAttributePresent(attributeDir)) {
+ attributeValue = selenium.getAttribute(attributeDir);
+ assertEquals(attributeValue, "", "Attribute dir after none was set.");
+ }
+ }
+
+ @Test(dataProvider = "templates")
+ public void testLang(String templates) {
+ ElementLocator langInput = pjq("input[id$=langInput]");
+ AttributeLocator attributeLang = outputDiv.getAttribute(new Attribute("lang"));
+
+ selenium.typeKeys(langInput, "en");
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ String attributeValue = selenium.getAttribute(attributeLang);
+ assertEquals(attributeValue, "en", "Lang attribute");
+
+ selenium.typeKeys(langInput, "sk");
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ attributeValue = selenium.getAttribute(attributeLang);
+ assertEquals(attributeValue, "sk", "Lang attribute");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testLayout(String templates) {
+ ElementLocator optionBlock = pjq("input[name$=layoutInput][value=block]");
+ ElementLocator optionInline = pjq("input[name$=layoutInput][value=inline]");
+ ElementLocator optionNone = pjq("input[name$=layoutInput][value=none]");
+
+ assertTrue(selenium.isElementPresent(outputDiv), "Div should be rendered on the beginning.");
+ assertFalse(selenium.isElementPresent(outputSpan), "Div should be rendered on the beginning.");
+
+ selenium.click(optionInline);
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertFalse(selenium.isElementPresent(outputDiv), "Span should be rendered when inline is set.");
+ assertTrue(selenium.isElementPresent(outputSpan), "Span should be rendered when inline is set.");
+
+ selenium.click(optionBlock);
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertTrue(selenium.isElementPresent(outputDiv), "Div should be rendered when block is set.");
+ assertFalse(selenium.isElementPresent(outputSpan), "Div should be rendered when block is set.");
+
+ selenium.click(optionNone);
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertFalse(selenium.isElementPresent(outputDiv), "Span should be rendered when none is set.");
+ assertTrue(selenium.isElementPresent(outputSpan), "Span should be rendered when none is set.");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testRendered(String templates) {
+ ElementLocator renderedInput = pjq("input[id$=renderedInput]");
+
+ selenium.click(renderedInput);
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertFalse(selenium.isElementPresent(outputDiv), "Panel should not be rendered.");
+
+ selenium.click(increaseCounterButton);
+ selenium.click(increaseCounterButton);
+
+ selenium.click(renderedInput);
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertTrue(selenium.isElementPresent(outputDiv), "Panel should be rendered.");
+
+ String counter = selenium.getText(outputDiv);
+ assertEquals(counter, "2", "Counter after two clicks on button.");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testStyle(String templates) {
+ String style = "background-color: magenta; color: white; font-weight: bold;";
+ ElementLocator styleInput = pjq("input[id$=styleInput]");
+ AttributeLocator attributeStyle = outputDiv.getAttribute(Attribute.STYLE);
+
+ selenium.typeKeys(styleInput, style);
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ String attributeValue = selenium.getAttribute(attributeStyle);
+ assertEquals(attributeValue, style, "Value of attribute style.");
+
+ selenium.typeKeys(styleInput, "");
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ if (selenium.isAttributePresent(attributeStyle)) {
+ attributeValue = selenium.getAttribute(attributeStyle);
+ assertEquals(attributeValue, "", "Value of attribute style.");
+ }
+ }
+
+ @Test(dataProvider = "templates")
+ public void testStyleClass(String templates) {
+ ElementLocator optionNone = pjq("input[name$=styleClassInput][value=]");
+ AttributeLocator attributeClass = outputDiv.getAttribute(Attribute.CLASS);
+
+ selenium.click(optionBlue);
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertTrue(selenium.belongsClass(outputDiv, "blue-background"), "Panel should have class blue-background set.");
+ assertFalse(selenium.belongsClass(outputDiv, "gray-background"),
+ "Panel should not have class gray-background set.");
+
+ selenium.click(optionGray);
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertTrue(selenium.belongsClass(outputDiv, "gray-background"), "Panel should have class gray-background set.");
+ assertFalse(selenium.belongsClass(outputDiv, "blue-background"),
+ "Panel should not have class blue-background set.");
+
+ selenium.click(optionNone);
+ selenium.waitForPageToLoad(TIMEOUT);
+ if (selenium.isAttributePresent(attributeClass)) {
+ assertFalse(selenium.belongsClass(outputDiv, "blue-background"),
+ "Panel should not have class blue-background set.");
+ assertFalse(selenium.belongsClass(outputDiv, "gray-background"),
+ "Panel should not have class gray-background set.");
+ }
+ }
+
+ @Test(dataProvider = "templates")
+ public void testTitle(String templates) {
+ String title = "a4j:outputPanel title";
+ ElementLocator titleInput = pjq("input[id$=titleInput]");
+ AttributeLocator attributeTitle = outputDiv.getAttribute(new Attribute("title"));
+
+ selenium.typeKeys(titleInput, title);
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ String attributeValue = selenium.getAttribute(attributeTitle);
+ assertEquals(attributeValue, title, "Value of attribute title.");
+
+ selenium.typeKeys(titleInput, "");
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ if (selenium.isAttributePresent(attributeTitle)) {
+ attributeValue = selenium.getAttribute(attributeTitle);
+ assertEquals(attributeValue, "", "Value of attribute style.");
+ }
+ }
+}
14 years, 6 months
JBoss Rich Faces SVN: r17895 - in root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp: a4jLog and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-07-10 17:04:35 -0400 (Sat, 10 Jul 2010)
New Revision: 17895
Modified:
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/AbstractTestappTestCase.java
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jLog/A4JLogTestCase.java
Log:
RFPL-466
* added one more check into tests
* method invalidateSession refactored
Modified: root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/AbstractTestappTestCase.java
===================================================================
--- root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/AbstractTestappTestCase.java 2010-07-10 21:04:01 UTC (rev 17894)
+++ root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/AbstractTestappTestCase.java 2010-07-10 21:04:35 UTC (rev 17895)
@@ -118,9 +118,7 @@
* Invalidates session by clicking on a button on tested page.
*/
public void invalidateSession() {
- JQueryLocator invalidateButton = new JQueryLocator("input[value=Invalidate Session]");
- selenium.click(invalidateButton);
- selenium.waitForPageToLoad(TIMEOUT);
+ selenium.deleteAllVisibleCookies();
}
/**
Modified: root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jLog/A4JLogTestCase.java
===================================================================
--- root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jLog/A4JLogTestCase.java 2010-07-10 21:04:01 UTC (rev 17894)
+++ root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jLog/A4JLogTestCase.java 2010-07-10 21:04:35 UTC (rev 17895)
@@ -22,17 +22,14 @@
package org.richfaces.tests.testapp.a4jLog;
+import static org.jboss.test.selenium.locator.LocatorFactory.jq;
import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
-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 java.net.URL;
-import org.jboss.test.selenium.dom.Event;
-import org.jboss.test.selenium.locator.Attribute;
-import org.jboss.test.selenium.locator.AttributeLocator;
import org.jboss.test.selenium.locator.ElementLocator;
import org.jboss.test.selenium.locator.JQueryLocator;
import org.richfaces.tests.testapp.AbstractTestappTestCase;
@@ -213,6 +210,9 @@
selenium.click(levelInput);
selenium.waitForPageToLoad(TIMEOUT);
}
+
+ String selectedLevel = selenium.getSelectedLabel(levelSelect);
+ assertEquals(selectedLevel, filterLevel.toString().toLowerCase(), "Log level in select wasn't changed.");
selenium.typeKeys(input, logLevel.toString());
selenium.click(logButton);
@@ -224,7 +224,7 @@
if (count == 0) {
return;
}
-
+
String output = selenium.getText(msgType).replaceAll("\\[.*\\]:$", "");
assertEquals(output, logLevel.toString().toLowerCase(), "Message type in log.");
output = selenium.getText(msgContent);
14 years, 6 months
JBoss Rich Faces SVN: r17894 - root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/richExtendedDataTable.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-07-10 17:04:01 -0400 (Sat, 10 Jul 2010)
New Revision: 17894
Modified:
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/richExtendedDataTable/DataScroller.java
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/richExtendedDataTable/DataTable.java
Log:
following changes in library
Modified: root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/richExtendedDataTable/DataScroller.java
===================================================================
--- root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/richExtendedDataTable/DataScroller.java 2010-07-10 21:02:49 UTC (rev 17893)
+++ root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/richExtendedDataTable/DataScroller.java 2010-07-10 21:04:01 UTC (rev 17894)
@@ -22,10 +22,11 @@
package org.richfaces.tests.testapp.richExtendedDataTable;
+import org.jboss.test.selenium.framework.AjaxSelenium;
+import org.jboss.test.selenium.framework.AjaxSeleniumProxy;
import org.jboss.test.selenium.locator.JQueryLocator;
import static org.jboss.test.selenium.locator.LocatorFactory.*;
-import static org.jboss.test.selenium.framework.AjaxSelenium.getCurrentSelenium;
import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.*;
/**
@@ -33,6 +34,9 @@
* @version $Revision$
*/
public class DataScroller {
+
+ AjaxSelenium selenium = AjaxSeleniumProxy.getInstance();
+
JQueryLocator scrollerRoot;
JQueryLocator pageNumbers = jq(".rf-ds-dtl");
JQueryLocator firstPageButton = jq(".rf-ds-l[id$=ds_f]");
@@ -62,22 +66,22 @@
public void clickLastPageButton() {
JQueryLocator locator = scrollerRoot.getDescendant(lastPageButton);
- guardXhr(getCurrentSelenium()).click(locator);
+ guardXhr(selenium).click(locator);
}
public void clickFirstPageButton() {
JQueryLocator locator = scrollerRoot.getDescendant(firstPageButton);
- guardXhr(getCurrentSelenium()).click(locator);
+ guardXhr(selenium).click(locator);
}
public int getCountOfVisiblePages() {
JQueryLocator locator = scrollerRoot.getDescendant(pageNumbers);
- return getCurrentSelenium().getCount(locator);
+ return selenium.getCount(locator);
}
public boolean hasPages() {
JQueryLocator locator = scrollerRoot.getDescendant(lastVisiblePage);
- return getCurrentSelenium().isElementPresent(locator);
+ return selenium.isElementPresent(locator);
}
public Integer getLastVisiblePage() {
@@ -85,7 +89,7 @@
if (!hasPages()) {
return null;
}
- return integer(getCurrentSelenium().getText(locator));
+ return integer(selenium.getText(locator));
}
public int getCurrentPage() {
@@ -93,7 +97,7 @@
if (!hasPages()) {
return 1;
}
- return integer(getCurrentSelenium().getText(locator));
+ return integer(selenium.getText(locator));
}
public boolean isFirstPage() {
Modified: root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/richExtendedDataTable/DataTable.java
===================================================================
--- root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/richExtendedDataTable/DataTable.java 2010-07-10 21:02:49 UTC (rev 17893)
+++ root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/richExtendedDataTable/DataTable.java 2010-07-10 21:04:01 UTC (rev 17894)
@@ -22,16 +22,20 @@
package org.richfaces.tests.testapp.richExtendedDataTable;
+import org.jboss.test.selenium.framework.AjaxSelenium;
+import org.jboss.test.selenium.framework.AjaxSeleniumProxy;
import org.jboss.test.selenium.locator.JQueryLocator;
import static org.jboss.test.selenium.locator.LocatorFactory.*;
-import static org.jboss.test.selenium.framework.AjaxSelenium.getCurrentSelenium;
/**
* @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
* @version $Revision$
*/
public class DataTable {
+
+ AjaxSelenium selenium = AjaxSeleniumProxy.getInstance();
+
JQueryLocator tableRoot;
JQueryLocator tableRows = jq(".rf-dt-c:nth-child(1)");
@@ -42,11 +46,10 @@
public int getCountOfTableRows() {
JQueryLocator locator = tableRoot.getDescendant(tableRows);
- return getCurrentSelenium().getCount(locator);
-
+ return selenium.getCount(locator);
}
- public static int integer(String string) {
- return Integer.valueOf(string);
+ public String getTableText() {
+ return selenium.getText(tableRoot);
}
}
14 years, 6 months
JBoss Rich Faces SVN: r17893 - in root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp: a4jCommandButton and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-07-10 17:02:49 -0400 (Sat, 10 Jul 2010)
New Revision: 17893
Added:
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jLog/
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jLog/A4JLogTestCase.java
Modified:
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jCommandButton/A4JCommandButtonTestCase.java
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jCommandLink/A4JCommandLinkTestCase.java
Log:
https://jira.jboss.org/browse/RFPL-466
* added tests for a4j:log
* 2 tests (for button and link) uncommented
Modified: root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jCommandButton/A4JCommandButtonTestCase.java
===================================================================
--- root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jCommandButton/A4JCommandButtonTestCase.java 2010-07-10 21:02:09 UTC (rev 17892)
+++ root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jCommandButton/A4JCommandButtonTestCase.java 2010-07-10 21:02:49 UTC (rev 17893)
@@ -62,7 +62,7 @@
super.invalidateSession();
}
- // @Test(dataProvider = "templates", groups = "client-side-perf")
+ @Test(dataProvider = "templates", groups = "client-side-perf")
public void testSimpleClick(String templates) {
selenium.typeKeys(input, "RichFaces 4");
selenium.click(button);
Modified: root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jCommandLink/A4JCommandLinkTestCase.java
===================================================================
--- root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jCommandLink/A4JCommandLinkTestCase.java 2010-07-10 21:02:09 UTC (rev 17892)
+++ root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jCommandLink/A4JCommandLinkTestCase.java 2010-07-10 21:02:49 UTC (rev 17893)
@@ -62,7 +62,7 @@
super.invalidateSession();
}
- // @Test(dataProvider = "templates", groups = "client-side-perf")
+ @Test(dataProvider = "templates", groups = "client-side-perf")
public void testSimpleClick(String templates) {
selenium.typeKeys(input, "RichFaces 4");
selenium.click(link);
Added: root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jLog/A4JLogTestCase.java
===================================================================
--- root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jLog/A4JLogTestCase.java (rev 0)
+++ root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jLog/A4JLogTestCase.java 2010-07-10 21:02:49 UTC (rev 17893)
@@ -0,0 +1,234 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *******************************************************************************/
+
+package org.richfaces.tests.testapp.a4jLog;
+
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+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 java.net.URL;
+
+import org.jboss.test.selenium.dom.Event;
+import org.jboss.test.selenium.locator.Attribute;
+import org.jboss.test.selenium.locator.AttributeLocator;
+import org.jboss.test.selenium.locator.ElementLocator;
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.richfaces.tests.testapp.AbstractTestappTestCase;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.Test;
+
+/**
+ * Test case for page /faces/components/a4jLog/simple.xhtml
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public class A4JLogTestCase extends AbstractTestappTestCase {
+
+ /**
+ * Enumeration representing all possible levels for a4j:log.
+ */
+ public enum LogLevel {
+ DEBUG, INFO, WARN, ERROR;
+ }
+
+ private ElementLocator input = pjq("input[id$=nameInput]");
+ private ElementLocator submitButton = pjq("input[id$=submitButton]");
+ private ElementLocator output = pjq("span[id$=out]");
+
+ private ElementLocator log = pjq("div.rich-log");
+ private ElementLocator levelSelect = pjq("div.rich-log select");
+ private JQueryLocator logMsg = pjq("div.rich-log div.rich-log-contents div");
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/a4jLog/simple.xhtml");
+ }
+
+ @Override
+ @AfterMethod(alwaysRun = true)
+ public void invalidateSession() {
+ super.invalidateSession();
+ }
+
+ @Test(dataProvider = "templates")
+ public void testSubmit(String templates) {
+ selenium.typeKeys(input, "RichFaces 4");
+ selenium.click(submitButton);
+
+ waitGui.until(textEquals.locator(output).text("Hello RichFaces 4!"));
+
+ int count = selenium.getCount(logMsg);
+ assertTrue(count > 0, "There should be at least one message in log after submit button was clicked.");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testSubmitUnicode(String templates) {
+ selenium.typeKeys(input, "ľščťžýáíéôúäň");
+ selenium.click(submitButton);
+
+ waitGui.until(textEquals.locator(output).text("Hello ľščťžýáíéôúäň!"));
+
+ int count = selenium.getCount(logMsg);
+ assertTrue(count > 0, "There should be at least one message in log after submit button was clicked.");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testClearButton(String templates) {
+ ElementLocator clearButton = pjq("div.rich-log button");
+
+ selenium.typeKeys(input, "RichFaces 4");
+ selenium.click(submitButton);
+
+ waitGui.until(textEquals.locator(output).text("Hello RichFaces 4!"));
+
+ int count = selenium.getCount(logMsg);
+ assertTrue(count > 0, "There should be at least one message in log after submit button was clicked.");
+
+ // test clear
+ selenium.click(clearButton);
+ count = selenium.getCount(logMsg);
+ assertEquals(count, 0, "There should be no messages in log after clear button was clicked.");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testRendered(String templates) {
+ ElementLocator renderedInput = pjq("input[id$=renderedInput]");
+
+ selenium.click(renderedInput);
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ assertFalse(selenium.isElementPresent(log), "Log should not be displayed.");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testDebugFilterDebug(String templates) {
+ testLogging(LogLevel.DEBUG, LogLevel.DEBUG);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testDebugFilterInfo(String templates) {
+ testLogging(LogLevel.DEBUG, LogLevel.INFO);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testDebugFilterWarn(String templates) {
+ testLogging(LogLevel.DEBUG, LogLevel.WARN);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testDebugFilterError(String templates) {
+ testLogging(LogLevel.DEBUG, LogLevel.ERROR);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testInfoFilterDebug(String templates) {
+ testLogging(LogLevel.INFO, LogLevel.DEBUG);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testInfoFilterInfo(String templates) {
+ testLogging(LogLevel.INFO, LogLevel.INFO);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testInfoFilterWarn(String templates) {
+ testLogging(LogLevel.INFO, LogLevel.WARN);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testInfoFilterError(String templates) {
+ testLogging(LogLevel.INFO, LogLevel.ERROR);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testWarnFilterDebug(String templates) {
+ testLogging(LogLevel.WARN, LogLevel.DEBUG);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testWarnFilterInfo(String templates) {
+ testLogging(LogLevel.WARN, LogLevel.INFO);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testWarnFilterWarn(String templates) {
+ testLogging(LogLevel.WARN, LogLevel.WARN);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testWarnFilterError(String templates) {
+ testLogging(LogLevel.WARN, LogLevel.ERROR);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testErrorFilterDebug(String templates) {
+ testLogging(LogLevel.ERROR, LogLevel.DEBUG);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testErrorFilterInfo(String templates) {
+ testLogging(LogLevel.ERROR, LogLevel.INFO);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testErrorFilterWarn(String templates) {
+ testLogging(LogLevel.ERROR, LogLevel.WARN);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testErrorFilterError(String templates) {
+ testLogging(LogLevel.ERROR, LogLevel.ERROR);
+ }
+
+ private void testLogging(LogLevel logLevel, LogLevel filterLevel) {
+ ElementLocator logButton = pjq("input[id$=" + logLevel.toString().toLowerCase() + "Button]");
+ ElementLocator levelInput = pjq("input[type=radio][value=" + filterLevel.toString().toLowerCase() + "]");
+ ElementLocator msgType = logMsg.getChild(jq("span:eq(0)"));
+ ElementLocator msgContent = logMsg.getChild(jq("span:eq(1)"));
+
+ if (filterLevel != LogLevel.DEBUG) {
+ selenium.click(levelInput);
+ selenium.waitForPageToLoad(TIMEOUT);
+ }
+
+ selenium.typeKeys(input, logLevel.toString());
+ selenium.click(logButton);
+
+ int count = selenium.getCount(logMsg);
+ assertEquals(count, filterLevel.ordinal() <= logLevel.ordinal() ? 1 : 0,
+ "There should be only one message in log.");
+
+ if (count == 0) {
+ return;
+ }
+
+ String output = selenium.getText(msgType).replaceAll("\\[.*\\]:$", "");
+ assertEquals(output, logLevel.toString().toLowerCase(), "Message type in log.");
+ output = selenium.getText(msgContent);
+ assertEquals(output, logLevel.toString(), "Message content.");
+
+ }
+}
14 years, 6 months
JBoss Rich Faces SVN: r17892 - root/tests/metamer/trunk/ftest.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-07-10 17:02:09 -0400 (Sat, 10 Jul 2010)
New Revision: 17892
Modified:
root/tests/metamer/trunk/ftest/pom.xml
Log:
added jboss repository (contains the parent for tests)
Modified: root/tests/metamer/trunk/ftest/pom.xml
===================================================================
--- root/tests/metamer/trunk/ftest/pom.xml 2010-07-10 21:01:56 UTC (rev 17891)
+++ root/tests/metamer/trunk/ftest/pom.xml 2010-07-10 21:02:09 UTC (rev 17892)
@@ -36,6 +36,10 @@
<id>download-java-net-glassfish</id>
<url>http://download.java.net/maven/glassfish</url>
</repository>
+ <repository>
+ <id>jboss-public-repository-group</id>
+ <url>https://repository.jboss.org/nexus/content/groups/public/</url>
+ </repository>
</repositories>
<dependencies>
14 years, 6 months