Author: vrockai
Date: 2009-05-12 06:07:09 -0400 (Tue, 12 May 2009)
New Revision: 13339
Added:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/AdminPortalWizardTestCase.java
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/locator.properties
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/AdminPortalTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/testng.xml
Log:
[selenium] - portal admin wizard test added
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/locator.properties
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/locator.properties 2009-05-11
13:19:01 UTC (rev 13338)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/locator.properties 2009-05-12
10:07:09 UTC (rev 13339)
@@ -283,6 +283,25 @@
portal.admin.sel.pp.listener=//select[contains(@id,'edit-prop-form:listener')]
portal.admin.tbl.pp.props=//table[contains(@id,'common-manage-prop-form:prop-data-table')]
+# AdminPortalWizardTestCase
+
+portal.admin.wiz.sub.sub=_jbpnsAdminPortletWindowsnpbj:j_id20:wiz-conf-form:confirm
+portal.admin.wiz.sub.can=_jbpnsAdminPortletWindowsnpbj:j_id20:wiz-conf-form:cancel
+portal.admin.wiz.lnk.reg.c=_jbpnsAdminPortletWindowsnpbj:j_id28:region-wiz-form:region-1
+portal.admin.wiz.sub.portlet.type=_jbpnsAdminPortletWindowsnpbj:j_id169:portlet-wiz-form:wiz-change
+portal.admin.wiz.sel.portlet.type=_jbpnsAdminPortletWindowsnpbj:j_id169:portlet-wiz-form:menu
+portal.admin.wiz.lnk.wiz.mode=Link=*Switch to wizard mode*
+portal.admin.wiz.inp.submit.pagecreate=//input[contains(@id,'create-page-form:create-page')]
+portal.admin.wiz.inp.pagename=//input[contains(@id,'create-page-form:pageName')]
+portal.admin.wiz.inp.portalname=//input[contains(@id,'create-portal-form:name')]
+portal.admin.wiz.inp.submit.createportal=//input[contains(@id,'create-portal-form:create-portal')]
+portal.admin.wiz.tab.portalobj.id=Link=Admin
+portal.admin.wiz.lnk.portals.id=link=*Portal Objects*
+portal.admin.wiz.tab.portal.admin=//table[contains(@id,'obj-nav-form:portal-datatable')]
+portal.admin.wiz.por.tl.main=//a[contains(@id,''obj-nav-form:portal-datatable:{0}:object-iid-link'')]
+portal.admin.wiz.ul.paginator=//body/div[2]/div/div/div[2]/table/tbody/tr/td/div/div/div/div/div[6]/form[2]/ul[2]
+portal.admin.wiz.ul.paginator=//html/body/div[2]/div/div/div[2]/table/tbody/tr/td/div/div/div/div/div[6]/form[2]/table
+
# DashboardsTestCase
portal.dash.t.dh.sub.update=//form[contains(@id,'common-edit-theme-form')]/input[@type='submit']
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/AdminPortalTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/AdminPortalTestCase.java 2009-05-11
13:19:01 UTC (rev 13338)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/AdminPortalTestCase.java 2009-05-12
10:07:09 UTC (rev 13339)
@@ -607,7 +607,7 @@
* this page. Existence of text containing the name of window is asserted.
* At the page is loaded and the existence of the added portlet is asserted.
*/
- @Test(enabled = true, dependsOnMethods = { "testPortalCreate",
"testAddPage" }, description = "Creates a \"window\" on a
page")
+ @Test(enabled = true, dependsOnMethods = { "testPortalCreate",
"testAddPage" }, description = "Creates a 'window' on a
page")
public void testCreateWindow() {
final String portalName = "toAddWindowPortal";
Added:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/AdminPortalWizardTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/AdminPortalWizardTestCase.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/AdminPortalWizardTestCase.java 2009-05-12
10:07:09 UTC (rev 13339)
@@ -0,0 +1,189 @@
+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;
+
+/**
+ * AdminPortalTestCase is responsible for testing fundamental portal admin wizard
interface
+ * features of JBoss Portal.
+ *
+ * @author <a href="mailto:vrockai@redhat.com">Viliam Rockai</a>
+ *
+ */
+// TODO - adding of simple portlet - more portlet types
+@Test(groups = { "admin_portal" }, enabled = true, description = "Partal
administrating.")
+public class AdminPortalWizardTestCase extends JBossPortalSeleniumTestCase {
+
+ /** prefix for locator properties = portal.admin. */
+ public final String casePfx = "portal.admin.wiz.";
+
+ private final String SUB_SUB = getLoc(casePfx + "sub.sub",
"_jbpnsAdminPortletWindowsnpbj:j_id20:wiz-conf-form:confirm");
+ private final String SUB_CAN = getLoc(casePfx + "sub.can",
"_jbpnsAdminPortletWindowsnpbj:j_id20:wiz-conf-form:cancel");
+ private final String LNK_REG_C = getLoc(casePfx + "lnk.reg.c",
"_jbpnsAdminPortletWindowsnpbj:j_id28:region-wiz-form:region-1");
+ private final String SUB_PORTLET_TYPE = getLoc(casePfx + "sub.portlet.type",
"_jbpnsAdminPortletWindowsnpbj:j_id169:portlet-wiz-form:wiz-change");
+ private final String SEL_PORTLET_TYPE = getLoc(casePfx + "sel.portlet.type",
"_jbpnsAdminPortletWindowsnpbj:j_id169:portlet-wiz-form:menu");
+ private final String LNK_WIZ_MODE = getLoc(casePfx + "lnk.wiz.mode",
"Link=*Switch to wizard mode*");
+ private final String INP_SUBMIT_PAGECREATE = getLoc(casePfx +
"inp.submit.pagecreate",
"//input[contains(@id,'create-page-form:create-page')]");
+ private final String INP_PAGENAME = getLoc(casePfx + "inp.pagename",
"//input[contains(@id,'create-page-form:pageName')]");
+ private final String INP_PORTALNAME = getLoc(casePfx + "inp.portalname",
"//input[contains(@id,'create-portal-form:name')]");
+ private final String INP_SUBMIT_CREATEPORTAL = getLoc(casePfx +
"inp.submit.createportal",
"//input[contains(@id,'create-portal-form:create-portal')]");
+ private final String TAB_PORTALOBJ_ID = getLoc(casePfx + "tab.portalobj.id",
"Link=Admin");
+ private final String LNK_PORTALS_ID = getLoc(casePfx + "lnk.portals.id",
"link=*Portal Objects*");
+ private final String TAB_PORTAL_ADMIN = getLoc(casePfx + "tab.portal.admin",
"//table[contains(@id,'obj-nav-form:portal-datatable')]");
+ private final String POR_TL_MAIN = getLoc(casePfx + "por.tl.main",
"//a[contains(@id,''obj-nav-form:portal-datatable:{0}:object-iid-link'')]");
+ private final String UL_PAGINATOR = getLoc(casePfx + "ul.paginator",
"//body/div[2]/div/div/div[2]/table/tbody/tr/td/div/div/div/div/div[6]/form[2]/ul[2]");
+ private final String TAB_PORTLET_INSTANCES = getLoc(casePfx + "ul.paginator",
"//html/body/div[2]/div/div/div[2]/table/tbody/tr/td/div/div/div/div/div[6]/form[2]/table");
+
+ @BeforeMethod(groups = { "log" })
+ protected void loginBeforeTest() {
+ logoutIfPossible();
+ login("admin", "admin");
+ }
+
+ @AfterMethod(groups = { "log" })
+ protected void logoutAfterTest() {
+ }
+
+ /**
+ * Simple adding of counter portlet to "TestPortal" portal into page
"PageToWizard".
+ */
+ @Test(enabled = true, description = "Creates a new portal")
+ public void testSimpleWizard() {
+
+ String portalName = "TestPortal";
+ String pageName = "PageToWizard";
+ String portletType = "local";
+ String portletName = "Counter Portlet";
+
+ createPortal(portalName);
+ createPage(portalName, pageName);
+
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LNK_PORTALS_ID);
+
+ selenium.click(LNK_WIZ_MODE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ clickPortlet(portletType, portletName);
+
+ selenium.click("Link="+portalName);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("Link="+pageName);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LNK_REG_C);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(SUB_CAN);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ openAndWait("/portal/auth/portal/TestPortal/PageToWizard");
+ Assert.assertFalse(selenium.isTextPresent("Counter portlet"));
+
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LNK_PORTALS_ID);
+
+ clickPortlet(portletType, portletName);
+
+ selenium.click("Link="+portalName);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("Link="+pageName);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LNK_REG_C);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(SUB_SUB);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ openAndWait("/portal/auth/portal/TestPortal/PageToWizard");
+ Assert.assertTrue(selenium.isTextPresent("Counter portlet"));
+
+ }
+
+ private void clickPortlet(String type, String portletName){
+ selenium.select(SEL_PORTLET_TYPE, "label="+type);
+ selenium.click(SUB_PORTLET_TYPE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ if (traversePortlets(portletName, 0)>-1){
+ selenium.click("link="+portletName);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ }
+
+ }
+
+ private void createPortal(String name) {
+ selenium.open("/portal/");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LNK_PORTALS_ID);
+
+ selenium.type(INP_PORTALNAME, name);
+ selenium.click(INP_SUBMIT_CREATEPORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ }
+
+ private void createPage(String portalName, String pageName) {
+ selenium.open("/portal/");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LNK_PORTALS_ID);
+
+ int r = findTableRow(TAB_PORTAL_ADMIN, portalName, 0) - 1;
+
+ selenium.click(MessageFormat.format(POR_TL_MAIN, r));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.type(INP_PAGENAME, pageName);
+ selenium.click(INP_SUBMIT_PAGECREATE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ }
+
+ private int traversePortlets(String instance_name, int row) {
+
+ int r = -1;
+
+ r = findTableRow(TAB_PORTLET_INSTANCES, instance_name, row);
+
+ if (r >= 0)
+ return r;
+
+ String pages[] = getPages(UL_PAGINATOR);
+ for (String page : pages) {
+ if ("".equals(page.trim()))
+ continue;
+ selenium.click("link=" + page);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ r = findTableRow(TAB_PORTLET_INSTANCES, instance_name, row);
+
+ if (r >= 0)
+ break;
+ }
+
+ return r;
+ }
+
+ private String[] getPages(String paginator_location) {
+
+ String pagi = selenium.getText(paginator_location);
+ String[] pages = pagi.split(" ");
+
+ return pages;
+ }
+
+}
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/testng.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/testng.xml 2009-05-11 13:19:01 UTC
(rev 13338)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/testng.xml 2009-05-12 10:07:09 UTC
(rev 13339)
@@ -40,6 +40,12 @@
<class
name="org.jboss.portal.test.selenium.portal.AdminPortalTestCase"></class></classes>
</test>
+ <test
name="org.jboss.portal.test.selenium.portal.AdminPortalWizardTestCase"
+ verbose="2" annotations="JDK">
+ <classes>
+ <class
name="org.jboss.portal.test.selenium.portal.AdminPortalWizardTestCase"></class></classes>
+ </test>
+
<test
name="org.jboss.portal.test.selenium.portal.PortletDefinitionsTestCase"
verbose="2" annotations="JDK">
<classes>