Author: dsvyatobatsko
Date: 2009-02-05 08:32:55 -0500 (Thu, 05 Feb 2009)
New Revision: 12575
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/panelMenuGroup/styleAndClasseStandardHTMLAttributesTest.xhtml
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/panelMenuItem/panelMenuItemAutoTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/panelMenuItem/styleAndClasseStandardHTMLAttributesTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelMenuGroupTest.java
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelMenuItemTest.java
Log:
https://jira.jboss.org/jira/browse/RF-5902
https://jira.jboss.org/jira/browse/RF-5911
https://jira.jboss.org/jira/browse/RF-5909
+ refactoring
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/panelMenuGroup/styleAndClasseStandardHTMLAttributesTest.xhtml
===================================================================
(Binary files differ)
Property changes on:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/panelMenuGroup/styleAndClasseStandardHTMLAttributesTest.xhtml
___________________________________________________________________
Name: svn:mime-type
+ application/xhtml+xml
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/panelMenuItem/panelMenuItemAutoTest.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/panelMenuItem/styleAndClasseStandardHTMLAttributesTest.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelMenuGroupTest.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelMenuGroupTest.java 2009-02-05
13:26:16 UTC (rev 12574)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelMenuGroupTest.java 2009-02-05
13:32:55 UTC (rev 12575)
@@ -1,116 +1,65 @@
package org.richfaces.testng;
-import java.util.HashMap;
-import java.util.Map;
-
import org.ajax4jsf.template.Template;
import org.richfaces.AutoTester;
-import org.richfaces.SeleniumTestBase;
+import org.testng.Assert;
import org.testng.annotations.Test;
-public class PanelMenuGroupTest extends SeleniumTestBase {
+public class PanelMenuGroupTest extends PanelMenuItemTest {
- private static Map<String, String> params = new HashMap<String,
String>();
+ @Test
+ public void testIconsAttributesApply(Template template) {
+ renderPage(LOOK_AND_FEEL_TEST_URL, template, null);
- static {
- params.put("parameter1", "value1");
- params.put("parameter2", "value2");
- params.put("parameter3", "value3");
- }
+ writeStatus("Check icons attributes apply: are output to client and images
are accessible");
+ String itemId = getParentId() + FORM_ID + "componentId";
+ String iconImgXpath = "//*[@id='" + itemId +
"']/table/tbody/tr/td[1]/img";
- @Test
- public void testRenderedAttribute(Template template) {
- AutoTester tester = getAutoTester(this);
- tester.renderPage(template, null);
- writeStatus("Test component with rendered = false is not present on the
page");
- tester.testRendered();
- }
+ writeStatus("Check iconDisabled attribute");
+ disable(true);
- @Test
- public void testReRenderAttribute(Template template) {
- AutoTester tester = getAutoTester(this);
- tester.renderPage(template, null);
- writeStatus("Test component re-renders another components");
- tester.testReRender();
- }
+ Assert.assertTrue(isPresent(iconImgXpath), "Icon is not rendered");
+ testIcon(iconImgXpath, "Disc");
- @Test
- public void testOncomplete(Template template) {
- AutoTester tester = getAutoTester(this);
- tester.renderPage(template, null);
- writeStatus("Test oncomplete attribute");
- tester.testOncomplete();
- }
+ disable(false);
- @Test
- public void testAjaxSingle(Template template) {
- AutoTester autoTester = getAutoTester(this);
- autoTester.renderPage(template, null);
- writeStatus("Test ajaxSingle attribute in case of external validation
failure");
- autoTester.testAjaxSingle();
- }
+ writeStatus("Check iconCollapsed attribute");
+ Assert.assertTrue(isPresent(iconImgXpath), "Icon is not rendered");
+ testIcon(iconImgXpath, "TriangleUp");
- @Test
- public void testLimitToListAttribute(Template template) {
- AutoTester tester = getAutoTester(this);
- tester.renderPage(template, null);
- writeStatus("Test component with limitToList = true skips ajaxRendered areas
update");
- tester.testLimitToList();
+ writeStatus("Check iconExpanded attribute");
+ clickAjaxCommandAndWait("icon" + itemId);
+ Assert.assertTrue(isPresent(iconImgXpath), "Icon is not rendered");
+ testIcon(iconImgXpath, "TriangleDown");
}
@Test
- public void testNestedParams(Template template) {
- AutoTester tester = getAutoTester(this);
- tester.renderPage(template, null);
- writeStatus("Test component encodes nested f:param tags and their values are
present as request parameters");
- tester.testRequestParameters(params);
- }
+ public void testOncollapseOnexpandEventsFired(Template template) {
+ renderPage(LOOK_AND_FEEL_TEST_URL, template, null);
- @Test
- public void testImmediate(Template template) {
- AutoTester tester = getAutoTester(this);
- tester.renderPage(template, null);
- writeStatus("Test immediate attribute");
- tester.testImmediate();
- }
+ writeStatus("Check oncollapse/onexpand events are fired ");
- @Test
- public void testImmediateWithExternalValidationFailed(Template template) {
- AutoTester tester = getAutoTester(this);
- tester.renderPage(template, null);
- writeStatus("Test immediate attribute with external validation
failed");
- tester.testImmediateWithExternalValidationFailed();
- }
+ String componentId = "icon" + getParentId() + FORM_ID +
"componentId";
- @Test
- public void testWithExternalValidationFailure(Template template) {
- AutoTester autoTester = getAutoTester(this);
- autoTester.renderPage(template, null);
- writeStatus("Check component in case of external validation failure:
listeners are not invoked, model is not updated");
- autoTester.testExtrenalValidationFailure();
+ clickAjaxCommandAndWait(componentId);
+ assertEvent("onexpand");
+ clickAjaxCommandAndWait(componentId);
+ assertEvent("oncollapse");
}
- @Test
- public void testBypassUpdatesAttribute(Template template) {
- AutoTester tester = getAutoTester(this);
- tester.renderPage(template, null);
- writeStatus("Test component with bypassUpdates = true skips update model
values phase");
- tester.testBypassUpdate();
- }
-
@Override
public void sendAjax() {
clickAjaxCommandAndWait("icon" +
getAutoTester(this).getClientId(AutoTester.COMPONENT_ID));
}
@Override
- public String getAutoTestUrl() {
- return "pages/panelMenuGroup/panelMenuGroupAutoTest.xhtml";
+ public String getTestBase() {
+ return "pages/panelMenuGroup/";
}
@Override
- public String getTestUrl() {
- return null;
+ public String getAutoTestUrl() {
+ return "panelMenuGroupAutoTest.xhtml";
}
}
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelMenuItemTest.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelMenuItemTest.java 2009-02-05
13:26:16 UTC (rev 12574)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelMenuItemTest.java 2009-02-05
13:32:55 UTC (rev 12575)
@@ -12,13 +12,12 @@
public class PanelMenuItemTest extends SeleniumTestBase {
- private final static String LOOK_AND_FEEL_TEST_URL =
"pages/panelMenuItem/styleAndClasseStandardHTMLAttributesTest.xhtml";
+ protected final static String LOOK_AND_FEEL_TEST_URL =
"styleAndClasseStandardHTMLAttributesTest.xhtml";
- private static final String FORM_ID = "form:";
+ protected static final String FORM_ID = "form:";
- private static final String CONTROL_FORM_ID = "control:";
+ protected static final String CONTROL_FORM_ID = "control:";
-
private static Map<String, String> params = new HashMap<String,
String>();
static {
@@ -114,7 +113,7 @@
writeStatus("Check standard HTML attributes are output to client");
String parentId = getParentId();
- String menuItemId = "icon" + parentId + FORM_ID + "item";
+ String menuItemId = "icon" + parentId + FORM_ID +
"componentId";
disable(false);
@@ -129,12 +128,12 @@
writeStatus("Check styles and classes are output to client");
String parentId = getParentId();
- String itemId = parentId + FORM_ID + "item";
+ String itemId = parentId + FORM_ID + "componentId";
writeStatus("Check enabled component at first");
disable(false);
- String styleElementId = "tablehide" + parentId + FORM_ID +
"item";
+ String styleElementId = "tablehide" + parentId + FORM_ID +
"componentId";
assertStyleAttribute(styleElementId, "font-size: 16px", "Style
attribute was not output to client");
assertClassNames(styleElementId, new String[] { "noclass" },
"Class attribute was not output to client", true);
@@ -162,23 +161,30 @@
renderPage(LOOK_AND_FEEL_TEST_URL, template, null);
writeStatus("Check icons attributes apply: are output to client and images
are accessible");
+ String itemId = getParentId() + FORM_ID + "componentId";
+ String iconImgXpath = "//*[@id='" + itemId +
"']/table/tbody/tr/td[1]/img";
+ writeStatus("Check iconDisabled attribute");
+ disable(true);
+
+ Assert.assertTrue(isPresent(iconImgXpath), "Icon is not rendered");
+ testIcon(iconImgXpath, "Disc");
+
+ writeStatus("Check icon attribute");
disable(false);
- String itemId = getParentId() + FORM_ID + "item";
- String iconImgXpath = "//*[@id='" + itemId +
"']/table/tbody/tr/td[1]/img";
Assert.assertTrue(isPresent(iconImgXpath), "Icon is not rendered");
testIcon(iconImgXpath, "Chevron");
}
@Override
public void sendAjax() {
- clickAjaxCommandAndWait("icon" +
getAutoTester(this).getClientId("") + "item");
+ clickAjaxCommandAndWait("icon" +
getAutoTester(this).getClientId("") + "componentId");
}
@Override
public String getAutoTestUrl() {
- return "pages/panelMenuItem/panelMenuItemAutoTest.xhtml";
+ return "panelMenuItemAutoTest.xhtml";
}
@Override
@@ -186,7 +192,12 @@
return null;
}
- private boolean disable(boolean isDisabled) {
+ @Override
+ public String getTestBase() {
+ return "pages/panelMenuItem/";
+ }
+
+ protected boolean disable(boolean isDisabled) {
String parentId = getParentId();
String isDisabledId = parentId + CONTROL_FORM_ID + "isDisabled";
String disablingControlId = parentId + CONTROL_FORM_ID + "disable";
@@ -204,7 +215,7 @@
* @param location location of image representing icon to be tested
* @param iconName substring that icon uri has to contain
*/
- private void testIcon(String location, String iconSubstring) {
+ protected void testIcon(String location, String iconSubstring) {
String iconSrc = selenium.getAttribute(location + "/@src");
if (null == iconSrc || !iconSrc.matches(".*" + iconSubstring +
".*")) {
Assert.fail("It looks as if the icon is not proper. Uri of icon is being
tested must contain ["