Author: ppitonak(a)redhat.com
Date: 2011-02-16 10:59:12 -0500 (Wed, 16 Feb 2011)
New Revision: 21704
Added:
modules/tests/metamer/trunk/application/src/main/webapp/components/richInputNumberSlider/fAjax.xhtml
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInputNumberSlider/AbstractSliderTest.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInputNumberSlider/TestRichSliderFAjax.java
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richInputNumberSlider/list.xhtml
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInputNumberSlider/TestRichSlider.java
Log:
added sample and tests for slide+f:ajax
Added:
modules/tests/metamer/trunk/application/src/main/webapp/components/richInputNumberSlider/fAjax.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richInputNumberSlider/fAjax.xhtml
(rev 0)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richInputNumberSlider/fAjax.xhtml 2011-02-16
15:59:12 UTC (rev 21704)
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:metamer="http://java.sun.com/jsf/composite/metamer"
xmlns:rich="http://richfaces.org/rich"
+
xmlns:h="http://java.sun.com/jsf/html">
+
+ <!--
+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.
+ -->
+
+ <ui:composition template="/templates/template.xhtml">
+
+ <ui:define name="head">
+ <f:metadata>
+ <f:viewParam name="templates"
value="#{templateBean.templates}">
+ <f:converter converterId="templatesListConverter" />
+ </f:viewParam>
+ </f:metadata>
+ </ui:define>
+
+ <ui:define name="outOfTemplateBefore">
+ </ui:define>
+
+ <ui:define name="component">
+ <rich:inputNumberSlider id="slider"
+
accesskey="#{richInputNumberSliderBean.attributes['accesskey'].value}"
+
decreaseClass="#{richInputNumberSliderBean.attributes['decreaseClass'].value}"
+
decreaseSelectedClass="#{richInputNumberSliderBean.attributes['decreaseSelectedClass'].value}"
+
delay="#{richInputNumberSliderBean.attributes['delay'].value}"
+
disabled="#{richInputNumberSliderBean.attributes['disabled'].value}"
+
enableManualInput="#{richInputNumberSliderBean.attributes['enableManualInput'].value}"
+
handleClass="#{richInputNumberSliderBean.attributes['handleClass'].value}"
+
handleSelectedClass="#{richInputNumberSliderBean.attributes['handleSelectedClass'].value}"
+
immediate="#{richInputNumberSliderBean.attributes['immediate'].value}"
+
increaseClass="#{richInputNumberSliderBean.attributes['increaseClass'].value}"
+
increaseSelectedClass="#{richInputNumberSliderBean.attributes['increaseSelectedClass'].value}"
+
inputClass="#{richInputNumberSliderBean.attributes['inputClass'].value}"
+
inputPosition="#{richInputNumberSliderBean.attributes['inputPosition'].value}"
+
inputSize="#{richInputNumberSliderBean.attributes['inputSize'].value}"
+
maxValue="#{richInputNumberSliderBean.attributes['maxValue'].value}"
+
maxlength="#{richInputNumberSliderBean.attributes['maxlength'].value}"
+
minValue="#{richInputNumberSliderBean.attributes['minValue'].value}"
+
onchange="#{richInputNumberSliderBean.attributes['onchange'].value}"
+
rendered="#{richInputNumberSliderBean.attributes['rendered'].value}"
+
showArrows="#{richInputNumberSliderBean.attributes['showArrows'].value}"
+
showBoundaryValues="#{richInputNumberSliderBean.attributes['showBoundaryValues'].value}"
+
showInput="#{richInputNumberSliderBean.attributes['showInput'].value}"
+
showTooltip="#{richInputNumberSliderBean.attributes['showTooltip'].value}"
+
step="#{richInputNumberSliderBean.attributes['step'].value}"
+
style="#{richInputNumberSliderBean.attributes['style'].value}"
+
styleClass="#{richInputNumberSliderBean.attributes['styleClass'].value}"
+
tabindex="#{richInputNumberSliderBean.attributes['tabindex'].value}"
+
tooltipClass="#{richInputNumberSliderBean.attributes['tooltipClass'].value}"
+
trackClass="#{richInputNumberSliderBean.attributes['trackClass'].value}"
+
value="#{richInputNumberSliderBean.attributes['value'].value}"
+
valueChangeListener="#{richBean.valueChangeListener}"
+ >
+
+ <f:ajax event="change" render="output
:phasesPanel"/>
+
+ </rich:inputNumberSlider>
+
+ <br/><br/>
+
+ output: <h:outputText id="output"
value="#{richInputNumberSliderBean.attributes['value'].value}"/>
+ </ui:define>
+
+ <ui:define name="outOfTemplateAfter">
+ <metamer:attributes
value="#{richInputNumberSliderBean.attributes}" id="attributes" />
+ </ui:define>
+
+ </ui:composition>
+</html>
\ No newline at end of file
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richInputNumberSlider/list.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richInputNumberSlider/list.xhtml 2011-02-16
15:58:24 UTC (rev 21703)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richInputNumberSlider/list.xhtml 2011-02-16
15:59:12 UTC (rev 21704)
@@ -32,9 +32,13 @@
<ui:define name="links">
<metamer:testPageLink id="simple" outcome="simple"
value="Simple">
- Page containing <b>rich:inputNumberSlider</b> and input boxes
for all its attributes.
+ Page containing <b>rich:inputNumberSlider</b> with a4j:ajax
and input boxes for all its attributes.
</metamer:testPageLink>
+ <metamer:testPageLink id="fAjax" outcome="fAjax"
value="f:ajax">
+ Page containing <b>rich:inputNumberSlider</b> with f:ajax and
input boxes for all its attributes.
+ </metamer:testPageLink>
+
</ui:define>
</ui:composition>
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInputNumberSlider/AbstractSliderTest.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInputNumberSlider/AbstractSliderTest.java
(rev 0)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInputNumberSlider/AbstractSliderTest.java 2011-02-16
15:59:12 UTC (rev 21704)
@@ -0,0 +1,170 @@
+/*******************************************************************************
+ * 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.richInputNumberSlider;
+
+import static
org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardNoRequest;
+import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardXhr;
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+
+import java.net.URL;
+
+import org.jboss.test.selenium.css.CssProperty;
+import org.jboss.test.selenium.encapsulated.JavaScript;
+import org.jboss.test.selenium.geometry.Point;
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
+import org.richfaces.tests.metamer.ftest.annotations.Inject;
+import org.richfaces.tests.metamer.ftest.annotations.Use;
+import org.testng.annotations.Test;
+
+/**
+ * Abstract test case for rich:inputNumberSlider.
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public abstract class AbstractSliderTest extends AbstractMetamerTest {
+
+ protected JQueryLocator slider = pjq("span[id$=slider]");
+ protected JQueryLocator input = pjq("input.rf-insl-inp");
+ protected JQueryLocator left = pjq("span.rf-insl-dec");
+ protected JQueryLocator right = pjq("span.rf-insl-inc");
+ protected JQueryLocator minBoundary = pjq("span.rf-insl-mn");
+ protected JQueryLocator maxBoundary = pjq("span.rf-insl-mx");
+ protected JQueryLocator track = pjq("span.rf-insl-trc");
+ protected JQueryLocator handle = pjq("span.rf-insl-hnd");
+ protected JQueryLocator tooltip = pjq("span.rf-insl-tt");
+ protected JQueryLocator output = pjq("span[id$=output]");
+ protected String[] correctNumbers = {"-10", "-5", "-1",
"0", "1", "5", "10"};
+ protected String[] smallNumbers = {"-11", "-15",
"-100"};
+ protected String[] bigNumbers = {"11", "15", "100"};
+ protected String[] decimalNumbers = {"1.4999", "5.6",
"7.0001", "-5.50001", "-9.9", "1.222e0",
"0e0", "-5.50001e0"};
+ @Inject
+ @Use(empty = true)
+ protected String number;
+ @Inject
+ @Use(empty = true)
+ protected Integer delay;
+ protected JavaScript clickLeft = new JavaScript("jQuery(\"" +
left.getRawLocator() + "\").mousedown().mouseup()");
+ protected JavaScript clickRight = new JavaScript("jQuery(\"" +
right.getRawLocator() + "\").mousedown().mouseup()");
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath,
"faces/components/richInputNumberSlider/simple.xhtml");
+ }
+
+ public void testTypeIntoInputCorrect() {
+ String reqTime = selenium.getText(time);
+ guardXhr(selenium).type(input, number);
+ waitGui.failWith("Page was not updated").waitForChange(reqTime,
retrieveText.locator(time));
+
+ assertEquals(selenium.getText(output), number, "Output was not
updated.");
+ }
+
+ public void testTypeIntoInputSmall() {
+ String reqTime = selenium.getText(time);
+ guardXhr(selenium).type(input, number);
+ waitGui.failWith("Page was not updated").waitForChange(reqTime,
retrieveText.locator(time));
+
+ assertEquals(selenium.getText(output), "-10", "Output was not
updated.");
+ assertEquals(selenium.getValue(input), "-10", "Input was not
updated.");
+ }
+
+ public void testTypeIntoInputBig() {
+ String reqTime = selenium.getText(time);
+ guardXhr(selenium).type(input, number);
+ waitGui.failWith("Page was not updated").waitForChange(reqTime,
retrieveText.locator(time));
+
+ assertEquals(selenium.getText(output), "10", "Output was not
updated.");
+ assertEquals(selenium.getValue(input), "10", "Input was not
updated.");
+ }
+
+ public void testTypeIntoInputDecimal() {
+ String reqTime = selenium.getText(time);
+ guardXhr(selenium).type(input, number);
+ waitGui.failWith("Page was not updated").waitForChange(reqTime,
retrieveText.locator(time));
+
+ Double newNumber = new Double(number);
+
+ assertEquals(selenium.getText(output), newNumber == 0 ? "0" :
newNumber.toString(), "Output was not updated.");
+ assertEquals(selenium.getValue(input), newNumber == 0 ? "0" :
newNumber.toString(), "Input was not updated.");
+ }
+
+ public void testTypeIntoInputNotNumber() {
+ guardNoRequest(selenium).type(input, "aaa");
+ assertEquals(selenium.getText(output), "2", "Output should not be
updated.");
+ assertEquals(selenium.getValue(input), "2", "Input should not be
updated.");
+ }
+
+ public void testClickLeft() {
+ selenium.type(pjq("input[type=text][id$=delayInput]"),
"500");
+ selenium.waitForPageToLoad();
+
selenium.click(pjq("input[type=radio][name$=showArrowsInput][value=true]"));
+ selenium.waitForPageToLoad();
+
+ selenium.runScript(clickLeft);
+ selenium.runScript(clickLeft);
+ selenium.runScript(clickLeft);
+ selenium.runScript(clickLeft);
+ waitGui.failWith("Output was not
updated.").until(textEquals.locator(output).text("-2"));
+ }
+
+ public void testClickRight() {
+ selenium.type(pjq("input[type=text][id$=delayInput]"),
"500");
+ selenium.waitForPageToLoad();
+
selenium.click(pjq("input[type=radio][name$=showArrowsInput][value=true]"));
+ selenium.waitForPageToLoad();
+
+ selenium.runScript(clickRight);
+ selenium.runScript(clickRight);
+ selenium.runScript(clickRight);
+ selenium.runScript(clickRight);
+ waitGui.failWith("Output was not
updated.").until(textEquals.locator(output).text("6"));
+ }
+
+ public void testClick() {
+ String reqTime = selenium.getText(time);
+ guardXhr(selenium).mouseDownAt(track, new Point(0, 0));
+ waitGui.failWith("Page was not updated").waitForChange(reqTime,
retrieveText.locator(time));
+ assertEquals(selenium.getText(output), "-10", "Output was not
updated.");
+ String margin = selenium.getStyle(handle,
CssProperty.MARGIN_LEFT).replace("px", "").trim();
+ assertEquals(Double.parseDouble(margin), 0d, "Left margin of
handle.");
+
+ reqTime = selenium.getText(time);
+ guardXhr(selenium).mouseDownAt(track, new Point(30, 0));
+ waitGui.failWith("Page was not updated").waitForChange(reqTime,
retrieveText.locator(time));
+ assertEquals(selenium.getText(output), "-7", "Output was not
updated.");
+ margin = selenium.getStyle(handle,
CssProperty.MARGIN_LEFT).replace("px", "").trim();
+ double marginD = Double.parseDouble(margin);
+ assertTrue(marginD > 25 && marginD < 30, "Left margin of
handle should be between 25 and 30.");
+
+ reqTime = selenium.getText(time);
+ guardXhr(selenium).mouseDownAt(track, new Point(195, 0));
+ waitGui.failWith("Page was not updated").waitForChange(reqTime,
retrieveText.locator(time));
+ assertEquals(selenium.getText(output), "10", "Output was not
updated.");
+ margin = selenium.getStyle(handle,
CssProperty.MARGIN_LEFT).replace("px", "").trim();
+ marginD = Double.parseDouble(margin);
+ assertTrue(marginD > 190 && marginD < 200, "Left margin of
handle should be between 190 and 200.");
+ }
+}
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInputNumberSlider/TestRichSlider.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInputNumberSlider/TestRichSlider.java 2011-02-16
15:58:24 UTC (rev 21703)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInputNumberSlider/TestRichSlider.java 2011-02-16
15:59:12 UTC (rev 21704)
@@ -22,7 +22,6 @@
package org.richfaces.tests.metamer.ftest.richInputNumberSlider;
import java.text.ParseException;
-import static
org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardNoRequest;
import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardXhr;
import static org.jboss.test.selenium.locator.option.OptionLocatorFactory.optionLabel;
import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
@@ -48,8 +47,6 @@
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.metamer.ftest.AbstractMetamerTest;
-import org.richfaces.tests.metamer.ftest.annotations.Inject;
import org.richfaces.tests.metamer.ftest.annotations.IssueTracking;
import org.richfaces.tests.metamer.ftest.annotations.Use;
import org.testng.annotations.Test;
@@ -60,153 +57,76 @@
* @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
* @version $Revision$
*/
-public class TestRichSlider extends AbstractMetamerTest {
+public class TestRichSlider extends AbstractSliderTest {
- private JQueryLocator slider = pjq("span[id$=slider]");
- private JQueryLocator input = pjq("input.rf-insl-inp");
- private JQueryLocator left = pjq("span.rf-insl-dec");
- private JQueryLocator right = pjq("span.rf-insl-inc");
- private JQueryLocator minBoundary = pjq("span.rf-insl-mn");
- private JQueryLocator maxBoundary = pjq("span.rf-insl-mx");
- private JQueryLocator track = pjq("span.rf-insl-trc");
- private JQueryLocator handle = pjq("span.rf-insl-hnd");
- private JQueryLocator tooltip = pjq("span.rf-insl-tt");
- private JQueryLocator output = pjq("span[id$=output]");
- private String[] correctNumbers = {"-10", "-5", "-1",
"0", "1", "5", "10"};
- private String[] smallNumbers = {"-11", "-15",
"-100"};
- private String[] bigNumbers = {"11", "15", "100"};
- private String[] decimalNumbers = {"1.4999", "5.6",
"7.0001", "-5.50001", "-9.9", "1.222e0",
"0e0", "-5.50001e0"};
- @Inject
- @Use(empty = true)
- private String number;
- @Inject
- @Use(empty = true)
- private Integer delay;
- private JavaScript clickLeft = new JavaScript("jQuery(\"" +
left.getRawLocator() + "\").mousedown().mouseup()");
- private JavaScript clickRight = new JavaScript("jQuery(\"" +
right.getRawLocator() + "\").mousedown().mouseup()");
-
@Override
public URL getTestUrl() {
return buildUrl(contextPath,
"faces/components/richInputNumberSlider/simple.xhtml");
}
@Test
- public void testInit() {
- assertTrue(selenium.isDisplayed(slider), "Slider is not present on the
page.");
- assertTrue(selenium.isDisplayed(input), "Slider's input is not present
on the page.");
- assertFalse(selenium.isElementPresent(left), "Slider's left arrow should
not be present on the page.");
- assertFalse(selenium.isElementPresent(right), "Slider's right arrow
should not be present on the page.");
- assertTrue(selenium.isDisplayed(minBoundary), "Slider's min value is not
present on the page.");
- assertTrue(selenium.isDisplayed(maxBoundary), "Slider's max value is not
present on the page.");
- assertTrue(selenium.isDisplayed(track), "Slider's track is not present
on the page.");
- assertTrue(selenium.isDisplayed(handle), "Slider's handle is not present
on the page.");
- assertFalse(selenium.isElementPresent(tooltip), "Slider's tooltip should
not be present on the page.");
- }
-
- @Test
@Use(field = "number", value = "correctNumbers")
+ @Override
public void testTypeIntoInputCorrect() {
- String reqTime = selenium.getText(time);
- guardXhr(selenium).type(input, number);
- waitGui.failWith("Page was not updated").waitForChange(reqTime,
retrieveText.locator(time));
-
- assertEquals(selenium.getText(output), number, "Output was not
updated.");
+ super.testTypeIntoInputCorrect();
}
@Test
@Use(field = "number", value = "smallNumbers")
+ @Override
public void testTypeIntoInputSmall() {
- String reqTime = selenium.getText(time);
- guardXhr(selenium).type(input, number);
- waitGui.failWith("Page was not updated").waitForChange(reqTime,
retrieveText.locator(time));
-
- assertEquals(selenium.getText(output), "-10", "Output was not
updated.");
- assertEquals(selenium.getValue(input), "-10", "Input was not
updated.");
+ super.testTypeIntoInputSmall();
}
@Test
@Use(field = "number", value = "bigNumbers")
+ @Override
public void testTypeIntoInputBig() {
- String reqTime = selenium.getText(time);
- guardXhr(selenium).type(input, number);
- waitGui.failWith("Page was not updated").waitForChange(reqTime,
retrieveText.locator(time));
-
- assertEquals(selenium.getText(output), "10", "Output was not
updated.");
- assertEquals(selenium.getValue(input), "10", "Input was not
updated.");
+ super.testTypeIntoInputBig();
}
@Test
@Use(field = "number", value = "decimalNumbers")
+ @Override
public void testTypeIntoInputDecimal() {
- String reqTime = selenium.getText(time);
- guardXhr(selenium).type(input, number);
- waitGui.failWith("Page was not updated").waitForChange(reqTime,
retrieveText.locator(time));
-
- Double newNumber = new Double(number);
-
- assertEquals(selenium.getText(output), newNumber == 0 ? "0" :
newNumber.toString(), "Output was not updated.");
- assertEquals(selenium.getValue(input), newNumber == 0 ? "0" :
newNumber.toString(), "Input was not updated.");
+ super.testTypeIntoInputDecimal();
}
@Test
+ @Override
public void testTypeIntoInputNotNumber() {
- guardNoRequest(selenium).type(input, "aaa");
- assertEquals(selenium.getText(output), "2", "Output should not be
updated.");
- assertEquals(selenium.getValue(input), "2", "Input should not be
updated.");
+ super.testTypeIntoInputNotNumber();
}
@Test
+ @Override
public void testClickLeft() {
- selenium.type(pjq("input[type=text][id$=delayInput]"),
"500");
- selenium.waitForPageToLoad();
-
selenium.click(pjq("input[type=radio][name$=showArrowsInput][value=true]"));
- selenium.waitForPageToLoad();
-
- selenium.runScript(clickLeft);
- selenium.runScript(clickLeft);
- selenium.runScript(clickLeft);
- selenium.runScript(clickLeft);
- waitGui.failWith("Output was not
updated.").until(textEquals.locator(output).text("-2"));
+ super.testClickLeft();
}
@Test
+ @Override
public void testClickRight() {
- selenium.type(pjq("input[type=text][id$=delayInput]"),
"500");
- selenium.waitForPageToLoad();
-
selenium.click(pjq("input[type=radio][name$=showArrowsInput][value=true]"));
- selenium.waitForPageToLoad();
-
- selenium.runScript(clickRight);
- selenium.runScript(clickRight);
- selenium.runScript(clickRight);
- selenium.runScript(clickRight);
- waitGui.failWith("Output was not
updated.").until(textEquals.locator(output).text("6"));
+ super.testClickRight();
}
@Test
+ @Override
public void testClick() {
- String reqTime = selenium.getText(time);
- guardXhr(selenium).mouseDownAt(track, new Point(0, 0));
- waitGui.failWith("Page was not updated").waitForChange(reqTime,
retrieveText.locator(time));
- assertEquals(selenium.getText(output), "-10", "Output was not
updated.");
- String margin = selenium.getStyle(handle,
CssProperty.MARGIN_LEFT).replace("px", "").trim();
- assertEquals(Double.parseDouble(margin), 0d, "Left margin of
handle.");
+ super.testClick();
+ }
- reqTime = selenium.getText(time);
- guardXhr(selenium).mouseDownAt(track, new Point(30, 0));
- waitGui.failWith("Page was not updated").waitForChange(reqTime,
retrieveText.locator(time));
- assertEquals(selenium.getText(output), "-7", "Output was not
updated.");
- margin = selenium.getStyle(handle,
CssProperty.MARGIN_LEFT).replace("px", "").trim();
- double marginD = Double.parseDouble(margin);
- assertTrue(marginD > 25 && marginD < 30, "Left margin of
handle should be between 25 and 30.");
-
- reqTime = selenium.getText(time);
- guardXhr(selenium).mouseDownAt(track, new Point(195, 0));
- waitGui.failWith("Page was not updated").waitForChange(reqTime,
retrieveText.locator(time));
- assertEquals(selenium.getText(output), "10", "Output was not
updated.");
- margin = selenium.getStyle(handle,
CssProperty.MARGIN_LEFT).replace("px", "").trim();
- marginD = Double.parseDouble(margin);
- assertTrue(marginD > 190 && marginD < 200, "Left margin of
handle should be between 190 and 200.");
+ @Test
+ public void testInit() {
+ assertTrue(selenium.isDisplayed(slider), "Slider is not present on the
page.");
+ assertTrue(selenium.isDisplayed(input), "Slider's input is not present
on the page.");
+ assertFalse(selenium.isElementPresent(left), "Slider's left arrow should
not be present on the page.");
+ assertFalse(selenium.isElementPresent(right), "Slider's right arrow
should not be present on the page.");
+ assertTrue(selenium.isDisplayed(minBoundary), "Slider's min value is not
present on the page.");
+ assertTrue(selenium.isDisplayed(maxBoundary), "Slider's max value is not
present on the page.");
+ assertTrue(selenium.isDisplayed(track), "Slider's track is not present
on the page.");
+ assertTrue(selenium.isDisplayed(handle), "Slider's handle is not present
on the page.");
+ assertFalse(selenium.isElementPresent(tooltip), "Slider's tooltip should
not be present on the page.");
}
@Test
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInputNumberSlider/TestRichSliderFAjax.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInputNumberSlider/TestRichSliderFAjax.java
(rev 0)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInputNumberSlider/TestRichSliderFAjax.java 2011-02-16
15:59:12 UTC (rev 21704)
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * 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.richInputNumberSlider;
+
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+
+import java.net.URL;
+import org.richfaces.tests.metamer.ftest.annotations.Use;
+import org.testng.annotations.Test;
+
+/**
+ * Test case for page /faces/components/richInputNumberSlider/fAjax.xhtml
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public class TestRichSliderFAjax extends AbstractSliderTest {
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath,
"faces/components/richInputNumberSlider/fAjax.xhtml");
+ }
+
+ @Test
+ @Use(field = "number", value = "correctNumbers")
+ @Override
+ public void testTypeIntoInputCorrect() {
+ super.testTypeIntoInputCorrect();
+ }
+
+ @Test
+ @Use(field = "number", value = "smallNumbers")
+ @Override
+ public void testTypeIntoInputSmall() {
+ super.testTypeIntoInputSmall();
+ }
+
+ @Test
+ @Use(field = "number", value = "bigNumbers")
+ @Override
+ public void testTypeIntoInputBig() {
+ super.testTypeIntoInputBig();
+ }
+
+ @Test
+ @Use(field = "number", value = "decimalNumbers")
+ @Override
+ public void testTypeIntoInputDecimal() {
+ super.testTypeIntoInputDecimal();
+ }
+
+ @Test
+ @Override
+ public void testTypeIntoInputNotNumber() {
+ super.testTypeIntoInputNotNumber();
+ }
+
+ @Test
+ @Override
+ public void testClickLeft() {
+ super.testClickLeft();
+ }
+
+ @Test
+ @Override
+ public void testClickRight() {
+ super.testClickRight();
+ }
+
+ @Test
+ @Override
+ public void testClick() {
+ super.testClick();
+ }
+}