Author: ppitonak(a)redhat.com
Date: 2009-09-14 08:06:09 -0400 (Mon, 14 Sep 2009)
New Revision: 15550
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/progressBar/ProgressBarTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/separator/SeparatorTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/progressBar/locators.properties
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/progressBar/messages.properties
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/separator/locators.properties
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/separator/messages.properties
Log:
* SeparatorTestCase and ProgressBarTestCase refactored
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/progressBar/ProgressBarTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/progressBar/ProgressBarTestCase.java 2009-09-14
09:45:52 UTC (rev 15549)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/progressBar/ProgressBarTestCase.java 2009-09-14
12:06:09 UTC (rev 15550)
@@ -1,6 +1,27 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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.richfaces.integrationTest.progressBar;
-import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
@@ -16,185 +37,136 @@
*/
public class ProgressBarTestCase extends AbstractSeleniumRichfacesTestCase {
- // messages
- private final String MSG_COMPONENT_DESCRIPTION =
getMess("COMPONENT_DESCRIPTION");
- private final String MSG_BUTTON_SHOULD_BE_PRESENT =
getMess("BUTTON_SHOULD_BE_PRESENT");
- private final String MSG_BUTTON_SHOULD_NOT_BE_PRESENT =
getMess("BUTTON_SHOULD_NOT_BE_PRESENT");
- private final String MSG_FIRST_PROGRESS_BAR_LABEL =
getMess("FIRST_PROGRESS_BAR_LABEL");
- private final String MSG_SECOND_PROGRESS_BAR_UPLOAD =
getMess("SECOND_PROGRESS_BAR_UPLOAD");
- private final String MSG_SECOND_PB_INITIAL_LABEL_SHOULD_BE_VISIBLE =
getMess("SECOND_PB_INITIAL_LABEL_SHOULD_BE_VISIBLE");
- private final String MSG_SECOND_PB_INITIAL_LABEL_SHOULD_NOT_BE_VISIBLE =
getMess("SECOND_PB_INITIAL_LABEL_SHOULD_NOT_BE_VISIBLE");
- private final String MSG_SECOND_PB_FINISHED_LABEL_SHOULD_BE_VISIBLE =
getMess("SECOND_PB_FINISHED_LABEL_SHOULD_BE_VISIBLE");
- private final String MSG_SECOND_PB_FINISHED_LABEL_SHOULD_NOT_BE_VISIBLE =
getMess("SECOND_PB_FINISHED_LABEL_SHOULD_NOT_BE_VISIBLE");
+ // locators
+ private final String LOC_EXAMPLE_1_HEADER = getLoc("EXAMPLE_1_HEADER");
+ private final String LOC_EXAMPLE_2_HEADER = getLoc("EXAMPLE_2_HEADER");
+ private final String LOC_FIRST_BUTTON = getLoc("FIRST_BUTTON");
+ private final String LOC_FIRST_PROGRESS_BAR_STYLE =
getLoc("FIRST_PROGRESS_BAR_STYLE");
+ private final String LOC_SECOND_BUTTON = getLoc("SECOND_BUTTON");
+ private final String LOC_SECOND_LABEL_FINISHED =
getLoc("SECOND_LABEL_FINISHED");
+ private final String LOC_SECOND_LABEL_INITIAL =
getLoc("SECOND_LABEL_INITIAL");
+ private final String LOC_SECOND_PROGRESS_BAR_STYLE =
getLoc("SECOND_PROGRESS_BAR_STYLE");
- // locators
- private final String LOC_EXAMPLE_1_HEADER = getLoc("EXAMPLE_1_HEADER");
- private final String LOC_EXAMPLE_2_HEADER = getLoc("EXAMPLE_2_HEADER");
- private final String LOC_FIRST_BUTTON = getLoc("FIRST_BUTTON");
- private final String LOC_FIRST_PROGRESS_BAR_LABEL =
getLoc("FIRST_PROGRESS_BAR_LABEL");
- private final String LOC_FIRST_PROGRESS_BAR_STYLE =
getLoc("FIRST_PROGRESS_BAR_STYLE");
- private final String LOC_SECOND_BUTTON = getLoc("SECOND_BUTTON");
- private final String LOC_SECOND_LABEL_FINISHED =
getLoc("SECOND_LABEL_FINISHED");
- private final String LOC_SECOND_LABEL_INITIAL =
getLoc("SECOND_LABEL_INITIAL");
- private final String LOC_SECOND_PROGRESS_BAR_STYLE =
getLoc("SECOND_PROGRESS_BAR_STYLE");
+ /**
+ * Tests the first example. It checks that the button is visible and then it
+ * click on the button. The process starts and the test checks 3 times that
+ * the label of the progress bar and its "width" attribute equal.
+ */
+ @Test
+ public void testFirstExample() {
+ scrollIntoView(LOC_EXAMPLE_1_HEADER, true);
- /**
- * Tests the first example. It checks that the button is visible and then it
- * click on the button. The process starts and the test checks 3 times that
- * the label of the progress bar and its "width" attribute equal.
- */
- @Test
- public void testFirstExample() {
- scrollIntoView(LOC_EXAMPLE_1_HEADER, true);
+ boolean present = selenium.isElementPresent(LOC_FIRST_BUTTON);
+ assertTrue(present, "Button should be present on the page.");
- boolean present = selenium.isElementPresent(LOC_FIRST_BUTTON);
- assertTrue(present, MSG_BUTTON_SHOULD_BE_PRESENT);
+ selenium.click(LOC_FIRST_BUTTON);
- selenium.click(LOC_FIRST_BUTTON);
+ waitFor(500);
+ present = selenium.isElementPresent(LOC_FIRST_BUTTON);
+ assertFalse(present, "Button \"Restart Process\" should not be
present on the page.");
- waitFor(500);
- present = selenium.isElementPresent(LOC_FIRST_BUTTON);
- assertFalse(present, MSG_BUTTON_SHOULD_NOT_BE_PRESENT);
+ int value1 = 0;
+ int value2 = 0;
- int value1 = 0;
- int value2 = 0;
+ for (int i = 0; i < 6; i++) {
+ waitFor(2000);
+ value2 = value1;
+ value1 = (int) Double.parseDouble(getStyle(LOC_FIRST_PROGRESS_BAR_STYLE,
"width").replace("px", ""));
+ assertTrue(value1 > value2, "Progress bar should move to the
right.");
+ }
+ }
- for (int i = 0; i < 4; i++) {
- value1 = getValue(LOC_FIRST_PROGRESS_BAR_STYLE);
- value2 = Integer.parseInt(selenium.getText(
- LOC_FIRST_PROGRESS_BAR_LABEL).replace(" %", ""));
- assertEquals(value1, value2, MSG_FIRST_PROGRESS_BAR_LABEL);
- waitFor(6000);
- }
- }
+ /**
+ * Tests the second example. First it checks the displayed label. Then it
+ * clicks on the button and verifies several times that the progress bar is
+ * moving right. Then it waits for process to finish and checks that a label
+ * was displayed.
+ */
+ @Test
+ public void testSecondExample() {
+ scrollIntoView(LOC_EXAMPLE_2_HEADER, true);
- /**
- * Tests the second example. First it checks the displayed label. Then it
- * clicks on the button and verifies several times that the progress bar is
- * moving right. Then it waits for process to finish and checks that a label
- * was displayed.
- */
- @Test
- public void testSecondExample() {
- scrollIntoView(LOC_EXAMPLE_2_HEADER, true);
+ assertTrue(isDisplayed(LOC_SECOND_LABEL_INITIAL), "Initial label should be
visible.");
+ assertFalse(isDisplayed(LOC_SECOND_LABEL_FINISHED), "Finished label should
not be visible.");
- String text = null;
- try {
- text = selenium.getAttribute(LOC_SECOND_LABEL_INITIAL + "@style");
- assertTrue(!text.contains("display: none;"),
- MSG_SECOND_PB_INITIAL_LABEL_SHOULD_BE_VISIBLE);
- } catch (Exception e) {
- // OK -- there is no style attribute
- }
- text = selenium.getAttribute(LOC_SECOND_LABEL_FINISHED + "@style");
- assertFalse(!text.contains("display: none;"),
- MSG_SECOND_PB_FINISHED_LABEL_SHOULD_NOT_BE_VISIBLE);
+ selenium.click(LOC_SECOND_BUTTON);
- selenium.click(LOC_SECOND_BUTTON);
+ int current = 0;
+ int previous = 0;
+ waitFor(2200);
- int current = 0;
- int previous = 0;
- waitFor(2200);
+ for (int i = 0; i < 10; i++) {
+ waitFor(2000);
+ current = (int) Double.parseDouble(getStyle(LOC_SECOND_PROGRESS_BAR_STYLE,
"width").replace("px", ""));
+ assertTrue(current >= previous, "Progress of the progress bar -- the
current value should be greater then the one 2 seconds ago.");
+ previous = current;
+ }
- for (int i = 0; i < 10; i++) {
- waitFor(2000);
- current = getValue(LOC_SECOND_PROGRESS_BAR_STYLE);
- assertTrue(current >= previous, MSG_SECOND_PROGRESS_BAR_UPLOAD);
- previous = current;
- }
+ waitFor(82000);
- waitFor(82000);
+ assertFalse(isDisplayed(LOC_SECOND_LABEL_INITIAL), "Initial label should not
be visible.");
+ assertTrue(isDisplayed(LOC_SECOND_LABEL_FINISHED), "Finished label should be
visible.");
+ }
- text = selenium.getAttribute(LOC_SECOND_LABEL_INITIAL + "@style");
- assertFalse(!text.contains("display: none;"),
- MSG_SECOND_PB_INITIAL_LABEL_SHOULD_NOT_BE_VISIBLE);
- try {
- text = selenium.getAttribute(LOC_SECOND_LABEL_FINISHED + "@style");
- assertTrue(!text.contains("display: none;"),
- MSG_SECOND_PB_FINISHED_LABEL_SHOULD_BE_VISIBLE);
- } catch (Exception e) {
- // OK -- there is no style attribute
- }
+ /**
+ * Tests the "View Source" in the first example. It checks that the source
+ * code is not visible, clicks on the link, and checks 7 lines of source
+ * code.
+ */
+ @Test
+ public void testFirstExampleSource() {
+ String[] strings = new String[] { "<ui:composition
xmlns=\"http://www.w3.org/1999/xhtml\"",
+ "<a4j:outputPanel id=\"progressPanel\">",
+ "<rich:progressBar
value=\"#{progressBarBean.currentValue}\"",
+ "interval=\"2000\"
label=\"#{progressBarBean.currentValue} %\"",
+ "enabled=\"#{progressBarBean.enabled}\"
minValue=\"-1\" maxValue=\"100\"",
+ "reRenderAfterComplete=\"progressPanel\">",
+ "<a4j:commandButton
action=\"#{progressBarBean.startProcess}\"", };
- }
+ abstractTestSource(1, "View Source", strings);
+ }
- /**
- * Tests the "View Source" in the first example. It checks that the source
- * code is not visible, clicks on the link, and checks 7 lines of source
- * code.
- */
- @Test
- public void testFirstExampleSource() {
- String[] strings = new String[] {
- "<ui:composition
xmlns=\"http://www.w3.org/1999/xhtml\"",
- "<a4j:outputPanel id=\"progressPanel\">",
- "<rich:progressBar
value=\"#{progressBarBean.currentValue}\"",
- "interval=\"2000\" label=\"#{progressBarBean.currentValue}
%\"",
- "enabled=\"#{progressBarBean.enabled}\" minValue=\"-1\"
maxValue=\"100\"",
- "reRenderAfterComplete=\"progressPanel\">",
- "<a4j:commandButton
action=\"#{progressBarBean.startProcess}\"", };
+ /**
+ * Tests the "View Java Bean Source" in the first example. It checks that
+ * the source code is not visible, clicks on the link, and checks 7 lines of
+ * source code.
+ */
+ @Test
+ public void testFirstExampleBeanSource() {
+ String[] strings = new String[] { "package
org.richfaces.demo.progressBar;", "public class ProgressBarBean {",
+ "private boolean buttonRendered = true;",
"setStartTime(new Date().getTime());",
+ "Long current = (new Date().getTime() - startTime)/1000;",
"public void setEnabled(boolean enabled) {",
+ "this.buttonRendered = buttonRendered;", };
- abstractTestSource(1, "View Source", strings);
- }
+ abstractTestSource(1, "View Java Bean Source", strings);
+ }
- /**
- * Tests the "View Java Bean Source" in the first example. It checks that
- * the source code is not visible, clicks on the link, and checks 7 lines of
- * source code.
- */
- @Test
- public void testFirstExampleBeanSource() {
- String[] strings = new String[] {
- "package org.richfaces.demo.progressBar;",
- "public class ProgressBarBean {",
- "private boolean buttonRendered = true;",
- "setStartTime(new Date().getTime());",
- "Long current = (new Date().getTime() - startTime)/1000;",
- "public void setEnabled(boolean enabled) {",
- "this.buttonRendered = buttonRendered;", };
+ /**
+ * Tests the "View Source" in the second example. It checks that the
source
+ * code is not visible, clicks on the link, and checks 7 lines of source
+ * code.
+ */
+ @Test
+ public void testSecondExampleSource() {
+ String[] strings = new String[] {
+ "<ui:composition
xmlns=\"http://www.w3.org/1999/xhtml\"",
+
"$('form:progressBar').component.setValue(counter*5);",
+ "document.getElementById('button').disabled=false;",
+ "<h:form id=\"form\">",
+ "</f:facet>",
+ "</rich:progressBar>",
+ "<rich:progressBar mode=\"client\"
id=\"progressBar\">",
+ "<button type=\"button\"
onclick=\"startProgress();\" style=\"margin: 9px 0px 5px;\"
id=\"button\">Start Progress</button>", };
- abstractTestSource(1, "View Java Bean Source", strings);
- }
+ abstractTestSource(2, "View Source", strings);
+ }
- /**
- * Tests the "View Source" in the second example. It checks that the source
- * code is not visible, clicks on the link, and checks 7 lines of source
- * code.
- */
- @Test
- public void testSecondExampleSource() {
- String[] strings = new String[] {
- "<ui:composition
xmlns=\"http://www.w3.org/1999/xhtml\"",
- "$('form:progressBar').component.setValue(counter*5);",
- "document.getElementById('button').disabled=false;",
- "<h:form id=\"form\">",
- "</f:facet>",
- "</rich:progressBar>",
- "<rich:progressBar mode=\"client\"
id=\"progressBar\">",
- "<button type=\"button\" onclick=\"startProgress();\"
style=\"margin: 9px 0px 5px;\" id=\"button\">Start
Progress</button>", };
-
- abstractTestSource(2, "View Source", strings);
- }
-
- /**
- * Returns the value of progress bar from the style attribute.
- *
- * @param locator
- * locator of the style attribute
- * @return the value of the attribute style (%)
- */
- private int getValue(String locator) {
- String attr = selenium.getAttribute(locator);
- attr = attr.substring(attr.indexOf("width"));
- attr = attr.substring(7, attr.indexOf("%;"));
- return (int) Double.parseDouble(attr);
- }
-
- /**
- * Loads the page containing the component.
- */
- @BeforeMethod
- private void loadPage() {
- super.loadPage("richOutputs", 6, 1, MSG_COMPONENT_DESCRIPTION);
- }
+ /**
+ * Loads the page containing the component.
+ */
+ @SuppressWarnings("unused")
+ @BeforeMethod
+ private void loadPage() {
+ openComponent("Progress Bar");
+ }
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/separator/SeparatorTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/separator/SeparatorTestCase.java 2009-09-14
09:45:52 UTC (rev 15549)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/separator/SeparatorTestCase.java 2009-09-14
12:06:09 UTC (rev 15550)
@@ -1,3 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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.richfaces.integrationTest.separator;
import static org.testng.Assert.assertEquals;
@@ -4,7 +26,6 @@
import static org.testng.Assert.fail;
import java.io.IOException;
-import java.security.NoSuchAlgorithmException;
import org.jboss.richfaces.integrationTest.AbstractSeleniumRichfacesTestCase;
import org.jboss.test.selenium.utils.URLUtils;
@@ -19,156 +40,153 @@
*/
public class SeparatorTestCase extends AbstractSeleniumRichfacesTestCase {
- // messages
- private final String MSG_COMPONENT_DESCRIPTION =
getMess("COMPONENT_DESCRIPTION");
- private final String MSG_HEIGHT_OF_SEPARATOR =
getMess("HEIGHT_OF_SEPARATOR");
- private final String MSG_WIDTH_OF_SEPARATOR = getMess("WIDTH_OF_SEPARATOR");
- private final String MSG_HASH_CODE = getMess("HASH_CODE");
+ // messages
+ private final String MSG_FIRST_HEIGHT = getMsg("FIRST_HEIGHT");
+ private final String MSG_FIRST_HASH = getMsg("FIRST_HASH");
+ private final String MSG_SECOND_HEIGHT = getMsg("SECOND_HEIGHT");
+ private final String MSG_SECOND_HASH = getMsg("SECOND_HASH");
+ private final String MSG_THIRD_HEIGHT = getMsg("THIRD_HEIGHT");
+ private final String MSG_THIRD_HASH = getMsg("THIRD_HASH");
+ private final String MSG_FOURTH_HEIGHT = getMsg("FOURTH_HEIGHT");
+ private final String MSG_FOURTH_HASH = getMsg("FOURTH_HASH");
+ private final String MSG_FIFTH_HEIGHT = getMsg("FIFTH_HEIGHT");
+ private final String MSG_FIFTH_HASH = getMsg("FIFTH_HASH");
+ private final String MSG_SIXTH_HEIGHT = getMsg("SIXTH_HEIGHT");
+ private final String MSG_SIXTH_HASH = getMsg("SIXTH_HASH");
- // locators
- private final String LOC_EXAMPLE_HEADER = getLoc("EXAMPLE_HEADER");
- private final String LOC_SEPARATOR_N = getLoc("SEPARATOR_N");
+ // locators
+ private final String LOC_EXAMPLE_HEADER = getLoc("EXAMPLE_HEADER");
+ private final String LOC_SEPARATOR_N = getLoc("SEPARATOR_N");
- /**
- * Tests the first separator. It checks both height of the separator and
- * hash code of the image used in separator.
- */
- @Test
- public void testFirstSeparator() {
- String text = getStyle(String.format(LOC_SEPARATOR_N, 1), "height");
- assertEquals(text, "6px", MSG_HEIGHT_OF_SEPARATOR);
+ /**
+ * Tests the first separator. It checks both height of the separator and
+ * hash code of the image used in separator.
+ */
+ @Test
+ public void testFirstSeparator() {
+ String text = getStyle(format(LOC_SEPARATOR_N, 1), "height");
+ assertEquals(text, MSG_FIRST_HEIGHT, "Height of the separator.");
- text = getSeparatorHash(String.format(LOC_SEPARATOR_N, 1) + "@style");
- assertEquals(text, "c8568515d1a22227648977798c87cfb0", MSG_HASH_CODE);
- }
+ text = getSeparatorHash(format(LOC_SEPARATOR_N, 1));
+ assertEquals(text, MSG_FIRST_HASH, "Hash code of the image that makes the
separator.");
+ }
- /**
- * Tests the second separator. It checks height of the separator, width of
- * the separator, and hash code of the image used in separator.
- */
- @Test
- public void testSecondSeparator() {
- String text = getStyle(String.format(LOC_SEPARATOR_N, 2), "height");
- assertEquals(text, "8px", MSG_HEIGHT_OF_SEPARATOR);
+ /**
+ * Tests the second separator. It checks height of the separator, width of
+ * the separator, and hash code of the image used in separator.
+ */
+ @Test
+ public void testSecondSeparator() {
+ String text = getStyle(format(LOC_SEPARATOR_N, 2), "height");
+ assertEquals(text, MSG_SECOND_HEIGHT, "Height of the separator.");
- double widthFull = Double.parseDouble(getStyle(
- String.format(LOC_SEPARATOR_N, 1), "width").replace("px",
""));
- double width75 = Double.parseDouble(getStyle(
- String.format(LOC_SEPARATOR_N, 2), "width").replace("px",
""));
+ double widthFull = Double.parseDouble(getStyle(format(LOC_SEPARATOR_N, 1),
"width").replace("px", ""));
+ double width75 = Double.parseDouble(getStyle(format(LOC_SEPARATOR_N, 2),
"width").replace("px", ""));
- assertEquals(width75, widthFull * 0.75, MSG_WIDTH_OF_SEPARATOR);
+ assertEquals(width75, widthFull * 0.75, "Width of the separator.");
- text = getSeparatorHash(String.format(LOC_SEPARATOR_N, 2) + "@style");
- assertEquals(text, "350f395b0570f1c1cb528ef18299dd5d", MSG_HASH_CODE);
- }
+ text = getSeparatorHash(format(LOC_SEPARATOR_N, 2));
+ assertEquals(text, MSG_SECOND_HASH, "Hash code of the image that makes the
separator.");
+ }
- /**
- * Tests the third separator. It checks both height of the separator and
- * hash code of the image used in separator.
- */
- @Test
- public void testThirdSeparator() {
- String text = getStyle(String.format(LOC_SEPARATOR_N, 3), "height");
- assertEquals(text, "2px", MSG_HEIGHT_OF_SEPARATOR);
+ /**
+ * Tests the third separator. It checks both height of the separator and
+ * hash code of the image used in separator.
+ */
+ @Test
+ public void testThirdSeparator() {
+ String text = getStyle(format(LOC_SEPARATOR_N, 3), "height");
+ assertEquals(text, MSG_THIRD_HEIGHT, "Height of the separator.");
- // FIXME the hash code is not valid
- // text = getSeparatorHash(String.format(LOC_SEPARATOR_N, 3) +
- // "@style");
- // assertEquals(text, "0bf81058de26083a10657f2db675e3ea",
- // MSG_HASH_CODE);
- }
+ text = getSeparatorHash(format(LOC_SEPARATOR_N, 3));
+ assertEquals(text, MSG_THIRD_HASH, "Hash code of the image that makes the
separator.");
+ }
- /**
- * Tests the fourth separator. It checks both height of the separator and
- * hash code of the image used in separator.
- */
- @Test
- public void testFourthSeparator() {
- String text = getStyle(String.format(LOC_SEPARATOR_N, 4), "height");
- assertEquals(text, "2px", MSG_HEIGHT_OF_SEPARATOR);
+ /**
+ * Tests the fourth separator. It checks both height of the separator and
+ * hash code of the image used in separator.
+ */
+ @Test
+ public void testFourthSeparator() {
+ String text = getStyle(format(LOC_SEPARATOR_N, 4), "height");
+ assertEquals(text, MSG_FOURTH_HEIGHT, "Height of the separator.");
- text = getSeparatorHash(String.format(LOC_SEPARATOR_N, 4) + "@style");
- assertEquals(text, "94779ca2ce53f57796d3704454cabb2f", MSG_HASH_CODE);
- }
+ text = getSeparatorHash(format(LOC_SEPARATOR_N, 4));
+ assertEquals(text, MSG_FOURTH_HASH, "Hash code of the image that makes the
separator.");
+ }
- /**
- * Tests the fifth separator. It checks both height of the separator and
- * hash code of the image used in separator.
- */
- @Test
- public void testFifthSeparator() {
- String text = getStyle(String.format(LOC_SEPARATOR_N, 5), "height");
- assertEquals(text, "4px", MSG_HEIGHT_OF_SEPARATOR);
+ /**
+ * Tests the fifth separator. It checks both height of the separator and
+ * hash code of the image used in separator.
+ */
+ @Test
+ public void testFifthSeparator() {
+ String text = getStyle(format(LOC_SEPARATOR_N, 5), "height");
+ assertEquals(text, MSG_FIFTH_HEIGHT, "Height of the separator.");
- text = getSeparatorHash(String.format(LOC_SEPARATOR_N, 5) + "@style");
- assertEquals(text, "14c1dfe353747b738a586a51070f631a", MSG_HASH_CODE);
- }
+ text = getSeparatorHash(format(LOC_SEPARATOR_N, 5));
+ assertEquals(text, MSG_FIFTH_HASH, "Hash code of the image that makes the
separator.");
+ }
- /**
- * Tests the sixth separator. It checks both height of the separator and
- * hash code of the image used in separator.
- */
- @Test
- public void testSixthSeparator() {
- String text = getStyle(String.format(LOC_SEPARATOR_N, 6), "height");
- assertEquals(text, "2px", MSG_HEIGHT_OF_SEPARATOR);
+ /**
+ * Tests the sixth separator. It checks both height of the separator and
+ * hash code of the image used in separator.
+ */
+ @Test
+ public void testSixthSeparator() {
+ String text = getStyle(format(LOC_SEPARATOR_N, 6), "height");
+ assertEquals(text, MSG_SIXTH_HEIGHT, "Height of the separator.");
- text = getSeparatorHash(String.format(LOC_SEPARATOR_N, 6) + "@style");
- assertEquals(text, "6ab8ba31211c2a0ecbbeff9cc61bc950", MSG_HASH_CODE);
- }
+ text = getSeparatorHash(format(LOC_SEPARATOR_N, 6));
+ assertEquals(text, MSG_SIXTH_HASH, "Hash code of the image that makes the
separator.");
+ }
- /**
- * Tests the "View Source" in the example. It checks that the source code is
- * not visible, clicks on the link, and checks 7 lines of source code.
- */
- @Test
- public void testFirstExampleSource() {
- String[] strings = new String[] {
- "<ui:composition
xmlns=\"http://www.w3.org/1999/xhtml\"",
- "<rich:separator/>",
- "<rich:separator lineType=\"beveled\" height=\"8\"
width=\"75%\" align=\"center\"/>",
- "<rich:separator height=\"2\"
lineType=\"dotted\"/><br/>",
- "<rich:separator height=\"2\"
lineType=\"dashed\"/><br/>",
- "<rich:separator height=\"4\"
lineType=\"double\"/><br/>",
- "<rich:separator height=\"2\"
lineType=\"solid\"/><br/>", };
+ /**
+ * Tests the "View Source" in the example. It checks that the source code
is
+ * not visible, clicks on the link, and checks 7 lines of source code.
+ */
+ @Test
+ public void testFirstExampleSource() {
+ String[] strings = new String[] { "<ui:composition
xmlns=\"http://www.w3.org/1999/xhtml\"",
+ "<rich:separator/>",
+ "<rich:separator lineType=\"beveled\"
height=\"8\" width=\"75%\" align=\"center\"/>",
+ "<rich:separator height=\"2\"
lineType=\"dotted\"/><br/>",
+ "<rich:separator height=\"2\"
lineType=\"dashed\"/><br/>",
+ "<rich:separator height=\"4\"
lineType=\"double\"/><br/>",
+ "<rich:separator height=\"2\"
lineType=\"solid\"/><br/>", };
- abstractTestSource(1, "View Source", strings);
- }
+ abstractTestSource(1, "View Source", strings);
+ }
- /**
- * Returns hash code of the separator's image.
- *
- * @param locator
- * style attribute of the separator
- */
- private String getSeparatorHash(String locator) {
- // create URL of the image
- String tmp = selenium.getAttribute(locator);
+ /**
+ * Returns hash code of the separator's image.
+ *
+ * @param locator
+ * style attribute of the separator
+ */
+ private String getSeparatorHash(String locator) {
+ // create URL of the image
+ String url = getStyle(locator, "background-image");
+ url = url.replace("url(", "").replace(")",
"");
- int index = tmp.indexOf("background-image:");
- tmp = tmp.substring(index + 22);
- tmp = tmp.substring(0, tmp.indexOf(");"));
+ String hash = null;
+ try {
+ hash = URLUtils.resourceMd5Digest(url);
+ } catch (IOException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
- index = selenium.getLocation().indexOf('/', 7);
- String url = selenium.getLocation().substring(0, index);
- url += tmp;
+ return hash;
+ }
- try {
- tmp = URLUtils.resourceMd5Digest(url);
- } catch (IOException e) {
- e.printStackTrace();
- fail(e.getMessage());
- }
-
- return tmp;
- }
-
- /**
- * Loads the page containing the component.
- */
- @BeforeMethod
- private void loadPage() {
- super.loadPage("richOutputs", 7, 1, MSG_COMPONENT_DESCRIPTION);
- scrollIntoView(LOC_EXAMPLE_HEADER, true);
- }
+ /**
+ * Loads the page containing the component.
+ */
+ @SuppressWarnings("unused")
+ @BeforeMethod
+ private void loadPage() {
+ openComponent("Separator");
+ scrollIntoView(LOC_EXAMPLE_HEADER, true);
+ }
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/progressBar/locators.properties
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/progressBar/locators.properties 2009-09-14
09:45:52 UTC (rev 15549)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/progressBar/locators.properties 2009-09-14
12:06:09 UTC (rev 15550)
@@ -2,13 +2,12 @@
EXAMPLE_2_HEADER=//fieldset[2]/legend
FIRST_BUTTON=//fieldset[1]/div/form/span/div/input
-FIRST_PROGRESS_BAR_LABEL=//fieldset[1]/div/form/span/div/div[2]
-FIRST_PROGRESS_BAR_STYLE=//fieldset[1]/div/form/span/div/div[2]@style
+FIRST_PROGRESS_BAR_STYLE=//fieldset[1]/div/form/span/div/div[2]
SECOND_BUTTON=//button[@id='button']
SECOND_LABEL_FINISHED=//fieldset[2]/div/form/div/div[3]
SECOND_LABEL_INITIAL=//fieldset[2]/div/form/div/div[1]
-SECOND_PROGRESS_BAR_STYLE=//fieldset[2]/div/form/div/div[2]/div@style
+SECOND_PROGRESS_BAR_STYLE=//fieldset[2]/div/form/div/div[2]/div
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/progressBar/messages.properties
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/progressBar/messages.properties 2009-09-14
09:45:52 UTC (rev 15549)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/progressBar/messages.properties 2009-09-14
12:06:09 UTC (rev 15550)
@@ -1,11 +0,0 @@
-COMPONENT_DESCRIPTION=rich:progressBar is a component which could be used to display
progress of any client or server side process.
-
-BUTTON_SHOULD_BE_PRESENT=Button should be present on the page.
-BUTTON_SHOULD_NOT_BE_PRESENT=Button "Restart Process" should not be present on
the page.
-FIRST_PROGRESS_BAR_LABEL=The value in the label and real value should equal.
-
-SECOND_PROGRESS_BAR_UPLOAD=Progress of the progress bar -- the current value should be
greater then the one 2 seconds ago.
-SECOND_PB_INITIAL_LABEL_SHOULD_BE_VISIBLE=Initial label should be visible.
-SECOND_PB_INITIAL_LABEL_SHOULD_NOT_BE_VISIBLE=Initial label should not be visible.
-SECOND_PB_FINISHED_LABEL_SHOULD_BE_VISIBLE=Finished label should be visible.
-SECOND_PB_FINISHED_LABEL_SHOULD_NOT_BE_VISIBLE=Finished label should not be visible.
\ No newline at end of file
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/separator/locators.properties
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/separator/locators.properties 2009-09-14
09:45:52 UTC (rev 15549)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/separator/locators.properties 2009-09-14
12:06:09 UTC (rev 15550)
@@ -1,5 +1,5 @@
EXAMPLE_HEADER=//fieldset/legend
-SEPARATOR_N=//fieldset/div/div[%d]/div
+SEPARATOR_N=//fieldset/div/div[{0}]/div
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/separator/messages.properties
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/separator/messages.properties 2009-09-14
09:45:52 UTC (rev 15549)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/separator/messages.properties 2009-09-14
12:06:09 UTC (rev 15550)
@@ -1,4 +1,18 @@
-COMPONENT_DESCRIPTION= Separator is used to draw a horizontal line on a page.
-HEIGHT_OF_SEPARATOR=Height of the separator.
-WIDTH_OF_SEPARATOR=Width of the separator.
-HASH_CODE=Hash code of the image that makes the separator.
+FIRST_HEIGHT=6px
+FIRST_HASH=c8568515d1a22227648977798c87cfb0
+
+SECOND_HEIGHT=8px
+SECOND_HASH=350f395b0570f1c1cb528ef18299dd5d
+
+THIRD_HEIGHT=2px
+THIRD_HASH=bf81058de26083a10657f2db675e3ea
+
+FOURTH_HEIGHT=2px
+FOURTH_HASH=94779ca2ce53f57796d3704454cabb2f
+
+FIFTH_HEIGHT=4px
+FIFTH_HASH=14c1dfe353747b738a586a51070f631a
+
+SIXTH_HEIGHT=2px
+SIXTH_HASH=6ab8ba31211c2a0ecbbeff9cc61bc950
+