JBoss Portal SVN: r12061 - in branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests: selenium-rc-server and 1 other directories.
by portal-commits@lists.jboss.org
Author: vrockai
Date: 2008-10-14 11:18:59 -0400 (Tue, 14 Oct 2008)
New Revision: 12061
Modified:
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/selenium-rc-server/user-extensions.js
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/AdminPortalTestCase.java
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/DashboardsTestCase.java
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/PortletDefinitionsTestCase.java
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/PortletInstancesTestCase.java
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/testng.xml
Log:
portal admin tests cases added
Modified: branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/selenium-rc-server/user-extensions.js
===================================================================
--- branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/selenium-rc-server/user-extensions.js 2008-10-13 16:26:13 UTC (rev 12060)
+++ branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/selenium-rc-server/user-extensions.js 2008-10-14 15:18:59 UTC (rev 12061)
@@ -44,7 +44,7 @@
Selenium.prototype.assertTextOrder = function(textValues) {
var allText = this.page().bodyText();
- var expectedTextValues = textValues.parseCSV();
+ var expectedTextValues = textValues.split(";");
for (var i = 0; i < expectedTextValues.length - 1; i++) {
var index = allText.indexOf(expectedTextValues[i]);
Modified: branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/AdminPortalTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/AdminPortalTestCase.java 2008-10-13 16:26:13 UTC (rev 12060)
+++ branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/AdminPortalTestCase.java 2008-10-14 15:18:59 UTC (rev 12061)
@@ -14,17 +14,38 @@
@Test(groups = { "admin_portal" }, enabled = true, description = "Partal administrating.")
public class AdminPortalTestCase extends JBossPortalSeleniumTestCase {
- private static final String SUBMIT_RENAME_PORTAL = "renameForm:rename";
- private static final String INPUT_RENAME_PORTAL = "renameForm:newName";
+ private static final String TABLE_PAGE_DISP_LANG = "display-name-form1:locale-datatable";
+ private static final String SUB_PAGE_DISP_LANG = "display-name-form:add-display";
+ private static final String INP_PAGE_DISP_LANG = "display-name-form:newName";
+ private static final String SEL_PAGE_DISP_LANG = "display-name-form:locales";
+ private static final String SUB_PAGE_PROP_ERR_UPDATE = "common-edit-page-error-form:update_2";
+ private static final String SUB_PAGE_PROP_LISTENER = "edit-prop-form:update";
+ private static final String SEL_PAGE_PROP_LISTENER = "edit-prop-form:listener";
+ private static final String SUB_PAGE_PROP_UPDATE = "common-manage-prop-form:update_1";
+ private static final String SEL_PAGE_PROP_PREDEFINED = "common-edit-prop-form:predefined-properties:predefinedProperty";
+ private static final String PAGE_PROP_PREDEFINED_PROP = SEL_PAGE_PROP_PREDEFINED;
+ private static final String SUB_PAGE_PROP_ADDPROP = "common-edit-prop-form:add-property";
+ private static final String INP_PAGE_PROP_ADDPROP = "common-edit-prop-form:property";
+ private static final String SUB_PAGE_THEME = "common-edit-theme-form:_id41jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj";
+ private static final String SEL_PAGE_THEME_RENDERSET = "common-edit-theme-form:renderSet";
+ private static final String SEL_PAGE_THEME_THEME = "common-edit-theme-form:theme";
+ private static final String SEL_PAGE_THEME_LAY = "common-edit-theme-form:layout";
+ private static final String SUB_PAGE_LAY_ADDLEFT = "layoutForm:a_left";
+ private static final String SUB_PAGE_LAY_ADDCENTER = "layoutForm:a_center";
+ private static final String INP_PAGE_LAYOUT_NAME = "windowForm:windowName";
+ private static final String SUBMIT_RENAME_PAGE = "renameForm:rename";
+ private static final String INPUT_RENAME_PAGE = "renameForm:newName";
+ private static final String SUBMIT_RENAME_PORTAL = SUBMIT_RENAME_PAGE;
+ private static final String INPUT_RENAME_PORTAL = INPUT_RENAME_PAGE;
private static final String SUBMIT_DELETE_PORTAL_CONF = "delete-view:confirm-form:delete";
private static final String INPUT_SUBMIT_PAGECREATE = "create-page-form:create-page";
private static final String INPUT_PAGENAME = "create-page-form:pageName";
private static final String INPUT_PORTALNAME = "create-portal-form:name";
private static final String INPUT_SUBMIT_CREATEPORTAL = "create-portal-form:create-portal";
- private final String TAB_PORTALOBJ_ID = "//div[@id='current']/a";
+ private final String TAB_PORTALOBJ_ID = "instance-temp-form:portal-obj-link";
- private final String LINK_PORTALS_ID = "link=*Portal Objects*";
+ // private final String LINK_PORTALS_ID = "link=*Portal Objects*";
private final String LINK_PORTAL_HOME = "obj-temp-form:object-link-0";
private final String TABLE_PORTAL_ADMIN = "obj-nav-form:portal-datatable";
@@ -57,24 +78,243 @@
logout();
}
+ @Test(enabled = true, dependsOnMethods = { "testPortalCreate" })
+ public void testPortalMakeDef() {
+ // create portal
+ openAndWait("/portal");
+ Assert.assertTrue(selenium.isTextPresent("Greetings !"));
+
+ final String portalName = "TestDefPortal";
+
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LINK_PORTAL_HOME);
+
+ Assert.assertFalse(selenium.isTextPresent(portalName), "Not created page already exist.");
+
+ selenium.type(INPUT_PORTALNAME, portalName);
+ selenium.click(INPUT_SUBMIT_CREATEPORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ int r = findTableRow(TABLE_PORTAL_ADMIN, portalName, 0) - 1;
+
+ clickAndWait(MessageFormat.format(POR_TL_MAKEDEF, r));
+
+ openAndWait("/portal/");
+ Assert.assertFalse(selenium.isTextPresent("Greetings !"));
+ }
+
@Test(enabled = true)
+ public void testPortalSecure() {
+ // create portal
+ final String portalName = "template";
+
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LINK_PORTAL_HOME);
+
+ int r = findTableRow(TABLE_PORTAL_ADMIN, portalName, 0) - 1;
+
+ clickAndWait(MessageFormat.format(POR_TL_SECURITY, r));
+ // setting permissions to forbiden
+ selenium.click("//input[@name='common-edit-security-form:cars_2' and @value='viewrecursive']");
+ selenium.click("common-edit-security-form:update");
+ selenium.waitForPageToLoad("30000");
+
+ openAndWait("/portal/auth/portal/" + portalName);
+ Assert.assertTrue(selenium.isTextPresent("Access to the specified resource () has been forbidden."), "Secured page is not forbidden.");
+
+ // setting permissions to seen for admin, but not for user
+ openAndWait(ADDR_PORTAL);
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LINK_PORTAL_HOME);
+
+ r = findTableRow(TABLE_PORTAL_ADMIN, portalName, 0) - 1;
+
+ clickAndWait(MessageFormat.format(POR_TL_SECURITY, r));
+
+ selenium.click("//input[@name='common-edit-security-form:cars_0' and @value='viewrecursive']");
+ selenium.click("//input[@name='common-edit-security-form:cars_1' and @value='viewrecursive']");
+ selenium.click("common-edit-security-form:update");
+ selenium.waitForPageToLoad("30000");
+
+ openAndWait("/portal/auth/portal/" + portalName);
+ Assert.assertFalse(selenium.isTextPresent("Access to the specified resource () has been forbidden."), "Secured page is not forbidden.");
+
+ // click on everything
+ openAndWait(ADDR_PORTAL);
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LINK_PORTAL_HOME);
+
+ r = findTableRow(TABLE_PORTAL_ADMIN, portalName, 0) - 1;
+
+ clickAndWait(MessageFormat.format(POR_TL_SECURITY, r));
+
+ selenium.click("//input[@name='common-edit-security-form:cars_0']");
+ selenium.click("//input[@name='common-edit-security-form:cars_1']");
+ selenium.click("//input[@name='common-edit-security-form:cars_2']");
+ selenium.click("//input[@name='common-edit-security-form:cars_2' and @value='viewrecursive']");
+ selenium.click("//input[@name='common-edit-security-form:cars_2' and @value='personalize']");
+ selenium.click("//input[@name='common-edit-security-form:cars_1' and @value='personalize']");
+ selenium.click("//input[@name='common-edit-security-form:cars_0' and @value='personalize']");
+ selenium.click("//input[@name='common-edit-security-form:cars_0' and @value='personalizerecursive']");
+ selenium.click("//input[@name='common-edit-security-form:cars_1' and @value='personalizerecursive']");
+ selenium.click("//input[@name='common-edit-security-form:cars_2' and @value='personalizerecursive']");
+ selenium.click("common-edit-security-form:update");
+ selenium.waitForPageToLoad("30000");
+
+ openAndWait("/portal/auth/portal/" + portalName);
+ Assert.assertFalse(selenium.isTextPresent("Access to the specified resource () has been forbidden."), "Secured page is not forbidden.");
+
+ }
+
+ @Test(enabled = true, dependsOnMethods = { "testPortalCreate" })
+ public void testPortalProperties() {
+ // create portal
+ final String portalName = "TestPropPortal";
+
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LINK_PORTAL_HOME);
+
+ Assert.assertFalse(selenium.isTextPresent(portalName), "Not created page already exist.");
+
+ selenium.type(INPUT_PORTALNAME, portalName);
+ selenium.click(INPUT_SUBMIT_CREATEPORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ int r = findTableRow(TABLE_PORTAL_ADMIN, portalName, 0) - 1;
+
+ clickAndWait(MessageFormat.format(POR_TL_PROPERTIES, r));
+
+ // properties handling
+ selenium.type("common-edit-prop-form:property", "testProp");
+ clickAndWait("common-edit-prop-form:add-property");
+ selenium.type("common-manage-prop-form:prop-data-table:1:prop-value-input", "12");
+ clickAndWait("common-manage-prop-form:update_1");
+ clickAndWait("//a[@id='common-manage-prop-form:prop-data-table:1:delete']/span");
+ clickAndWait("common-edit-page-error-form:page-access-check");
+ clickAndWait("common-manage-prop-form:update_1");
+
+ // portal error handling
+ selenium.click("common-edit-portal-error-form:portal-access-check");
+ selenium.waitForPageToLoad("30000");
+ selenium.select("common-edit-portal-error-form:portal-access-select", "label=Redirect to the specified resource");
+ selenium.waitForPageToLoad("30000");
+ selenium.click("common-edit-portal-error-form:portal-unavail-check");
+ selenium.waitForPageToLoad("30000");
+ selenium.select("common-edit-portal-error-form:portal-unavail-select", "label=Redirect to the specified resource");
+ selenium.waitForPageToLoad("30000");
+ selenium.click("common-edit-portal-error-form:portal-error-check");
+ selenium.waitForPageToLoad("30000");
+ selenium.select("common-edit-portal-error-form:portal-error-select", "label=Display the default error message");
+ selenium.waitForPageToLoad("30000");
+ selenium.click("common-edit-portal-error-form:portal-internal-check");
+ selenium.waitForPageToLoad("30000");
+ selenium.select("common-edit-portal-error-form:portal-internal-select", "label=Display the default error message");
+ selenium.waitForPageToLoad("30000");
+ selenium.click("common-edit-portal-error-form:portal-not-found-check");
+ selenium.waitForPageToLoad("30000");
+ selenium.select("common-edit-portal-error-form:portal-not-found-select", "label=Redirect to the specified resource");
+ selenium.waitForPageToLoad("30000");
+ selenium.click("common-edit-portal-error-form:portal-res-check");
+ selenium.waitForPageToLoad("30000");
+ selenium.type("common-edit-portal-error-form:portal-res-input", "/WEB-INF/jsp/error/portalZ.jsp");
+ selenium.click("common-edit-portal-error-form:update_2");
+ selenium.waitForPageToLoad("30000");
+
+ // page error handling
+ selenium.select("common-edit-page-error-form:page-access-select", "label=Display the default error message");
+ selenium.waitForPageToLoad("30000");
+ clickAndWait("common-edit-page-error-form:page-control-check");
+ selenium.select("common-edit-page-error-form:page-control-select", "label=Display the default error message");
+ selenium.waitForPageToLoad("30000");
+ clickAndWait("common-edit-page-error-form:page-error-check");
+ selenium.select("common-edit-page-error-form:page-error-select", "label=Display the default error message");
+ selenium.waitForPageToLoad("30000");
+ clickAndWait("common-edit-page-error-form:page-internal-check");
+ selenium.select("common-edit-page-error-form:page-internal-select", "label=Display the default error message");
+ selenium.waitForPageToLoad("30000");
+ clickAndWait("common-edit-page-error-form:page-not-found-check");
+ selenium.select("common-edit-page-error-form:page-not-found-select", "label=Display the default error message");
+ selenium.waitForPageToLoad("30000");
+ clickAndWait("common-edit-page-error-form:page-res-check");
+ clickAndWait("common-edit-page-error-form:update_3");
+
+ // listener
+
+ selenium.select(SEL_PAGE_PROP_LISTENER, "label=test_listener");
+ clickAndWait(SUB_PAGE_PROP_LISTENER);
+ }
+
+ @Test(enabled = true, dependsOnMethods = { "testPortalCreate" })
+ public void testPortalTheme() {
+ // create portal
+ final String portalName = "TestThemePortal";
+
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LINK_PORTAL_HOME);
+
+ Assert.assertFalse(selenium.isTextPresent(portalName), "Not created page already exist.");
+
+ selenium.type(INPUT_PORTALNAME, portalName);
+ selenium.click(INPUT_SUBMIT_CREATEPORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ int r = findTableRow(TABLE_PORTAL_ADMIN, portalName, 0) - 1;
+
+ clickAndWait(MessageFormat.format(POR_TL_THEME, r));
+
+ // changing theme
+
+ selenium.select("common-edit-theme-form:layout", "label=1column");
+ selenium.select("common-edit-theme-form:theme", "label=mission-critical");
+ selenium.select("common-edit-theme-form:renderSet", "label=emptyRenderer");
+ selenium.click("common-edit-theme-form:_id34jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj");
+ selenium.waitForPageToLoad("30000");
+
+ clickAndWait("admin-portal-form:edit-theme-link");
+
+ selenium.select("common-edit-theme-form:layout", "label=1column");
+ selenium.select("common-edit-theme-form:theme", "label=mission-critical");
+ selenium.select("common-edit-theme-form:renderSet", "label=emptyRenderer");
+ selenium.click("common-edit-theme-form:_id33jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj");
+ selenium.waitForPageToLoad("30000");
+ }
+
+ @Test(enabled = true)
public void testPortalCreate() {
selenium.click("link=Admin");
selenium.waitForPageToLoad(PAGE_LOAD);
-
clickIfVisible(TAB_PORTALOBJ_ID);
- clickIfVisible(LINK_PORTALS_ID);
+ clickIfVisible(LINK_PORTAL_HOME);
- Assert.assertFalse(selenium.isTextPresent("TestPortal"), "Not created page already exist.");
+ final String portalName = "TestPortal";
+ Assert.assertFalse(selenium.isTextPresent(portalName), "Not created page already exist.");
- selenium.type(INPUT_PORTALNAME, "TestPortal");
+ selenium.type(INPUT_PORTALNAME, portalName);
selenium.click(INPUT_SUBMIT_CREATEPORTAL);
selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertTrue(selenium.isTextPresent("TestPortal"));
+ Assert.assertTrue(selenium.isTextPresent(portalName));
- int r = findTableRow(TABLE_PORTAL_ADMIN, "TestPortal", 0) - 1;
+ int r = findTableRow(TABLE_PORTAL_ADMIN, portalName, 0) - 1;
Assert.assertTrue(selenium.isElementPresent(MessageFormat.format(POR_TL_MAIN, r)));
Assert.assertTrue(selenium.isElementPresent(MessageFormat.format(POR_TL_SECURITY, r)));
@@ -82,30 +322,54 @@
Assert.assertTrue(selenium.isElementPresent(MessageFormat.format(POR_TL_MAKEDEF, r)));
Assert.assertTrue(selenium.isElementPresent(MessageFormat.format(POR_TL_RENAME, r)));
Assert.assertTrue(selenium.isElementPresent(MessageFormat.format(POR_TL_THEME, r)));
+
}
@Test(enabled = true, dependsOnMethods = { "testPortalCreate" })
public void testPortalRename() {
+
+ final String portalName = "TestRenameMePortal";
+ final String portalNameNew = "TestRenamedPortal";
+
+ // creating portal to rename
+
selenium.click("link=Admin");
selenium.waitForPageToLoad(PAGE_LOAD);
clickIfVisible(TAB_PORTALOBJ_ID);
- clickIfVisible(LINK_PORTALS_ID);
+ clickIfVisible(LINK_PORTAL_HOME);
- Assert.assertTrue(selenium.isTextPresent("TestPortal"));
- Assert.assertFalse(selenium.isTextPresent("AestPortal"), "Not created page already exist.");
+ selenium.type(INPUT_PORTALNAME, portalName);
+ selenium.click(INPUT_SUBMIT_CREATEPORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
- int r = findTableRow(TABLE_PORTAL_ADMIN, "TestPortal", 0) - 1;
+ Assert.assertTrue(selenium.isTextPresent(portalName));
+ int r = findTableRow(TABLE_PORTAL_ADMIN, portalName, 0) - 1;
+
+ // renaming portal
+
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LINK_PORTAL_HOME);
+
+ Assert.assertTrue(selenium.isTextPresent(portalName));
+ Assert.assertFalse(selenium.isTextPresent(portalNameNew), "Not created page already exist.");
+
+ r = findTableRow(TABLE_PORTAL_ADMIN, portalName, 0) - 1;
+
selenium.click(MessageFormat.format(POR_TL_RENAME, r));
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.type(INPUT_RENAME_PORTAL, "AestPortal");
+ selenium.type(INPUT_RENAME_PORTAL, portalNameNew);
selenium.click(SUBMIT_RENAME_PORTAL);
selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertFalse(selenium.isTextPresent("TestPortal"));
- Assert.assertTrue(selenium.isTextPresent("AestPortal"));
+ Assert.assertFalse(selenium.isTextPresent(portalName));
+ Assert.assertTrue(selenium.isTextPresent(portalNameNew));
+
}
@Test(enabled = true, dependsOnMethods = { "testPortalCreate" })
@@ -114,7 +378,7 @@
selenium.waitForPageToLoad(PAGE_LOAD);
clickIfVisible(TAB_PORTALOBJ_ID);
- clickIfVisible(LINK_PORTALS_ID);
+ clickIfVisible(LINK_PORTAL_HOME);
selenium.type(INPUT_PORTALNAME, "TestDelete");
selenium.click(INPUT_SUBMIT_CREATEPORTAL);
@@ -146,7 +410,7 @@
selenium.waitForPageToLoad(PAGE_LOAD);
clickIfVisible(TAB_PORTALOBJ_ID);
- clickIfVisible(LINK_PORTALS_ID);
+ clickIfVisible(LINK_PORTAL_HOME);
final String portalName = "TestAddPortal";
final String portalPage = "tPage";
@@ -159,7 +423,7 @@
selenium.click(MessageFormat.format(POR_TL_MAIN, r));
selenium.waitForPageToLoad(PAGE_LOAD);
-
+
Assert.assertFalse(selenium.isTextPresent(portalPage), "Portal page already present");
Assert.assertTrue(selenium.isTextPresent("Create a page named:"));
@@ -179,7 +443,7 @@
selenium.waitForPageToLoad(PAGE_LOAD);
clickIfVisible(TAB_PORTALOBJ_ID);
- clickIfVisible(LINK_PORTALS_ID);
+ clickIfVisible(LINK_PORTAL_HOME);
int r = findTableRow(TABLE_PORTAL_ADMIN, portalName, 0) - 1;
@@ -207,15 +471,15 @@
createPortal(portalName);
createPage(portalName, pageName);
- selenium.open("/portal/");
+ selenium.open(ADDR_PORTAL);
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=Admin");
selenium.waitForPageToLoad(PAGE_LOAD);
clickIfVisible(TAB_PORTALOBJ_ID);
- clickIfVisible(LINK_PORTALS_ID);
clickIfVisible(LINK_PORTAL_HOME);
+ clickIfVisible(LINK_PORTAL_HOME);
int r = findTableRow(TABLE_PORTAL_ADMIN, portalName, 0) - 1;
selenium.click(MessageFormat.format(POR_TL_MAIN, r));
@@ -227,65 +491,293 @@
selenium.click(MessageFormat.format(PAG_TL_LAYOUT, r));
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.type("windowForm:windowName", windowName);
+ selenium.type(INP_PAGE_LAYOUT_NAME, windowName);
selenium.click("link=Who's online portlet");
selenium.waitForPageToLoad("30000");
- selenium.click("layoutForm:a_center");
+ selenium.click(SUB_PAGE_LAY_ADDCENTER);
selenium.waitForPageToLoad("30000");
Assert.assertTrue(selenium.isTextPresent(windowName));
- selenium.open("/portal/auth/portal/mimikry");
+ selenium.open("/portal/auth/portal/" + portalName + "/" + pageName);
+ selenium.waitForPageToLoad("30000");
Assert.assertTrue(selenium.isTextPresent("Current users"));
}
-
- @Test(enabled = true, dependsOnMethods={"testPortalCreate"})
- public void testPageRename(){
+
+ @Test(enabled = true, dependsOnMethods = { "testPortalCreate" })
+ public void testPageRename() {
String portalName = "TestPortal";
String pageName = "PageToRename";
-
- createPage("TestPortal", "PageToRename");
-
+
+ createPage(portalName, pageName);
+
openAndWait("/portal");
clickAndWait("link=Admin");
-
+ clickAndWait("link=Admin");
clickIfVisible(TAB_PORTALOBJ_ID);
- clickIfVisible(LINK_PORTALS_ID, "Create a portal named:");
+ clickIfVisible(LINK_PORTAL_HOME);
- int r = findTableRow(TABLE_PORTAL_ADMIN, portalName, 0) - 1;
+ Assert.assertTrue(selenium.isTextPresent("Create a portal named:"));
- clickAndWait(MessageFormat.format(POR_TL_MAIN, r));
+ int r = findTableRow(TABLE_PORTAL_ADMIN, portalName, 0);
- r = findTableRow(TABLE_PORTALPAGE_ADMIN, pageName, 0) - 1;
+ clickAndWait(MessageFormat.format(POR_TL_MAIN, r - 1));
- clickAndWait(MessageFormat.format(PAG_TL_RENAME, r));
+ r = findTableRow(TABLE_PORTALPAGE_ADMIN, pageName, 0);
+ clickAndWait(MessageFormat.format(PAG_TL_RENAME, r - 1));
+
+ selenium.type(INPUT_RENAME_PAGE, "PageAlreadyRenamed");
+ selenium.click(SUBMIT_RENAME_PAGE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(findTableRow(TABLE_PORTALPAGE_ADMIN, "PageAlreadyRenamed", 0) >= 0, "Renamed page ont found.");
}
@Test(enabled = false)
- public void testPageSecurity(){
-
+ public void testPageSecurity() {
+ String portalName = "TestPortal";
+ String pageName = "PageToSecure";
+
+ createPage(portalName, pageName);
+
+ openAndWait("/portal");
+ clickAndWait("link=Admin");
+ clickAndWait("link=Admin");
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LINK_PORTAL_HOME);
+
+ Assert.assertTrue(selenium.isTextPresent("Create a portal named:"));
+
+ int r = findTableRow(TABLE_PORTAL_ADMIN, portalName, 0);
+
+ clickAndWait(MessageFormat.format(POR_TL_MAIN, r - 1));
+
+ r = findTableRow(TABLE_PORTALPAGE_ADMIN, pageName, 0);
+
+ clickAndWait(MessageFormat.format(PAG_TL_SECURITY, r - 1));
+
+ selenium.click("//input[@name='common-edit-security-form:cars_2' and @value='viewrecursive']");
+ selenium.click("common-edit-security-form:update");
+ selenium.waitForPageToLoad("30000");
+
+ selenium.open("/portal/auth/portal/" + portalName + "/" + pageName);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent("Access to the specified resource () has been forbidden."), "Secured page is not forbidden.");
+
}
-
- @Test(enabled = false)
- public void testPageTheme(){
-
+
+ @Test(enabled = true, dependsOnMethods = { "testPortalCreate" })
+ public void testPageProperties() {
+ String portalName = "TestPortal";
+ String pageName = "PageToProp";
+
+ createPage(portalName, pageName);
+
+ openAndWait("/portal");
+ clickAndWait("link=Admin");
+ clickAndWait("link=Admin");
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LINK_PORTAL_HOME);
+
+ Assert.assertTrue(selenium.isTextPresent("Create a portal named:"));
+
+ int r = findTableRow(TABLE_PORTAL_ADMIN, portalName, 0);
+
+ clickAndWait(MessageFormat.format(POR_TL_MAIN, r - 1));
+
+ r = findTableRow(TABLE_PORTALPAGE_ADMIN, pageName, 0);
+
+ clickAndWait(MessageFormat.format(PAG_TL_PROPERTIES, r - 1));
+
+ // properties table
+ selenium.type(INP_PAGE_PROP_ADDPROP, "testProp");
+ clickAndWait(SUB_PAGE_PROP_ADDPROP);
+ selenium.select(PAGE_PROP_PREDEFINED_PROP, "label=Tab order");
+ selenium.type(INP_PAGE_PROP_ADDPROP, "testTabProp");
+ clickAndWait(SUB_PAGE_PROP_ADDPROP);
+ selenium.type("common-manage-prop-form:prop-data-table:2:prop-value-input", "11");
+ selenium.type("common-manage-prop-form:prop-data-table:1:prop-value-input", "12");
+ clickAndWait(SUB_PAGE_PROP_UPDATE);
+ clickAndWait("//a[@id='common-manage-prop-form:prop-data-table:2:delete']/span");
+ clickAndWait("common-edit-page-error-form:page-access-check");
+
+ // error handling
+ selenium.select("common-edit-page-error-form:page-access-select", "label=Display the default error message");
+ selenium.waitForPageToLoad("30000");
+ clickAndWait("common-edit-page-error-form:page-control-check");
+ selenium.select("common-edit-page-error-form:page-control-select", "label=Display the default error message");
+ selenium.waitForPageToLoad("30000");
+ clickAndWait("common-edit-page-error-form:page-error-check");
+ selenium.select("common-edit-page-error-form:page-error-select", "label=Display the default error message");
+ selenium.waitForPageToLoad("30000");
+ clickAndWait("common-edit-page-error-form:page-internal-check");
+ selenium.select("common-edit-page-error-form:page-internal-select", "label=Display the default error message");
+ selenium.waitForPageToLoad("30000");
+ clickAndWait("common-edit-page-error-form:page-not-found-check");
+ selenium.select("common-edit-page-error-form:page-not-found-select", "label=Display the default error message");
+ selenium.waitForPageToLoad("30000");
+ clickAndWait("common-edit-page-error-form:page-res-check");
+ clickAndWait(SUB_PAGE_PROP_UPDATE);
+ clickAndWait(SUB_PAGE_PROP_ERR_UPDATE);
+
+ // listener
+
+ selenium.select(SEL_PAGE_PROP_LISTENER, "label=test_listener");
+ clickAndWait(SUB_PAGE_PROP_LISTENER);
}
-
- @Test(enabled = false)
- public void testPageLayout(){
-
+
+ @Test(enabled = true, dependsOnMethods = { "testPortalCreate" })
+ public void testPageMakeDef() {
+ String portalName = "TestPortal";
+ String pageName = "PageToMakeDef";
+
+ selenium.open("/portal/auth/portal/" + portalName);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isElementPresent("//li[@id='current']/a[@href='/portal/auth/portal/TestPortal/default']"));
+
+ createPage(portalName, pageName);
+
+ openAndWait("/portal/");
+ clickAndWait("link=Admin");
+ clickAndWait("link=Admin");
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LINK_PORTAL_HOME);
+
+ Assert.assertTrue(selenium.isTextPresent("Create a portal named:"));
+
+ int r = findTableRow(TABLE_PORTAL_ADMIN, portalName, 0);
+
+ clickAndWait(MessageFormat.format(POR_TL_MAIN, r - 1));
+
+ r = findTableRow(TABLE_PORTALPAGE_ADMIN, pageName, 0);
+
+ clickAndWait(MessageFormat.format(PAG_TL_MAKEDEF, r - 1));
+
+ selenium.open("/portal/auth/portal/" + portalName);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isElementPresent("//li[@id='current']/a[@href='/portal/auth/portal/TestPortal/PageToMakeDef']"));
}
-
+
+ @Test(enabled = true, dependsOnMethods = { "testPortalCreate" })
+ public void testPageDisplay() {
+ String portalName = "TestPortal";
+ String pageName = "PageToDisplay";
+
+ createPage(portalName, pageName);
+
+ openAndWait("/portal");
+ clickAndWait("link=Admin");
+ clickAndWait("link=Admin");
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LINK_PORTAL_HOME);
+
+ Assert.assertTrue(selenium.isTextPresent("Create a portal named:"));
+
+ int r = findTableRow(TABLE_PORTAL_ADMIN, portalName, 0);
+
+ clickAndWait(MessageFormat.format(POR_TL_MAIN, r - 1));
+
+ r = findTableRow(TABLE_PORTALPAGE_ADMIN, pageName, 0);
+
+ clickAndWait(MessageFormat.format(PAG_TL_DISPLAY, r - 1));
+
+ final String searchName = "Zobrazenie";
+ Assert.assertFalse(findTableRow(TABLE_PAGE_DISP_LANG, searchName, 1) >= 0);
+
+ selenium.select(SEL_PAGE_DISP_LANG, "label=Slovak");
+ selenium.type(INP_PAGE_DISP_LANG, searchName);
+ clickAndWait(SUB_PAGE_DISP_LANG);
+
+ Assert.assertTrue(findTableRow(TABLE_PAGE_DISP_LANG, searchName, 1) >= 0);
+
+ clickAndWait("//a[@id='display-name-form1:locale-datatable:0:rename']/span");
+ final String searchName2 = "PreYobrazenie";
+ selenium.type(INP_PAGE_DISP_LANG, searchName2);
+ clickAndWait(SUB_PAGE_DISP_LANG);
+
+ Assert.assertFalse(findTableRow(TABLE_PAGE_DISP_LANG, searchName, 1) >= 0);
+ Assert.assertTrue(findTableRow(TABLE_PAGE_DISP_LANG, searchName2, 1) >= 0);
+
+ clickAndWait("//a[@id='display-name-form1:locale-datatable:0:delete']/span");
+
+ Assert.assertFalse(findTableRow(TABLE_PAGE_DISP_LANG, searchName, 1) >= 0);
+ Assert.assertFalse(findTableRow(TABLE_PAGE_DISP_LANG, searchName2, 1) >= 0);
+ }
+
+ @Test(enabled = true, dependsOnMethods = { "testPortalCreate" })
+ public void testPageTheme() {
+ String portalName = "TestPortal";
+ String pageName = "PageToTheme";
+
+ createPage(portalName, pageName);
+
+ openAndWait("/portal");
+ clickAndWait("link=Admin");
+ clickAndWait("link=Admin");
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LINK_PORTAL_HOME);
+
+ clickAndWait("link=" + portalName);
+
+ int r = findTableRow(TABLE_PORTALPAGE_ADMIN, pageName, 0);
+
+ clickAndWait(MessageFormat.format(PAG_TL_THEME, r - 1));
+
+ selenium.select(SEL_PAGE_THEME_LAY, "label=1column");
+ selenium.select(SEL_PAGE_THEME_THEME, "label=maple");
+ selenium.select(SEL_PAGE_THEME_RENDERSET, "label=emptyRenderer");
+ selenium.click(SUB_PAGE_THEME);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ }
+
+ @Test(enabled = true, dependsOnMethods = { "testPortalCreate" })
+ public void testPageLayout() {
+ String portalName = "TestPortal";
+ String pageName = "PageToLayout";
+
+ createPage(portalName, pageName);
+
+ openAndWait("/portal");
+ clickAndWait("link=Admin");
+ clickAndWait("link=Admin");
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LINK_PORTAL_HOME);
+
+ clickAndWait("link=" + portalName);
+
+ int r = findTableRow(TABLE_PORTALPAGE_ADMIN, pageName, 0);
+
+ clickAndWait(MessageFormat.format(PAG_TL_LAYOUT, r - 1));
+
+ selenium.type(INP_PAGE_LAYOUT_NAME, "ViliamLay");
+ clickAndWait("portlet-instance-link_0");
+ clickAndWait(SUB_PAGE_LAY_ADDCENTER);
+ clickAndWait("portlet-instance-link_7");
+ clickAndWait(SUB_PAGE_LAY_ADDLEFT);
+ clickAndWait("obj-temp-form:object-link-2");
+
+ Assert.assertTrue(selenium.isElementPresent("obj-nav-form:windows-datatable:0:window-name-link"));
+ Assert.assertTrue(selenium.isElementPresent("obj-nav-form:windows-datatable:1:window-name-link"));
+
+ selenium.open("/portal/auth/portal/TestPortal/PageToLayout");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("Current users"));
+ Assert.assertTrue(selenium.isTextPresent("Management Portlet"));
+ }
+
private void createPortal(String name) {
- selenium.open("/portal/");
+ selenium.open(ADDR_PORTAL);
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=Admin");
selenium.waitForPageToLoad(PAGE_LOAD);
clickIfVisible(TAB_PORTALOBJ_ID);
- clickIfVisible(LINK_PORTALS_ID);
+ clickIfVisible(LINK_PORTAL_HOME);
selenium.type(INPUT_PORTALNAME, name);
selenium.click(INPUT_SUBMIT_CREATEPORTAL);
@@ -293,13 +785,13 @@
}
private void createPage(String portalName, String pageName) {
- selenium.open("/portal/");
+ selenium.open(ADDR_PORTAL);
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=Admin");
selenium.waitForPageToLoad(PAGE_LOAD);
clickIfVisible(TAB_PORTALOBJ_ID);
- clickIfVisible(LINK_PORTALS_ID);
+ clickIfVisible(LINK_PORTAL_HOME);
int r = findTableRow(TABLE_PORTAL_ADMIN, portalName, 0) - 1;
Modified: branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/DashboardsTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/DashboardsTestCase.java 2008-10-13 16:26:13 UTC (rev 12060)
+++ branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/DashboardsTestCase.java 2008-10-14 15:18:59 UTC (rev 12061)
@@ -72,14 +72,13 @@
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isTextPresent(propName));
- int r = findTableRow(TABLE_PROPS, propName, 0);
- System.out.println(propName+":"+r);
+ int r = findTableRow(TABLE_PROPS, propName, 1);
selenium.type(MessageFormat.format(T_PROPS_INPUT_VALUE, r-1),value);
selenium.click(SUBMIT_UPDATE_VALUE);
selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertTrue(selenium.isTextPresent(value));
+ Assert.assertEquals(selenium.getValue(MessageFormat.format(T_PROPS_INPUT_VALUE, r-1)),value,"Updated value not found.");
}
@@ -94,7 +93,6 @@
Assert.assertTrue(selenium.isTextPresent(propName));
int r = findTableRow(TABLE_PROPS, propName, 0);
- System.out.println(propName+":"+r);
selenium.click(MessageFormat.format(T_PROPS_LINK_DEL, r-1));
selenium.waitForPageToLoad(PAGE_LOAD);
Modified: branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/PortletDefinitionsTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/PortletDefinitionsTestCase.java 2008-10-13 16:26:13 UTC (rev 12060)
+++ branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/PortletDefinitionsTestCase.java 2008-10-14 15:18:59 UTC (rev 12061)
@@ -78,13 +78,13 @@
selenium.click(SUBMIT_PROVIDER_VIEW);
selenium.waitForPageToLoad(PAGE_LOAD);
int n = countTableRows(TABLE_PORTLET);
- Assert.assertEquals(n, 16,"Wrong number of self portlets.");
+ Assert.assertTrue(findTableRow(TABLE_PORTLET, "Administration Portlet", 0)<0);
selenium.select(SELECT_PROVIDER, "label=local");
selenium.click(SUBMIT_PROVIDER_VIEW);
selenium.waitForPageToLoad(PAGE_LOAD);
n = countTableRows(TABLE_PORTLET);
- Assert.assertEquals(n, 21, "Wrong number of local portlets.");
+ Assert.assertTrue(findTableRow(TABLE_PORTLET, "Administration Portlet", 0)>=0);
}
private void goToPD(){
Modified: branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/PortletInstancesTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/PortletInstancesTestCase.java 2008-10-13 16:26:13 UTC (rev 12060)
+++ branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/PortletInstancesTestCase.java 2008-10-14 15:18:59 UTC (rev 12061)
@@ -8,15 +8,15 @@
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
-public class PortletInstancesTestCase extends JBossPortalSeleniumTestCase{
+public class PortletInstancesTestCase extends JBossPortalSeleniumTestCase {
private static final String SUBMIT_SECURITY_UPDATE = "common-edit-security-form:update";
private static final String SUBMIT_SECURITY_CANCEL = "common-edit-security-form:cancel";
-
+
private static final String LINK_PREF_WELCOMEPORT = "instances-form:security-JSPPortletInstance";
private static final String TABLE_PREF_KEY = "//form[@id='common-edit-pref-form']/table";
-
+
private static final String SUBMIT_PREF_DELETE = "common-edit-exisiting-form:row_0";
private static final String LINK_PREF_GUESTNUM = "common-edit-pref-form:pref-link-0";
private static final String INPUT_PREF_NEWVAL = "common-append-form:new_value";
@@ -50,9 +50,9 @@
public void logoutAfterTest() {
logout();
}
-
+
@Test(enabled = true)
- public void testAddName(){
+ public void testAddName() {
selenium.click(LINK_COUNTPORT);
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.select(SELECT_LANGUAGE, "label=Czech");
@@ -60,12 +60,12 @@
selenium.type(INPUT_NAME, name);
selenium.click(SUBMIT_MODIFY_NAME);
selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertTrue(findTableRow(TABLE_DISPNAMES, name, 1)>=0);
+ Assert.assertTrue(findTableRow(TABLE_DISPNAMES, name, 1) >= 0);
}
-
+
@Test(enabled = true)
- public void testDeleteName(){
- // adding the name
+ public void testDeleteName() {
+ // adding the name
selenium.click(LINK_COUNTPORT);
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.select(SELECT_LANGUAGE, "label=Japanese");
@@ -73,20 +73,20 @@
selenium.type(INPUT_NAME, name);
selenium.click(SUBMIT_MODIFY_NAME);
selenium.waitForPageToLoad(PAGE_LOAD);
-
+
// deleting name
-
+
int r = findTableRow(TABLE_DISPNAMES, name, 1);
-
- selenium.click(MessageFormat.format(T_LINK_DELETENAME, r-1));
+
+ selenium.click(MessageFormat.format(T_LINK_DELETENAME, r - 1));
selenium.waitForPageToLoad(PAGE_LOAD);
-
- Assert.assertFalse(findTableRow(TABLE_DISPNAMES, name, r)>=0);
+
+ Assert.assertFalse(findTableRow(TABLE_DISPNAMES, name, r) >= 0);
}
-
+
@Test(enabled = true)
- public void testModifyName(){
- // adding the name
+ public void testModifyName() {
+ // adding the name
selenium.click(LINK_COUNTPORT);
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.select(SELECT_LANGUAGE, "label=Japanese");
@@ -96,23 +96,23 @@
selenium.type(INPUT_NAME, name);
selenium.click(SUBMIT_MODIFY_NAME);
selenium.waitForPageToLoad(PAGE_LOAD);
-
+
// midifying name
-
+
int r = findTableRow(TABLE_DISPNAMES, name, 1);
-
- selenium.click(MessageFormat.format(T_LINK_MODIFYNAME, r-1));
+
+ selenium.click(MessageFormat.format(T_LINK_MODIFYNAME, r - 1));
selenium.waitForPageToLoad(PAGE_LOAD);
-
+
selenium.type(INPUT_NAME, nameNew);
selenium.click(SUBMIT_MODIFY_NAME);
selenium.waitForPageToLoad(PAGE_LOAD);
-
- Assert.assertTrue(findTableRow(TABLE_DISPNAMES, nameNew, 1)>=0);
+
+ Assert.assertTrue(findTableRow(TABLE_DISPNAMES, nameNew, 1) >= 0);
}
-
+
@Test(enabled = true)
- public void testSecure(){
+ public void testSecure() {
// "common-edit-security-form:cancel"
selenium.click(LINK_PREF_WELCOMEPORT);
selenium.waitForPageToLoad("30000");
@@ -124,10 +124,11 @@
selenium.click("//input[@name='common-edit-security-form:cars_2' and @value='admin']");
selenium.click(SUBMIT_SECURITY_UPDATE);
selenium.waitForPageToLoad("30000");
- selenium.click("link=Portal");
+
+ selenium.open("/portal/auth/portal/default/");
selenium.waitForPageToLoad("30000");
Assert.assertTrue(selenium.isTextPresent("Greetings !"));
-
+
// then cancel
selenium.click("link=Admin");
selenium.waitForPageToLoad("30000");
@@ -140,10 +141,10 @@
selenium.click("//input[@name='common-edit-security-form:cars_1']");
selenium.click(SUBMIT_SECURITY_CANCEL);
selenium.waitForPageToLoad("30000");
- selenium.click("link=Portal");
+ selenium.open("/portal/auth/portal/default/");
selenium.waitForPageToLoad("30000");
Assert.assertTrue(selenium.isTextPresent("Greetings !"));
-
+
// then really stop the greetings portlet
selenium.click("link=Admin");
selenium.waitForPageToLoad("30000");
@@ -156,16 +157,16 @@
selenium.click("//input[@name='common-edit-security-form:cars_1']");
selenium.click(SUBMIT_SECURITY_UPDATE);
selenium.waitForPageToLoad("30000");
-
- selenium.click("link=Portal");
+
+ selenium.open("/portal/auth/portal/default/");
selenium.waitForPageToLoad("30000");
Assert.assertFalse(selenium.isTextPresent("Greetings !"));
}
-
+
@Test(enabled = true)
- public void testDeleteInstance(){
+ public void testDeleteInstance() {
// cancel first
- Assert.assertTrue(selenium.isElementPresent(LINK_DEL_EXCEPTPORT),"Exception portlet not found.");
+ Assert.assertTrue(selenium.isElementPresent(LINK_DEL_EXCEPTPORT), "Exception portlet not found.");
selenium.click(LINK_DEL_EXCEPTPORT);
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isTextPresent("WARNING!"));
@@ -174,18 +175,18 @@
selenium.waitForPageToLoad(PAGE_LOAD);
// delete
goToPI();
- Assert.assertTrue(selenium.isElementPresent(LINK_DEL_EXCEPTPORT),"Exception portlet not found.");
+ Assert.assertTrue(selenium.isElementPresent(LINK_DEL_EXCEPTPORT), "Exception portlet not found.");
selenium.click(LINK_DEL_EXCEPTPORT);
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isTextPresent("WARNING!"));
Assert.assertTrue(selenium.isTextPresent("Are you sure you want to delete this portlet instance ?"));
selenium.click(SUBMIT_PI_DELETE_CONF);
selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertFalse(selenium.isElementPresent(LINK_DEL_EXCEPTPORT),"Exception portlet found after deletition.");
+ Assert.assertFalse(selenium.isElementPresent(LINK_DEL_EXCEPTPORT), "Exception portlet found after deletition.");
}
-
+
@Test(enabled = true)
- public void testPreferences(){
+ public void testPreferences() {
int r;
selenium.click(LINK_CURUSER_PREFERENCES);
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -196,36 +197,36 @@
Assert.assertTrue(findTableRow(TABLE_PREF_KEY, "guestNumber", 0) >= 0);
selenium.click(LINK_PREF_GUESTNUM);
selenium.waitForPageToLoad(PAGE_LOAD);
-
- r=findTableRow(TABLE_PREF_KEY, "guestNumber", 0);
- Assert.assertEquals(selenium.getText(TABLE_PREF_KEY+"/tbody/tr["+r+"]/td[4]"),"[true]");
+
+ r = findTableRow(TABLE_PREF_KEY, "guestNumber", 0);
+ Assert.assertEquals(selenium.getText(TABLE_PREF_KEY + "/tbody/tr[" + r + "]/td[4]"), "[true]");
selenium.type(INPUT_PREF_APPEND, "true1");
selenium.click(INPUT_PREF_UPDATE);
selenium.waitForPageToLoad(PAGE_LOAD);
-
- r=findTableRow(TABLE_PREF_KEY, "guestNumber", 0);
- Assert.assertEquals(selenium.getText(TABLE_PREF_KEY+"/tbody/tr["+r+"]/td[4]"),"[true1]");
+
+ r = findTableRow(TABLE_PREF_KEY, "guestNumber", 0);
+ Assert.assertEquals(selenium.getText(TABLE_PREF_KEY + "/tbody/tr[" + r + "]/td[4]"), "[true1]");
selenium.click(SUBMIT_PREF_DELETE);
selenium.waitForPageToLoad(PAGE_LOAD);
-
- r=findTableRow(TABLE_PREF_KEY, "guestNumber", 0);
- Assert.assertEquals(selenium.getText(TABLE_PREF_KEY+"/tbody/tr["+r+"]/td[4]"),"[]");
+
+ r = findTableRow(TABLE_PREF_KEY, "guestNumber", 0);
+ Assert.assertEquals(selenium.getText(TABLE_PREF_KEY + "/tbody/tr[" + r + "]/td[4]"), "[]");
selenium.type(INPUT_PREF_NEWVAL, "viliam");
selenium.click(SUBMIT_PREF_UPDATE);
selenium.waitForPageToLoad(PAGE_LOAD);
-
- r=findTableRow(TABLE_PREF_KEY, "guestNumber", 0);
- Assert.assertEquals(selenium.getText(TABLE_PREF_KEY+"/tbody/tr["+r+"]/td[4]"),"[viliam]");
+
+ r = findTableRow(TABLE_PREF_KEY, "guestNumber", 0);
+ Assert.assertEquals(selenium.getText(TABLE_PREF_KEY + "/tbody/tr[" + r + "]/td[4]"), "[viliam]");
selenium.click(SUBMIT_PREF_SAVE);
selenium.waitForPageToLoad(PAGE_LOAD);
}
-
- private void goToPI(){
- selenium.open("/portal/");
+
+ private void goToPI() {
+ selenium.open(ADDR_PORTAL);
clickIfVisible(LINK_ADMIN);
clickIfVisible(LINK_ADMIN);
clickIfVisible(LINK_TAB_PI);
clickIfVisible(LINK_PI_MAIN);
}
-
+
}
Modified: branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/testng.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/testng.xml 2008-10-13 16:26:13 UTC (rev 12060)
+++ branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/testng.xml 2008-10-14 15:18:59 UTC (rev 12061)
@@ -102,5 +102,5 @@
<classes>
<class name="org.jboss.portal.test.selenium.portal.DashboardsTestCase"></class></classes>
</test>
-
+<!-- -->
</suite>
17 years, 6 months
JBoss Portal SVN: r12060 - in branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests: selenium-rc-server and 3 other directories.
by portal-commits@lists.jboss.org
Author: vrockai
Date: 2008-10-13 12:26:13 -0400 (Mon, 13 Oct 2008)
New Revision: 12060
Added:
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSPendingItemsTestCase.java
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/DashboardsTestCase.java
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/PortletDefinitionsTestCase.java
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/PortletInstancesTestCase.java
Modified:
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/selenium-rc-server/user-extensions.js
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/DashboardTestCase.java
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/IdentityAdminTestCase.java
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/JBossPortalSeleniumTestCase.java
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/PortletUserCreationTestCase.java
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/WSRPTestCase.java
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSArchiveUploadTestCase.java
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSDirectoryTestCase.java
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileTestCase.java
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileWorkflowTestCase.java
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSSecureTestCase.java
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/testng.xml
Log:
portal admin tests addded
Modified: branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/selenium-rc-server/user-extensions.js
===================================================================
--- branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/selenium-rc-server/user-extensions.js 2008-10-13 14:45:21 UTC (rev 12059)
+++ branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/selenium-rc-server/user-extensions.js 2008-10-13 16:26:13 UTC (rev 12060)
@@ -39,4 +39,25 @@
Selenium.prototype.fillInEditor = function(locator, content){
var iframe = this.browserbot.findElement(locator);
iframe.contentDocument.body.innerHTML= content;
-}
\ No newline at end of file
+}
+
+Selenium.prototype.assertTextOrder = function(textValues) {
+
+ var allText = this.page().bodyText();
+ var expectedTextValues = textValues.parseCSV();
+
+ for (var i = 0; i < expectedTextValues.length - 1; i++) {
+ var index = allText.indexOf(expectedTextValues[i]);
+ var nextIndex = allText.indexOf(expectedTextValues[i+1]);
+ if (index == -1) {
+ assert.fail("'" + expectedTextValues[i] + "' not found.");
+ }
+ if (nextIndex == -1) {
+ assert.fail("'" + expectedTextValues[i+1] + "' not found.");
+ }
+
+ if (index > nextIndex) {
+ assert.fail("'" + expectedTextValues[i+1] + "' found before '" + expectedTextValues[i] + "'");
+ }
+ }
+}
Modified: branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/DashboardTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/DashboardTestCase.java 2008-10-13 14:45:21 UTC (rev 12059)
+++ branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/DashboardTestCase.java 2008-10-13 16:26:13 UTC (rev 12060)
@@ -75,8 +75,6 @@
Assert.assertEquals(selenium.getSelectedLabel(SELECT_THEME), "renaissance", "Previously selected theme other then expected.");
}
-
-
@Test(enabled = true, dependsOnMethods = { "testCreatePage" })
public void testUpdateLayout() {
selenium.click(LINK_DASHBOARD);
@@ -124,6 +122,47 @@
Assert.assertTrue(selenium.isTextPresent("[admin]"));
}
+ @Test(enabled = true, dependsOnMethods = { "testCreatePage","testAddPortlet" })
+ public void testMovePortlet() {
+ final String pageName = "DashMovePage";
+
+
+ selenium.click(LINK_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LINK_CONFIGURE_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.type(INPUT_PAGENAME, pageName);
+ selenium.click(SUBMIT_CREATEPAGE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click(LINK_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LINK_CONFIGURE_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selectIfNotSelected(SELECT_PAGE,pageName);
+ selenium.click("link=ExceptionPortletInstance");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(SUBMIT_ADDCENTER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selectIfNotSelected(SELECT_PAGE,pageName);
+ selenium.click("link=Who's online portlet");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(SUBMIT_ADDCENTER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click(LINK_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link="+pageName);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertFalse(assertTextOrder("Current;Exception"));
+ Assert.assertTrue(assertTextOrder("Exception;Current"));
+
+ }
+
@Test(enabled = true, dependsOnMethods = { "testAddPortlet" })
public void testDeletePortlet() {
Modified: branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/IdentityAdminTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/IdentityAdminTestCase.java 2008-10-13 14:45:21 UTC (rev 12059)
+++ branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/IdentityAdminTestCase.java 2008-10-13 16:26:13 UTC (rev 12060)
@@ -79,7 +79,7 @@
logoutIfPossible();
}
-
+/*
// For this mode to be functional, the user which is logged in must be "admin" after each test
@BeforeClass(groups = { "single" })
public void loginBefore() {
@@ -90,7 +90,7 @@
public void logoutAfter() {
logout();
}
-
+*/
@Test(enabled = true, description = "Creation of new user.")
public void testCreateUser() {
createUser("tempUser", "tempPassword", "tempUser(a)redhat.com");
@@ -326,7 +326,7 @@
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertFalse(selenium.isElementPresent(TABLE_ROLEMEMBERS), "Not assigned member found in the role members table.");
- selenium.setSpeed("3000");
+
deleteRole("membersRole");
deleteUser("newRoleMember" , "newRoleMem(a)redhatqa.com");
}
@@ -400,10 +400,11 @@
searchSimple("man","100");
Assert.assertEquals(countTableRows(TABLE_USERLIST)-1,95,"Wrong number of row in user table #4.");
-
+ /*
for(int i=0; i< 95; i++){
deleteUser("man"+i+"us", "man"+i+"us"+"@redhatqa.com");
}
+ */
}
Modified: branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/JBossPortalSeleniumTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/JBossPortalSeleniumTestCase.java 2008-10-13 14:45:21 UTC (rev 12059)
+++ branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/JBossPortalSeleniumTestCase.java 2008-10-13 16:26:13 UTC (rev 12060)
@@ -92,6 +92,10 @@
selenium.waitForPageToLoad(PAGE_LOAD);
}
}
+
+ protected boolean assertTextOrder(String text){
+ return Boolean.valueOf(selenium.getEval("selenium.assertTextOrder(\"" + text + "\")"));
+ }
protected void login(String username, String password) {
selenium.open(ADDR_PORTAL);
Modified: branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/PortletUserCreationTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/PortletUserCreationTestCase.java 2008-10-13 14:45:21 UTC (rev 12059)
+++ branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/PortletUserCreationTestCase.java 2008-10-13 16:26:13 UTC (rev 12060)
@@ -90,8 +90,6 @@
selenium.click(SUBMIT_CREATE_CONF_EDIT);
selenium.waitForPageToLoad(PAGE_LOAD);
- //selenium.setSpeed("3000");
-
selenium.type(INPUT_USERNAME, "portletLong2User");
selenium.type(INPUT_USERMAIL, "portletLong2User(a)redhat.com");
selenium.type(INPUT_USERPASSWD, "portletLong2UserPassword");
Modified: branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/WSRPTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/WSRPTestCase.java 2008-10-13 14:45:21 UTC (rev 12059)
+++ branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/WSRPTestCase.java 2008-10-13 16:26:13 UTC (rev 12060)
@@ -301,6 +301,9 @@
selenium.type(INPUT_CREATECONS, name);
selenium.click(SUBMIT_CREATECONS);
selenium.waitForPageToLoad(PAGE_LOAD);
+
+
+
selenium.type(INPUT_CACHEEXP, timeout);
selenium.type(INPUT_CONSWSDL, address);
selenium.click(SUBMIT_REFRESHSAVE);
@@ -308,6 +311,9 @@
selenium.type(INPUT_CONS_REGVALUE, "public");
selenium.click(SUBMIT_CONS_REGVAL);
selenium.waitForPageToLoad(PAGE_LOAD);
+
+
+
selenium.click(SUBMIT_REFRESHFINAL);
selenium.waitForPageToLoad(PAGE_LOAD);
}
Modified: branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSArchiveUploadTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSArchiveUploadTestCase.java 2008-10-13 14:45:21 UTC (rev 12059)
+++ branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSArchiveUploadTestCase.java 2008-10-13 16:26:13 UTC (rev 12060)
@@ -13,6 +13,9 @@
@Test(groups = { "cms_archive_upload" }, enabled = true)
public class CMSArchiveUploadTestCase extends JBossPortalSeleniumTestCase {
+ /* uncomment following lines and set the right path to the workspace in the case
+ * you want to use this test case locally from eclipse */
+
/*
{
System.setProperty("workspace","/home/vrockai/workspace/selenium/selenium/");
@@ -34,7 +37,29 @@
@Test(enabled = true, description = "Test archive consisting of two files upload.")
public void testArchiveUpload() {
//System.out.println("archive adress:" + WORKSPACE);
+ // canceling at the first stage
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.select("//div[@id='center']/div/div/div[1]/div/select", "label=Upload Archive");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.waitForPopUp("_top", PAGE_LOAD);
+ selenium.type("response", WORKSPACE + "/test_files/archive.zip");
+ selenium.click("cancel");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+
+ Assert.assertFalse(selenium.isTextPresent("Your archive has been accepted for processing"));
+ Assert.assertFalse(selenium.isElementPresent("link=archive"));
+
+ selenium.open(ADDR_PORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertFalse(selenium.isElementPresent("link=archive"));
+
+ // really uploading the file now
selenium.click("link=Admin");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=CMS");
@@ -46,8 +71,10 @@
selenium.type("response", WORKSPACE + "/test_files/archive.zip");
selenium.click("submit");
-
selenium.waitForPageToLoad(PAGE_LOAD);
+ //
+
+ selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertEquals(selenium.getText("//div[@id='center']/div/div/table/tbody/tr[2]/td/font"),
"Your archive has been accepted for processing. The resources will appear in your Folder once the processing is finished");
Modified: branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSDirectoryTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSDirectoryTestCase.java 2008-10-13 14:45:21 UTC (rev 12059)
+++ branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSDirectoryTestCase.java 2008-10-13 16:26:13 UTC (rev 12060)
@@ -32,6 +32,9 @@
@Test(enabled = true, description="Directory creation.")
public void testCreateDirectory() {
+
+ // cancelling of creating
+
selenium.click("link=Admin");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=CMS");
@@ -40,14 +43,38 @@
selenium.open("/portal/auth/portal/admin/CMS");
selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertFalse(selenium.isTextPresent("TestFolder["), "Test folder is already present.");
+ Assert.assertFalse(selenium.isTextPresent(tempDirName), "Test folder is already present.");
selenium.select("//div[@id='center']/div/div/div[1]/div/select", "label=Create Folder");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.waitForPopUp("_top", PAGE_LOAD);
selenium.type("newcollectionname", tempDirName);
selenium.type("newcollectiondescription", "test folder");
+ selenium.click("cancel");
+
+ // really creating
+ selenium.open(ADDR_PORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.open("/portal/auth/portal/admin/CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertFalse(selenium.isTextPresent(tempDirName), "Test folder is already present.");
+
+ selenium.select("//div[@id='center']/div/div/div[1]/div/select", "label=Create Folder");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.waitForPopUp("_top", PAGE_LOAD);
+ selenium.type("newcollectionname", tempDirName);
+ selenium.type("newcollectiondescription", "test folder");
selenium.click("submit");
+
+ // assuring that the directory is deleted
+
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isElementPresent("//div[@id='center']/div/div/ul/li[3]"));
Assert.assertEquals(tempDirName, selenium.getText("//div[@id='center']/div/div/ul/li[3]"));
@@ -59,11 +86,36 @@
@Test(enabled = true, dependsOnMethods = "testCreateDirectory",description="Directory delete.")
public void testDeleteDirectory() {
+
+ // firstly cancel the delete process
+
selenium.click("link=Admin");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=CMS");
selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isElementPresent("link=" + tempDirName));
+ selenium.select(takeAction(tempDirName) + "/select", "label=Delete");
+ selenium.click(takeAction(tempDirName) + "/select/option[4]");
+ selenium.click(takeAction(tempDirName) + "/input");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent("Confirm Deletion of /" + tempDirName));
+ Assert.assertTrue(selenium.isTextPresent("WARNING! You will not be able to undo these change!"));
+ Assert.assertTrue(selenium.isTextPresent("Are you sure you want to delete this resource?"));
+ selenium.click("cancel");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ // really deleting
+ selenium.open(ADDR_PORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isElementPresent("link=" + tempDirName));
selenium.select(takeAction(tempDirName) + "/select", "label=Delete");
selenium.click(takeAction(tempDirName) + "/select/option[4]");
selenium.click(takeAction(tempDirName) + "/input");
@@ -76,6 +128,14 @@
selenium.click("submit");
selenium.waitForPageToLoad(PAGE_LOAD);
+ // assuring that the deletition was processed
+ selenium.open(ADDR_PORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
Assert.assertFalse(selenium.isElementPresent("link=" + tempDirName));
}
Modified: branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileTestCase.java 2008-10-13 14:45:21 UTC (rev 12059)
+++ branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileTestCase.java 2008-10-13 16:26:13 UTC (rev 12060)
@@ -14,6 +14,7 @@
public class CMSFileTestCase extends JBossPortalSeleniumTestCase {
private final String CMS_FILE_TABLE = "//div[@id='center']/div/div/div[3]/table";
+ public static final String CMS_FILE_PENDING_TABLE = "//div[@id='center']/div/div/table[2]";
@BeforeMethod(groups = { "log" })
public void loginBeforeTest() {
@@ -109,6 +110,13 @@
selenium.select("language", "label=Czech");
selenium.click("save");
selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(findTableRow(CMS_FILE_PENDING_TABLE, "text/plain", 0) >= 0);
+ Assert.assertTrue(findTableRow(CMS_FILE_PENDING_TABLE, "0kb", 1) >= 0);
+ Assert.assertTrue(findTableRow(CMS_FILE_PENDING_TABLE, "admin", 3) >= 0);
+
+ selenium.click("link=Approve");
+
Assert.assertEquals("Czech", selenium.getText("link=Czech"));
Assert.assertEquals("text/plain", selenium.getText("link=text/plain"));
Assert.assertEquals("1.0", selenium.getText("//div[@id='center']/div/div/table/tbody/tr[4]/td[3]"));
Modified: branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileWorkflowTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileWorkflowTestCase.java 2008-10-13 14:45:21 UTC (rev 12059)
+++ branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileWorkflowTestCase.java 2008-10-13 16:26:13 UTC (rev 12060)
@@ -34,9 +34,11 @@
logout();
}
-
@Test(enabled = true, description = "Simple file creation.")
public void testCreateFileApprove() {
+
+ // canceling first
+
selenium.click("link=Admin");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=CMS");
@@ -50,6 +52,25 @@
selenium.type("title", "newFile title");
selenium.select("language", "label=Czech");
+ selenium.click("cancel");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ // saving
+ selenium.open(ADDR_PORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select(SELECT_CMS_MAIN, "label=Create File");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.waitForPopUp("_top", PAGE_LOAD);
+ selenium.type("filename", "newFile");
+ selenium.type("description", "newFile description");
+ selenium.type("title", "newFile title");
+ selenium.select("language", "label=Czech");
+
selenium.click("save");
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -101,10 +122,33 @@
@Test(enabled = true, description = "Simple file creation.")
public void testCreateFilePreview(){
+ String name = "file2preview";
- //TODO after the bug with empty content is repaired
+ selenium.open(ADDR_PORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Home");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select(SELECT_CMS_MAIN, "label=Create File");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.waitForPopUp("_top", PAGE_LOAD);
+ selenium.type("filename", name);
+ selenium.type("description", name + " description");
+ selenium.type("title", "existingFile title");
+ selenium.select("language", "label=Czech");
+ fillInEditor("vivat!");
+ selenium.click("save");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Preview");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("Pending Approval Queue"));
+ Assert.assertTrue(selenium.isTextPresent("vivat!"));
+
}
@Test(enabled = true, dependsOnMethods = "testCreateFileApprove", description = "Simple file delete Cancel in first step, and then delete.")
@@ -131,9 +175,9 @@
row = findTableRow(CMS_FILE_TABLE, "newFile", 0) + 1;
- selenium.select("//div[@id='center']/div/div/div[3]/table/tbody/tr["+row+"]/td[2]/form/select", "label=Delete");
- selenium.click("//div[@id='center']/div/div/div[3]/table/tbody/tr["+row+"]/td[2]/form/select/option[4]");
- selenium.click("//div[@id='center']/div/div/div[3]/table/tbody/tr["+row+"]/td[2]/form/input");
+ selenium.select(CMS_FILE_TABLE + "/tbody/tr["+row+"]/td[2]/form/select", "label=Delete");
+ selenium.click(CMS_FILE_TABLE + "/tbody/tr["+row+"]/td[2]/form/select/option[4]");
+ selenium.click(CMS_FILE_TABLE + "/tbody/tr["+row+"]/td[2]/form/input");
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isTextPresent("Confirm Deletion of /newFile"));
Assert.assertTrue(selenium.isTextPresent("WARNING! You will not be able to undo these change!"));
@@ -145,19 +189,54 @@
@Test(enabled = true, description = "File creation and moving to default directory.")
public void testMoveFile() {
createFile("fileToMove","");
+
+ //canceling first
+
selenium.click("link=Admin");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=CMS");
selenium.waitForPageToLoad(PAGE_LOAD);
int row = findTableRow(CMS_FILE_TABLE, "fileToMove", 0) + 1;
- selenium.select("//div[@id='center']/div/div/div[3]/table/tbody/tr[" + row + "]/td[2]/form/select", "label=Move");
- selenium.click("//div[@id='center']/div/div/div[3]/table/tbody/tr[" + row + "]/td[2]/form/select/option[3]");
- selenium.click("//div[@id='center']/div/div/div[3]/table/tbody/tr[" + row + "]/td[2]/form/input");
+ selenium.select(CMS_FILE_TABLE + "/tbody/tr[" + row + "]/td[2]/form/select", "label=Move");
+ selenium.click(CMS_FILE_TABLE + "/tbody/tr[" + row + "]/td[2]/form/select/option[3]");
+ selenium.click(CMS_FILE_TABLE + "/tbody/tr[" + row + "]/td[2]/form/input");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=default");
+ selenium.click("cancel");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ // assuming file is not moved
+
+ selenium.click("link=default");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertFalse(selenium.isElementPresent("link=fileToMove"));
+
+ selenium.click("link=Home");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isElementPresent("link=fileToMove"));
+
+ // really moving file
+ selenium.open(ADDR_PORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ row = findTableRow(CMS_FILE_TABLE, "fileToMove", 0) + 1;
+
+ selenium.select(CMS_FILE_TABLE + "/tbody/tr[" + row + "]/td[2]/form/select", "label=Move");
+ selenium.click(CMS_FILE_TABLE + "/tbody/tr[" + row + "]/td[2]/form/select/option[3]");
+ selenium.click(CMS_FILE_TABLE + "/tbody/tr[" + row + "]/td[2]/form/input");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=default");
selenium.click("submit");
selenium.waitForPageToLoad(PAGE_LOAD);
+
+ // assuming file is moved
+
selenium.click("link=default");
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -178,9 +257,9 @@
selenium.waitForPageToLoad(PAGE_LOAD);
int row = findTableRow(CMS_FILE_TABLE, "file2copy", 0) + 1;
- selenium.select("//div[@id='center']/div/div/div[3]/table/tbody/tr[" + row + "]/td[2]/form/select", "label=Copy");
- selenium.click("//div[@id='center']/div/div/div[3]/table/tbody/tr[" + row + "]/td[2]/form/select/option[3]");
- selenium.click("//div[@id='center']/div/div/div[3]/table/tbody/tr[" + row + "]/td[2]/form/input");
+ selenium.select(CMS_FILE_TABLE + "/tbody/tr[" + row + "]/td[2]/form/select", "label=Copy");
+ selenium.click(CMS_FILE_TABLE + "/tbody/tr[" + row + "]/td[2]/form/select/option[3]");
+ selenium.click(CMS_FILE_TABLE + "/tbody/tr[" + row + "]/td[2]/form/input");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=default");
selenium.click("submit");
@@ -204,6 +283,8 @@
createFile(file,"contentstring1");
+ // canceling for the first time
+
selenium.click("link=Admin");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=CMS");
@@ -211,11 +292,31 @@
selenium.click("link="+file);
selenium.waitForPageToLoad(PAGE_LOAD);
- //selenium.setSpeed("5000");
+
row = findTableRow(CMS_FV_TABLE, "1.1", 2) + 1;
- selenium.click("//div[@id='center']/div/div/table/tbody/tr["+row+"]/td[1]/a");
+ selenium.click(CMS_FV_TABLE + "/tbody/tr["+row+"]/td[1]/a");
selenium.waitForPageToLoad(PAGE_LOAD);
fillInEditor("contentstring2");
+ selenium.click("cancel");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ // really creating and approving
+ selenium.open(ADDR_PORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Home");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click("link="+file);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ row = findTableRow(CMS_FV_TABLE, "1.1", 2) + 1;
+ selenium.click(CMS_FV_TABLE + "/tbody/tr["+row+"]/td[1]/a");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ fillInEditor("contentstring2");
selenium.click("save");
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -223,7 +324,7 @@
selenium.waitForPageToLoad(PAGE_LOAD);
row = findTableRow(CMS_FV_TABLE, "1.3", 2) + 1;
- selenium.click("//div[@id='center']/div/div/table/tbody/tr["+row+"]/td[1]/a");
+ selenium.click(CMS_FV_TABLE + "/tbody/tr["+row+"]/td[1]/a");
selenium.waitForPageToLoad(PAGE_LOAD);
fillInEditor("contentstring3");
selenium.click("save");
@@ -235,19 +336,26 @@
Assert.assertFalse(selenium.isTextPresent("1.5"));
row = findTableRow(CMS_FV_TABLE, "1.3", 2) + 1;
- selenium.click("//div[@id='center']/div/div/table/tbody/tr["+row+"]/td[1]/a");
+ selenium.click(CMS_FV_TABLE + "/tbody/tr["+row+"]/td[1]/a");
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isTextPresent("contentstring2"));
}
+
private void createFile(String name,String content) {
+
+ // save and approve
+ selenium.open(ADDR_PORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=Admin");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=CMS");
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.select("//div[@id='center']/div/div/div[1]/div/select", "label=Create File");
+ selenium.click("link=Home");
selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select(SELECT_CMS_MAIN, "label=Create File");
+ selenium.waitForPageToLoad(PAGE_LOAD);
selenium.waitForPopUp("_top", PAGE_LOAD);
selenium.type("filename", name);
selenium.type("description", name + " description");
@@ -256,6 +364,7 @@
selenium.click("save");
selenium.waitForPageToLoad(PAGE_LOAD);
+
selenium.click("link=Approve");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=Home");
Added: branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSPendingItemsTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSPendingItemsTestCase.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSPendingItemsTestCase.java 2008-10-13 16:26:13 UTC (rev 12060)
@@ -0,0 +1,61 @@
+package org.jboss.portal.test.selenium.cms;
+import org.jboss.portal.test.selenium.JBossPortalSeleniumTestCase;
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import com.thoughtworks.selenium.DefaultSelenium;
+import com.thoughtworks.selenium.Selenium;
+
+/**
+ * @author <a href="mailto:vrockai@redhat.com">Viliam Rockai</a>
+ */
+
+@Test(groups = { "cms_gui" }, enabled = true)
+
+public class CMSPendingItemsTestCase extends JBossPortalSeleniumTestCase {
+
+ public static final String SELECT_MAIN = "//div[@id='center']/div/div/div[1]/div/select";
+ public static final String PENDING_TABLE ="//div[@id='center']/div/div/table";
+
+ @BeforeMethod( groups = { "log" })
+ public void loginBeforeTest() {
+ login("admin", "admin");
+ }
+
+ @AfterMethod(groups = { "log" })
+ public void logoutAfterTest() {
+ logout();
+ }
+
+ @Test(enabled = true, description = "Simple file creation.")
+ public void testCreatePendingFile() {
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select(SELECT_MAIN, "label=Create File");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.waitForPopUp("_top", PAGE_LOAD);
+ selenium.type("filename", "newFile");
+ selenium.type("description", "newFile description");
+ selenium.type("title", "newFile title");
+ selenium.select("language", "label=Czech");
+ selenium.click("save");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click("link=Home");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertEquals("newFile", selenium.getText("link=newFile"));
+
+ selenium.select(SELECT_MAIN, "label=Pending Items");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(findTableRow(PENDING_TABLE, "newFile", 0)>=0);
+
+ }
+
+}
Property changes on: branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSPendingItemsTestCase.java
___________________________________________________________________
Name: svn:executable
+ *
Modified: branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSSecureTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSSecureTestCase.java 2008-10-13 14:45:21 UTC (rev 12059)
+++ branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSSecureTestCase.java 2008-10-13 16:26:13 UTC (rev 12060)
@@ -131,6 +131,9 @@
@Test(enabled = true, description = "Set user read permissions, login as user.")
public void testSetUserReadPer() {
+
+ // cancelling at first stage
+
login("admin", "admin");
Assert.assertFalse(selenium.isTextPresent("Access Denied"),"Non secured resource is not visible.#1");
@@ -148,6 +151,30 @@
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.select(SELECT_SECUREROLES_READ, "label=Administrators");
selenium.select(SELECT_SECUREUSERS_READ, "label=user");
+ selenium.click("cancel");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ logout();
+
+ // really setting the permissions
+
+ login("admin", "admin");
+
+ Assert.assertFalse(selenium.isTextPresent("Access Denied"),"Non secured resource is not visible.#1");
+ Assert.assertFalse(selenium.isTextPresent("You are not allowed to access the following resource - /default/index.html"),"Non secured resource is not visible.#2");
+
+ selenium.click(LINK_ADMIN);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LINK_CMS);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LINK_DEFAULT);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LINK_INDEX_HTML);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select(SELECT_CMS_ACTION, "label=Secure");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select(SELECT_SECUREROLES_READ, "label=Administrators");
+ selenium.select(SELECT_SECUREUSERS_READ, "label=user");
selenium.click(SUBMIT_SECURITY_SET);
selenium.waitForPageToLoad(PAGE_LOAD);
Added: branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/DashboardsTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/DashboardsTestCase.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/DashboardsTestCase.java 2008-10-13 16:26:13 UTC (rev 12060)
@@ -0,0 +1,151 @@
+package org.jboss.portal.test.selenium.portal;
+
+import java.text.MessageFormat;
+
+import org.jboss.portal.test.selenium.JBossPortalSeleniumTestCase;
+import org.testng.Assert;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+public class DashboardsTestCase extends JBossPortalSeleniumTestCase {
+
+ private static final String T_DH_SUB_UPDATE = "common-edit-theme-form:_id125jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj";
+ private static final String T_DH_SEL_RENDERSET = "common-edit-theme-form:renderSet";
+ private static final String T_DH_SEL_THEME = "common-edit-theme-form:theme";
+ private static final String T_DH_SEL_LAYOUT = "common-edit-theme-form:layout";
+ private static final String T_PA_SUB_UPDATE = "common-edit-page-error-form:update_2";
+ private static final String T_PO_SUB_UPDATE = "common-edit-portal-error-form:update_1";
+ private static final String T_PA_INP_PAGEADD = "common-edit-page-error-form:page-res-select";
+ private static final String T_PO_INP_PAGEADD = "common-edit-portal-error-form:portal-res-input";
+ private static final String T_PA_SEL_PNF = "common-edit-page-error-form:page-not-found-select";
+ private static final String T_PA_SEL_INTERN = "common-edit-page-error-form:page-internal-select";
+ private static final String T_PA_SEL_ERROR = "common-edit-page-error-form:page-error-select";
+ private static final String T_PA_SEL_CONTROL = "common-edit-page-error-form:page-control-select";
+ private static final String T_PA_SEL_ACCESS = "common-edit-page-error-form:page-access-select";
+ private static final String T_PO_SEL_PNF = "common-edit-portal-error-form:portal-not-found-select";
+ private static final String T_PO_SEL_UNAVAIL = "common-edit-portal-error-form:portal-unavail-select";
+ private static final String T_PO_SEL_ACCESS = "common-edit-portal-error-form:portal-access-select";
+ private static final String SUBMIT_UPDATE_VALUE = "common-manage-prop-form:update";
+ private static final String TABLE_PROPS = "common-manage-prop-form:prop-data-table";
+ private static final String T_PROPS_INPUT_VALUE = "common-manage-prop-form:prop-data-table:{0}:prop-value-input";
+ private static final String T_PROPS_LINK_DEL = "common-manage-prop-form:prop-data-table:{0}:delete";
+
+ private static final String TABLE_PA_ERR = "//form[@id='common-edit-page-error-form']/table";
+ private static final String TABLE_PO_ERR = "//form[@id='common-edit-portal-error-form']/table";
+ private static final String TABLE_DH_THM = "//form[@id='common-edit-theme-form']/table";
+ private static final String INPUT_PROP_NAME = "common-edit-prop-form:property";
+ private static final String SUBMIT_ADD_PROP = "common-edit-prop-form:add-property";
+ private static final String LINK_ADMIN = "link=Admin";
+ private static final String LINK_TAB_DASH = "admin-subtab-form:dashboard-link";
+
+ @BeforeMethod(groups = { "log" })
+ public void loginBeforeTest() {
+ login("admin", "admin");
+ goToDash();
+ }
+
+ @AfterMethod(groups = { "log" })
+ public void logoutAfterTest() {
+ logout();
+ }
+
+ @Test(enabled = true)
+ public void testPropAdd() {
+ final String propName = "SelenProp";
+
+ Assert.assertFalse(selenium.isTextPresent(propName));
+ selenium.type(INPUT_PROP_NAME, propName);
+ selenium.click(SUBMIT_ADD_PROP);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent(propName));
+ }
+
+ @Test(enabled = true)
+ public void testPropUpdate() {
+ final String propName = "SelenValueProp";
+ final String value = "updatedValue";
+ Assert.assertFalse(selenium.isTextPresent(value));
+ Assert.assertFalse(selenium.isTextPresent(propName));
+ selenium.type(INPUT_PROP_NAME, propName);
+ selenium.click(SUBMIT_ADD_PROP);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent(propName));
+
+ int r = findTableRow(TABLE_PROPS, propName, 0);
+ System.out.println(propName+":"+r);
+
+ selenium.type(MessageFormat.format(T_PROPS_INPUT_VALUE, r-1),value);
+ selenium.click(SUBMIT_UPDATE_VALUE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent(value));
+
+ }
+
+ @Test(enabled = true)
+ public void testPropDelete() {
+ final String propName = "SelenDeleteProp";
+
+ Assert.assertFalse(selenium.isTextPresent(propName));
+ selenium.type(INPUT_PROP_NAME, propName);
+ selenium.click(SUBMIT_ADD_PROP);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent(propName));
+
+ int r = findTableRow(TABLE_PROPS, propName, 0);
+ System.out.println(propName+":"+r);
+
+ selenium.click(MessageFormat.format(T_PROPS_LINK_DEL, r-1));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertFalse(selenium.isTextPresent(propName));
+
+ }
+
+ @Test(enabled = true)
+ public void testPortalError() {
+ selenium.select(T_PO_SEL_ACCESS, "label=Redirect to the specified resource");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select(T_PO_SEL_UNAVAIL, "label=Redirect to the specified resource");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select(T_PO_SEL_PNF, "label=Redirect to the specified resource");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.type(T_PO_INP_PAGEADD, "/WEB-INF/jsp/error/portalX.jsp");
+ selenium.click(T_PO_SUB_UPDATE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ }
+
+ @Test(enabled = true)
+ public void testPageError() {
+ selenium.select(T_PA_SEL_ACCESS, "label=Display the default error message");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select(T_PA_SEL_CONTROL, "label=Redirect to the specified resource");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select(T_PA_SEL_ERROR, "label=Remove the resource from page");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select(T_PA_SEL_INTERN, "label=Display the default error message");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select(T_PA_SEL_PNF, "label=Redirect to the specified resource");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.type(T_PA_INP_PAGEADD, "/WEB-INF/jsp/error/pageY.jsp");
+ selenium.click(T_PA_SUB_UPDATE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ }
+
+ @Test(enabled = true)
+ public void testDashboardTheme() {
+ selenium.select(T_DH_SEL_LAYOUT, "label=1column");
+ selenium.select(T_DH_SEL_THEME, "label=nphalanx");
+ selenium.select(T_DH_SEL_RENDERSET, "label=default");
+ selenium.click(T_DH_SUB_UPDATE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ }
+
+ private void goToDash() {
+ selenium.open("/portal/");
+ clickIfVisible(LINK_ADMIN);
+ clickIfVisible(LINK_ADMIN);
+ clickIfVisible(LINK_TAB_DASH);
+ }
+}
Added: branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/PortletDefinitionsTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/PortletDefinitionsTestCase.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/PortletDefinitionsTestCase.java 2008-10-13 16:26:13 UTC (rev 12060)
@@ -0,0 +1,97 @@
+package org.jboss.portal.test.selenium.portal;
+
+import java.text.MessageFormat;
+
+import org.jboss.portal.test.selenium.JBossPortalSeleniumTestCase;
+import org.testng.Assert;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+public class PortletDefinitionsTestCase extends JBossPortalSeleniumTestCase{
+
+ private static final String T_LINK_PREF = "def-list:portlet-pref-{0}";
+ private static final String SUBMIT_CREATE_INST = "add_instance_form:_id19jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj";
+ private static final String INPUT_INSTANCE_NAME = "add_instance_form:instanceId";
+ private static final String T_LINK_CREATE = "def-list:create-instance-{0}";
+ private static final String SUBMIT_PROVIDER_VIEW = "definition-form:view-portlets";
+ private static final String SELECT_PROVIDER = "definition-form:menu";
+ private static final String TABLE_PORTLET = "//form[@id='def-list']/table";
+ private static final String LINK_NAME_ADMIN_PORT = "common-show-portlet-detail-form:field1:select";
+ private static final String LINK_ADMIN_PORT = "def-list:portlet-def-0";
+ private static final String LINK_ADMIN = "link=Admin";
+ private static final String LINK_TAB_PD = "admin-subtab-form:portlet-def-link";
+ private static final String LINK_PD_MAIN = "man-form:def-link";
+
+
+ @BeforeMethod(groups = { "log" })
+ public void loginBeforeTest() {
+ login("admin", "admin");
+ goToPD();
+ }
+
+ @AfterMethod(groups = { "log" })
+ public void logoutAfterTest() {
+ logout();
+ }
+
+ @Test(enabled = true)
+ public void testShowInfo(){
+ selenium.click(LINK_ADMIN_PORT);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("Portlet Instance Information"));
+ Assert.assertTrue(selenium.isElementPresent(LINK_NAME_ADMIN_PORT));
+ Assert.assertTrue(selenium.isTextPresent("Administration Portlet"));
+ Assert.assertTrue(selenium.isTextPresent("Management Portlet"));
+ Assert.assertTrue(selenium.isTextPresent("management,admin"));
+ Assert.assertTrue(selenium.isTextPresent("de it en"));
+ }
+
+ @Test(enabled = true)
+ public void testCreateInstance(){
+
+ int r = findTableRow(TABLE_PORTLET, "Administration Portlet", 0);
+
+ selenium.click(MessageFormat.format(T_LINK_CREATE,r-1));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.type(INPUT_INSTANCE_NAME, "littleAdmin");
+ selenium.click(SUBMIT_CREATE_INST);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("littleAdmin portlet details"));
+ Assert.assertTrue(selenium.isTextPresent("Portlet Instance Information"));
+ }
+
+ @Test(enabled = true)
+ public void testPreferences(){
+
+ int r = findTableRow(TABLE_PORTLET, "Current Users Portlet", 0);
+
+ selenium.click(MessageFormat.format(T_LINK_PREF,r-1));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("Current Users Portlet preferences"));
+ Assert.assertTrue(selenium.isTextPresent("guestNumber"));
+ }
+
+ @Test(enabled = true)
+ public void testSwitchProvider(){
+ selenium.select(SELECT_PROVIDER, "label=self");
+ selenium.click(SUBMIT_PROVIDER_VIEW);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ int n = countTableRows(TABLE_PORTLET);
+ Assert.assertEquals(n, 16,"Wrong number of self portlets.");
+
+ selenium.select(SELECT_PROVIDER, "label=local");
+ selenium.click(SUBMIT_PROVIDER_VIEW);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ n = countTableRows(TABLE_PORTLET);
+ Assert.assertEquals(n, 21, "Wrong number of local portlets.");
+ }
+
+ private void goToPD(){
+ selenium.open("/portal/");
+ clickIfVisible(LINK_ADMIN);
+ clickIfVisible(LINK_ADMIN);
+ clickIfVisible(LINK_TAB_PD);
+ clickIfVisible(LINK_PD_MAIN);
+ }
+}
Added: branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/PortletInstancesTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/PortletInstancesTestCase.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/PortletInstancesTestCase.java 2008-10-13 16:26:13 UTC (rev 12060)
@@ -0,0 +1,231 @@
+package org.jboss.portal.test.selenium.portal;
+
+import java.text.MessageFormat;
+
+import org.jboss.portal.test.selenium.JBossPortalSeleniumTestCase;
+import org.testng.Assert;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+public class PortletInstancesTestCase extends JBossPortalSeleniumTestCase{
+
+ private static final String SUBMIT_SECURITY_UPDATE = "common-edit-security-form:update";
+ private static final String SUBMIT_SECURITY_CANCEL = "common-edit-security-form:cancel";
+
+ private static final String LINK_PREF_WELCOMEPORT = "instances-form:security-JSPPortletInstance";
+
+ private static final String TABLE_PREF_KEY = "//form[@id='common-edit-pref-form']/table";
+
+ private static final String SUBMIT_PREF_DELETE = "common-edit-exisiting-form:row_0";
+ private static final String LINK_PREF_GUESTNUM = "common-edit-pref-form:pref-link-0";
+ private static final String INPUT_PREF_NEWVAL = "common-append-form:new_value";
+ private static final String SUBMIT_PREF_UPDATE = "common-append-form:append-button";
+ private static final String SUBMIT_PREF_SAVE = "_id919jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj:save";
+ private static final String INPUT_PREF_UPDATE = "common-edit-exisiting-form:update";
+ private static final String INPUT_PREF_APPEND = "common-edit-exisiting-form:pref-input-0";
+ private static final String SUBMIT_PREF_CANCEL = "_id458jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj:cancel";
+ private static final String LINK_CURUSER_PREFERENCES = "instances-form:preference-CurrentUsersPortletInstance";
+ private static final String LINK_DEL_EXCEPTPORT = "instances-form:delete-ExceptionPortletInstance";
+ private static final String SUBMIT_PI_DELETE_CONF = "confirm-delete-form1:delete";
+ private static final String SUBMIT_PI_DELETE_CANC = "confirm-delete-form1:cancel";
+ private static final String T_LINK_DELETENAME = "displaynamecontainer:instance-display-form:locale-data-table:{0}:delete-link";
+ private static final String T_LINK_MODIFYNAME = "displaynamecontainer:instance-display-form:locale-data-table:{0}:edit-link";
+ private static final String LINK_COUNTPORT = "instances-form:CounterPortletInstance";
+ private static final String SUBMIT_MODIFY_NAME = "displaynamecontainer:displayNameForm:addDisplay";
+ private static final String INPUT_NAME = "displaynamecontainer:displayNameForm:newName";
+ private static final String SELECT_LANGUAGE = "displaynamecontainer:displayNameForm:locales";
+ private static final String LINK_ADMIN = "link=Admin";
+ private static final String LINK_TAB_PI = "admin-subtab-form:portlet-instance-link";
+ private static final String LINK_PI_MAIN = "instance-form1:instance-link";
+ private static final String TABLE_DISPNAMES = "displaynamecontainer:instance-display-form:locale-data-table";
+
+ @BeforeMethod(groups = { "log" })
+ public void loginBeforeTest() {
+ login("admin", "admin");
+ goToPI();
+ }
+
+ @AfterMethod(groups = { "log" })
+ public void logoutAfterTest() {
+ logout();
+ }
+
+ @Test(enabled = true)
+ public void testAddName(){
+ selenium.click(LINK_COUNTPORT);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select(SELECT_LANGUAGE, "label=Czech");
+ final String name = "Administracny";
+ selenium.type(INPUT_NAME, name);
+ selenium.click(SUBMIT_MODIFY_NAME);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(findTableRow(TABLE_DISPNAMES, name, 1)>=0);
+ }
+
+ @Test(enabled = true)
+ public void testDeleteName(){
+ // adding the name
+ selenium.click(LINK_COUNTPORT);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select(SELECT_LANGUAGE, "label=Japanese");
+ final String name = "Aduminu";
+ selenium.type(INPUT_NAME, name);
+ selenium.click(SUBMIT_MODIFY_NAME);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ // deleting name
+
+ int r = findTableRow(TABLE_DISPNAMES, name, 1);
+
+ selenium.click(MessageFormat.format(T_LINK_DELETENAME, r-1));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertFalse(findTableRow(TABLE_DISPNAMES, name, r)>=0);
+ }
+
+ @Test(enabled = true)
+ public void testModifyName(){
+ // adding the name
+ selenium.click(LINK_COUNTPORT);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select(SELECT_LANGUAGE, "label=Japanese");
+ final String name = "Adminisimo";
+ final String nameNew = "Adminiprisimo";
+
+ selenium.type(INPUT_NAME, name);
+ selenium.click(SUBMIT_MODIFY_NAME);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ // midifying name
+
+ int r = findTableRow(TABLE_DISPNAMES, name, 1);
+
+ selenium.click(MessageFormat.format(T_LINK_MODIFYNAME, r-1));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.type(INPUT_NAME, nameNew);
+ selenium.click(SUBMIT_MODIFY_NAME);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(findTableRow(TABLE_DISPNAMES, nameNew, 1)>=0);
+ }
+
+ @Test(enabled = true)
+ public void testSecure(){
+ // "common-edit-security-form:cancel"
+ selenium.click(LINK_PREF_WELCOMEPORT);
+ selenium.waitForPageToLoad("30000");
+ selenium.click("//input[@name='common-edit-security-form:cars_2']");
+ selenium.click("//input[@name='common-edit-security-form:cars_1']");
+ selenium.click("//input[@name='common-edit-security-form:cars_0']");
+ selenium.click("//input[@name='common-edit-security-form:cars_0' and @value='admin']");
+ selenium.click("//input[@name='common-edit-security-form:cars_1' and @value='admin']");
+ selenium.click("//input[@name='common-edit-security-form:cars_2' and @value='admin']");
+ selenium.click(SUBMIT_SECURITY_UPDATE);
+ selenium.waitForPageToLoad("30000");
+ selenium.click("link=Portal");
+ selenium.waitForPageToLoad("30000");
+ Assert.assertTrue(selenium.isTextPresent("Greetings !"));
+
+ // then cancel
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad("30000");
+ selenium.click(LINK_PREF_WELCOMEPORT);
+ selenium.waitForPageToLoad("30000");
+ selenium.click("//input[@name='common-edit-security-form:cars_0']");
+ selenium.click("//input[@name='common-edit-security-form:cars_1' and @value='admin']");
+ selenium.click("//input[@name='common-edit-security-form:cars_0' and @value='admin']");
+ selenium.click("//input[@name='common-edit-security-form:cars_2' and @value='admin']");
+ selenium.click("//input[@name='common-edit-security-form:cars_1']");
+ selenium.click(SUBMIT_SECURITY_CANCEL);
+ selenium.waitForPageToLoad("30000");
+ selenium.click("link=Portal");
+ selenium.waitForPageToLoad("30000");
+ Assert.assertTrue(selenium.isTextPresent("Greetings !"));
+
+ // then really stop the greetings portlet
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad("30000");
+ selenium.click(LINK_PREF_WELCOMEPORT);
+ selenium.waitForPageToLoad("30000");
+ selenium.click("//input[@name='common-edit-security-form:cars_0']");
+ selenium.click("//input[@name='common-edit-security-form:cars_1' and @value='admin']");
+ selenium.click("//input[@name='common-edit-security-form:cars_0' and @value='admin']");
+ selenium.click("//input[@name='common-edit-security-form:cars_2' and @value='admin']");
+ selenium.click("//input[@name='common-edit-security-form:cars_1']");
+ selenium.click(SUBMIT_SECURITY_UPDATE);
+ selenium.waitForPageToLoad("30000");
+
+ selenium.click("link=Portal");
+ selenium.waitForPageToLoad("30000");
+ Assert.assertFalse(selenium.isTextPresent("Greetings !"));
+ }
+
+ @Test(enabled = true)
+ public void testDeleteInstance(){
+ // cancel first
+ Assert.assertTrue(selenium.isElementPresent(LINK_DEL_EXCEPTPORT),"Exception portlet not found.");
+ selenium.click(LINK_DEL_EXCEPTPORT);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("WARNING!"));
+ Assert.assertTrue(selenium.isTextPresent("Are you sure you want to delete this portlet instance ?"));
+ selenium.click(SUBMIT_PI_DELETE_CANC);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ // delete
+ goToPI();
+ Assert.assertTrue(selenium.isElementPresent(LINK_DEL_EXCEPTPORT),"Exception portlet not found.");
+ selenium.click(LINK_DEL_EXCEPTPORT);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("WARNING!"));
+ Assert.assertTrue(selenium.isTextPresent("Are you sure you want to delete this portlet instance ?"));
+ selenium.click(SUBMIT_PI_DELETE_CONF);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertFalse(selenium.isElementPresent(LINK_DEL_EXCEPTPORT),"Exception portlet found after deletition.");
+ }
+
+ @Test(enabled = true)
+ public void testPreferences(){
+ int r;
+ selenium.click(LINK_CURUSER_PREFERENCES);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(SUBMIT_PREF_CANCEL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LINK_CURUSER_PREFERENCES);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(findTableRow(TABLE_PREF_KEY, "guestNumber", 0) >= 0);
+ selenium.click(LINK_PREF_GUESTNUM);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ r=findTableRow(TABLE_PREF_KEY, "guestNumber", 0);
+ Assert.assertEquals(selenium.getText(TABLE_PREF_KEY+"/tbody/tr["+r+"]/td[4]"),"[true]");
+ selenium.type(INPUT_PREF_APPEND, "true1");
+ selenium.click(INPUT_PREF_UPDATE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ r=findTableRow(TABLE_PREF_KEY, "guestNumber", 0);
+ Assert.assertEquals(selenium.getText(TABLE_PREF_KEY+"/tbody/tr["+r+"]/td[4]"),"[true1]");
+ selenium.click(SUBMIT_PREF_DELETE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ r=findTableRow(TABLE_PREF_KEY, "guestNumber", 0);
+ Assert.assertEquals(selenium.getText(TABLE_PREF_KEY+"/tbody/tr["+r+"]/td[4]"),"[]");
+ selenium.type(INPUT_PREF_NEWVAL, "viliam");
+ selenium.click(SUBMIT_PREF_UPDATE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ r=findTableRow(TABLE_PREF_KEY, "guestNumber", 0);
+ Assert.assertEquals(selenium.getText(TABLE_PREF_KEY+"/tbody/tr["+r+"]/td[4]"),"[viliam]");
+ selenium.click(SUBMIT_PREF_SAVE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ }
+
+ private void goToPI(){
+ selenium.open("/portal/");
+ clickIfVisible(LINK_ADMIN);
+ clickIfVisible(LINK_ADMIN);
+ clickIfVisible(LINK_TAB_PI);
+ clickIfVisible(LINK_PI_MAIN);
+ }
+
+}
Modified: branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/testng.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/testng.xml 2008-10-13 14:45:21 UTC (rev 12059)
+++ branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/testng.xml 2008-10-13 16:26:13 UTC (rev 12060)
@@ -15,7 +15,7 @@
<classes>
<class name="org.jboss.portal.test.selenium.IdentityAdminTestCase"></class></classes>
</test>
-
+<!--
<test name="org.jboss.portal.test.selenium.IdentityAdminTestCase - SingleLogin"
verbose="2" annotations="JDK">
<groups>
@@ -24,7 +24,7 @@
<classes>
<class name="org.jboss.portal.test.selenium.IdentityAdminTestCase"></class></classes>
</test>
-
+-->
<test name="org.jboss.portal.test.selenium.PortletUserCreationTestCase"
verbose="2" annotations="JDK">
<classes>
@@ -84,4 +84,23 @@
<classes>
<class name="org.jboss.portal.test.selenium.portal.AdminPortalTestCase"></class></classes>
</test>
+
+ <test name="org.jboss.portal.test.selenium.portal.PortletInstancesTestCase"
+ verbose="2" annotations="JDK">
+ <classes>
+ <class name="org.jboss.portal.test.selenium.portal.PortletInstancesTestCase"></class></classes>
+ </test>
+
+ <test name="org.jboss.portal.test.selenium.portal.PortletDefinitionsTestCase"
+ verbose="2" annotations="JDK">
+ <classes>
+ <class name="org.jboss.portal.test.selenium.portal.PortletDefinitionsTestCase"></class></classes>
+ </test>
+
+ <test name="org.jboss.portal.test.selenium.portal.DashboardsTestCase"
+ verbose="2" annotations="JDK">
+ <classes>
+ <class name="org.jboss.portal.test.selenium.portal.DashboardsTestCase"></class></classes>
+ </test>
+
</suite>
17 years, 6 months
JBoss Portal SVN: r12059 - in branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium: cms and 1 other directory.
by portal-commits@lists.jboss.org
Author: vrockai
Date: 2008-10-13 10:45:21 -0400 (Mon, 13 Oct 2008)
New Revision: 12059
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/IdentityAdminTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/JBossPortalSeleniumTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/PortletUserCreationTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/UserLoginTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/WSRPTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSArchiveUploadTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSDirectoryTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileWorkflowTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSSecureTestCase.java
Log:
id fixes
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 2008-10-09 14:23:21 UTC (rev 12058)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/DashboardTestCase.java 2008-10-13 14:45:21 UTC (rev 12059)
@@ -75,8 +75,6 @@
Assert.assertEquals(selenium.getSelectedLabel(SELECT_THEME), "renaissance", "Previously selected theme other then expected.");
}
-
-
@Test(enabled = true, dependsOnMethods = { "testCreatePage" })
public void testUpdateLayout() {
selenium.click(LINK_DASHBOARD);
@@ -124,6 +122,47 @@
Assert.assertTrue(selenium.isTextPresent("[admin]"));
}
+ @Test(enabled = true, dependsOnMethods = { "testCreatePage","testAddPortlet" })
+ public void testMovePortlet() {
+ final String pageName = "DashMovePage";
+
+
+ selenium.click(LINK_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LINK_CONFIGURE_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.type(INPUT_PAGENAME, pageName);
+ selenium.click(SUBMIT_CREATEPAGE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click(LINK_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LINK_CONFIGURE_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selectIfNotSelected(SELECT_PAGE,pageName);
+ selenium.click("link=ExceptionPortletInstance");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(SUBMIT_ADDCENTER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selectIfNotSelected(SELECT_PAGE,pageName);
+ selenium.click("link=Who's online portlet");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(SUBMIT_ADDCENTER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click(LINK_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link="+pageName);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertFalse(assertTextOrder("Current;Exception"));
+ Assert.assertTrue(assertTextOrder("Exception;Current"));
+
+ }
+
@Test(enabled = true, dependsOnMethods = { "testAddPortlet" })
public void testDeletePortlet() {
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/IdentityAdminTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/IdentityAdminTestCase.java 2008-10-09 14:23:21 UTC (rev 12058)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/IdentityAdminTestCase.java 2008-10-13 14:45:21 UTC (rev 12059)
@@ -16,37 +16,55 @@
@Test(groups = { "admin_ui" }, enabled = true)
public class IdentityAdminTestCase extends JBossPortalSeleniumTestCase {
- public static final String LINK_T_USRLIST_DEL = "search-user-form1:userlist:{0}:delete-user-link";
- public static final String LINK_T_USRLIST_ROLES = "search-user-form1:userlist:{0}:assign-role-link";
- public static final String LINK_T_ROLLIST_DEL = "roles-form:userlist:{0}:delete-role-link";
- public static final String TABLE_ROLELIST = "roles-form:userlist";
- public static final String TABLE_USERLIST = "search-user-form1:userlist";
- public static final String ID_SUBMIT_CONF_CREATE_USER = "confirm-form:admin";
- public static final String ID_SUBMIT_DELETE_ROLE = "delete-role-form:confirm";
- public static final String ID_SUBMIT_ROLE_CREATE = "create-role-form:submit";
- public static final String ID_INPUT_ROLEDISNAME = "create-role-form:roledisplayname";
- public static final String ID_INPUT_ROLENAME = "create-role-form:rolename";
- public static final String ID_BUT_ROLE_CREATE = "create-role-form:create-role-link";
- public static final String ID_BUT_SUBMIT_DEL_USER = "delete-user-form:submit";
- public static final String ID_SUBMIT_ASSIGN_ROLE = "assign-roles-form:submit";
- public static final String ID_SUBMIT_USER_ROLE = "register-role-form:submit";
- public static final String ID_SUBMIT_CREATE_USER = "register-form:submit";
- public static final String ID_INPUT_PASSWORD_CHK = "register-form:passwordCheck";
- public static final String ID_INPUT_PASSWORD = "register-form:password";
- public static final String ID_INPUT_USEREMAIL = "register-form:email";
- public static final String ID_INPUT_USERNAME = "register-form:username";
- public static final String ID_SUBMIT_SEARCH_USER = "search-user-form:search";
- public static final String ID_INPUT_SEARCH_USER = "search-user-form:searchString";
- public static final String LINK_SEARCH_USER = "user-form:search-user-link";
- public static final String ID_LINK_USERTAB = "role-temp-form:manage-users";
- public static final String ID_LINK_USERMAIN = "user-temp-form1:user-adm-link";
- public static final String ID_LINK_ROLETAB = "user-temp-form:role-mgm-link";
- public static final String ID_LINK_ROLEMAIN = "role-temp-form1:role-mgm-link";
- public static final String LINK_USERMANG_MAIN = "user-temp-form1:assign-role-link";
- public static final String LINK_USERMANG_MAIN2 = "user-temp-form1:user-mgm-link";
- public static final String ID_LINK_CREATE_USER = "user-form:create-user-link";
+ private static final String INPUT_PASS_CHANGE_SUBMIT = "//input[contains(@id,'jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj:_viewRoot:change-pwd-form:j_id31')]";
+ private static final String INPUT_PASS_CHANGE_CANCEL = "//input[contains(@id,'change-pwd-form:cancel')]";
+ private static final String INPUT_PASS_CHANGE_P2 = "//input[contains(@id,':change-pwd-form:passwordCheck')]";
+ private static final String INPUT_PASS_CHANGE_P1 = "//input[contains(@id,':change-pwd-form:password')]";
+ private static final String LINK_CHANGE_PASS = "//a[contains(@id,':profile-form:change-pwd-adm-link')]";
+ public static final String TABLE_USERLIST = "//table[contains(@id,'search-user-form1:userlist')]";
+ public static final String LINK_T_USRLIST_DEL = "//a[contains(@id,''search-user-form1:userlist:{0}:delete-user-link'')]";
+ public static final String LINK_T_USRLIST_ROLES = "//a[contains(@id,''search-user-form1:userlist:{0}:assign-role-link'')]";
+ public static final String LINK_T_USRLIST_DIS = "//a[contains(@id,''search-user-form1:userlist:{0}:enable-user-link'')]";
+ public static final String LINK_T_USRLIST_EDIT = "//a[contains(@id,''search-user-form1:userlist:{0}:rename-link'')]";
+
+ public static final String TABLE_ROLELIST = "//table[contains(@id,':_viewRoot:roles-form:userlist')]";
+
+ public static final String LINK_T_ROLLIST_DEL = "//a[contains(@id,''roles-form:userlist:{0}:delete-role-link'')]";
+ public static final String LINK_T_ROLLIST_MEMBERS = "//a[contains(@id,''roles-form:userlist:{0}:view-role-link'')]";
+ public static final String LINK_T_ROLLIST_EDIT = "//a[contains(@id,''roles-form:userlist:{0}:edit-role-link'')]";
+
+ public static final String TABLE_ROLEMEMBERS = "//table[contains(@id,'role-members-form:role-data-table')]";
+
+ public static final String ID_SUBMIT_CONF_CREATE_USER = "//input[contains(@id,'confirm-form:admin')]";
+ public static final String ID_SUBMIT_DELETE_ROLE = "//input[contains(@id,'delete-role-form:confirm')]";
+ public static final String ID_SUBMIT_ROLE_CREATE = "//input[contains(@id,':_viewRoot:create-role-form:submit')]";
+ public static final String ID_INPUT_ROLEDISNAME = "//input[contains(@id,':_viewRoot:create-role-form:roledisplayname')]";
+ public static final String ID_INPUT_ROLENAME = "//input[contains(@id,':_viewRoot:create-role-form:rolename')]";
+
+ public static final String ID_BUT_ROLE_CREATE = "//a[contains(@id, ':_viewRoot:create-role-form:create-role-link')]";
+ public static final String ID_BUT_SUBMIT_DEL_USER = "//input[contains(@id,'delete-user-form:submit')]";
+ public static final String ID_SUBMIT_ASSIGN_ROLE = "//input[contains(@id,'assign-roles-form:submit')]";
+ public static final String ID_SUBMIT_USER_ROLE = "//input[contains(@id,'register-role-form:submit')]";
+ public static final String ID_SUBMIT_CREATE_USER = "//input[contains(@id,'register-form:submit')]";
+ public static final String ID_INPUT_PASSWORD_CHK = "//input[contains(@id,'register-form:passwordCheck')]";
+ public static final String ID_INPUT_PASSWORD = "//input[contains(@id,'register-form:password')]";
+ public static final String ID_INPUT_USEREMAIL = "//input[contains(@id,'register-form:email')]";
+ public static final String ID_INPUT_USERNAME = "//input[contains(@id,'register-form:username')]";
+ public static final String ID_SUBMIT_SEARCH_USER = "//input[contains(@id,'search-user-form:search')]";
+ public static final String ID_INPUT_SEARCH_USER = "//input[contains(@id,'search-user-form:searchString')]";
+ public static final String LINK_SEARCH_USER = "//a[contains(@id,'user-form:search-user-link')]";
+ public static final String ID_LINK_USERTAB = "//a[contains(@id,'role-temp-form:manage-users')]";
+ public static final String ID_LINK_USERMAIN = "//a[contains(@id,'user-temp-form1:user-adm-link')]";
+
+ public static final String ID_LINK_ROLETAB = "//a[contains(@id,'_viewRoot:user-temp-form:role-mgm-link')]";
+
+ public static final String ID_LINK_ROLEMAIN = "//a[contains(@id, ':_viewRoot:role-temp-form1:role-admin-link')]";
+ public static final String LINK_USERMANG_MAIN = "//a[contains(@id,'user-temp-form1:assign-role-link')]";
+ public static final String LINK_USERMANG_MAIN2 = "//a[contains(@id,'user-temp-form1:user-mgm-link')]";
+ public static final String ID_LINK_CREATE_USER = "//a[contains(@id,':user-form:create-user-link')]";
- public static final String ID_CHECK_ROLE = "//input[@name=''assign-roles-form:roles'' and @value=''{0}'']";
+ public static final String ID_CHECK_ROLE = "//input[contains(@name,''assign-roles-form:roles'') and @value=''{0}'']";
+
private String butDelUsr_id(String userName) {
String table = TABLE_USERLIST;
@@ -54,12 +72,6 @@
return MessageFormat.format(LINK_T_USRLIST_DEL, r - 1);
}
- private String butDelRol_id(String roleName) {
- String table = TABLE_ROLELIST;
- int r = findTableRow(table, roleName, 0);
- return MessageFormat.format(LINK_T_ROLLIST_DEL, r - 1);
- }
-
private String butUsrRol_id(String userName) {
String table = TABLE_USERLIST;
int r = findTableRow(table, userName, 0);
@@ -73,9 +85,11 @@
@AfterMethod(groups = { "log" })
public void logoutAfterTest() {
- logout();
+ logoutIfPossible();
}
+/*
+ // For this mode to be functional, the user which is logged in must be "admin" after each test
@BeforeClass(groups = { "single" })
public void loginBefore() {
login("admin", "admin");
@@ -85,7 +99,7 @@
public void logoutAfter() {
logout();
}
-
+*/
@Test(enabled = true, description = "Creation of new user.")
public void testCreateUser() {
createUser("tempUser", "tempPassword", "tempUser(a)redhat.com");
@@ -107,7 +121,325 @@
createRole(role, "tempRoleDisplay");
deleteRole(role);
}
+
+ @Test(enabled = true, description = "Creating and deteling a user.")
+ public void testDeleteUser() {
+ createUser("deleteMe", "deleterPass", "disableMe(a)redhat.com");
+ deleteUser("deleteMe", "disableMe(a)redhat.com");
+ }
+
+ @Test(enabled = true, description = "Creating and disabling a user.")
+ public void testDisableUser() {
+ createUser("disableMe", "disablePass", "disableMe(a)redhat.com");
+
+ logout();
+ login("disableMe", "disablePass");
+ logout();
+ login("admin","admin");
+
+ searchUser("disableMe", "disableMe(a)redhat.com");
+ int r = findTableRow(TABLE_USERLIST, "disableMe", 0);
+
+ selenium.click(MessageFormat.format(LINK_T_USRLIST_DIS, r - 1 ));
+
+ logout();
+
+ //trying to log in with disabled account
+ selenium.open(ADDR_PORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click(LINK_LOGIN);
+ selenium.selectFrame(FRAME_LOGIN_CONTENT);
+
+ try {
+ Thread.sleep(2000);
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ selenium.type(INPUT_USERNAME, "disableMe");
+ selenium.type(INPUT_PASSWORD, "disablePass");
+ selenium.click(SUBMIT_LOGIN);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("Your account is disabled"));
+ // we should be unable to login with disabled account
+ // logging as user to end the test correctly
+
+ login("admin","admin");
+
+ deleteUser("disableMe", "disableMe(a)redhat.com");
+ }
+
+ @Test(enabled = true, dependsOnMethods = {"testDisableUser"},description = "Enabling disabled user.")
+ public void testEnableUser() {
+ createUser("enableMe", "enableMe", "enableMe(a)redhat.com");
+ searchUser("enableMe", "enableMe(a)redhat.com");
+
+ int r = findTableRow(TABLE_USERLIST, "Enable", 5);
+ Assert.assertTrue(r<0,"No user should be disabled.");
+ r = findTableRow(TABLE_USERLIST, "enableMe", 0);
+
+ selenium.click(MessageFormat.format(LINK_T_USRLIST_DIS, r - 1 ));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ searchUser("enableMe", "enableMe(a)redhat.com");
+ r = findTableRow(TABLE_USERLIST, "Enable", 5);
+ Assert.assertFalse(r<0,"One user should have been disabled.");
+
+ r = findTableRow(TABLE_USERLIST, "enableMe", 0);
+ selenium.click(MessageFormat.format(LINK_T_USRLIST_DIS, r - 1 ));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ searchUser("enableMe", "enableMe(a)redhat.com");
+ r = findTableRow(TABLE_USERLIST, "Enable", 5);
+ Assert.assertTrue(r<0,"No user should be disabled.");
+
+ deleteUser("enableMe", "enableMe(a)redhat.com");
+ }
+
+ @Test(enabled = true, description = "Editing a user.")
+ public void testEditUser() {
+ createUser("editMe", "editPass", "editMe(a)redhat.com");
+
+ // canceling the edit form
+ searchUser("editMe", "editMe(a)redhat.com");
+
+ int r = findTableRow(TABLE_USERLIST, "editMe", 0);
+ selenium.click(MessageFormat.format(LINK_T_USRLIST_EDIT, r - 1));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.type("profile-form:email", "editMe2(a)redhat.com");
+ selenium.click("profile-form:cancel");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("editMe(a)redhat.com"));
+
+ // filling out the edit page
+ searchUser("editMe", "editMe(a)redhat.com");
+
+ r = findTableRow(TABLE_USERLIST, "editMe", 0);
+ selenium.click(MessageFormat.format(LINK_T_USRLIST_EDIT, r - 1));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.type("profile-form:email", "editMe2(a)redhat.com");
+ selenium.select("profile-form:timezone", "label=(GMT -12:00 hours) Eniwetok, Kwajalein");
+ selenium.select("profile-form:theme", "label=portal.industrial");
+ selenium.select("profile-form:locale", "label=Albanian");
+ selenium.type("profile-form:givenname", "Edit");
+ selenium.type("profile-form:lastname", "Meme");
+ selenium.type("profile-form:location", "Editoland");
+ selenium.type("profile-form:skype", "editor");
+ selenium.type("profile-form:icq", "112113114");
+ selenium.type("profile-form:aim", "83838495");
+ selenium.type("profile-form:msnm", "u8u8i9o0");
+ selenium.type("profile-form:yim", "99384875");
+ selenium.type("profile-form:xmmp", "10309128");
+ selenium.type("profile-form:homepage", "http://www.edit.com");
+ selenium.type("profile-form:occupation", "editor");
+ selenium.type("profile-form:interests", "editing");
+ selenium.type("profile-form:signature", "----\n\ni like to edit");
+ selenium.type("profile-form:extra", "me edit good");
+ selenium.click("profile-form:submit");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("editMe2(a)redhat.com"));
+ Assert.assertTrue(selenium.isTextPresent("Edit"));
+ Assert.assertTrue(selenium.isTextPresent("Meme"));
+
+ deleteUser("editMe", "editMe2(a)redhat.com");
+
+ }
+
+ @Test(enabled = true, description = "Editing a user - changing of password.")
+ public void testEditUserChangePassword() {
+ createUser("changePass", "changePassPass", "changePass(a)redhat.com");
+
+ logout();
+ login("changePass","changePassPass");
+ logout();
+ login("admin","admin");
+
+ /*
+ * Canceling of change at the first approach
+ */
+
+ searchUser("changePass", "changePass(a)redhat.com");
+
+ int r = findTableRow(TABLE_USERLIST, "changePass", 0);
+ selenium.click(MessageFormat.format(LINK_T_USRLIST_EDIT, r - 1));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LINK_CHANGE_PASS);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.type(INPUT_PASS_CHANGE_P1, "changePass2");
+ selenium.type(INPUT_PASS_CHANGE_P2, "changePass2");
+ selenium.click(INPUT_PASS_CHANGE_CANCEL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertFalse(selenium.isTextPresent("Password has been updated."));
+
+ logout();
+ login("changePass","changePassPass");
+ logout();
+ login("admin","admin");
+
+ /*
+ * In the second approach really change the password
+ */
+
+ searchUser("changePass", "changePass(a)redhat.com");
+
+ r = findTableRow(TABLE_USERLIST, "changePass", 0);
+ selenium.click(MessageFormat.format(LINK_T_USRLIST_EDIT, r - 1));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LINK_CHANGE_PASS);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.type(INPUT_PASS_CHANGE_P1, "changePass2");
+ selenium.type(INPUT_PASS_CHANGE_P2, "changePass2");
+ selenium.click(INPUT_PASS_CHANGE_SUBMIT);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent("Password has been updated."));
+
+ logout();
+ login("changePass","changePass2");
+ logout();
+ login("admin","admin");
+
+ deleteUser("changePass","changePass(a)redhat.com");
+ }
+
+ @Test(enabled = true, description = "Managing members of role.")
+ public void testRoleMembers() {
+ createRole("membersRole", "membersRoleDisplay");
+ createUser("newRoleMember" , "newRoleMember", "newRoleMem(a)redhatqa.com");
+ assignRole("newRoleMember", "newRoleMem(a)redhatqa.com", "membersRole", "membersRoleDisplay");
+
+ clickUntilMembers();
+ clickIfVisible(ID_LINK_ROLETAB);
+ clickIfVisible(ID_LINK_ROLEMAIN);
+
+ int r = findTableRow(TABLE_ROLELIST, "membersRole", 0);
+ selenium.click(MessageFormat.format(LINK_T_ROLLIST_MEMBERS, r-1));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ //search for the real member of current role
+ selenium.type("search-user-form:searchString", "newRoleMember");
+ selenium.click("search-user-form:search");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ r = findTableRow(TABLE_ROLEMEMBERS, "newRoleMember", 0);
+ Assert.assertTrue(r>0, "Assigned member not found in the role members table.");
+
+ //search for the non-member user of current role
+ selenium.type("search-user-form:searchString", "newRoleNonMember");
+ selenium.click("search-user-form:search");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertFalse(selenium.isElementPresent(TABLE_ROLEMEMBERS), "Not assigned member found in the role members table.");
+
+ deleteRole("membersRole");
+ deleteUser("newRoleMember" , "newRoleMem(a)redhatqa.com");
+ }
+
+ @Test(enabled = true, description = "Creation of new role.")
+ public void testRoleEdit() {
+
+ createRole("editRole", "editRoleDisplay");
+
+ clickUntilMembers();
+ clickIfVisible(ID_LINK_ROLETAB);
+ clickIfVisible(ID_LINK_ROLEMAIN);
+
+ int r = findTableRow(TABLE_ROLELIST, "editRoleDisplay", 1);
+ Assert.assertTrue(r>=0,"Renamed display name found in table");
+
+ r = findTableRow(TABLE_ROLELIST, "editedRoleDisplay", 1);
+ Assert.assertFalse(r>=0,"Not created role display name found in table");
+
+ //canceling of renaming of displayname for the first time
+ r = findTableRow(TABLE_ROLELIST, "editRole", 0);
+
+ selenium.click(MessageFormat.format(LINK_T_ROLLIST_EDIT, r -1));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.type("edit-role-link:display-Name", "editedRoleDisplay");
+ selenium.click("edit-role-link:cancel");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ r = findTableRow(TABLE_ROLELIST, "editRoleDisplay", 1);
+ Assert.assertTrue(r>=0,"Renamed display name found in table");
+
+ r = findTableRow(TABLE_ROLELIST, "editedRoleDisplay", 1);
+ Assert.assertFalse(r>=0,"Not created role display name found in table");
+
+ // real renaming
+ r = findTableRow(TABLE_ROLELIST, "editRole", 0);
+ selenium.click(MessageFormat.format(LINK_T_ROLLIST_EDIT, r-1));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.type("edit-role-link:display-Name", "editedRoleDisplay");
+ selenium.click("edit-role-link:submit");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ r = findTableRow(TABLE_ROLELIST, "editRoleDisplay", 1);
+ Assert.assertFalse(r>=0,"Renamed display name found in table");
+
+ r = findTableRow(TABLE_ROLELIST, "editedRoleDisplay", 1);
+ Assert.assertTrue(r>=0,"New role display name not found in table");
+
+ deleteRole("editRole");
+ }
+
+ @Test(enabled= false, description = "Altering the number of rows in user search")
+ public void testSearchUserCount() {
+
+ for(int i=0; i< 95; i++){
+ createUser("man"+i+"us", "man"+i+"pas", "man"+i+"us"+"@redhatqa.com");
+ }
+
+ searchSimple("man","10");
+ Assert.assertEquals(countTableRows(TABLE_USERLIST)-1,10,"Wrong number of row in user table #1.");
+
+ searchSimple("man","50");
+ Assert.assertEquals(countTableRows(TABLE_USERLIST)-1,50,"Wrong number of row in user table #2.");
+ selenium.click("search-user-form1:next-page");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertEquals(countTableRows(TABLE_USERLIST)-1,45,"Wrong number of row in user table #3.");
+ selenium.click("search-user-form1:prev-page");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ searchSimple("man","100");
+ Assert.assertEquals(countTableRows(TABLE_USERLIST)-1,95,"Wrong number of row in user table #4.");
+ /*
+ for(int i=0; i< 95; i++){
+ deleteUser("man"+i+"us", "man"+i+"us"+"@redhatqa.com");
+ }
+ */
+
+ }
+
+ private void searchSimple(String name, String count){
+ selenium.open("/portal/");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Members");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ clickIfVisible(ID_LINK_USERTAB);
+ clickIfVisible(ID_LINK_USERMAIN);
+ clickIfVisible(LINK_USERMANG_MAIN);
+
+ selenium.click(LINK_SEARCH_USER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.type(ID_INPUT_SEARCH_USER, name);
+ selenium.select("search-user-form:limit", "label="+count);
+ selenium.click(ID_SUBMIT_SEARCH_USER);
+ //selenium.waitForPageToLoad(PAGE_LOAD);
+ waitBlock();
+ }
+
+
@Test(enabled = true, dependsOnMethods = { "testCreateUser", "testCreateRole" }, description = "Assigning of the role to the user.")
public void testAssignRole2User() {
String user = "tempUser";
@@ -251,8 +583,8 @@
selenium.type(ID_INPUT_SEARCH_USER, username);
selenium.click(ID_SUBMIT_SEARCH_USER);
- selenium.waitForPageToLoad(PAGE_LOAD);
-
+ //selenium.waitForPageToLoad(PAGE_LOAD);
+ waitBlock();
Assert.assertTrue(selenium.isTextPresent(username), "Username was not found.");
Assert.assertTrue(selenium.isTextPresent(email), "User email adress was not found.");
}
@@ -276,8 +608,8 @@
selenium.type(ID_INPUT_SEARCH_USER, username);
selenium.click(ID_SUBMIT_SEARCH_USER);
- selenium.waitForPageToLoad(PAGE_LOAD);
-
+ //selenium.waitForPageToLoad(PAGE_LOAD);
+ waitBlock();
Assert.assertTrue(selenium.isTextPresent(username), "Username was not found.");
Assert.assertTrue(selenium.isTextPresent(email), "User e-mail adress was not found.");
@@ -288,6 +620,15 @@
Assert.assertTrue(selenium.isTextPresent("User deleted"), "user was not deleted (\"User deleted\" text missing).");
}
+ private void clickUntilMembers(){
+ selenium.open("/portal/");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Members");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ }
+
private void createRole(String roleName, String roleDisplayName) {
selenium.open("/portal/");
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -328,14 +669,26 @@
Assert.assertTrue(selenium.isTextPresent(roleName), "Role name is missing");
- selenium.click(butDelRol_id(roleName));
+ int r = findTableRow(TABLE_ROLELIST, roleName, 0);
+ selenium.click(MessageFormat.format(LINK_T_ROLLIST_DEL, r-1));
+ selenium.waitForPageToLoad(PAGE_LOAD);
selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertTrue(selenium.isTextPresent("Warning! You are about to delete the role " + roleName),
+ Assert.assertTrue(selenium.isTextPresent("Warning! You are about to delete the role '" + roleName+"'"),
"Confirmation text for role deletion missing missing.");
selenium.click(ID_SUBMIT_DELETE_ROLE);
selenium.waitForPageToLoad(PAGE_LOAD);
}
+
+ public void waitBlock(){
+ try {
+ Thread.sleep(2000);
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
}
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/JBossPortalSeleniumTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/JBossPortalSeleniumTestCase.java 2008-10-09 14:23:21 UTC (rev 12058)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/JBossPortalSeleniumTestCase.java 2008-10-13 14:45:21 UTC (rev 12059)
@@ -10,13 +10,13 @@
* @author <a href="mailto:vrockai@redhat.com">Viliam Rockai</a>
*/
public class JBossPortalSeleniumTestCase {
- private static final String LINK_LOGOUT = "link=Logout";
- private static final String SUBMIT_LOGIN = "login";
- private static final String ADDR_PORTAL = "/portal/";
- private static final String FRAME_LOGIN_CONTENT = "login-content";
- private static final String LINK_LOGIN = "link=Login";
- private static final String INPUT_PASSWORD = "j_password";
- private static final String INPUT_USERNAME = "j_username";
+ public static final String LINK_LOGOUT = "link=Logout";
+ public static final String SUBMIT_LOGIN = "login";
+ public static final String ADDR_PORTAL = "/portal/";
+ public static final String FRAME_LOGIN_CONTENT = "login-content";
+ public static final String LINK_LOGIN = "link=Login";
+ public static final String INPUT_PASSWORD = "j_password";
+ public static final String INPUT_USERNAME = "j_username";
protected Selenium selenium;
protected static final String PAGE_LOAD = "250000";
@@ -38,7 +38,6 @@
if (selenium.isElementPresent(id)){
selenium.click(id);
-
selenium.waitForPageToLoad(PAGE_LOAD);
}
}
@@ -92,9 +91,12 @@
selenium.waitForPageToLoad(PAGE_LOAD);
}
}
+
+ protected boolean assertTextOrder(String text){
+ return Boolean.valueOf(selenium.getEval("selenium.assertTextOrder(\"" + text + "\")"));
+ }
protected void login(String username, String password) {
- selenium.setTimeout("0");
selenium.open(ADDR_PORTAL);
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -125,4 +127,15 @@
Assert.assertFalse(selenium.isTextPresent("Logged in as:"), "Not logged in, login message missing.");
Assert.assertTrue(selenium.isElementPresent("Link=Login"), "Login link not present.");
}
+
+ protected void logoutIfPossible() {
+ selenium.open(ADDR_PORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ if (selenium.isElementPresent(LINK_LOGOUT)){
+ selenium.click(LINK_LOGOUT);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertFalse(selenium.isTextPresent("Logged in as:"), "Not logged in, login message missing.");
+ Assert.assertTrue(selenium.isElementPresent("Link=Login"), "Login link not present.");
+ }
+ }
}
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/PortletUserCreationTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/PortletUserCreationTestCase.java 2008-10-09 14:23:21 UTC (rev 12058)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/PortletUserCreationTestCase.java 2008-10-13 14:45:21 UTC (rev 12059)
@@ -10,8 +10,10 @@
@Test(groups = { "portlet_user_creation" }, enabled = true)
public class PortletUserCreationTestCase extends JBossPortalSeleniumTestCase {
private static final String SUBMIT_CREATE_CONF = "confirm-form:user";
+ public static final String SUBMIT_CREATE_CONF_EDIT = "confirm-form:revise";
private static final String SUBMIT_CREATE_USER = "register-form:submit";
+ private static final String SUBMIT_CREATE_USER_CANCEL = "register-form:cancel";
private static final String INPUT_USERPASSWDCONF = "register-form:passwordCheck";
@@ -47,9 +49,91 @@
Assert.assertTrue((selenium.isTextPresent("portletUser(a)redhat.com")));
selenium.click(SUBMIT_CREATE_CONF);
selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertTrue((selenium.isTextPresent("* Your account has been successfully created. You may want to login now.")));
+ Assert.assertTrue((selenium.isTextPresent("Your account has been successfully created. You may want to login now.")));
}
+
+ @Test(enabled = true, description = "User creation using most of the active elements on page.")
+ public void userCreationLongTest() {
+
+ //canceling of creation
+ selenium.open("/portal");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ clickIfVisible(TAB_WELCOME);
+ Assert.assertTrue((selenium.isElementPresent(LINK_CREATE_USER)));
+ selenium.click(LINK_CREATE_USER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue((selenium.isTextPresent("Username *")));
+ Assert.assertTrue((selenium.isTextPresent("E-Mail *")));
+ Assert.assertTrue((selenium.isTextPresent("Password *")));
+ Assert.assertTrue((selenium.isTextPresent("Confirm Password *")));
+ selenium.type(INPUT_USERNAME, "portletLongUser");
+ selenium.type(INPUT_USERMAIL, "portletLongUser(a)redhat.com");
+ selenium.type(INPUT_USERPASSWD, "portletLongUserPassword");
+ selenium.type(INPUT_USERPASSWDCONF, "portletLongUserPassword");
+
+ selenium.click(SUBMIT_CREATE_USER_CANCEL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ // editing of creation
+ selenium.open("/portal");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ clickIfVisible(TAB_WELCOME);
+ Assert.assertTrue((selenium.isElementPresent(LINK_CREATE_USER)));
+ selenium.click(LINK_CREATE_USER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.type(INPUT_USERNAME, "portlextLongUser");
+ selenium.type(INPUT_USERMAIL, "portxletLongUser(a)redhat.com");
+ selenium.type(INPUT_USERPASSWD, "porxtletLongUserPassword");
+ selenium.type(INPUT_USERPASSWDCONF, "porxtletLongUserPassword");
+ selenium.click(SUBMIT_CREATE_USER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(SUBMIT_CREATE_CONF_EDIT);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.type(INPUT_USERNAME, "portletLong2User");
+ selenium.type(INPUT_USERMAIL, "portletLong2User(a)redhat.com");
+ selenium.type(INPUT_USERPASSWD, "portletLong2UserPassword");
+ selenium.type(INPUT_USERPASSWDCONF, "portletLong2UserPassword");
+ selenium.click(SUBMIT_CREATE_USER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue((selenium.isTextPresent("portletLong2User")));
+ Assert.assertTrue((selenium.isTextPresent("portletLong2User(a)redhat.com")));
+
+ selenium.click(SUBMIT_CREATE_CONF);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ // verification
+ Assert.assertTrue((selenium.isTextPresent("Your account has been successfully created. You may want to login now.")));
+ }
+ @Test(enabled = true, description = "Canceling of editing during the user creation.")
+ public void userCreationCancelEditTest() {
+ selenium.open("/portal");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ clickIfVisible(TAB_WELCOME);
+ Assert.assertTrue((selenium.isElementPresent(LINK_CREATE_USER)));
+ selenium.click(LINK_CREATE_USER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.type(INPUT_USERNAME, "portletCLongUser");
+ selenium.type(INPUT_USERMAIL, "portletCLongUser(a)redhat.com");
+ selenium.type(INPUT_USERPASSWD, "portletCLongUserPassword");
+ selenium.type(INPUT_USERPASSWDCONF, "portletCLongUserPassword");
+ selenium.click(SUBMIT_CREATE_USER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(SUBMIT_CREATE_CONF_EDIT);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.type(INPUT_USERNAME, "portletCLong2User");
+ selenium.type(INPUT_USERMAIL, "portletCLong2User(a)redhat.com");
+ selenium.type(INPUT_USERPASSWD, "portletCLong2UserPassword");
+ selenium.type(INPUT_USERPASSWDCONF, "portletCLong2UserPassword");
+ selenium.click(SUBMIT_CREATE_USER_CANCEL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent("You can create an account."));
+ }
+
@Test(enabled = true, description = "Creation of already existing user.")
public void existingUserCreationTest() {
selenium.open("/portal");
@@ -66,7 +150,7 @@
Assert.assertTrue(selenium.isTextPresent("This username is already taken. user"));
}
- @Test(enabled = true, description = "Using invalid e-mail within user creation.")
+ @Test(enabled = false, description = "Using invalid e-mail within user creation.")
public void invalidEmail() {
selenium.open("/portal");
selenium.waitForPageToLoad(PAGE_LOAD);
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/UserLoginTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/UserLoginTestCase.java 2008-10-09 14:23:21 UTC (rev 12058)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/UserLoginTestCase.java 2008-10-13 14:45:21 UTC (rev 12059)
@@ -45,22 +45,6 @@
Assert.assertTrue(selenium.isTextPresent("Logged in as: user"), "\"Logged in as\" message missing.");
- Assert.assertTrue(selenium.isElementPresent("xpath=id('regionA')/div[2]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[1]/td[1]/"),
- "DOM Element with username label not available.");
- Assert.assertEquals(selenium.getText("xpath=id('regionA')/div[2]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[1]/td[1]/"), "Username:");
-
- Assert.assertTrue(selenium.isElementPresent("xpath=id('regionA')/div[2]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[1]/td[2]/"),
- "Incorrect username for default user \"user\".");
- Assert.assertEquals(selenium.getText("xpath=id('regionA')/div[2]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[1]/td[2]/"), "user");
-
- Assert.assertTrue(selenium.isElementPresent("xpath=id('regionA')/div[2]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[2]/td[1]/"),
- "DOM Element with e-mail label not available.");
- Assert.assertEquals(selenium.getText("xpath=id('regionA')/div[2]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[2]/td[1]/"), "E-Mail:");
-
- Assert.assertTrue(selenium.isElementPresent("xpath=id('regionA')/div[2]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[2]/td[2]/"),
- "Incorrect e-mail for default user \"user\".");
- Assert.assertEquals(selenium.getText("xpath=id('regionA')/div[2]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[2]/td[2]/"), "user(a)portal.com");
-
Assert.assertTrue(selenium.isElementPresent("link=Logout"), "Expected DOM element for login link does not exist.");
Assert.assertEquals(selenium.getText("link=Logout"), "Logout", "Logout has wrong label.");
@@ -90,24 +74,6 @@
Assert.assertTrue(selenium.isTextPresent("Logged in as: admin"), "\"Logged in as\" message missing.");
- Assert.assertTrue(selenium.isElementPresent("xpath=id('regionA')/div[2]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[1]/td[1]/"),
- "DOM Element with username label not available.");
- Assert.assertEquals(selenium.getText("xpath=id('regionA')/div[2]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[1]/td[1]/"), "Username:");
-
- Assert.assertTrue(selenium.isElementPresent("xpath=id('regionA')/div[2]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[1]/td[2]/"),
- "Incorrect username for default user \"user\".");
- Assert.assertEquals(selenium.getText("xpath=id('regionA')/div[2]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[1]/td[2]/"), "admin");
-
- Assert.assertTrue(selenium.isElementPresent("xpath=id('regionA')/div[2]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[2]/td[1]/"),
- "DOM Element with e-mail label not available.");
- Assert.assertEquals(selenium.getText("xpath=id('regionA')/div[2]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[2]/td[1]/"), "E-Mail:");
-
- Assert.assertTrue(selenium.isElementPresent("xpath=id('regionA')/div[2]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[2]/td[2]/"),
- "Incorrect e-mail for default user \"user\".");
- Assert
- .assertEquals(selenium.getText("xpath=id('regionA')/div[2]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[2]/td[2]/"),
- "admin(a)portal.com");
-
Assert.assertTrue(selenium.isElementPresent("link=Logout"), "Expected DOM element for login link does not exist.");
Assert.assertEquals(selenium.getText("link=Logout"), "Logout", "Logout has wrong label.");
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/WSRPTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/WSRPTestCase.java 2008-10-09 14:23:21 UTC (rev 12058)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/WSRPTestCase.java 2008-10-13 14:45:21 UTC (rev 12059)
@@ -301,6 +301,9 @@
selenium.type(INPUT_CREATECONS, name);
selenium.click(SUBMIT_CREATECONS);
selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.setSpeed("5000");
+
selenium.type(INPUT_CACHEEXP, timeout);
selenium.type(INPUT_CONSWSDL, address);
selenium.click(SUBMIT_REFRESHSAVE);
@@ -308,6 +311,9 @@
selenium.type(INPUT_CONS_REGVALUE, "public");
selenium.click(SUBMIT_CONS_REGVAL);
selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.setSpeed("0");
+
selenium.click(SUBMIT_REFRESHFINAL);
selenium.waitForPageToLoad(PAGE_LOAD);
}
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSArchiveUploadTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSArchiveUploadTestCase.java 2008-10-09 14:23:21 UTC (rev 12058)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSArchiveUploadTestCase.java 2008-10-13 14:45:21 UTC (rev 12059)
@@ -13,6 +13,9 @@
@Test(groups = { "cms_archive_upload" }, enabled = true)
public class CMSArchiveUploadTestCase extends JBossPortalSeleniumTestCase {
+ /* uncomment following lines and set the right path to the workspace in the case
+ * you want to use this test case locally from eclipse */
+
/*
{
System.setProperty("workspace","/home/vrockai/workspace/selenium/selenium/");
@@ -34,7 +37,29 @@
@Test(enabled = true, description = "Test archive consisting of two files upload.")
public void testArchiveUpload() {
//System.out.println("archive adress:" + WORKSPACE);
+ // canceling at the first stage
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.select("//div[@id='center']/div/div/div[1]/div/select", "label=Upload Archive");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.waitForPopUp("_top", PAGE_LOAD);
+ selenium.type("response", WORKSPACE + "/test_files/archive.zip");
+ selenium.click("cancel");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+
+ Assert.assertFalse(selenium.isTextPresent("Your archive has been accepted for processing"));
+ Assert.assertFalse(selenium.isElementPresent("link=archive"));
+
+ selenium.open(ADDR_PORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertFalse(selenium.isElementPresent("link=archive"));
+
+ // really uploading the file now
selenium.click("link=Admin");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=CMS");
@@ -46,8 +71,10 @@
selenium.type("response", WORKSPACE + "/test_files/archive.zip");
selenium.click("submit");
-
selenium.waitForPageToLoad(PAGE_LOAD);
+ //
+
+ selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertEquals(selenium.getText("//div[@id='center']/div/div/table/tbody/tr[2]/td/font"),
"Your archive has been accepted for processing. The resources will appear in your Folder once the processing is finished");
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSDirectoryTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSDirectoryTestCase.java 2008-10-09 14:23:21 UTC (rev 12058)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSDirectoryTestCase.java 2008-10-13 14:45:21 UTC (rev 12059)
@@ -32,6 +32,9 @@
@Test(enabled = true, description="Directory creation.")
public void testCreateDirectory() {
+
+ // cancelling of creating
+
selenium.click("link=Admin");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=CMS");
@@ -40,14 +43,38 @@
selenium.open("/portal/auth/portal/admin/CMS");
selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertFalse(selenium.isTextPresent("TestFolder["), "Test folder is already present.");
+ Assert.assertFalse(selenium.isTextPresent(tempDirName), "Test folder is already present.");
selenium.select("//div[@id='center']/div/div/div[1]/div/select", "label=Create Folder");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.waitForPopUp("_top", PAGE_LOAD);
selenium.type("newcollectionname", tempDirName);
selenium.type("newcollectiondescription", "test folder");
+ selenium.click("cancel");
+
+ // really creating
+ selenium.open(ADDR_PORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.open("/portal/auth/portal/admin/CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertFalse(selenium.isTextPresent(tempDirName), "Test folder is already present.");
+
+ selenium.select("//div[@id='center']/div/div/div[1]/div/select", "label=Create Folder");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.waitForPopUp("_top", PAGE_LOAD);
+ selenium.type("newcollectionname", tempDirName);
+ selenium.type("newcollectiondescription", "test folder");
selenium.click("submit");
+
+ // assuring that the directory is deleted
+
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isElementPresent("//div[@id='center']/div/div/ul/li[3]"));
Assert.assertEquals(tempDirName, selenium.getText("//div[@id='center']/div/div/ul/li[3]"));
@@ -59,11 +86,36 @@
@Test(enabled = true, dependsOnMethods = "testCreateDirectory",description="Directory delete.")
public void testDeleteDirectory() {
+
+ // firstly cancel the delete process
+
selenium.click("link=Admin");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=CMS");
selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isElementPresent("link=" + tempDirName));
+ selenium.select(takeAction(tempDirName) + "/select", "label=Delete");
+ selenium.click(takeAction(tempDirName) + "/select/option[4]");
+ selenium.click(takeAction(tempDirName) + "/input");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent("Confirm Deletion of /" + tempDirName));
+ Assert.assertTrue(selenium.isTextPresent("WARNING! You will not be able to undo these change!"));
+ Assert.assertTrue(selenium.isTextPresent("Are you sure you want to delete this resource?"));
+ selenium.click("cancel");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ // really deleting
+ selenium.open(ADDR_PORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isElementPresent("link=" + tempDirName));
selenium.select(takeAction(tempDirName) + "/select", "label=Delete");
selenium.click(takeAction(tempDirName) + "/select/option[4]");
selenium.click(takeAction(tempDirName) + "/input");
@@ -76,6 +128,14 @@
selenium.click("submit");
selenium.waitForPageToLoad(PAGE_LOAD);
+ // assuring that the deletition was processed
+ selenium.open(ADDR_PORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
Assert.assertFalse(selenium.isElementPresent("link=" + tempDirName));
}
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileTestCase.java 2008-10-09 14:23:21 UTC (rev 12058)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileTestCase.java 2008-10-13 14:45:21 UTC (rev 12059)
@@ -14,6 +14,7 @@
public class CMSFileTestCase extends JBossPortalSeleniumTestCase {
private final String CMS_FILE_TABLE = "//div[@id='center']/div/div/div[3]/table";
+ public static final String CMS_FILE_PENDING_TABLE = "//div[@id='center']/div/div/table[2]";
@BeforeMethod(groups = { "log" })
public void loginBeforeTest() {
@@ -109,6 +110,13 @@
selenium.select("language", "label=Czech");
selenium.click("save");
selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(findTableRow(CMS_FILE_PENDING_TABLE, "text/plain", 0) >= 0);
+ Assert.assertTrue(findTableRow(CMS_FILE_PENDING_TABLE, "0kb", 1) >= 0);
+ Assert.assertTrue(findTableRow(CMS_FILE_PENDING_TABLE, "admin", 3) >= 0);
+
+ selenium.click("link=Approve");
+
Assert.assertEquals("Czech", selenium.getText("link=Czech"));
Assert.assertEquals("text/plain", selenium.getText("link=text/plain"));
Assert.assertEquals("1.0", selenium.getText("//div[@id='center']/div/div/table/tbody/tr[4]/td[3]"));
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileWorkflowTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileWorkflowTestCase.java 2008-10-09 14:23:21 UTC (rev 12058)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileWorkflowTestCase.java 2008-10-13 14:45:21 UTC (rev 12059)
@@ -34,9 +34,11 @@
logout();
}
-
@Test(enabled = true, description = "Simple file creation.")
public void testCreateFileApprove() {
+
+ // canceling first
+
selenium.click("link=Admin");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=CMS");
@@ -50,6 +52,25 @@
selenium.type("title", "newFile title");
selenium.select("language", "label=Czech");
+ selenium.click("cancel");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ // saving
+ selenium.open(ADDR_PORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select(SELECT_CMS_MAIN, "label=Create File");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.waitForPopUp("_top", PAGE_LOAD);
+ selenium.type("filename", "newFile");
+ selenium.type("description", "newFile description");
+ selenium.type("title", "newFile title");
+ selenium.select("language", "label=Czech");
+
selenium.click("save");
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -101,10 +122,33 @@
@Test(enabled = true, description = "Simple file creation.")
public void testCreateFilePreview(){
+ String name = "file2preview";
- //TODO after the bug with empty content is repaired
+ selenium.open(ADDR_PORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Home");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select(SELECT_CMS_MAIN, "label=Create File");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.waitForPopUp("_top", PAGE_LOAD);
+ selenium.type("filename", name);
+ selenium.type("description", name + " description");
+ selenium.type("title", "existingFile title");
+ selenium.select("language", "label=Czech");
+ fillInEditor("vivat!");
+ selenium.click("save");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Preview");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("Pending Approval Queue"));
+ Assert.assertTrue(selenium.isTextPresent("vivat!"));
+
}
@Test(enabled = true, dependsOnMethods = "testCreateFileApprove", description = "Simple file delete Cancel in first step, and then delete.")
@@ -131,9 +175,9 @@
row = findTableRow(CMS_FILE_TABLE, "newFile", 0) + 1;
- selenium.select("//div[@id='center']/div/div/div[3]/table/tbody/tr["+row+"]/td[2]/form/select", "label=Delete");
- selenium.click("//div[@id='center']/div/div/div[3]/table/tbody/tr["+row+"]/td[2]/form/select/option[4]");
- selenium.click("//div[@id='center']/div/div/div[3]/table/tbody/tr["+row+"]/td[2]/form/input");
+ selenium.select(CMS_FILE_TABLE + "/tbody/tr["+row+"]/td[2]/form/select", "label=Delete");
+ selenium.click(CMS_FILE_TABLE + "/tbody/tr["+row+"]/td[2]/form/select/option[4]");
+ selenium.click(CMS_FILE_TABLE + "/tbody/tr["+row+"]/td[2]/form/input");
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isTextPresent("Confirm Deletion of /newFile"));
Assert.assertTrue(selenium.isTextPresent("WARNING! You will not be able to undo these change!"));
@@ -145,19 +189,54 @@
@Test(enabled = true, description = "File creation and moving to default directory.")
public void testMoveFile() {
createFile("fileToMove","");
+
+ //canceling first
+
selenium.click("link=Admin");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=CMS");
selenium.waitForPageToLoad(PAGE_LOAD);
int row = findTableRow(CMS_FILE_TABLE, "fileToMove", 0) + 1;
- selenium.select("//div[@id='center']/div/div/div[3]/table/tbody/tr[" + row + "]/td[2]/form/select", "label=Move");
- selenium.click("//div[@id='center']/div/div/div[3]/table/tbody/tr[" + row + "]/td[2]/form/select/option[3]");
- selenium.click("//div[@id='center']/div/div/div[3]/table/tbody/tr[" + row + "]/td[2]/form/input");
+ selenium.select(CMS_FILE_TABLE + "/tbody/tr[" + row + "]/td[2]/form/select", "label=Move");
+ selenium.click(CMS_FILE_TABLE + "/tbody/tr[" + row + "]/td[2]/form/select/option[3]");
+ selenium.click(CMS_FILE_TABLE + "/tbody/tr[" + row + "]/td[2]/form/input");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=default");
+ selenium.click("cancel");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ // assuming file is not moved
+
+ selenium.click("link=default");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertFalse(selenium.isElementPresent("link=fileToMove"));
+
+ selenium.click("link=Home");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isElementPresent("link=fileToMove"));
+
+ // really moving file
+ selenium.open(ADDR_PORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ row = findTableRow(CMS_FILE_TABLE, "fileToMove", 0) + 1;
+
+ selenium.select(CMS_FILE_TABLE + "/tbody/tr[" + row + "]/td[2]/form/select", "label=Move");
+ selenium.click(CMS_FILE_TABLE + "/tbody/tr[" + row + "]/td[2]/form/select/option[3]");
+ selenium.click(CMS_FILE_TABLE + "/tbody/tr[" + row + "]/td[2]/form/input");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=default");
selenium.click("submit");
selenium.waitForPageToLoad(PAGE_LOAD);
+
+ // assuming file is moved
+
selenium.click("link=default");
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -178,9 +257,9 @@
selenium.waitForPageToLoad(PAGE_LOAD);
int row = findTableRow(CMS_FILE_TABLE, "file2copy", 0) + 1;
- selenium.select("//div[@id='center']/div/div/div[3]/table/tbody/tr[" + row + "]/td[2]/form/select", "label=Copy");
- selenium.click("//div[@id='center']/div/div/div[3]/table/tbody/tr[" + row + "]/td[2]/form/select/option[3]");
- selenium.click("//div[@id='center']/div/div/div[3]/table/tbody/tr[" + row + "]/td[2]/form/input");
+ selenium.select(CMS_FILE_TABLE + "/tbody/tr[" + row + "]/td[2]/form/select", "label=Copy");
+ selenium.click(CMS_FILE_TABLE + "/tbody/tr[" + row + "]/td[2]/form/select/option[3]");
+ selenium.click(CMS_FILE_TABLE + "/tbody/tr[" + row + "]/td[2]/form/input");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=default");
selenium.click("submit");
@@ -204,6 +283,8 @@
createFile(file,"contentstring1");
+ // canceling for the first time
+
selenium.click("link=Admin");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=CMS");
@@ -211,11 +292,31 @@
selenium.click("link="+file);
selenium.waitForPageToLoad(PAGE_LOAD);
- //selenium.setSpeed("5000");
+
row = findTableRow(CMS_FV_TABLE, "1.1", 2) + 1;
- selenium.click("//div[@id='center']/div/div/table/tbody/tr["+row+"]/td[1]/a");
+ selenium.click(CMS_FV_TABLE + "/tbody/tr["+row+"]/td[1]/a");
selenium.waitForPageToLoad(PAGE_LOAD);
fillInEditor("contentstring2");
+ selenium.click("cancel");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ // really creating and approving
+ selenium.open(ADDR_PORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Home");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click("link="+file);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ row = findTableRow(CMS_FV_TABLE, "1.1", 2) + 1;
+ selenium.click(CMS_FV_TABLE + "/tbody/tr["+row+"]/td[1]/a");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ fillInEditor("contentstring2");
selenium.click("save");
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -223,7 +324,7 @@
selenium.waitForPageToLoad(PAGE_LOAD);
row = findTableRow(CMS_FV_TABLE, "1.3", 2) + 1;
- selenium.click("//div[@id='center']/div/div/table/tbody/tr["+row+"]/td[1]/a");
+ selenium.click(CMS_FV_TABLE + "/tbody/tr["+row+"]/td[1]/a");
selenium.waitForPageToLoad(PAGE_LOAD);
fillInEditor("contentstring3");
selenium.click("save");
@@ -235,19 +336,26 @@
Assert.assertFalse(selenium.isTextPresent("1.5"));
row = findTableRow(CMS_FV_TABLE, "1.3", 2) + 1;
- selenium.click("//div[@id='center']/div/div/table/tbody/tr["+row+"]/td[1]/a");
+ selenium.click(CMS_FV_TABLE + "/tbody/tr["+row+"]/td[1]/a");
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isTextPresent("contentstring2"));
}
+
private void createFile(String name,String content) {
+
+ // save and approve
+ selenium.open(ADDR_PORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=Admin");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=CMS");
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.select("//div[@id='center']/div/div/div[1]/div/select", "label=Create File");
+ selenium.click("link=Home");
selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select(SELECT_CMS_MAIN, "label=Create File");
+ selenium.waitForPageToLoad(PAGE_LOAD);
selenium.waitForPopUp("_top", PAGE_LOAD);
selenium.type("filename", name);
selenium.type("description", name + " description");
@@ -256,6 +364,7 @@
selenium.click("save");
selenium.waitForPageToLoad(PAGE_LOAD);
+
selenium.click("link=Approve");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=Home");
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSSecureTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSSecureTestCase.java 2008-10-09 14:23:21 UTC (rev 12058)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSSecureTestCase.java 2008-10-13 14:45:21 UTC (rev 12059)
@@ -131,6 +131,9 @@
@Test(enabled = true, description = "Set user read permissions, login as user.")
public void testSetUserReadPer() {
+
+ // cancelling at first stage
+
login("admin", "admin");
Assert.assertFalse(selenium.isTextPresent("Access Denied"),"Non secured resource is not visible.#1");
@@ -148,6 +151,30 @@
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.select(SELECT_SECUREROLES_READ, "label=Administrators");
selenium.select(SELECT_SECUREUSERS_READ, "label=user");
+ selenium.click("cancel");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ logout();
+
+ // really setting the permissions
+
+ login("admin", "admin");
+
+ Assert.assertFalse(selenium.isTextPresent("Access Denied"),"Non secured resource is not visible.#1");
+ Assert.assertFalse(selenium.isTextPresent("You are not allowed to access the following resource - /default/index.html"),"Non secured resource is not visible.#2");
+
+ selenium.click(LINK_ADMIN);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LINK_CMS);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LINK_DEFAULT);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LINK_INDEX_HTML);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select(SELECT_CMS_ACTION, "label=Secure");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select(SELECT_SECUREROLES_READ, "label=Administrators");
+ selenium.select(SELECT_SECUREUSERS_READ, "label=user");
selenium.click(SUBMIT_SECURITY_SET);
selenium.waitForPageToLoad(PAGE_LOAD);
17 years, 6 months
JBoss Portal SVN: r12058 - in branches/JBoss_Portal_2_6_6_JBPORTAL-2109/core-identity/src: main/org/jboss/portal/core/identity/ui/admin and 4 other directories.
by portal-commits@lists.jboss.org
Author: mputz
Date: 2008-10-09 10:23:21 -0400 (Thu, 09 Oct 2008)
New Revision: 12058
Modified:
branches/JBoss_Portal_2_6_6_JBPORTAL-2109/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/EditProfileAction.java
branches/JBoss_Portal_2_6_6_JBPORTAL-2109/core-identity/src/main/org/jboss/portal/core/identity/ui/admin/UserAdministrationBean.java
branches/JBoss_Portal_2_6_6_JBPORTAL-2109/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/PasswordValidator.java
branches/JBoss_Portal_2_6_6_JBPORTAL-2109/core-identity/src/resources/portal-identity-sar/conf/bundles/Identity.properties
branches/JBoss_Portal_2_6_6_JBPORTAL-2109/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/user/changePassword.xhtml
branches/JBoss_Portal_2_6_6_JBPORTAL-2109/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/user/searchUsers.xhtml
branches/JBoss_Portal_2_6_6_JBPORTAL-2109/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/profile/viewProfile.xhtml
Log:
JBPORTAL-2167: Wrong validation message shown in Change password function
Modified: branches/JBoss_Portal_2_6_6_JBPORTAL-2109/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/EditProfileAction.java
===================================================================
--- branches/JBoss_Portal_2_6_6_JBPORTAL-2109/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/EditProfileAction.java 2008-10-09 02:02:07 UTC (rev 12057)
+++ branches/JBoss_Portal_2_6_6_JBPORTAL-2109/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/EditProfileAction.java 2008-10-09 14:23:21 UTC (rev 12058)
@@ -278,12 +278,12 @@
catch (Exception e)
{
log.error("error while updating password", e);
- ctx.addMessage("status", new FacesMessage(bundle.getString("IDENTITY_EDIT_CHANGE_PASSWORD_ERROR")));
+ ctx.addMessage("status", new FacesMessage(FacesMessage.SEVERITY_ERROR, bundle.getString("IDENTITY_EDIT_CHANGE_PASSWORD_ERROR"), ""));
}
}
else
{
- ctx.addMessage("status", new FacesMessage(bundle.getString("IDENTITY_EDIT_CHANGE_PASSWORD_ERROR")));
+ ctx.addMessage("status", new FacesMessage(FacesMessage.SEVERITY_ERROR, bundle.getString("IDENTITY_EDIT_CHANGE_PASSWORD_ERROR"), ""));
}
this.resetWindowState(ctx);
Modified: branches/JBoss_Portal_2_6_6_JBPORTAL-2109/core-identity/src/main/org/jboss/portal/core/identity/ui/admin/UserAdministrationBean.java
===================================================================
--- branches/JBoss_Portal_2_6_6_JBPORTAL-2109/core-identity/src/main/org/jboss/portal/core/identity/ui/admin/UserAdministrationBean.java 2008-10-09 02:02:07 UTC (rev 12057)
+++ branches/JBoss_Portal_2_6_6_JBPORTAL-2109/core-identity/src/main/org/jboss/portal/core/identity/ui/admin/UserAdministrationBean.java 2008-10-09 14:23:21 UTC (rev 12058)
@@ -257,10 +257,12 @@
public String enableUser()
{
+
FacesContext ctx = FacesContext.getCurrentInstance();
ExternalContext ectx = ctx.getExternalContext();
Map params = ectx.getRequestParameterMap();
String action = (String) params.get("enableAction");
+ ResourceBundle bundle = ResourceBundle.getBundle("conf.bundles.Identity", ctx.getViewRoot().getLocale());
this.currentUser = params.get("currentUser") != null ? decoder.encode((String) params.get("currentUser")) : null;
// TODO - do something better than .equals("admin")
@@ -287,12 +289,18 @@
catch (Exception e)
{
log.error("unable to get user: " + this.currentUser, e);
- ResourceBundle bundle = ResourceBundle.getBundle("conf.bundles.Identity", ctx.getViewRoot().getLocale());
ctx.addMessage("status", new FacesMessage(bundle.getString("IDENTITY_MANAGEMENT_ERROR_ACTION_USER")));
return "userAdmin";
}
// Updating search
- ctx.addMessage("status", new FacesMessage("user enabled"));
+ if (action.equals("enable"))
+ {
+ ctx.addMessage("status", new FacesMessage(bundle.getString("IDENTITY_MANAGEMENT_ENABLE_USER_ENABLED")));
+ }
+ else if (action.equals("disable"))
+ {
+ ctx.addMessage("status", new FacesMessage(bundle.getString("IDENTITY_MANAGEMENT_DISABLE_USER_DISABLED")));
+ }
return this.searchUsers();
}
return "searchUsers";
Modified: branches/JBoss_Portal_2_6_6_JBPORTAL-2109/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/PasswordValidator.java
===================================================================
--- branches/JBoss_Portal_2_6_6_JBPORTAL-2109/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/PasswordValidator.java 2008-10-09 02:02:07 UTC (rev 12057)
+++ branches/JBoss_Portal_2_6_6_JBPORTAL-2109/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/PasswordValidator.java 2008-10-09 14:23:21 UTC (rev 12058)
@@ -44,8 +44,7 @@
if (passwordComponent != null && passwordComponent instanceof HtmlInputSecret)
{
String password = (String) ((HtmlInputSecret) passwordComponent).getValue();
-
- if (value == null || password == null || !password.equals((String) value))
+ if (password != null && !password.equals((String) value))
{
throw new ValidatorException(new FacesMessage(bundle.getString("IDENTITY_VALIDATION_ERROR_PASSWORD_DOESNT_MATCH")));
}
Modified: branches/JBoss_Portal_2_6_6_JBPORTAL-2109/core-identity/src/resources/portal-identity-sar/conf/bundles/Identity.properties
===================================================================
--- branches/JBoss_Portal_2_6_6_JBPORTAL-2109/core-identity/src/resources/portal-identity-sar/conf/bundles/Identity.properties 2008-10-09 02:02:07 UTC (rev 12057)
+++ branches/JBoss_Portal_2_6_6_JBPORTAL-2109/core-identity/src/resources/portal-identity-sar/conf/bundles/Identity.properties 2008-10-09 14:23:21 UTC (rev 12058)
@@ -54,8 +54,8 @@
IDENTITY_EDIT_PASSWORD_TITLE=Change your password
IDENTITY_EDIT_PASSWORD_CURRENT=Current password
IDENTITY_EDIT_CHANGE_PASSWORD=Change password
-IDENTITY_EDIT_CHANGE_PASSWORD_ERROR=Could not change your password.
-IDENTITY_EDIT_CHANGE_PASSWOR_STATUS=Your password has been updated.
+IDENTITY_EDIT_CHANGE_PASSWORD_ERROR=Could not change password.
+IDENTITY_EDIT_CHANGE_PASSWOR_STATUS=Password has been updated.
IDENTITY_EDIT_EMAIL_TITLE=Change your email address
IDENTITY_EDIT_EMAIL_NEW=New email address
Modified: branches/JBoss_Portal_2_6_6_JBPORTAL-2109/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/user/changePassword.xhtml
===================================================================
--- branches/JBoss_Portal_2_6_6_JBPORTAL-2109/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/user/changePassword.xhtml 2008-10-09 02:02:07 UTC (rev 12057)
+++ branches/JBoss_Portal_2_6_6_JBPORTAL-2109/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/user/changePassword.xhtml 2008-10-09 14:23:21 UTC (rev 12058)
@@ -35,13 +35,13 @@
<h:inputSecret id="password" required="true" value="#{editprofilemgr.password}">
<f:validateLength minimum="6"/>
</h:inputSecret>
- <h:message for="password"/>
+ <h:message for="password" infoClass="portlet-msg-success" errorClass="portlet-msg-error" fatalClass="portlet-msg-error" warnClass="portlet-msg-alert"/>
<h:outputText value="#{bundle.IDENTITY_REGISTER_PASSWORD_CONFIRM}"/>
<h:inputSecret id="passwordCheck" required="true">
<f:validator validatorId="PasswordValidator"/>
</h:inputSecret>
- <h:message for="passwordCheck"/>
+ <h:message for="passwordCheck" infoClass="portlet-msg-success" errorClass="portlet-msg-error" fatalClass="portlet-msg-error" warnClass="portlet-msg-alert"/>
</h:panelGrid>
<hr/>
Modified: branches/JBoss_Portal_2_6_6_JBPORTAL-2109/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/user/searchUsers.xhtml
===================================================================
--- branches/JBoss_Portal_2_6_6_JBPORTAL-2109/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/user/searchUsers.xhtml 2008-10-09 02:02:07 UTC (rev 12057)
+++ branches/JBoss_Portal_2_6_6_JBPORTAL-2109/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/user/searchUsers.xhtml 2008-10-09 14:23:21 UTC (rev 12058)
@@ -20,7 +20,9 @@
<ui:define name="content">
<h3><h:outputText value="#{bundle.IDENTITY_MANAGEMENT_SEARCH_USER}"/></h3>
- <h:form>
+ <h:messages infoClass="portlet-msg-success" errorClass="portlet-msg-error"
+ fatalClass="portlet-msg-error" warnClass="portlet-msg-alert"/>
+ <h:form>
<h:panelGrid columns="4">
<h:inputText id="searchString" value="#{useradministrationbean.searchString}" />
<h:commandButton id ="search" value="#{bundle.IDENTITY_MANAGEMENT_SEARCH_USER}" action="#{useradministrationbean.searchUsers}" styleClass="portlet-form-button"/>
Modified: branches/JBoss_Portal_2_6_6_JBPORTAL-2109/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/profile/viewProfile.xhtml
===================================================================
--- branches/JBoss_Portal_2_6_6_JBPORTAL-2109/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/profile/viewProfile.xhtml 2008-10-09 02:02:07 UTC (rev 12057)
+++ branches/JBoss_Portal_2_6_6_JBPORTAL-2109/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/profile/viewProfile.xhtml 2008-10-09 14:23:21 UTC (rev 12058)
@@ -15,7 +15,7 @@
</ui:define>
<ui:define name="content">
- <h:message id="status" for="status" infoClass="portlet-msg-success" errorClass="portlet-msg-error"
+ <h:messages infoClass="portlet-msg-success" errorClass="portlet-msg-error"
fatalClass="portlet-msg-error" warnClass="portlet-msg-alert"/>
<h:panelGrid columns="2">
17 years, 7 months
JBoss Portal SVN: r12057 - branches/JBoss_Portal_2_6_6_JBPORTAL-2194/core/src/main/org/jboss/portal/core/aspects/server.
by portal-commits@lists.jboss.org
Author: mmillson
Date: 2008-10-08 22:02:07 -0400 (Wed, 08 Oct 2008)
New Revision: 12057
Modified:
branches/JBoss_Portal_2_6_6_JBPORTAL-2194/core/src/main/org/jboss/portal/core/aspects/server/UserInterceptor.java
Log:
"Fix issues with last-login date feature for [JBPORTAL-2194]."
Modified: branches/JBoss_Portal_2_6_6_JBPORTAL-2194/core/src/main/org/jboss/portal/core/aspects/server/UserInterceptor.java
===================================================================
--- branches/JBoss_Portal_2_6_6_JBPORTAL-2194/core/src/main/org/jboss/portal/core/aspects/server/UserInterceptor.java 2008-10-08 23:22:13 UTC (rev 12056)
+++ branches/JBoss_Portal_2_6_6_JBPORTAL-2194/core/src/main/org/jboss/portal/core/aspects/server/UserInterceptor.java 2008-10-09 02:02:07 UTC (rev 12057)
@@ -22,10 +22,18 @@
******************************************************************************/
package org.jboss.portal.core.aspects.server;
+import java.security.Principal;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.servlet.http.HttpServletRequest;
+
import org.jboss.logging.Logger;
import org.jboss.portal.common.invocation.AttributeResolver;
import org.jboss.portal.common.invocation.InvocationException;
-import org.jboss.portal.core.CoreConstants;
import org.jboss.portal.identity.CachedUserImpl;
import org.jboss.portal.identity.NoSuchUserException;
import org.jboss.portal.identity.User;
@@ -122,7 +130,6 @@
{
boolean trace = log.isTraceEnabled();
HttpServletRequest req = invocation.getServerContext().getClientRequest();
- HttpSession httpSession = req.getSession();
// Get scope
AttributeResolver principalScopeResolver = invocation.getContext().getAttributeResolver(ServerInvocation.PRINCIPAL_SCOPE);
@@ -132,7 +139,7 @@
// The user and its profile
User user = null;
- Map profile = null;
+ Map<String, String> profile = null;
// Fetch user if we can
if (userPrincipal != null)
@@ -156,6 +163,9 @@
// Fetch user info
user = getUserModule().findUserByUserName(userName);
+ // Set Last login date
+ getUserProfileModule().setProperty(user, User.INFO_USER_LAST_LOGIN_DATE, "" + new Date());
+
// Get profile
profile = getUserProfileModule().getProperties(user);
@@ -170,6 +180,8 @@
// Cache
invocation.getContext().setAttribute(ServerInvocation.PRINCIPAL_SCOPE, PROFILE_KEY, profile);
+
+
}
//
@@ -192,54 +204,6 @@
}
}
- //
- if (user == null)
- {
- // Erase any previous user finalizer, the side effect of unbinding the session attribute will finalize the previous user
- UserFinalizer finalizer = (UserFinalizer)httpSession.getAttribute(CoreConstants.Servlet.Session.USER_FINALIZER);
- if (finalizer != null)
- {
- if (trace)
- {
- log.trace("Removing finalizer for user=" + finalizer.userId);
- }
- httpSession.setAttribute(CoreConstants.Servlet.Session.USER_FINALIZER, null);
- }
- }
- else
- {
- // Get the current finalizer if any
- UserFinalizer finalizer = (UserFinalizer)httpSession.getAttribute(CoreConstants.Servlet.Session.USER_FINALIZER);
-
- // Get the user id from the request user
- if (finalizer == null)
- {
- if (trace)
- {
- log.trace("Adding finalizer for user=" + user.getUserName());
- }
-
- // Set the user finalizer
- finalizer = new UserFinalizer(user.getId());
-
- // Bind the new one, the side effect finalizes the previous user
- httpSession.setAttribute(CoreConstants.Servlet.Session.USER_FINALIZER, finalizer);
- }
- else if (!finalizer.userId.equals(user.getId()))
- {
- if (trace)
- {
- log.trace("Replacing the finalizer for user=" + finalizer.userId + " with user=" + user.getId());
- }
-
- // Set the user finalizer
- finalizer = new UserFinalizer(user.getId());
-
- // Bind the new one, the side effect finalizes the previous user
- httpSession.setAttribute(CoreConstants.Servlet.Session.USER_FINALIZER, finalizer);
- }
- }
-
try
{
// Continue the invocation
@@ -255,7 +219,6 @@
}
}
-
public boolean isCacheUser()
{
return cacheUser;
@@ -266,117 +229,4 @@
this.cacheUser = cacheUser;
}
- /** Implement the last login date feature. */
- private static class UserFinalizer implements Serializable, HttpSessionBindingListener
- {
-
- /** The serialVersionUID */
- private static final long serialVersionUID = -8534276945533635226L;
-
- private static final Logger log = Logger.getLogger(UserFinalizer.class);
-
- private final Object userId;
-
- public UserFinalizer(Object userId)
- {
- if (userId == null)
- {
- throw new IllegalArgumentException("No user id present");
- }
- this.userId = userId;
- }
-
- public void valueBound(HttpSessionBindingEvent event)
- {
- }
-
- public void valueUnbound(HttpSessionBindingEvent event)
- {
- try
- {
- finalizeUser();
- }
- catch (Exception e)
- {
- log.warn("Cannot set last login date for user with id '" + userId + "' : " + e.getMessage());
- log.debug("Failed to set user last login date (may happen during server shutdown): ", e);
- }
- }
-
- protected void finalizeUser() throws Exception
- {
- /**
- * Note: Due to a possible bug in JBoss Cache Transaction propagation within a cluster,
- * We need to spawn a separate thread with its own new transaction to perform the finalizeUser
- * logic.
- *
- * Without that, it results in data deadlocks in the cluster.
- */
- Thread thread = new Thread(new FinalizeRunner());
- thread.start();
- thread.join();
- }
-
- /**
- *
- * @author soshah
- *
- */
- private class FinalizeRunner implements Runnable
- {
- public void run()
- {
- UserTransaction tx = null;
- try
- {
- //
- if (log.isTraceEnabled())
- {
- log.trace("Finalizing user " + userId);
- }
-
- //
- // Here we use JNDI to locate the module as this finalizer could have been
- // migrated in the session of another node of the cluster
- UserModule userModule = null;
- UserProfileModule userProfileModule = null;
- InitialContext ctx = new InitialContext();
- tx = (UserTransaction)ctx.lookup("UserTransaction");
- tx.begin();
- try
- {
- userModule = (UserModule)new InitialContext().lookup("java:portal/UserModule");
- userProfileModule = (UserProfileModule)new InitialContext().lookup("java:portal/UserProfileModule");
- }
- catch (NameNotFoundException ignore)
- {
- // Name is not bound anymore, it could happen during a shutdown, we don't do anything
- }
-
- // Get user and set last visit date to now if we can
- if (userModule != null && userProfileModule != null)
- {
- try
- {
- User user = userModule.findUserById(userId);
- //user.setLastVisitDate(new Date());
- userProfileModule.setProperty(user, User.INFO_USER_LAST_LOGIN_DATE, new Date().toString());
-
- }
- catch (NoSuchUserException e)
- {
- // User is not found
- log.warn("Trying to finalize non existing user " + userId);
- }
- }
- tx.commit();
- }
- catch(Exception e)
- {
- try{tx.rollback();}catch(Exception rbe){}
- log.debug(this, e);
- }
- }
- }
- }
}
17 years, 7 months
JBoss Portal SVN: r12056 - branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/services.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-10-08 19:22:13 -0400 (Wed, 08 Oct 2008)
New Revision: 12056
Modified:
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/services/RemoteSOAPInvokerServiceFactory.java
Log:
- JBPORTAL-1726: there were still some issues if a producer was configured with a
non-reachable URL and then switched to a valid one. In particular, refreshing
producer with unreachable URL led to infinite loop.
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/services/RemoteSOAPInvokerServiceFactory.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/services/RemoteSOAPInvokerServiceFactory.java 2008-10-08 23:22:01 UTC (rev 12055)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/services/RemoteSOAPInvokerServiceFactory.java 2008-10-08 23:22:13 UTC (rev 12056)
@@ -87,6 +87,7 @@
{
initServices();
setFailed(false);
+ setAvailable(true);
}
catch (MalformedURLException e)
{
@@ -97,6 +98,7 @@
{
log.info("Couldn't access WSDL information. Service won't be available", e);
setAvailable(false);
+ setFailed(true);
throw e;
}
}
17 years, 7 months
JBoss Portal SVN: r12055 - branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/services.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-10-08 19:22:01 -0400 (Wed, 08 Oct 2008)
New Revision: 12055
Modified:
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/services/RemoteSOAPInvokerServiceFactory.java
Log:
- JBPORTAL-1726: there were still some issues if a producer was configured with a
non-reachable URL and then switched to a valid one. In particular, refreshing
producer with unreachable URL led to infinite loop.
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/services/RemoteSOAPInvokerServiceFactory.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/services/RemoteSOAPInvokerServiceFactory.java 2008-10-08 20:20:43 UTC (rev 12054)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/services/RemoteSOAPInvokerServiceFactory.java 2008-10-08 23:22:01 UTC (rev 12055)
@@ -83,6 +83,7 @@
{
initServices();
setFailed(false);
+ setAvailable(true);
}
catch (MalformedURLException e)
{
@@ -95,7 +96,7 @@
setAvailable(false);
throw e;
}
- }
+ }
private void initServices() throws MalformedURLException
{
@@ -114,6 +115,7 @@
}
catch (WSDLException e)
{
+ setFailed(true);
throw new RuntimeException("Couldn't initialize services for WSDL at '" + wsdlDefinitionURL + "'", e);
}
}
17 years, 7 months
JBoss Portal SVN: r12054 - branches.
by portal-commits@lists.jboss.org
Author: mmillson
Date: 2008-10-08 16:20:43 -0400 (Wed, 08 Oct 2008)
New Revision: 12054
Added:
branches/JBoss_Portal_2_6_6_JBPORTAL-2194/
Log:
Create JBPORTAL-2194 patch branch from JBoss_Portal_2_6_6 tag
Copied: branches/JBoss_Portal_2_6_6_JBPORTAL-2194 (from rev 12053, tags/JBoss_Portal_2_6_6)
17 years, 7 months
JBoss Portal SVN: r12053 - in branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core: impl/coordination and 1 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-10-08 16:10:58 -0400 (Wed, 08 Oct 2008)
New Revision: 12053
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/CoordinationConfigurator.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/CoordinationManager.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/EventConverter.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/coordination/CoordinationService.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/coordination/SimpleEventConverter.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/PageContainer.java
Log:
- JBPORTAL-2147: more API fixes
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/CoordinationConfigurator.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/CoordinationConfigurator.java 2008-10-08 18:34:17 UTC (rev 12052)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/CoordinationConfigurator.java 2008-10-08 20:10:58 UTC (rev 12053)
@@ -151,10 +151,10 @@
* Defines shared parameter binding for a given collection of windows.
*
* @param name
- * @param mappings
+ * @param parameterMappings
* @throws IllegalCoordinationException
*/
- void setParameterBinding(String name, Map<Window, Set<QName>> mappings) throws IllegalCoordinationException;
+ void setParameterBinding(String name, Map<Window, Set<QName>> parameterMappings) throws IllegalCoordinationException;
/**
* Removes given parameter binding
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/CoordinationManager.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/CoordinationManager.java 2008-10-08 18:34:17 UTC (rev 12052)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/CoordinationManager.java 2008-10-08 20:10:58 UTC (rev 12053)
@@ -22,10 +22,9 @@
package org.jboss.portal.core.controller.coordination;
+import org.jboss.portal.core.controller.portlet.ControllerPortletControllerContext;
import org.jboss.portal.core.model.portal.PageContainer;
import org.jboss.portal.core.model.portal.Window;
-import org.jboss.portal.core.model.portal.Page;
-import org.jboss.portal.core.controller.portlet.ControllerPortletControllerContext;
import org.jboss.portal.portlet.controller.event.PortletWindowEvent;
import javax.xml.namespace.QName;
@@ -52,8 +51,8 @@
/**
- * Resolves wiring implicit mode. If there is no strategy defined for this page container method will browse
- * parent object to resolve inherited modes. If no mode is set this method will return default one
+ * Resolves wiring implicit mode. If there is no strategy defined for this page container method will browse parent
+ * object to resolve inherited modes. If no mode is set this method will return default one
*
* @param page
* @return
@@ -61,21 +60,21 @@
Boolean resolveEventWiringImplicitModeEnabled(PageContainer page);
/**
- * Resolves binding implicit mode. If there is no mode defined for this page container method will browse
- * parent object to resolve inherited modes. If no mode is set this method will return default one
+ * Resolves binding implicit mode. If there is no mode defined for this page container method will browse parent
+ * object to resolve inherited modes. If no mode is set this method will return default one
*
* @param pageContainer the page container
- * @return
+ * @return
*/
Boolean resolveParameterBindingImplicitModeEnabled(PageContainer pageContainer);
- /**
- * Returns the list of bindings for a given window and a given name. The collection is an aggregation
- * of window bindings and alias bindings.
+ /**
+ * Returns the list of bindings for a given window and a given name. The collection is an aggregation of parameter
+ * bindings and alias bindings.
*
* @param window the target window
- * @param name the target name
- * @return all parameter binding names with a given window/name mapping
+ * @param name the target name
+ * @return all binding names with a given window/name mapping
*/
Collection<String> getBindingNames(Window window, QName name);
}
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/EventConverter.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/EventConverter.java 2008-10-08 18:34:17 UTC (rev 12052)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/EventConverter.java 2008-10-08 20:10:58 UTC (rev 12053)
@@ -22,9 +22,9 @@
package org.jboss.portal.core.controller.coordination;
+import org.jboss.portal.core.model.portal.Window;
import org.jboss.portal.portlet.controller.event.PortletWindowEvent;
import org.jboss.portal.portlet.info.EventInfo;
-import org.jboss.portal.core.model.portal.Window;
/**
* @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
@@ -34,12 +34,12 @@
{
/**
- * Converts source event using information about destination event mapping. Return event will have
- * destination event QName, source event windowId and negotiated payload value.
+ * Converts source event using information about destination event mapping. Return event will have destination event
+ * QName, source event windowId and negotiated payload value.
*
* @param sourceEvent
* @param destEventInfo
* @return
*/
- PortletWindowEvent resolveEvent(PortletWindowEvent sourceEvent, EventInfo destEventInfo, Window window);
+ PortletWindowEvent convertEvent(PortletWindowEvent sourceEvent, EventInfo destEventInfo, Window window);
}
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/coordination/CoordinationService.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/coordination/CoordinationService.java 2008-10-08 18:34:17 UTC (rev 12052)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/coordination/CoordinationService.java 2008-10-08 20:10:58 UTC (rev 12053)
@@ -172,7 +172,7 @@
EventInfo destEventInfo = portletInfo.getEventing().getConsumedEvents().get(destEventName);
if (destEventInfo != null)
{
- windows.put(window, getEventConverter().resolveEvent(event, destEventInfo, window));
+ windows.put(window, getEventConverter().convertEvent(event, destEventInfo, window));
}
}
@@ -507,18 +507,18 @@
// Binding stuff *****************************************************************************************
- public void setParameterBinding(String name, Map<Window, Set<QName>> mappings) throws IllegalCoordinationException
+ public void setParameterBinding(String name, Map<Window, Set<QName>> parameterMappings) throws IllegalCoordinationException
{
- ParameterValidation.throwIllegalArgExceptionIfNull(mappings, "windows");
- ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(name, "name", "window binding");
- if (mappings.isEmpty())
+ ParameterValidation.throwIllegalArgExceptionIfNull(parameterMappings, "parameter mappings");
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(name, "name", "parameter binding");
+ if (parameterMappings.isEmpty())
{
- throw new IllegalArgumentException("empty windows map");
+ throw new IllegalArgumentException("empty parameter mappings");
}
// Obtain parent page and check that all windows are in one branch...
Page parentPage = null;
- for (Window window : mappings.keySet())
+ for (Window window : parameterMappings.keySet())
{
if (parentPage == null)
{
@@ -534,22 +534,22 @@
String prop_wiring = PREFIX_PARAMETER_BINDING + name;
//
- for (Window window : mappings.keySet())
+ for (Window window : parameterMappings.keySet())
{
- window.setDeclaredProperty(prop_wiring, concatenateQNames(mappings.get(window)));
+ window.setDeclaredProperty(prop_wiring, concatenateQNames(parameterMappings.get(window)));
}
}
public void removeParameterBinding(ParameterBindingInfo info) throws IllegalCoordinationException
{
- ParameterValidation.throwIllegalArgExceptionIfNull(info, "WindowBindingInfo");
+ ParameterValidation.throwIllegalArgExceptionIfNull(info, "ParameterBindingInfo");
removeParameterBinding(info.getPage(), info.getName());
}
public void removeParameterBinding(Page page, String name)
{
- ParameterValidation.throwIllegalArgExceptionIfNull(name, "window binding name");
+ ParameterValidation.throwIllegalArgExceptionIfNull(name, "parameter binding name");
ParameterValidation.throwIllegalArgExceptionIfNull(page, "Page");
String nameProp = PREFIX_PARAMETER_BINDING + name;
@@ -575,7 +575,7 @@
public ParameterBindingInfo getParameterBinding(Page page, String name) throws IllegalCoordinationException
{
ParameterValidation.throwIllegalArgExceptionIfNull(page, "Page");
- ParameterValidation.throwIllegalArgExceptionIfNull(name, "window binding name");
+ ParameterValidation.throwIllegalArgExceptionIfNull(name, "parameter binding name");
String nameProp = PREFIX_PARAMETER_BINDING + name;
@@ -669,7 +669,7 @@
public void removeAliasBinding(Page page, String name)
{
- ParameterValidation.throwIllegalArgExceptionIfNull(name, "window binding name");
+ ParameterValidation.throwIllegalArgExceptionIfNull(name, "alias binding name");
ParameterValidation.throwIllegalArgExceptionIfNull(page, "Page");
String nameProp = PREFIX_PARAMETER_ALIAS_NAME + name;
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/coordination/SimpleEventConverter.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/coordination/SimpleEventConverter.java 2008-10-08 18:34:17 UTC (rev 12052)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/coordination/SimpleEventConverter.java 2008-10-08 20:10:58 UTC (rev 12053)
@@ -25,8 +25,8 @@
import org.jboss.portal.core.controller.coordination.EventConverter;
import org.jboss.portal.core.model.portal.Window;
import org.jboss.portal.portlet.controller.event.PortletWindowEvent;
-import org.jboss.portal.portlet.info.EventInfo;
import org.jboss.portal.portlet.impl.info.ContainerTypeInfo;
+import org.jboss.portal.portlet.info.EventInfo;
import javax.xml.namespace.QName;
import java.io.Serializable;
@@ -38,7 +38,7 @@
public class SimpleEventConverter implements EventConverter
{
- public PortletWindowEvent resolveEvent(PortletWindowEvent sourceEvent, EventInfo destEventInfo, Window window)
+ public PortletWindowEvent convertEvent(PortletWindowEvent sourceEvent, EventInfo destEventInfo, Window window)
{
QName destName = destEventInfo.getName();
@@ -50,8 +50,8 @@
String sourcePayloadType = sourceEvent.getPayload().getClass().getName();
String destPayloadType = ((ContainerTypeInfo)destEventInfo.getType()).getType().getName();
-
+
// NOTE: rules below can be merged but I leave it like this to have more clear logic to follow
// Same payload types
@@ -82,5 +82,4 @@
}
-
}
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/PageContainer.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/PageContainer.java 2008-10-08 18:34:17 UTC (rev 12052)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/PageContainer.java 2008-10-08 20:10:58 UTC (rev 12053)
@@ -33,6 +33,7 @@
/**
* Return an existing page or null if the child does not exist or does not have the right type.
*
+ * @param name the name of the child page to be retrieved
* @return the specified page
* @throws IllegalArgumentException if the name argument is null
*/
17 years, 7 months