Author: andrei_exadel
Date: 2008-10-31 12:28:18 -0400 (Fri, 31 Oct 2008)
New Revision: 10992
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/contextMenu/contextMenu.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ContextMenuTest.java
Log:
RF-4776
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/contextMenu/contextMenu.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ContextMenuTest.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ContextMenuTest.java 2008-10-31
16:27:13 UTC (rev 10991)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ContextMenuTest.java 2008-10-31
16:28:18 UTC (rev 10992)
@@ -50,8 +50,80 @@
contextMenuBody = contextMenuId + "_menu";
}
+ @Test
+ public void testContextMenuRendering(Template template) {
+ renderPage(template);
+
+ String parentId = getParentId();
+ String menuId = parentId + FORMID + "contextMenu2";
+ String menuBody = menuId + "_menu";
+ String autoCreatedId = menuId + ":_auto_created";
+
+ String showId = "showContext2";
+ String hideId = "hideContext2";
+
+ //show menu
+ clickById(showId);
+
+ waitForMenuShow(menuId);
+
+ AssertPresent(menuBody, "Context menu has not been displayed");
+ AssertPresent(autoCreatedId, "Context menu has not been displayed");
+
+ String menuGroupId = parentId + FORMID + "menuGroup";
+ String itemId = parentId + FORMID + "g5";
+ AssertPresent(menuGroupId, "Context menu group has not been displayed");
+ AssertPresent(itemId, "Menu item has not been displayed");
+
+ int separatorCount =
selenium.getXpathCount("//div[@id='"+menuBody+"']/div/div[@class='dr-menu-separator
rich-menu-separator']").intValue();
+ Assert.assertTrue(separatorCount == 1, "Separators count is invalid");
+
+ menuBody = parentId + FORMID + "menuGroup_menu";
+
+ AssertPresent(menuBody);
+ itemId = parentId + FORMID + "g1";
+ AssertTextEquals(itemId, "Item1", "Item label is invalid");
+ AssertPresent(itemId, "Menu item has not been displayed");
+ itemId = parentId + FORMID + "g2";
+ AssertTextEquals(itemId, "Item2", "Item label is invalid");
+ AssertPresent(itemId, "Menu item has not been displayed");
+ itemId = parentId + FORMID + "g3";
+ AssertPresent(itemId, "Menu separator div does not present");
+ itemId = parentId + FORMID + "g4";
+ AssertTextEquals(itemId, "Item3", "Item label is invalid");
+ AssertPresent(itemId, "Menu item has not been displayed");
+
+ separatorCount =
selenium.getXpathCount("//div[@id='"+menuBody+"']/div/div[@class='dr-menu-separator
rich-menu-separator']").intValue();
+ Assert.assertTrue(separatorCount == 1, "Separators count is invalid");
+
+ clickById(hideId);
+ clickById(showId);
+
+ menuId = parentId + FORMID + "menuGroup";
+ fireMouseEvent(menuId, "mouseover", 10, 10, false);
+ waitForMenuShow(menuId);
+
+ String top = runScript(getElementById(menuBody) + ".style.top");
+ String left = runScript(getElementById(menuBody) + ".style.left");
+
+ Assert.assertTrue(top != null && top.length() > 0);
+ Assert.assertTrue(left != null && left.length() > 0);
+
+ AssertTextEquals(menuId, "Group1", "Group label is invalid");
+
+
+ }
- @Test
+ private void waitForMenuShow(String id) {
+ String bodyId = id + "_menu";
+ if (!selenium.isElementPresent(bodyId)) {
+ waiteForCondition(getElementById(bodyId), 5000);
+ }
+ waiteForCondition(getElementById(bodyId) + ".style.display !=
'none'", 5000);
+ }
+
+
+ //@Test
public void testContextMenuStandAlone(Template template) {
renderPage(template);
initIds(getParentId(), UNATTACHED_CONTEXTMENU);
@@ -72,7 +144,7 @@
AssertNotVisible(contextMenuBody, "Context menu has not been hidden");
}
- @Test
+ //@Test
public void testComponentControlManagement(Template template) {
renderPage(template);
initIds(getParentId(), UNATTACHED_CONTEXTMENU);
@@ -94,7 +166,7 @@
AssertNotVisible(contextMenuBody, "Context menu has not been hidden");
}
- @Test
+ //@Test
public void testMacrodefinitions(Template template) {
renderPage(template);
initIds(getParentId(), UNATTACHED_CONTEXTMENU);
Show replies by date