Author: lfryc(a)redhat.com
Date: 2010-01-19 07:23:01 -0500 (Tue, 19 Jan 2010)
New Revision: 16331
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/suggestionBox/SuggestionBoxTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/suggestionBox/locators.properties
Log:
- rf-demo ftest - SuggestionBoxTestCase - testing shadow depth fails in Firefox
(RFPL-341)
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/suggestionBox/SuggestionBoxTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/suggestionBox/SuggestionBoxTestCase.java 2010-01-19
11:53:00 UTC (rev 16330)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/suggestionBox/SuggestionBoxTestCase.java 2010-01-19
12:23:01 UTC (rev 16331)
@@ -24,14 +24,16 @@
import static org.testng.Assert.assertEquals;
+import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.math.Range;
import org.jboss.richfaces.integrationTest.AbstractSeleniumRichfacesTestCase;
import org.jboss.test.selenium.dom.Event;
import org.jboss.test.selenium.waiting.Condition;
import org.jboss.test.selenium.waiting.Wait;
-import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import com.thoughtworks.selenium.SeleniumException;
+
/**
* Test case that tests the suggestion box.
*
@@ -69,8 +71,8 @@
private final String LOC_FIRST_BORDER_STYLE =
getLoc("FIRST_BORDER_STYLE");
private final String LOC_FIRST_WIDTH_STYLE = getLoc("FIRST_WIDTH_STYLE");
private final String LOC_FIRST_HEIGHT_STYLE =
getLoc("FIRST_HEIGHT_STYLE");
- private final String LOC_FIRST_SHADOW_DEPTH_STYLE =
getLoc("FIRST_SHADOW_DEPTH_STYLE");
- private final String LOC_FIRST_SHADOW_OPACITY_STYLE =
getLoc("FIRST_SHADOW_OPACITY_STYLE");
+ private final String LOC_FIRST_SHADOW = getLoc("FIRST_SHADOW");
+ private final String LOC_FIRST_NOTHING_FOUND =
getLoc("FIRST_NOTHING_FOUND");
private final String LOC_FIRST_CELLPADDING = getLoc("FIRST_CELLPADDING");
private final String LOC_SECOND_INPUT = getLoc("SECOND_INPUT");
@@ -268,15 +270,28 @@
for (int i : new int[] { 7, 4, 2, 6, 3, 0, 8 }) {
selenium.type(locInput, String.valueOf(i));
selenium.fireEvent(locInput, Event.BLUR);
- selenium.type(LOC_FIRST_INPUT, String.valueOf(i));
- selenium.fireEvent(LOC_FIRST_INPUT, Event.KEYDOWN);
+ for (int j = 1; j <= 5; j++) {
+ try {
+ selenium.type(LOC_FIRST_INPUT, StringUtils.repeat(String.valueOf(i), j));
+ selenium.fireEvent(LOC_FIRST_INPUT, Event.KEYDOWN);
+ selenium.waitForCondition(format("jqFind('{0}').is(':visible')",
removeJQueryPrefix(LOC_FIRST_SHADOW)), "5000");
+ break;
+ } catch (SeleniumException e) {
+ if (j < 5 && e.getMessage().startsWith("Timed out")) {
+ continue;
+ }
+ throw e;
+ }
+ }
String result = range.getRoundedValue(i).toString();
- Wait.failWith(format(MSG_SUGGESTION_BOX_SHADOW_DEPTH_PREFORMATTED,
String.valueOf(i))).until(
- new StyleCondition(LOC_FIRST_SHADOW_DEPTH_STYLE, "top", result));
- assertEquals(getStyleValue(LOC_FIRST_SHADOW_DEPTH_STYLE, "left"), result);
+ assertEquals(getStyleValue(LOC_FIRST_SHADOW, "top"), result,
format(MSG_SUGGESTION_BOX_SHADOW_DEPTH_PREFORMATTED, i));
+ assertEquals(getStyleValue(LOC_FIRST_SHADOW, "left"), result,
format(MSG_SUGGESTION_BOX_SHADOW_DEPTH_PREFORMATTED, i));
assertEquals(selenium.getValue(locInput), result);
+ selenium.click(LOC_FIRST_NOTHING_FOUND);
+ selenium.waitForCondition(format("jqFind('{0}').is(':hidden')",
removeJQueryPrefix(LOC_FIRST_SHADOW)), "5000");
+ Wait.timeout(500).waitForTimeout();
}
- }
+ }
/**
* Tests the "Shadow Opacity" slider. It tests values 10, 5, 0, 9, 1, -1,
12.
@@ -294,7 +309,7 @@
selenium.fireEvent(LOC_FIRST_INPUT, Event.KEYDOWN);
String result = range.getRoundedValue(i).toString();
Wait.failWith(format(MSG_SUGGESTION_BOX_SHADOW_OPACITY_PREFORMATTED,
String.valueOf(i))).until(
- new StyleCondition(LOC_FIRST_SHADOW_OPACITY_STYLE, "opacity",
format("0.{0}", result)));
+ new StyleCondition(LOC_FIRST_SHADOW, "opacity", format("0.{0}",
result)));
assertEquals(selenium.getValue(locInput), result);
}
}
@@ -479,6 +494,7 @@
private String locator;
private String style;
private String value;
+ private String actualValue;
/**
* @param locator
@@ -498,8 +514,14 @@
}
public boolean isTrue() {
- return getStyleValue(locator, style).equals(value);
+ actualValue = getStyleValue(locator, style);
+ return actualValue.equals(value);
}
+
+ @Override
+ public String toString() {
+ return actualValue;
+ }
}
/**
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/suggestionBox/locators.properties
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/suggestionBox/locators.properties 2010-01-19
11:53:00 UTC (rev 16330)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/suggestionBox/locators.properties 2010-01-19
12:23:01 UTC (rev 16331)
@@ -13,8 +13,8 @@
FIRST_BORDER_STYLE=jquery\=div[id$\=suggestionBoxId] div.rich-sb-ext-decor-2
FIRST_WIDTH_STYLE=jquery\=div[id$\=suggestionBoxId]
FIRST_HEIGHT_STYLE=jquery\=div[id$\=suggestionBoxId]
-FIRST_SHADOW_DEPTH_STYLE=jquery\=div[id$\=suggestionBoxId] > div\:eq(1)
-FIRST_SHADOW_OPACITY_STYLE=jquery\=div[id$\=suggestionBoxId] > div\:eq(1)
+FIRST_SHADOW=jquery\=div[id$\=suggestionBoxId] > div.rich-sb-shadow
+FIRST_NOTHING_FOUND=jquery\=tr[id$\=suggestionBoxIdNothingLabel] td
FIRST_CELLPADDING=jquery=div[id$=suggestionBoxId] table[id$=suggest]@cellpadding
SECOND_INPUT=jquery=fieldset:eq(1) input[id$=statesinput]