Author: dsvyatobatsko
Date: 2009-03-23 14:39:15 -0400 (Mon, 23 Mar 2009)
New Revision: 13123
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/suggestionBox/suggestionBoxAutoTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/SuggestionBoxTest.java
Log:
RF-6250, RF-6254
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/testng/SuggestionBoxTest.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/SuggestionBoxTest.java 2009-03-23
18:20:06 UTC (rev 13122)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/SuggestionBoxTest.java 2009-03-23
18:39:15 UTC (rev 13123)
@@ -3,6 +3,8 @@
import java.util.HashMap;
import java.util.Map;
+import junit.framework.Assert;
+
import org.ajax4jsf.template.Template;
import org.richfaces.AutoTester;
import org.richfaces.SeleniumTestBase;
@@ -115,6 +117,54 @@
tester.testAjaxSingleWithProcesExternalValidation(false);
}
+ @Test
+ public void testKeyboardNavigation(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, RESET_METHOD);
+ writeStatus("Check keyboard navigation works for component");
+ String componentId = getAutoTester(this).getClientId("suggestion");
+
+ type(componentId, "stan");
+ waitForAjaxCompletion();
+ selenium.keyDown(componentId, "\\40");//down x 4 times
+ selenium.keyDown(componentId, "\\40");
+ selenium.keyDown(componentId, "\\40");
+ selenium.keyDown(componentId, "\\40");
+ selenium.keyDown(componentId, "\\13");//enter
+ AssertValueEquals(componentId, "Uzbekistan");
+
+ type(componentId, "stan");
+ waitForAjaxCompletion();
+ selenium.keyDown(componentId, "\\40");//down x 2 times
+ selenium.keyDown(componentId, "\\40");
+ selenium.keyDown(componentId, "\\38");//up
+ selenium.keyDown(componentId, "\\13");//enter
+ AssertValueEquals(componentId, "Kyrgyzstan");
+ }
+
+ @Test
+ public void testJSAPI(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, RESET_METHOD);
+ writeStatus("Check JS API is present and works");
+
+ writeStatus("Check callSuggestion(ignoreMinChars) function");
+ String componentId = getAutoTester(this).getClientId(AutoTester.COMPONENT_ID);
+ String suggestInputId = getAutoTester(this).getClientId("suggestion");
+ type(suggestInputId, "Be");
+ invokeFromComponent(componentId, "callSuggestion", true);
+ waitForAjaxCompletion();
+ selenium.keyDown(suggestInputId, "\\13");//enter
+ AssertValueEquals(suggestInputId, "Belarus");
+
+ writeStatus("Check getSelectedItems() function");
+ type(suggestInputId, "Aze");//Azerbaijan
+ waitForAjaxCompletion();
+ selenium.keyDown(suggestInputId, "\\13");//enter
+ String capital =
runScript(String.format("document.getElementById('%1$s').component.getSelectedItems()[0].capital",
componentId));
+ Assert.assertEquals("Baku", capital);
+ }
+
@Override
public void sendAjax() {
type(getAutoTester(this).getClientId("suggestion"), "Bel");