Author: vrockai
Date: 2009-05-11 07:03:03 -0400 (Mon, 11 May 2009)
New Revision: 13332
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/AdminPortalTestCase.java
Log:
[selenium] - portal admin; page security test case
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/AdminPortalTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/AdminPortalTestCase.java 2009-05-09
23:06:21 UTC (rev 13331)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/AdminPortalTestCase.java 2009-05-11
11:03:03 UTC (rev 13332)
@@ -22,6 +22,22 @@
/** prefix for locator properties = portal.admin. */
public final String casePfx = "portal.admin.";
+ private final String SUB_SEC_SUBMIT = getLoc(casePfx +
"sub.sec.submit","//input[contains(@id,'common-edit-security-form:update')]");
+ private final String SUB_SEC_CANCEL = getLoc(casePfx +
"sub.sec.cancel","//input[contains(@id,'common-edit-security-form:cancel')]");
+
+ private final String CHK_SEC_RUN_PR = getLoc(casePfx +
"chk.sec.run.pr","//input[contains(@id,'common-edit-security-form:cars_2:3')]");
+ private final String CHK_SEC_RUN_P = getLoc(casePfx +
"chk.sec.run.p","//input[contains(@id,'common-edit-security-form:cars_2:2')]");
+ private final String CHK_SEC_RUN_VR = getLoc(casePfx +
"chk.sec.run.vr","//input[contains(@id,'common-edit-security-form:cars_2:1')]");
+ private final String CHK_SEC_RUN_V = getLoc(casePfx +
"chk.sec.run.v","//input[contains(@id,'common-edit-security-form:cars_2:0')]");
+ private final String CHK_SEC_RU_PR = getLoc(casePfx +
"chk.sec.ru.pr","//input[contains(@id,'common-edit-security-form:cars_1:3')]");
+ private final String CHK_SEC_RU_P = getLoc(casePfx +
"chk.sec.ru.p","//input[contains(@id,'common-edit-security-form:cars_1:2')]");
+ private final String CHK_SEC_RU_VR = getLoc(casePfx +
"chk.sec.ru.vr","//input[contains(@id,'common-edit-security-form:cars_1:1')]");
+ private final String CHK_SEC_RU_V = getLoc(casePfx +
"chk.sec.ru.v","//input[contains(@id,'common-edit-security-form:cars_1:0')]");
+ private final String CHK_SEC_RA_PR = getLoc(casePfx +
"chk.sec.ra.pr","//input[contains(@id,'common-edit-security-form:cars_0:3')]");
+ private final String CHK_SEC_RA_P = getLoc(casePfx +
"chk.sec.ra.p","//input[contains(@id,'common-edit-security-form:cars_0:2')]");
+ private final String CHK_SEC_RA_VR = getLoc(casePfx +
"chk.sec.ra.vr","//input[contains(@id,'common-edit-security-form:cars_0:1')]");
+ private final String CHK_SEC_RA_V = getLoc(casePfx +
"chk.sec.ra.v","//input[contains(@id,'common-edit-security-form:cars_0:0')]");
+
private final String MES_P1 = getMess(casePfx + "p1", "Who's online
portlet");
private final String MES_P2 = getMess(casePfx + "p1",
"CharsetPortletInstance");
private final String MES_P3 = getMess(casePfx + "p1", "Coordination Map
Portlet");
@@ -655,7 +671,7 @@
String pageName = "PageToRename";
String pageNewName = "PageWasRenamed";
- createPage("TestPortal", "PageToRename");
+ createPage(portalName, pageName);
openAndWait("/portal");
clickAndWait("link=Admin");
@@ -709,13 +725,144 @@
Assert.assertTrue(r < 0, "Renamed page was found with the old name.");
}
-
- // TODO TEST CODE IS MISSING!
+
/**
- * TEST CODE IS MISSING!
+ * Page security testing. New page "PageToSecure" is created in
"TestPortal". The security page for the page is opened. It is asserted that all
checkboxes are off by
+ * default. All checkboxes are set to "checked" and cancel is clicked. The
security page is loaded again and it is asserted that all checkboxes are off after
cancel.
+ * All checkboxes are then set to "checked" and update button is clicked. The
security page is loaded again and it is asserted that all the checkboxes are in the
+ * "checked" state.
*/
- @Test(enabled = false, description = "")
+ @Test(enabled = true, dependsOnMethods = { "testPortalCreate",
"testAddPage" }, description = "Tests page security")
public void testPageSecurity() {
+
+ String portalName = "TestPortal";
+ String pageName = "PageToSecure";
+
+ createPage(portalName, pageName);
+
+ // cancel
+
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LINK_PORTALS_ID);
+ clickIfVisible(LINK_PORTAL_HOME);
+ Assert.assertTrue(selenium.isTextPresent("Create a portal named:"));
+ int r = findTableRow(TABLE_PORTAL_ADMIN, portalName, 0) - 1;
+
+ clickAndWait(MessageFormat.format(POR_TL_MAIN, r));
+
+ r = findTableRow(TABLE_PORTALPAGE_ADMIN, pageName, 0) - 1;
+
+ clickAndWait(MessageFormat.format(PAG_TL_SECURITY, r));
+
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RA_V),"Checkbox should not be
checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RA_VR),"Checkbox should not be
checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RA_P),"Checkbox should not be
checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RA_PR),"Checkbox should not be
checked");
+
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RU_V),"Checkbox should not be
checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RU_VR),"Checkbox should not be
checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RU_P),"Checkbox should not be
checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RU_PR),"Checkbox should not be
checked");
+
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RUN_V),"Checkbox should not be
checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RUN_VR),"Checkbox should not be
checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RUN_P),"Checkbox should not be
checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RUN_PR),"Checkbox should not be
checked");
+
+ selenium.click(CHK_SEC_RA_V);
+ selenium.click(CHK_SEC_RA_VR);
+ selenium.click(CHK_SEC_RA_P);
+ selenium.click(CHK_SEC_RA_PR);
+
+ selenium.click(CHK_SEC_RU_V);
+ selenium.click(CHK_SEC_RU_VR);
+ selenium.click(CHK_SEC_RU_P);
+ selenium.click(CHK_SEC_RU_PR);
+
+ selenium.click(CHK_SEC_RUN_V);
+ selenium.click(CHK_SEC_RUN_VR);
+ selenium.click(CHK_SEC_RUN_P);
+ selenium.click(CHK_SEC_RUN_PR);
+
+ selenium.click(SUB_SEC_CANCEL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ // update
+
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LINK_PORTALS_ID);
+ clickIfVisible(LINK_PORTAL_HOME);
+ Assert.assertTrue(selenium.isTextPresent("Create a portal named:"));
+ r = findTableRow(TABLE_PORTAL_ADMIN, portalName, 0) - 1;
+
+ clickAndWait(MessageFormat.format(POR_TL_MAIN, r));
+
+ r = findTableRow(TABLE_PORTALPAGE_ADMIN, pageName, 0) - 1;
+
+ clickAndWait(MessageFormat.format(PAG_TL_SECURITY, r));
+
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RA_V),"Checkbox should not be
checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RA_VR),"Checkbox should not be
checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RA_P),"Checkbox should not be
checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RA_PR),"Checkbox should not be
checked");
+
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RU_V),"Checkbox should not be
checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RU_VR),"Checkbox should not be
checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RU_P),"Checkbox should not be
checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RU_PR),"Checkbox should not be
checked");
+
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RUN_V),"Checkbox should not be
checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RUN_VR),"Checkbox should not be
checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RUN_P),"Checkbox should not be
checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RUN_PR),"Checkbox should not be
checked");
+
+ selenium.click(CHK_SEC_RA_V);
+ selenium.click(CHK_SEC_RA_VR);
+ selenium.click(CHK_SEC_RA_P);
+ selenium.click(CHK_SEC_RA_PR);
+
+ selenium.click(CHK_SEC_RU_V);
+ selenium.click(CHK_SEC_RU_VR);
+ selenium.click(CHK_SEC_RU_P);
+ selenium.click(CHK_SEC_RU_PR);
+
+ selenium.click(CHK_SEC_RUN_V);
+ selenium.click(CHK_SEC_RUN_VR);
+ selenium.click(CHK_SEC_RUN_P);
+ selenium.click(CHK_SEC_RUN_PR);
+
+ selenium.click(SUB_SEC_SUBMIT);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ // assert
+
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LINK_PORTALS_ID);
+ clickIfVisible(LINK_PORTAL_HOME);
+ Assert.assertTrue(selenium.isTextPresent("Create a portal named:"));
+ r = findTableRow(TABLE_PORTAL_ADMIN, portalName, 0) - 1;
+
+ clickAndWait(MessageFormat.format(POR_TL_MAIN, r));
+
+ r = findTableRow(TABLE_PORTALPAGE_ADMIN, pageName, 0) - 1;
+
+ clickAndWait(MessageFormat.format(PAG_TL_SECURITY, r));
+
+ Assert.assertTrue(selenium.isChecked(CHK_SEC_RA_V),"Checkbox should be
checked");
+ Assert.assertTrue(selenium.isChecked(CHK_SEC_RA_VR),"Checkbox should be
checked");
+ Assert.assertTrue(selenium.isChecked(CHK_SEC_RA_P),"Checkbox should be
checked");
+ Assert.assertTrue(selenium.isChecked(CHK_SEC_RA_PR),"Checkbox should be
checked");
+
+ Assert.assertTrue(selenium.isChecked(CHK_SEC_RU_V),"Checkbox should be
checked");
+ Assert.assertTrue(selenium.isChecked(CHK_SEC_RU_VR),"Checkbox should be
checked");
+ Assert.assertTrue(selenium.isChecked(CHK_SEC_RU_P),"Checkbox should be
checked");
+ Assert.assertTrue(selenium.isChecked(CHK_SEC_RU_PR),"Checkbox should be
checked");
+
+ Assert.assertTrue(selenium.isChecked(CHK_SEC_RUN_V),"Checkbox should be
checked");
+ Assert.assertTrue(selenium.isChecked(CHK_SEC_RUN_VR),"Checkbox should be
checked");
+ Assert.assertTrue(selenium.isChecked(CHK_SEC_RUN_P),"Checkbox should be
checked");
+ Assert.assertTrue(selenium.isChecked(CHK_SEC_RUN_PR),"Checkbox should be
checked");
+
}
/**