Author: vrockai
Date: 2009-05-06 10:06:14 -0400 (Wed, 06 May 2009)
New Revision: 13307
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/DashboardTestCase.java
Log:
[JBPORTAL-2380] - drag and drop test added, class slightly refactored
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/DashboardTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/DashboardTestCase.java 2009-05-06
13:44:35 UTC (rev 13306)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/DashboardTestCase.java 2009-05-06
14:06:14 UTC (rev 13307)
@@ -5,6 +5,8 @@
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import sun.security.action.GetBooleanAction;
+
/**
* DashboardTestCase is responsible for testing configure dashboard functions.
* Each test is running with user "admin" logged in.
@@ -14,11 +16,19 @@
@Test(groups = { "cms_dashboard" }, enabled = true, description =
"Dashboard issues test case.")
public class DashboardTestCase extends JBossPortalSeleniumTestCase {
- private static final String MSG_POWER = "Powered by JBoss";
-
/** prefix for locator properties = dash. */
public String casePfx = "dash.";
+ private final String HAND_R1 = getLoc(casePfx + "hand.r1",
"//html/body/div[2]/div/div/div[2]/div[2]/div/div/div[2]/div/div");
+ private final String HAND_L1 = getLoc(casePfx + "hand.l1",
"//html/body/div[2]/div/div/div[2]/div/div/div/div/div/div/table/tbody/tr/td[2]/div");
+ private final String SPAN_R1 = getLoc(casePfx + "span.r1",
"//html/body/div[2]/div/div/div[2]/div[2]/div/div/div/div/div/table/tbody/tr/td[2]/div/div/span");
+ private final String DIV_REG_A = getLoc(casePfx + "div.reg.a",
"//div[@id='regionA']");
+ private final String DIV_REG_B = getLoc(casePfx + "div.reg.b",
"//div[@id='regionB']");
+ private final String SPAN_L2 = getLoc(casePfx + "span.l2",
"//html/body/div[2]/div/div/div[2]/div/div/div/div[2]/div/div/table/tbody/tr/td[2]/div/div/span");
+ private final String SPAN_L1 = getLoc(casePfx + "span.l1",
"//html/body/div[2]/div/div/div[2]/div/div/div/div/div/div/table/tbody/tr/td[2]/div/div/span");
+
+ private final String MSG_POWER = getMess(casePfx + "msg.power", "Powered
by JBoss");
+
private final String LNK_POR_WEA_EDIT = getLoc(casePfx + "lnk.por.wea.edit",
"//body/div[2]/div/div/div[2]/div/div/div/div/div/div/table/tbody/tr/td[2]/div/div/div[2]/span/a");
private final String SUB_LAYOUT_UPDATE = getLoc(casePfx + "sub.layout.update",
"//input[contains(@name,'dashboardLayoutForm:j_id12')]");
@@ -65,6 +75,32 @@
}
/**
+ * Simple drag and drop test processed on "user" dashboard. The greetings
+ * portlet is moved from left to right column and the cms portlet is moved
+ * from the right to left corner. The names of Greetings and User profile
+ * portlets are then used for final assertion. The Greetings portlet message
+ * must be at the top right corner and the "user profile" message should be
+ * in the top left corner.
+ */
+ @Test(enabled = true)
+ public void testDragAndDrop() {
+ logout();
+ login("user", "user");
+ selenium.click(LNK_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertEquals(selenium.getText(SPAN_L1), "Greetings !");
+ Assert.assertEquals(selenium.getText(SPAN_L2), "User profile");
+
+ selenium.dragAndDropToObject(HAND_L1, DIV_REG_B);
+ selenium.dragAndDropToObject(HAND_R1, DIV_REG_A);
+
+ Assert.assertEquals(selenium.getText(SPAN_L1), "User profile");
+ Assert.assertEquals(selenium.getText(SPAN_R1), "Greetings !");
+
+ }
+
+ /**
* Creates a page. In Dashboard configuration a new page named
* "DashTestPage" is created. The existence of the link (page) is then
* asserted on dashboard.s
@@ -72,8 +108,8 @@
@Test(enabled = true)
public void testCreatePage() {
selenium.click(LNK_DASHBOARD);
- selenium.setSpeed("5000");
- // selenium.waitForPageToLoad(PAGE_LOAD);
+ // selenium.setSpeed("5000");
+ selenium.waitForPageToLoad(PAGE_LOAD);
waitFor(AJAX_LOAD);
selenium.click(LNK_CONFIGURE_DASHBOARD);
@@ -230,6 +266,8 @@
selenium.click("link=DashTestPage");
selenium.waitForPageToLoad(PAGE_LOAD);
+ waitFor(AJAX_LOAD);
+
Assert.assertTrue(selenium.isTextPresent("Current users"));
Assert.assertTrue(selenium.isTextPresent("Among them: * logged-in"));
Assert.assertTrue(selenium.isTextPresent("[admin]"));
@@ -381,9 +419,14 @@
//
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=143023
//
https://jira.jboss.org/jira/browse/JBPORTAL-2177
/**
- * Dashboard rename page loses portlet state settings bug testing.
- * From forum reference <a
href="http://www.jboss.com/index.html?module=bb&op=viewtopic&...;.
- * Jira for this issue already created in <a
href="https://jira.jboss.org/jira/browse/JBPORTAL-2177">http...;.
+ * Dashboard rename page loses portlet state settings bug testing. From
+ * forum reference <a
+ *
href="http://www.jboss.com/index.html?module=bb&op=viewtopic&...
+ *
>http://www.jboss.com/index.html?module=bb&op=viewtopic&t=143023</a>.
+ * Jira for this issue already created in <a
+ *
href="https://jira.jboss.org/jira/browse/JBPORTAL-2177"
+ * >https://jira.jboss.org/jira/browse/JBPORTAL-2177</a>.
+ *
* <pre>
* - in Configure Dashboard, create a new dashboard page; I called mine test1
* - in the left region, add the Weather portlet