Author: vrockai
Date: 2009-02-27 11:12:59 -0500 (Fri, 27 Feb 2009)
New Revision: 12902
Added:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/PageCoordinationTestCase.java
Log:
[JBPORTAL-2316] - coordination samples testcase
Added:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/PageCoordinationTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/PageCoordinationTestCase.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/PageCoordinationTestCase.java 2009-02-27
16:12:59 UTC (rev 12902)
@@ -0,0 +1,280 @@
+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 PageCoordinationTestCase extends JBossPortalSeleniumTestCase {
+ private final String INP_ALIAS_REN =
"//input[contains(@name,'renameForm:newName')]";
+ private final String SUB_ALIAS_RENAME_SUBMIT =
"//input[contains(@name,'renameForm:j_id35')]";
+ private final String SUB_ALIAS_REN_CANCEL =
"//input[contains(@name,'renameForm:j_id36')]";
+ private final String TBL_ALIASES =
"//div[@id='aliasBindings']/form/div/table";
+ private final String LNK_T_ALIAS_RENAME =
"//div[@id=''aliasBindings'']/form[2]/div/table/tbody/tr[{0}]/td[2]/table/tbody/tr/td[1]/a/span";
+ private final String LNK_T_ALIAS_DELETE =
"//div[@id=''aliasBindings'']/form[2]/div/table/tbody/tr[{0}]/td[2]/table/tbody/tr/td[2]/a/span";
+ private final String SUB_ALIAS_DEL_SUBMIT =
"_jbpnsAdminPortletWindowsnpbj:j_id47:j_id34:j_id40:j_id41";
+ private final String SUB_ALIAS_DEL_CANCEL =
"_jbpnsAdminPortletWindowsnpbj:j_id47:j_id34:j_id40:j_id42";
+ private final String CHK_EXPL_WIR =
"//input[contains(@id,'useExplicitEvents')]";
+ private final String CHK_PARAM_BIND =
"//input[contains(@id,'useExplicitBinding')]";
+ private final String SUB_CREATE_ALIAS =
"//input[contains(@name,'create-alias-form') and
@type='submit'][1]";
+ private final String SUB_CREATE_ALIAS_CANCEL =
"//input[contains(@name,'create-alias-form') and
@type='submit'][2]";
+ private final String INP_ALIAS_NAME =
"//input[contains(@id,'create-alias-form:aliasName')]";
+ private final String LIS_RENDER_PAR =
"//select[contains(@id,'create-alias-form:alias')]";
+
+ public final String casePfx = "portal.admin.";
+
+ private final String LNK_PP_PROP_DELETE =
getProp(casePfx+"lnk.pp.prop.delete","//a[contains(@id,''common-manage-prop-form:prop-data-table:{0}:delete'')]");
+ private final String SUB_PP_PROPVAL_UPDATE =
getProp(casePfx+"sub.pp.propval.update","//input[contains(@id,'common-manage-prop-form:update')]");
+ private final String INP_PP_PROP_VAL =
getProp(casePfx+"inp.pp.prop.val","//input[contains(@id,''common-manage-prop-form:prop-data-table:{0}:prop-value-input'')]");
+ private final String SUB_PPA_FORM_UPDATE =
getProp(casePfx+"sub.ppa.form.update","//input[contains(@id,'common-edit-page-error-form:update')]");
+ private final String INP_PPA_RES_SELECT =
getProp(casePfx+"inp.ppa.res.select","//input[contains(@id,'common-edit-page-error-form:page-res-select')]");
+ private final String SEL_PPA_NF_SELECT =
getProp(casePfx+"sel.ppa.nf.select","//select[contains(@id,'common-edit-page-error-form:page-not-found-select')]");
+ private final String SEL_PPA_INTERNAL_SELECT =
getProp(casePfx+"sel.ppa.internal.select","//select[contains(@id,'common-edit-page-error-form:page-internal-select')]");
+ private final String SEL_PPA_ERROR_SELECT =
getProp(casePfx+"sel.ppa.error.select","//select[contains(@id,'common-edit-page-error-form:page-error-select')]");
+ private final String SEL_PPA_CONTROL_SELECT =
getProp(casePfx+"sel.ppa.control.select","//select[contains(@id,'common-edit-page-error-form:page-control-select')]");
+ private final String SEL_PPA_ACCESS_SELECT =
getProp(casePfx+"sel.ppa.access.select","//select[contains(@id,'common-edit-page-error-form:page-access-select')]");
+ private final String CHK_PPA_RES_CHECK =
getProp(casePfx+"chk.ppa.res.check","//input[contains(@id,'common-edit-page-error-form:page-res-check')]");
+ private final String CHK_PPA_NF_CHECK =
getProp(casePfx+"chk.ppa.nf.check","//input[contains(@id,'common-edit-page-error-form:page-not-found-check')]");
+ private final String CHK_PPA_INTERNAL_CHECK =
getProp(casePfx+"chk.ppa.internal.check","//input[contains(@id,'common-edit-page-error-form:page-internal-check')]");
+ private final String CHK_PPA_ERROR_CHECK =
getProp(casePfx+"chk.ppa.error.check","//input[contains(@id,'common-edit-page-error-form:page-error-check')]");
+ private final String CHK_PPA_CONTROL_CHECK =
getProp(casePfx+"chk.ppa.control.check","//input[contains(@id,'common-edit-page-error-form:page-control-check')]");
+ private final String CHK_PPA_ACCESS_CHECK =
getProp(casePfx+"chk.ppa.access.check","//input[contains(@id,'common-edit-page-error-form:page-access-check')]");
+ private final String SUB_PP_ERROR_FORM_UPDATE =
getProp(casePfx+"sub.pp.error.form.update","//input[contains(@id,'common-edit-portal-error-form:update')]");
+ private final String INP_PP_RES_INPUT =
getProp(casePfx+"inp.pp.res.input","//input[contains(@id,'common-edit-portal-error-form:portal-res-input')]");
+ private final String SEL_PP_NF_SELECT =
getProp(casePfx+"sel.pp.nf.select","//select[contains(@id,'common-edit-portal-error-form:portal-not-found-select')]");
+ private final String SEL_PP_INTERNAL_SELECT =
getProp(casePfx+"sel.pp.internal.select","//select[contains(@id,'common-edit-portal-error-form:portal-internal-select')]");
+ private final String SEL_PP_ERROR_SELECT =
getProp(casePfx+"sel.pp.error.select","//select[contains(@id,'common-edit-portal-error-form:portal-error-select')]");
+ private final String SEL_PP_UNAVAIL_SELECT =
getProp(casePfx+"sel.pp.unavail.select","//select[contains(@id,'common-edit-portal-error-form:portal-unavail-select')]");
+ private final String SEL_PP_ACCESS_SELECT =
getProp(casePfx+"sel.pp.access.select","//select[contains(@id,'common-edit-portal-error-form:portal-access-select')]");
+ private final String CHK_PP_RES_CHECK =
getProp(casePfx+"chk.pp.res.check","//input[contains(@id,'common-edit-portal-error-form:portal-res-check')]");
+ private final String CHK_PP_NF_CHECK =
getProp(casePfx+"chk.pp.nf.check","//input[contains(@id,'common-edit-portal-error-form:portal-not-found-check')]");
+ private final String CHK_PP_INTERNAL_CHECK =
getProp(casePfx+"chk.pp.internal.check","//input[contains(@id,'common-edit-portal-error-form:portal-internal-check')]");
+ private final String CHK_PP_ERROR_CHECK =
getProp(casePfx+"chk.pp.error.check","//input[contains(@id,'common-edit-portal-error-form:portal-error-check')]");
+ private final String CHK_PP_ACCESS_CHECK =
getProp(casePfx+"chk.pp.access.check","//input[contains(@id,'common-edit-portal-error-form:portal-access-check')]");
+ private final String CHK_PP_UNAVAIL_CHECK =
getProp(casePfx+"chk.pp.unavail.check","//input[contains(@id,'common-edit-portal-error-form:portal-unavail-check')]");
+ private final String SUB_PP_PROPADD =
getProp(casePfx+"sub.pp.propadd","//input[contains(@id,'common-edit-prop-form:add-property')]");
+ private final String INP_PP_PROPNAME =
getProp(casePfx+"inp.pp.propname","//input[contains(@id,'common-edit-prop-form:property')]");
+ private final String SUB_PP_LISTENER =
getProp(casePfx+"sub.pp.listener","//input[contains(@id,'edit-prop-form:update')]");
+ private final String SEL_PP_LISTENER =
getProp(casePfx+"sel.pp.listener","//select[contains(@id,'edit-prop-form:listener')]");
+ private final String TBL_PP_PROPS =
getProp(casePfx+"tbl.pp.props","//table[contains(@id,'common-manage-prop-form:prop-data-table')]");
+
+ private final String SUB_LAYOUT_ADD_CENTER = getProp(casePfx +
"sub.layout.add.center",
"//input[contains(@id,'layoutForm:a_center')]");
+ private final String INP_WINDOW_NAME = getProp(casePfx + "inp.window.name",
"//input[contains(@id,'windowForm:windowName')]");
+ private final String SUBMIT_RENAME_PORTAL = getProp(casePfx +
"submit.rename.portal",
"//input[contains(@id,'renameForm:rename')]");
+ private final String INPUT_RENAME_PORTAL = getProp(casePfx +
"input.rename.portal",
"//input[contains(@id,'renameForm:newName')]");
+ private final String SUBMIT_DELETE_PORTAL_CONF = getProp(casePfx +
"submit.delete.portal.conf",
"//input[contains(@id,'delete-view:confirm-form:delete')]");
+ private final String INPUT_SUBMIT_PAGECREATE = getProp(casePfx +
"input.submit.pagecreate",
"//input[contains(@id,'create-page-form:create-page')]");
+ private final String INPUT_PAGENAME = getProp(casePfx + "input.pagename",
"//input[contains(@id,'create-page-form:pageName')]");
+ private final String INPUT_PORTALNAME = getProp(casePfx + "input.portalname",
"//input[contains(@id,'create-portal-form:name')]");
+ private final String INPUT_SUBMIT_CREATEPORTAL = getProp(casePfx +
"input.submit.createportal",
"//input[contains(@id,'create-portal-form:create-portal')]");
+ private final String TAB_PORTALOBJ_ID = getProp(casePfx + "tab.portalobj.id",
"Link=Admin");
+ private final String LINK_PORTALS_ID = getProp(casePfx + "link.portals.id",
"link=*Portal Objects*");
+ private final String LINK_PORTAL_HOME = getProp(casePfx + "link.portal.home",
"//a[contains(@id,'obj-temp-form:object-link-0')]");
+ private final String TABLE_PORTAL_ADMIN = getProp(casePfx +
"table.portal.admin",
"//table[contains(@id,'obj-nav-form:portal-datatable')]");
+ private final String POR_TL_MAIN = getProp(casePfx + "por.tl.main",
"//a[contains(@id,''obj-nav-form:portal-datatable:{0}:object-iid-link'')]");
+ private final String POR_TL_SECURITY = getProp(casePfx + "por.tl.security",
"//a[contains(@id,''obj-nav-form:portal-datatable:{0}:security-link'')]");
+ private final String POR_TL_PROPERTIES = getProp(casePfx +
"por.tl.properties",
"//a[contains(@id,''obj-nav-form:portal-datatable:{0}:prop-link'')]");
+ private final String POR_TL_THEME = getProp(casePfx + "por.tl.theme",
"//a[contains(@id,''obj-nav-form:portal-datatable:{0}:theme-link'')]");
+ private final String POR_TL_RENAME = getProp(casePfx + "por.tl.rename",
"//a[contains(@id,''obj-nav-form:portal-datatable:{0}:rename'')]");
+ private final String POR_TL_DELETE = getProp(casePfx + "por.tl.delete",
"//a[contains(@id,''obj-nav-form:portal-datatable:{0}:delete'')]");
+ private final String POR_TL_MAKEDEF = getProp(casePfx + "por.tl.makedef",
"//a[contains(@id,''obj-nav-form:portal-datatable:{0}:default-link'')]");
+ private final String TABLE_PORTALPAGE_ADMIN = getProp(casePfx +
"table.portalpage.admin",
"//table[contains(@id,'obj-nav-form:pages-datatable')]");
+ private final String PAG_TL_MAIN = getProp(casePfx + "pag.tl.main",
"//a[contains(@id,''obj-nav-form:pages-datatable:{0}:object-link'')]");
+ private final String PAG_TL_LAYOUT = getProp(casePfx + "pag.tl.layout",
"//a[contains(@id,''obj-nav-form:pages-datatable:{0}:edit-page-layout'')]");
+ private final String PAG_TL_SECURITY = getProp(casePfx + "pag.tl.security",
"//a[contains(@id,''obj-nav-form:pages-datatable:{0}:security-link'')]");
+ private final String PAG_TL_PROPERTIES = getProp(casePfx +
"pag.tl.properties",
"//a[contains(@id,''obj-nav-form:pages-datatable:{0}:prop-link'')]");
+ private final String PAG_TL_COORDINATION = getProp(casePfx + "pag.tl.coord",
"//a[contains(@id,''pages-datatable:{0}:edit-coord'')]");
+ private final String PAG_TL_THEME = getProp(casePfx + "pag.tl.theme",
"//a[contains(@id,''obj-nav-form:pages-datatable:{0}:theme-link'')]");
+ private final String PAG_TL_RENAME = getProp(casePfx + "pag.tl.rename",
"//a[contains(@id,''obj-nav-form:pages-datatable:{0}:rename-link'')]");
+ private final String PAG_TL_DISPLAY = getProp(casePfx + "pag.tl.display",
"//a[contains(@id,''obj-nav-form:pages-datatable:{0}:rename-display'')]");
+ private final String PAG_TL_DELETE = getProp(casePfx + "pag.tl.delete",
"//a[contains(@id,''obj-nav-form:pages-datatable:{0}:delete-link'')]");
+ private final String PAG_TL_MAKEDEF = getProp(casePfx + "pag.tl.makedef",
"//a[contains(@id,''obj-nav-form:pages-datatable:{0}:default-link'')]");
+
+ @BeforeMethod(groups = { "log" })
+ public void loginBeforeTest() {
+ logoutIfPossible();
+ login("admin", "admin");
+ }
+
+ @AfterMethod(groups = { "log" })
+ public void logoutAfterTest() {
+ }
+
+ @Test(enabled = true)
+ public void testPageCoordination(){
+ String portalName = "default";
+ String pageName = "Coordination Samples";
+
+ openAndWait("/portal");
+ clickAndWait("link=Admin");
+
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LINK_PORTALS_ID);
+ clickIfVisible(LINK_PORTAL_HOME);
+ Assert.assertTrue(selenium.isTextPresent("Create a portal named:"));
+ int r = findTableRow(TABLE_PORTAL_ADMIN, portalName, 0) - 1;
+
+ clickAndWait(MessageFormat.format(POR_TL_MAIN, r));
+
+ r = findTableRow(TABLE_PORTALPAGE_ADMIN, pageName, 0) - 1;
+
+ clickAndWait(MessageFormat.format(PAG_TL_COORDINATION, r));
+
+ // create alias
+ selenium.addSelection(LIS_RENDER_PAR, "label=zipcode");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.type(INP_ALIAS_NAME, "aliasBindTest");
+ selenium.click(SUB_CREATE_ALIAS_CANCEL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.addSelection(LIS_RENDER_PAR, "label=zipcode");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.type(INP_ALIAS_NAME, "aliasBindTest");
+ selenium.click(SUB_CREATE_ALIAS);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ }
+
+ @Test(enabled = true)
+ public void testDeleteAlias(){
+ String portalName = "default";
+ String pageName = "Coordination Samples";
+
+ openAndWait("/portal");
+ clickAndWait("link=Admin");
+
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LINK_PORTALS_ID);
+ clickIfVisible(LINK_PORTAL_HOME);
+ Assert.assertTrue(selenium.isTextPresent("Create a portal named:"));
+ int r = findTableRow(TABLE_PORTAL_ADMIN, portalName, 0) - 1;
+
+ clickAndWait(MessageFormat.format(POR_TL_MAIN, r));
+
+ r = findTableRow(TABLE_PORTALPAGE_ADMIN, pageName, 0) - 1;
+
+ clickAndWait(MessageFormat.format(PAG_TL_COORDINATION, r));
+
+ // create delete alias
+ selenium.addSelection(LIS_RENDER_PAR,
"label={urn:jboss:portal:samples:coor}zipcode");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.type(INP_ALIAS_NAME, "aliasBindDelete");
+
+ selenium.click(SUB_CREATE_ALIAS);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ // delete alias
+ r = findTableRow(TBL_ALIASES, "aliasBindDelete", 0) ;
+
+ selenium.click(MessageFormat.format(LNK_T_ALIAS_DELETE,r));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(SUB_ALIAS_DEL_CANCEL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ r = findTableRow(TBL_ALIASES, "aliasBindDelete", 0) ;
+
+ selenium.click(MessageFormat.format(LNK_T_ALIAS_DELETE,r));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(SUB_ALIAS_DEL_SUBMIT);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ }
+
+ @Test(enabled = true)
+ public void testRenameAlias(){
+ String portalName = "default";
+ String pageName = "Coordination Samples";
+
+ openAndWait("/portal");
+ clickAndWait("link=Admin");
+
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LINK_PORTALS_ID);
+ clickIfVisible(LINK_PORTAL_HOME);
+ Assert.assertTrue(selenium.isTextPresent("Create a portal named:"));
+ int r = findTableRow(TABLE_PORTAL_ADMIN, portalName, 0) - 1;
+
+ clickAndWait(MessageFormat.format(POR_TL_MAIN, r));
+
+ r = findTableRow(TABLE_PORTALPAGE_ADMIN, pageName, 0) - 1;
+
+ clickAndWait(MessageFormat.format(PAG_TL_COORDINATION, r));
+
+ // create rename alias
+ selenium.addSelection(LIS_RENDER_PAR,
"label={urn:jboss:portal:samples:coor}zipcode");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.type(INP_ALIAS_NAME, "aliasBingRename");
+
+ selenium.click(SUB_CREATE_ALIAS);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ // rename alias
+ r = findTableRow(TBL_ALIASES, "aliasBingRename", 0) ;
+
+ selenium.click(MessageFormat.format(LNK_T_ALIAS_RENAME,r));
+
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(SUB_ALIAS_REN_CANCEL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ r = findTableRow(TBL_ALIASES, "aliasBingRename", 0) ;
+
+ selenium.click(MessageFormat.format(LNK_T_ALIAS_RENAME,r));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.type(INP_ALIAS_REN, "aliasBindWasRenamed");
+ selenium.click(SUB_ALIAS_RENAME_SUBMIT);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ }
+
+ @Test(enabled = true)
+ public void testParamBinding(){
+ String portalName = "default";
+ String pageName = "Coordination Samples";
+
+ openAndWait("/portal");
+ clickAndWait("link=Admin");
+
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LINK_PORTALS_ID);
+ clickIfVisible(LINK_PORTAL_HOME);
+ Assert.assertTrue(selenium.isTextPresent("Create a portal named:"));
+ int r = findTableRow(TABLE_PORTAL_ADMIN, portalName, 0) - 1;
+
+ clickAndWait(MessageFormat.format(POR_TL_MAIN, r));
+
+ r = findTableRow(TABLE_PORTALPAGE_ADMIN, pageName, 0) - 1;
+
+ clickAndWait(MessageFormat.format(PAG_TL_COORDINATION, r));
+
+ // parameter binding
+ selenium.click(CHK_PARAM_BIND);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ }
+
+ @Test(enabled = true)
+ public void testExplicitWiring(){
+ String portalName = "default";
+ String pageName = "Coordination Samples";
+
+ openAndWait("/portal");
+ clickAndWait("link=Admin");
+
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LINK_PORTALS_ID);
+ clickIfVisible(LINK_PORTAL_HOME);
+ Assert.assertTrue(selenium.isTextPresent("Create a portal named:"));
+ int r = findTableRow(TABLE_PORTAL_ADMIN, portalName, 0) - 1;
+
+ clickAndWait(MessageFormat.format(POR_TL_MAIN, r));
+
+ r = findTableRow(TABLE_PORTALPAGE_ADMIN, pageName, 0) - 1;
+
+ clickAndWait(MessageFormat.format(PAG_TL_COORDINATION, r));
+
+ // explicit wiring
+ selenium.click(CHK_EXPL_WIR);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ }
+}