Author: dsvyatobatsko
Date: 2009-03-27 13:45:38 -0400 (Fri, 27 Mar 2009)
New Revision: 13271
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/suggestionBox/suggestionBoxAutoTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/SuggestionBoxTest.java
Log:
RF-6248, RF-6255
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/suggestionBox/suggestionBoxAutoTest.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java 2009-03-27
16:51:27 UTC (rev 13270)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java 2009-03-27
17:45:38 UTC (rev 13271)
@@ -1134,6 +1134,18 @@
assertAttributeContains(locator, "class", expectedExpression,
message);
}
+ public void assertClassAttributeDoesNotContain(String locator, String
expectedExpression, String message) {
+ boolean contain = true;
+ try {
+ assertAttributeContains(locator, "class", expectedExpression,
message);
+ } catch (AssertionError ae) {
+ contain = false;
+ }
+ if (contain) {
+ throw new AssertionError(message);
+ }
+ }
+
/**
* Asserts that element attribute with given name <code>attrName</code>
contains <code>expectedExpression</code>
* @param locator id or xpath expression locating element
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/SuggestionBoxTest.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/SuggestionBoxTest.java 2009-03-27
16:51:27 UTC (rev 13270)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/SuggestionBoxTest.java 2009-03-27
17:45:38 UTC (rev 13271)
@@ -165,6 +165,72 @@
Assert.assertEquals("Baku", capital);
}
+ @Test
+ public void testNothingLabelAttribute(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, RESET_METHOD);
+ writeStatus("Check nothingLabel attribute is shown up as sure as no
suggestions available; item selection is not available");
+ String componentId = tester.getClientId("suggestion");
+ String suggestPopupId = tester.getClientId(AutoTester.COMPONENT_ID +
":suggest");
+
+ writeStatus("Misspell a little");
+ type(componentId, "Azir");
+ waitForAjaxCompletion();
+ AssertVisible(suggestPopupId, "Suggestion popup is not come up");
+ Assert.assertEquals(1, selenium.getXpathCount("//table[@id='" +
suggestPopupId + "']/tbody/tr"));
+ String nothingLabelItemXpath = "//table[@id='" + suggestPopupId +
"']/tbody/tr[1]";
+ AssertTextEquals(nothingLabelItemXpath, "No countries found");
+
+ writeStatus("Check item is not selectable");
+ selenium.click(nothingLabelItemXpath);
+ AssertValueEquals(componentId, "Azir");
+ }
+
+ @Test
+ public void testStylesAndClassesAndHtmlAttributes(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, RESET_METHOD);
+ String inputId = tester.getClientId("suggestion");
+ String componentId = tester.getClientId(AutoTester.COMPONENT_ID);
+ String spId = tester.getClientId(AutoTester.COMPONENT_ID +
":suggest");
+
+ type(inputId, "men");
+ waitForAjaxCompletion();
+
+ writeStatus("Check styles and classes are output to client");
+
+ writeStatus("Check styleClass/style attributes");
+ assertStyleAttributeContains(componentId, "font-size: 13px",
"Style attribute was not output to client");
+ assertClassAttributeContains(componentId, "noclass", "Class
attribute was not output to client");
+
+ writeStatus("Check popupClass/popupStyle attributes");
+ //assertStyleAttributeContains(componentId, "font-size: 14px",
"popupStyle attribute was not output to client");
+ assertClassAttributeContains(componentId, "popup-class",
"popupClass attribute was not output to client");
+
+ writeStatus("Check height/width attributes");
+ int w = selenium.getElementWidth(componentId).intValue();
+ int h = selenium.getElementHeight(componentId).intValue();
+
+ if (250 != h || 300 != w) {
+ Assert.fail("height/width are not applied: Expected [h=250,w=300] was
[h=" + h + ",w=" + w + "]");
+ }
+
+ writeStatus("Check entryClass attribute");
+ assertClassAttributeContains("//table[@id='" + spId +
"']/tbody/tr[1]", "entry-class", "entryClass attribute was
not output to client");
+ assertClassAttributeContains("//table[@id='" + spId +
"']/tbody/tr[2]", "entry-class", "entryClass attribute was
not output to client");
+
+ writeStatus("Check style alternating rows feature - rowClasses
attribute");
+ assertClassAttributeContains("//table[@id='" + spId +
"']/tbody/tr[1]", "odd-class", "rowClasses attribute is not
applied");
+ assertClassAttributeDoesNotContain("//table[@id='" + spId +
"']/tbody/tr[1]", "even-class", "rowClasses attribute is not
applied");
+ assertClassAttributeContains("//table[@id='" + spId +
"']/tbody/tr[2]", "even-class", "rowClasses attribute is not
applied");
+ assertClassAttributeDoesNotContain("//table[@id='" + spId +
"']/tbody/tr[2]", "odd-class", "rowClasses attribute is not
applied");
+
+ writeStatus("Check selectedClass attribute");
+ selenium.keyDown(inputId, "\\40");// select second row
+ assertClassAttributeDoesNotContain("//table[@id='" + spId +
"']/tbody/tr[1]", "selected-class", "selectedClass attribute
was output to client");
+ assertClassAttributeContains("//table[@id='" + spId +
"']/tbody/tr[2]", "selected-class", "selectedClass attribute
was not output to client");
+ }
+
@Override
public void sendAjax() {
type(getAutoTester(this).getClientId("suggestion"), "Bel");