Author: vrockai
Date: 2009-05-29 10:58:56 -0400 (Fri, 29 May 2009)
New Revision: 13423
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/EndtoEndPortalAdminTestCase.java
Log:
[JBPORTAL-2309] - test fixes, refactoring
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/EndtoEndPortalAdminTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/EndtoEndPortalAdminTestCase.java 2009-05-29
02:49:28 UTC (rev 13422)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/EndtoEndPortalAdminTestCase.java 2009-05-29
14:58:56 UTC (rev 13423)
@@ -12,57 +12,40 @@
import org.testng.annotations.Test;
/**
- * EndtoEndPortalAdminTestCase is responsible for end-to-end testing of portal admin.
Creating of new portal, adding pages to it and setting it as a default portal
- * is the main goal of this test case.
+ * EndtoEndPortalAdminTestCase is responsible for end-to-end testing of portal
+ * admin. Creating of new portal, adding pages to it and setting it as a default
+ * portal is the main goal of this test case.
+ *
* @author <a href="mailto:vrockai@redhat.com">Viliam Rockai</a>
*/
@Test(groups = { "end2end" }, enabled = true, description = "Creating of
new portal with content.")
public class EndtoEndPortalAdminTestCase extends JBossPortalSeleniumTestCase {
-
- private static final String SUB_POR_PROPS_UPDATE =
"_AdminPortletWindow:j_id108:common-manage-prop-form:update";
-
- private static final String SUB_POR_PROPERTY =
"_AdminPortletWindow:j_id108:common-edit-prop-form:add-property";
-
- private static final String INP_POR_PROPERTY =
"_AdminPortletWindow:j_id108:common-edit-prop-form:property";
-
- private static final String SUB_POR_LISTENER =
"_AdminPortletWindow:j_id108:edit-prop-form:update";
-
- private static final String SEL_POR_LISTENER =
"_AdminPortletWindow:j_id108:edit-prop-form:listener";
-
- private static final String SUB_PAL =
"_AdminPortletWindow:j_id134:common-edit-page-error-form:update";
-
- private static final String SEL_PAL_PR =
"_AdminPortletWindow:j_id134:common-edit-page-error-form:page-res-select";
-
- private static final String SEL_PAL_PN =
"_AdminPortletWindow:j_id134:common-edit-page-error-form:page-not-found-select";
-
- private static final String SEL_PAL_PI =
"_AdminPortletWindow:j_id134:common-edit-page-error-form:page-internal-select";
-
- private static final String SEL_PAL_PE =
"_AdminPortletWindow:j_id134:common-edit-page-error-form:page-error-select";
-
- private static final String SEL_PAL_PC =
"_AdminPortletWindow:j_id134:common-edit-page-error-form:page-control-select";
-
- private static final String SEL_PAL_PA =
"_AdminPortletWindow:j_id134:common-edit-page-error-form:page-access-select";
-
- private static final String SUB_POL =
"_AdminPortletWindow:j_id134:common-edit-portal-error-form:update";
-
- private static final String SEL_POL_PR =
"_AdminPortletWindow:j_id134:common-edit-portal-error-form:portal-res-input";
-
- private static final String SEL_POL_PN =
"_AdminPortletWindow:j_id134:common-edit-portal-error-form:portal-not-found-select";
-
- private static final String SEL_POL_PI =
"_AdminPortletWindow:j_id134:common-edit-portal-error-form:portal-internal-select";
-
- private static final String SEL_POL_PE =
"_AdminPortletWindow:j_id134:common-edit-portal-error-form:portal-error-select";
-
- private static final String SEL_POL_PU =
"_AdminPortletWindow:j_id134:common-edit-portal-error-form:portal-unavail-select";
-
- private static final String SEL_POL_PA =
"_AdminPortletWindow:j_id134:common-edit-portal-error-form:portal-access-select";
-
- /** prefix for locator properties = portal.e2e.*/
+ /** prefix for locator properties = portal.e2e. */
public static String casePfx = "portal.e2e.";
+
+ private final String SUB_POR_PROPS_UPDATE = getLoc(casePfx +
"sub.por.props.update",
"//input[contains(@id,'common-manage-prop-form:update')]");
+ private final String SUB_POR_PROPERTY = getLoc(casePfx + "sub.por.property",
"//input[contains(@id,'common-edit-prop-form:add-property')]");
+ private final String INP_POR_PROPERTY = getLoc(casePfx + "inp.por.property",
"//input[contains(@id,'common-edit-prop-form:property')]");
+ private final String SUB_POR_LISTENER = getLoc(casePfx + "sub.por.listener",
"//input[contains(@id,'edit-prop-form:update')]");
+ private final String SEL_POR_LISTENER = getLoc(casePfx + "sel.por.listener",
"//select[contains(@id,'edit-prop-form:listener')]");
+ private final String SUB_PAL = getLoc(casePfx + "sub.pal",
"//input[contains(@id,'common-edit-page-error-form:update')]");
+ private final String INP_PAL_PR = getLoc(casePfx + "inp.pal.pr",
"//input[contains(@id,'common-edit-page-error-form:page-res-select')]");
+ private final String SEL_PAL_PN = getLoc(casePfx + "sel.pal.pn",
"//select[contains(@id,'common-edit-page-error-form:page-not-found-select')]");
+ private final String SEL_PAL_PI = getLoc(casePfx + "sel.pal.pi",
"//select[contains(@id,'common-edit-page-error-form:page-internal-select')]");
+ private final String SEL_PAL_PE = getLoc(casePfx + "sel.pal.pe",
"//select[contains(@id,'common-edit-page-error-form:page-error-select')]");
+ private final String SEL_PAL_PC = getLoc(casePfx + "sel.pal.pc",
"//select[contains(@id,'common-edit-page-error-form:page-control-select')]");
+ private final String SEL_PAL_PA = getLoc(casePfx + "sel.pal.pa",
"//select[contains(@id,'common-edit-page-error-form:page-access-select')]");
+ private final String SUB_POL = getLoc(casePfx + "sub.pol",
"//input[contains(@id,'common-edit-portal-error-form:update')]");
+ private final String INP_POL_PR = getLoc(casePfx + "inp.pol.pr",
"//input[contains(@id,'common-edit-portal-error-form:portal-res-input')]");
+ private final String SEL_POL_PN = getLoc(casePfx + "sel.pol.pn",
"//select[contains(@id,'common-edit-portal-error-form:portal-not-found-select')]");
+ private final String SEL_POL_PI = getLoc(casePfx + "sel.pol.pi",
"//select[contains(@id,'common-edit-portal-error-form:portal-internal-select')]");
+ private final String SEL_POL_PE = getLoc(casePfx + "sel.pol.pe",
"//select[contains(@id,'common-edit-portal-error-form:portal-error-select')]");
+ private final String SEL_POL_PU = getLoc(casePfx + "sel.pol.pu",
"//select[contains(@id,'common-edit-portal-error-form:portal-unavail-select')]");
+ private final String SEL_POL_PA = getLoc(casePfx + "sel.pol.pa",
"//select[contains(@id,'common-edit-portal-error-form:portal-access-select')]");
- private final String ADR_PORTAL = getLoc(casePfx +
"adr.home","/portal");
- public final String SEL_PORTLET_TYPE = getLoc(casePfx +
"sel.portlet.type","//select[contains(@id,'windowForm:instanceId')]");
+ private final String ADR_PORTAL = getLoc(casePfx + "adr.home",
"/portal");
+ public final String SEL_PORTLET_TYPE = getLoc(casePfx + "sel.portlet.type",
"//select[contains(@id,'windowForm:instanceId')]");
private final String SUB_LAYOUT_ADD_CENTER = getLoc(casePfx +
"sub.layout.add.center",
"//input[contains(@id,'layoutForm:a_center')]");
private final String INP_WINDOW_NAME = getLoc(casePfx + "inp.window.name",
"//input[contains(@id,'windowForm:windowName')]");
private final String SUB_RENAME_PORTAL = getLoc(casePfx + "sub.rename.portal",
"//input[contains(@id,'renameForm:rename')]");
@@ -99,10 +82,10 @@
private final String INP_NET_SEARCH = getLoc(casePfx + "inp.net.search",
"//div[contains(@id,'directory_search_div')]/form/input[@name='query']");
private final String SUB_NET_SEARCH = getLoc(casePfx + "sub.net.search",
"//div[contains(@id,'directory_search_div')]/form/input[@type='submit']");
private final String TAB_PROPERTIES = getLoc(casePfx + "tab.properties",
"//table[contains(@id,'common-manage-prop-form:prop-data-table')]");
- private final String TAB_PROP_VAL = getLoc(casePfx + "tab.prop.val",
"//input[contains(@id,''common-manage-prop-form:prop-data-table:{0}:prop-value-input'')]");
+ private final String TAB_PROP_VAL = getLoc(casePfx + "tab.prop.val",
+ "//input[contains(@id,''common-manage-prop-form:prop-data-table:{0}:prop-value-input'')]");
private final String TAB_PROP_DEL = getLoc(casePfx + "tab.prop.val",
"//a[contains(@id,''common-manage-prop-form:prop-data-table:{0}:delete'')]");
-
-
+
@BeforeMethod(groups = { "log" })
protected void loginBeforeTest() {
logoutIfPossible();
@@ -115,80 +98,91 @@
final String portalName = "UseCasePortal";
final String portalManName = "UseManagePortal";
-
+
final String page1Name = "firstPage";
final String page2Name = "anotherPage";
final String page3Name = "lastPage with whitespace";
final String page4Name = "dseer";
final String page5Name = "cemese";
-
+
final String page1ManName = "firstManPage";
-
+
final String PORTLET1 = "Cart Portlet";
final String por1str = "Cart Portlet";
final String PORTLET2 = "Band Culinaria";
final String por2str = "Band Culinaria";
- final String PORTLET3 = "Cahuete.com";
- final String por3str = "Cahuete.com";
+ final String PORTLET3 = "Web Assurance";
+ final String por3str = "web-assurance.net";
final String PORTLET4 = "dir1/foo.txt";
final String por4str = "File Portlet";
final String PORTLET5 = "default/project.html";
final String por5str = "Our wiki knowledge base";
/**
- * Usecase for creating small portal with content. Portal named
"UseCasePortal" is created similar way as in {@link
AdminPortalTestCase#testPortalCreate()}. Then few pages are added similar way
- * as in {@link AdminPortalTestCase#testAddPage()}. A portlet is added to each page
similar way as in {@link AdminPortalTestCase#testCreateWindow()}. The important
information about pages and portlets are
- * listed in the table below
+ * Usecase for creating small portal with content. Portal named
+ * "UseCasePortal" is created similar way as in
+ * {@link AdminPortalTestCase#testPortalCreate()}. Then few pages are added
+ * similar way as in {@link AdminPortalTestCase#testAddPage()}. A portlet is
+ * added to each page similar way as in
+ * {@link AdminPortalTestCase#testCreateWindow()}. The important information
+ * about pages and portlets are listed in the table below
*
* <table>
- * <caption>Important information about portlets in
EndtoEndPortalAdminTestCase</caption>
- * <thead>
+ * <caption>Important information about portlets in
+ * EndtoEndPortalAdminTestCase</caption> <thead>
* <tr>
* <th>page name</th>
* <th>portlet name</th>
* <th>asserted string</th>
- * <th>portlet type</th>
+ * <th>portlet type</th>
* </tr>
* </thead>
* <tr>
- * <td>firstPage</td>
- * <td>Cart Portlet</td><td>Cart Portlet</td>
+ * <td>firstPage</td>
+ * <td>Cart Portlet</td>
+ * <td>Cart Portlet</td>
* <td>portlet</td>
* </tr>
* <tr>
- * <td>anotherPage</td>
- * <td>Band Culinaria</td><td>Band Culinaria</td>
+ * <td>anotherPage</td>
+ * <td>Band Culinaria</td>
+ * <td>Band Culinaria</td>
* <td>widget/google</td>
* </tr>
* <tr>
- * <td>lastPage with whitespace</td>
- * <td>Cahuete.com</td><td>Cahuete.com</td>
+ * <td>lastPage with whitespace</td>
+ * <td>Cahuete.com</td>
+ * <td>Cahuete.com</td>
* <td>widget/netvibes</td>
* </tr>
* <tr>
- * <td>dseer</td>
- * <td>dir1/foo.txt</td><td>File Portlet</td>
+ * <td>dseer</td>
+ * <td>dir1/foo.txt</td>
+ * <td>File Portlet</td>
* <td>filesystem</td>
* </tr>
* <tr>
- * <td>cemese</td>
- * <td>default/project.html</td><td>Our wiki knowledge
base</td>
+ * <td>cemese</td>
+ * <td>default/project.html</td>
+ * <td>Our wiki knowledge base</td>
* <td>cms</td>
* </tr>
* </table>
*
- * Final assertions are made by clicking on the pages listed above and asserting that
each page contains the string specific for the portlet used (again listed in table).
+ * Final assertions are made by clicking on the pages listed above and
+ * asserting that each page contains the string specific for the portlet
+ * used (again listed in table).
*
*/
@Test(enabled = true, description = "Usecase for creating small portal with
content.")
public void testCreatePortalUsecase() {
createPortal(portalName);
- addPage(portalName,page1Name);
- addPage(portalName,page2Name);
- addPage(portalName,page3Name);
- addPage(portalName,page4Name);
- addPage(portalName,page5Name);
+ addPage(portalName, page1Name);
+ addPage(portalName, page2Name);
+ addPage(portalName, page3Name);
+ addPage(portalName, page4Name);
+ addPage(portalName, page5Name);
addPortlet(portalName, page1Name, PORTLET1, "portlet");
addPortlet(portalName, page2Name, PORTLET2, "widget/google");
@@ -216,205 +210,185 @@
assertPageContains(page5Name, por5str);
}
-
- @Test(enabled = false, description = "Usecase for managing portals - listeners and
properties.")
- public void testManagePortalUsecase() {
+
+ @Test(enabled = true, description = "Usecase for managing portals - listeners and
properties.")
+ public void testManagePortalListernersUsecase() {
int r = -1;
-
- createPortal(portalManName);
- addPage(portalManName,page1ManName);
- //- Verify that you can add listener
+
+ //createPortal(portalManName);
+ // addPage(portalManName,page1ManName);
+ // - Verify that you can add listener
goToProperties();
selenium.select(SEL_POR_LISTENER, "label=test_listener");
selenium.click(SUB_POR_LISTENER);
selenium.waitForPageToLoad(PAGE_LOAD);
-
+
goToProperties();
- Assert.assertEquals(selenium.getSelectedLabel(SEL_POR_LISTENER),"test_listener","Previously
selected label not being the current label.");
-
+ Assert.assertEquals(selenium.getSelectedLabel(SEL_POR_LISTENER),
"test_listener", "Previously selected label not being the current
label.");
+
selenium.select(SEL_POR_LISTENER, "label=user_listener");
selenium.click(SUB_POR_LISTENER);
selenium.waitForPageToLoad(PAGE_LOAD);
-
+
goToProperties();
- Assert.assertEquals(selenium.getSelectedLabel(SEL_POR_LISTENER),"user_listener","Previously
selected label not being the current label.");
-
+ Assert.assertEquals(selenium.getSelectedLabel(SEL_POR_LISTENER),
"user_listener", "Previously selected label not being the current
label.");
+ }
+
+ @Test(enabled = true, description = "Usecase for managing portals - listeners and
properties.")
+ public void testManagePortalPropertiesUsecase() {
+ int r = -1;
+
goToProperties();
- //- assert no property is added
- //r = countTableRows(TAB_PROPERTIES);
- //Assert.assertTrue(r==0,"Property table is not empty.");
+ // - assert no property is added
+ // r = countTableRows(TAB_PROPERTIES);
+ // Assert.assertTrue(r==0,"Property table is not empty.");
Assert.assertFalse(selenium.isElementPresent(TAB_PROPERTIES));
-
- //- add d&d prop
+
+ // - add d&d prop
selenium.type(INP_POR_PROPERTY, "dragadrop");
selenium.click(SUB_POR_PROPERTY);
selenium.waitForPageToLoad(PAGE_LOAD);
- r = findTableRow(TAB_PROPERTIES, "dragadrop", 0)-1;
- selenium.type(MessageFormat.format(TAB_PROP_VAL, r),"dragicek");
+ r = findTableRow(TAB_PROPERTIES, "dragadrop", 0) - 1;
+ selenium.type(MessageFormat.format(TAB_PROP_VAL, r), "dragicek");
selenium.click(SUB_POR_PROPS_UPDATE);
selenium.waitForPageToLoad(PAGE_LOAD);
-
+
goToProperties();
- //- assert d&d is added
- r = findTableRow(TAB_PROPERTIES, "dragadrop", 0)-1;
- Assert.assertTrue(r>-1,"Previously added property drag&drop not found in
the property table");
-
- //- add partial refresh prop
+ // - assert d&d is added
+ //selenium.setSpeed("5000");
+ r = findTableRow(TAB_PROPERTIES, "dragadrop", 0) - 1;
+ Assert.assertTrue(r > -1, "Previously added property drag&drop not found in
the property table");
+
+ // - add partial refresh prop
selenium.type(INP_POR_PROPERTY, "partialRef");
selenium.click(SUB_POR_PROPERTY);
- selenium.waitForPageToLoad("30000");
-
- r = findTableRow(TAB_PROPERTIES, "partialRef", 0)-1;
- selenium.type(MessageFormat.format(TAB_PROP_VAL, r),"partialicek");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ r = findTableRow(TAB_PROPERTIES, "partialRef", 0) - 1;
+ selenium.type(MessageFormat.format(TAB_PROP_VAL, r), "partialicek");
selenium.click(SUB_POR_PROPS_UPDATE);
selenium.waitForPageToLoad("30000");
-
+
goToProperties();
- //- assert partial refresh is added
- r = findTableRow(TAB_PROPERTIES, "partialRef", 0)-1;
- Assert.assertTrue(r>-1,"Previously added property partial refresh not found in
the property table");
-
- //- delete d&d prop
- r = findTableRow(TAB_PROPERTIES, "dragadrop", 0)-1;
+ // - assert partial refresh is added
+ r = findTableRow(TAB_PROPERTIES, "partialRef", 0) - 1;
+ Assert.assertTrue(r > -1, "Previously added property partial refresh not found
in the property table");
+
+ // - delete d&d prop
+ r = findTableRow(TAB_PROPERTIES, "dragadrop", 0) - 1;
selenium.click(MessageFormat.format(TAB_PROP_DEL, r));
selenium.waitForPageToLoad(PAGE_LOAD);
-
+
goToProperties();
- //- assert d&d is not present
- r = findTableRow(TAB_PROPERTIES, "dragadrop", 0)-1;
- Assert.assertTrue(r==-1,"Deleted property drag and drop was found in property
table.");
-
- //- delete partial refresh prop
- r = findTableRow(TAB_PROPERTIES, "partialRef", 0)-1;
+ // - assert d&d is not present
+ r = findTableRow(TAB_PROPERTIES, "dragadrop", 0) - 1;
+ Assert.assertTrue(r < 0, "Deleted property drag and drop was found in property
table.");
+
+ // - delete partial refresh prop
+ r = findTableRow(TAB_PROPERTIES, "partialRef", 0) - 1;
selenium.click(MessageFormat.format(TAB_PROP_DEL, r));
selenium.waitForPageToLoad(PAGE_LOAD);
goToProperties();
- //- assert partial refresh is not added
- r = findTableRow(TAB_PROPERTIES, "partialRef", 0)-1;
- Assert.assertTrue(r<0,"Deleted property partial refresh was found in property
table.");
-
+ // - assert partial refresh is not added
+ Assert.assertFalse(selenium.isElementPresent(TAB_PROPERTIES));
+
}
-
+
@Test(enabled = false, description = "Usecase for managing portals - error
handling.")
public void testPortalErrorHandlingUsecase() {
-
+
String LAB_RED = "Redirect to the specified resource";
String LAB_ERR = "Display the default error message";
String LAB_REM = "Remove the resource from page";
-
+
// ***
// *** Portal level
// ***
-
+
// select RED handling
goToProperties();
- selenium.select(SEL_POL_PA, "label="+LAB_RED);
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.select(SEL_POL_PU, "label="+LAB_RED);
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.select(SEL_POL_PE, "label="+LAB_RED);
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.select(SEL_POL_PI, "label="+LAB_RED);
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.select(SEL_POL_PN, "label="+LAB_RED);
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.type(SEL_POL_PR, "/WEB-INF/jsp/error/port3al.jsp");
+ selectIfNotSelected(SEL_POL_PA, LAB_RED);
+ selectIfNotSelected(SEL_POL_PU, LAB_RED);
+ selectIfNotSelected(SEL_POL_PE, LAB_RED);
+ selectIfNotSelected(SEL_POL_PI, LAB_RED);
+ selectIfNotSelected(SEL_POL_PN, LAB_RED);
+ selenium.type(INP_POL_PR, "/WEB-INF/jsp/error/portal.jsp");
selenium.click(SUB_POL);
selenium.waitForPageToLoad(PAGE_LOAD);
-
+
// assert RED handling
openAndAssert("/portal/auth/portal/default/Test/Exception+test/ExceptionPortletWindow?op=error&action=1",
"ERROR");
openAndAssert("/portal/auth/portal/default/Test/Exception+test/ExceptionPortletWindow?op=error&action=1",
"Powered by JBoss Portal");
-
+
// select ERR handling
goToProperties();
- selenium.select(SEL_POL_PA, "label="+LAB_ERR);
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.select(SEL_POL_PU, "label="+LAB_ERR);
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.select(SEL_POL_PE, "label="+LAB_ERR);
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.select(SEL_POL_PI, "label="+LAB_ERR);
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.select(SEL_POL_PN, "label="+LAB_ERR);
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.type(SEL_POL_PR, "/WEB-INF/jsp/error/port3al.jsp");
+ selectIfNotSelected(SEL_POL_PA, LAB_ERR);
+ selectIfNotSelected(SEL_POL_PU, LAB_ERR);
+ selectIfNotSelected(SEL_POL_PE, LAB_ERR);
+ selectIfNotSelected(SEL_POL_PI, LAB_ERR);
+ selectIfNotSelected(SEL_POL_PN, LAB_ERR);
+ selenium.type(INP_POL_PR, "/WEB-INF/jsp/error/portal.jsp");
selenium.click(SUB_POL);
selenium.waitForPageToLoad(PAGE_LOAD);
-
+
// assert ERR handling
openAndAssert("/portal/auth/portal/default/Test/Exception+test/ExceptionPortletWindow?op=error&action=1",
"HTTP Status 500");
-
+
// ***
// *** Page level
// ***
-
+
// select RED handling
goToProperties();
- selenium.select(SEL_PAL_PA, "label="+LAB_RED);
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.select(SEL_PAL_PC, "label="+LAB_RED);
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.select(SEL_PAL_PE, "label="+LAB_RED);
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.select(SEL_PAL_PI, "label="+LAB_RED);
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.select(SEL_PAL_PN, "label="+LAB_RED);
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.type(SEL_PAL_PR, "/WEB-INF/jsp/error/pa9ge.jsp");
+ selectIfNotSelected(SEL_PAL_PA, LAB_RED);
+ selectIfNotSelected(SEL_PAL_PC, LAB_RED);
+ selectIfNotSelected(SEL_PAL_PE, LAB_RED);
+ selectIfNotSelected(SEL_PAL_PI, LAB_RED);
+ selectIfNotSelected(SEL_PAL_PN, LAB_RED);
+ selenium.type(INP_PAL_PR, "/WEB-INF/jsp/error/page.jsp");
selenium.click(SUB_PAL);
selenium.waitForPageToLoad(PAGE_LOAD);
-
+
// assert RED handling
openAndAssert("/portal/auth/portal/default/Test/Exception+test/ExceptionPortletWindow?op=error&action=1",
"ERROR");
openAndAssert("/portal/auth/portal/default/Test/Exception+test/ExceptionPortletWindow?op=error&action=1",
"Powered by JBoss Portal");
-
+
// select ERR handling
goToProperties();
- selenium.select(SEL_PAL_PA, "label="+LAB_ERR);
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.select(SEL_PAL_PC, "label="+LAB_ERR);
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.select(SEL_PAL_PE, "label="+LAB_ERR);
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.select(SEL_PAL_PI, "label="+LAB_ERR);
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.select(SEL_PAL_PN, "label="+LAB_ERR);
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.type(SEL_PAL_PR, "/WEB-INF/jsp/error/pa9ge.jsp");
+ selectIfNotSelected(SEL_PAL_PA, LAB_ERR);
+ selectIfNotSelected(SEL_PAL_PC, LAB_ERR);
+ selectIfNotSelected(SEL_PAL_PE, LAB_ERR);
+ selectIfNotSelected(SEL_PAL_PI, LAB_ERR);
+ selectIfNotSelected(SEL_PAL_PN, LAB_ERR);
+ selenium.type(INP_PAL_PR, "/WEB-INF/jsp/error/page.jsp");
selenium.click(SUB_PAL);
selenium.waitForPageToLoad(PAGE_LOAD);
-
+
// assert ERR handling
openAndAssert("/portal/auth/portal/default/Test/Exception+test/ExceptionPortletWindow?op=error&action=1",
"ERROR");
openAndAssert("/portal/auth/portal/default/Test/Exception+test/ExceptionPortletWindow?op=error&action=1",
"Powered by JBoss Portal");
-
+
// select REM handling
goToProperties();
- selenium.select(SEL_PAL_PA, "label="+LAB_REM);
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.select(SEL_PAL_PC, "label="+LAB_REM);
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.select(SEL_PAL_PE, "label="+LAB_REM);
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.select(SEL_PAL_PI, "label="+LAB_REM);
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.select(SEL_PAL_PN, "label="+LAB_REM);
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.type(SEL_PAL_PR, "/WEB-INF/jsp/error/pa9ge.jsp");
+ selectIfNotSelected(SEL_PAL_PA, LAB_REM);
+ selectIfNotSelected(SEL_PAL_PC, LAB_REM);
+ selectIfNotSelected(SEL_PAL_PE, LAB_REM);
+ selectIfNotSelected(SEL_PAL_PI, LAB_REM);
+ selectIfNotSelected(SEL_PAL_PN, LAB_REM);
+ selenium.type(INP_PAL_PR, "/WEB-INF/jsp/error/page.jsp");
selenium.click(SUB_PAL);
selenium.waitForPageToLoad(PAGE_LOAD);
-
+
// assert REM handling
openAndAssert("/portal/auth/portal/default/Test/Exception+test/ExceptionPortletWindow?op=error&action=1",
"ERROR");
openAndAssert("/portal/auth/portal/default/Test/Exception+test/ExceptionPortletWindow?op=error&action=1",
"Powered by JBoss Portal");
}
-
- private void openAndAssert(String add, String ass){
+
+ private void openAndAssert(String add, String ass) {
selenium.open(add);
selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertTrue(selenium.isTextPresent(ass),"Text: {\"" + ass +
"\"} not found on the page");
+ Assert.assertTrue(selenium.isTextPresent(ass), "Text: {\"" + ass +
"\"} not found on the page");
}
private void goToProperties() {
@@ -427,7 +401,7 @@
clickIfVisible(TAB_PORTALOBJ_ID);
clickIfVisible(LNK_PORTALS_ID);
clickIfVisible(LNK_PORTAL_HOME);
-
+
selenium.click("link=Properties");
selenium.waitForPageToLoad(PAGE_LOAD);
}
@@ -435,12 +409,12 @@
private void assertPageContains(String pageName, String awaitStr) {
selenium.open(ADR_PORTAL);
selenium.waitForPageToLoad(PAGE_LOAD);
-
- if(selenium.isAlertPresent()){
- selenium.getAlert();
- debugPrint("[EndtoEndPortalAdminTestCase] - alert was caught");
+
+ if (selenium.isAlertPresent()) {
+ selenium.getAlert();
+ debugPrint("[EndtoEndPortalAdminTestCase] - alert was caught");
}
-
+
selenium.click("link=" + pageName);
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -537,21 +511,20 @@
selenium.waitForPageToLoad(PAGE_LOAD);
} else if ("cms".equals(type)) {
String[] links = portletName.split("/");
- selenium.click("link="+links[0]);
+ selenium.click("link=" + links[0]);
selenium.waitForPageToLoad(PAGE_LOAD);
portletName = links[1];
} else if ("filesystem".equals(type)) {
String[] links = portletName.split("/");
- selenium.click("link="+links[0]);
+ selenium.click("link=" + links[0]);
selenium.waitForPageToLoad(PAGE_LOAD);
portletName = links[1];
}
-
- selenium.click("link=*" + portletName+"*");
+
+ selenium.click("link=*" + portletName + "*");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click(SUB_LAYOUT_ADD_CENTER);
selenium.waitForPageToLoad(PAGE_LOAD);
-
}