[portal-commits] JBoss Portal SVN: r11980 - in branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium: cms and 1 other directories.
portal-commits at lists.jboss.org
portal-commits at lists.jboss.org
Thu Sep 25 08:57:45 EDT 2008
Author: vrockai
Date: 2008-09-25 08:57:45 -0400 (Thu, 25 Sep 2008)
New Revision: 11980
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/JBossPortalSeleniumTestCase.java
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/UserInterceptorPortletTestCase.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/CMSFileManipulationTestCase.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/src/org/jboss/portal/test/selenium/portal/AdminPortalTestCase.java
Log:
code refactorring, cleaning, bugfixing
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-09-25 11:41:52 UTC (rev 11979)
+++ branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/DashboardTestCase.java 2008-09-25 12:57:45 UTC (rev 11980)
@@ -6,10 +6,14 @@
import org.testng.Assert;
import com.sun.java_cup.internal.internal_error;
-
+/**
+ * @author <a href="mailto:vrockai at redhat.com">Viliam Rockai</a>
+ */
@Test(groups = { "cms_dashboard" }, enabled = true, description = "Dashboard issues test case.")
public class DashboardTestCase extends JBossPortalSeleniumTestCase {
+ private static final String LINK_CONFIGURE_DASHBOARD = "link=Configure dashboard";
+ private static final String LINK_DASHBOARD = "link=Dashboard";
private static final String SELECT_PAGE = "page-selector-form:pageNameSelector";
private static final String INPUT_PAGENAME = "dashboard-form:pageName";
private static final String SUBMIT_CREATEPAGE = "dashboard-form:save-button";
@@ -30,14 +34,14 @@
@Test(enabled = true)
public void testCreatePage() {
- selenium.click("link=Dashboard");
+ selenium.click(LINK_DASHBOARD);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=Configure dashboard");
+ selenium.click(LINK_CONFIGURE_DASHBOARD);
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.type(INPUT_PAGENAME, "DashTestPage");
selenium.click(SUBMIT_CREATEPAGE);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=Dashboard");
+ selenium.click(LINK_DASHBOARD);
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isElementPresent("link=DashTestPage"));
selenium.click("link=DashTestPage");
@@ -47,21 +51,19 @@
@Test(enabled = true, dependsOnMethods = { "testCreatePage" })
public void testUpdateTheme() {
- selenium.click("link=Dashboard");
+ selenium.click(LINK_DASHBOARD);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=Configure dashboard");
+ selenium.click(LINK_CONFIGURE_DASHBOARD);
selenium.waitForPageToLoad(PAGE_LOAD);
- if (!selenium.getSelectedLabel(SELECT_PAGE).equals("DashTestPage"))
- selenium.select(SELECT_PAGE, "label=DashTestPage");
- selenium.waitForPageToLoad(PAGE_LOAD);
+ selectIfNotSelected("DashTestPage");
selenium.select(SELECT_THEME, "label=renaissance");
selenium.click(SUBMIT_THEMESEL);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=Dashboard");
+ selenium.click(LINK_DASHBOARD);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=Configure dashboard");
+ selenium.click(LINK_CONFIGURE_DASHBOARD);
selenium.waitForPageToLoad(PAGE_LOAD);
if (!selenium.getSelectedLabel(SELECT_PAGE).equals("DashTestPage")) {
@@ -70,26 +72,30 @@
}
- Assert.assertEquals("renaissance", selenium.getSelectedLabel(SELECT_THEME));
+ Assert.assertEquals(selenium.getSelectedLabel(SELECT_THEME), "renaissance","Previously selected theme other then expected.");
}
+ private void selectIfNotSelected(String label) {
+ if (!selenium.getSelectedLabel(SELECT_PAGE).equals(label))
+ selenium.select(SELECT_PAGE, "label="+label);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ }
+
@Test(enabled = true, dependsOnMethods = { "testCreatePage" })
public void testUpdateLayout() {
- selenium.click("link=Dashboard");
+ selenium.click(LINK_DASHBOARD);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=Configure dashboard");
+ selenium.click(LINK_CONFIGURE_DASHBOARD);
selenium.waitForPageToLoad(PAGE_LOAD);
- if (!selenium.getSelectedLabel(SELECT_PAGE).equals("DashTestPage"))
- selenium.select(SELECT_PAGE, "label=DashTestPage");
- selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertEquals("default", selenium.getSelectedLabel(SELECT_LAYOUT));
+ selectIfNotSelected("DashTestPage");
+ Assert.assertEquals(selenium.getSelectedLabel(SELECT_LAYOUT),"default","Default layout is not called \"default\".");
selenium.select(SELECT_LAYOUT, "label=generic");
selenium.click(SUBMIT_LAYOUTSEL);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=Dashboard");
+ selenium.click(LINK_DASHBOARD);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=Configure dashboard");
+ selenium.click(LINK_CONFIGURE_DASHBOARD);
selenium.waitForPageToLoad(PAGE_LOAD);
if (!selenium.getSelectedLabel(SELECT_PAGE).equals("DashTestPage")) {
@@ -97,24 +103,22 @@
selenium.waitForPageToLoad(PAGE_LOAD);
}
- Assert.assertEquals("generic", selenium.getSelectedLabel(SELECT_LAYOUT));
+ Assert.assertEquals(selenium.getSelectedLabel(SELECT_LAYOUT),"generic","Previously selected layout other then expected.");
}
@Test(enabled = true, dependsOnMethods = { "testCreatePage" })
public void testAddPortlet() {
- selenium.click("link=Dashboard");
+ selenium.click(LINK_DASHBOARD);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=Configure dashboard");
+ selenium.click(LINK_CONFIGURE_DASHBOARD);
selenium.waitForPageToLoad(PAGE_LOAD);
- if (!selenium.getSelectedLabel(SELECT_PAGE).equals("DashTestPage"))
- selenium.select(SELECT_PAGE, "label=DashTestPage");
- selenium.waitForPageToLoad(PAGE_LOAD);
+ selectIfNotSelected("DashTestPage");
selenium.click("link=Who's online portlet");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("layoutForm:a_center");
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=Dashboard");
+ selenium.click(LINK_DASHBOARD);
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=DashTestPage");
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -125,27 +129,23 @@
@Test(enabled = false, dependsOnMethods = { "testCreatePage" })
public void testAddGooglePortlet() {
- selenium.click("link=Dashboard");
+ selenium.click(LINK_DASHBOARD);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=Configure dashboard");
+ selenium.click(LINK_CONFIGURE_DASHBOARD);
selenium.waitForPageToLoad(PAGE_LOAD);
- if (!selenium.getSelectedLabel(SELECT_PAGE).equals("DashTestPage"))
- selenium.select(SELECT_PAGE, "label=DashTestPage");
- selenium.waitForPageToLoad(PAGE_LOAD);
+ selectIfNotSelected("DashTestPage");
selenium.select("abc:instanceId", "label=widget/google");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=Hindu God of the Week");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("layoutForm:a_center");
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=Dashboard");
+ selenium.click(LINK_DASHBOARD);
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=DashTestPage");
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isTextPresent("Hindu God of the Week"));
- //Assert.assertTrue(selenium.isTextPresent("powered by Google"));
- //selenium.setSpeed("0");
}
@Test(enabled = false, dependsOnMethods = { "testCreatePage" })
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-09-25 11:41:52 UTC (rev 11979)
+++ branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/JBossPortalSeleniumTestCase.java 2008-09-25 12:57:45 UTC (rev 11980)
@@ -6,10 +6,19 @@
import com.thoughtworks.selenium.DefaultSelenium;
import com.thoughtworks.selenium.Selenium;
-
+/**
+ * @author <a href="mailto:vrockai at 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";
protected Selenium selenium;
- protected static final String PAGE_LOAD = "150000";
+ protected static final String PAGE_LOAD = "250000";
@BeforeClass
public void setupChromeForLogin() throws Exception {
@@ -41,7 +50,6 @@
}
}
for (String link : selenium.getAllFields()) {
- //System.out.println(link);
if (link.equals(id)) {
return true;
}
@@ -60,11 +68,11 @@
protected void login(String username, String password) {
selenium.setTimeout("0");
- selenium.open("/portal/");
+ selenium.open(ADDR_PORTAL);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=Login");
- selenium.selectFrame("login-content");
+ selenium.click(LINK_LOGIN);
+ selenium.selectFrame(FRAME_LOGIN_CONTENT);
try {
Thread.sleep(2000);
@@ -73,20 +81,19 @@
e.printStackTrace();
}
- //selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.type("j_username", username);
- selenium.type("j_password", password);
- Assert.assertTrue(selenium.isElementPresent("login"));
- selenium.click("login");
+ selenium.type(INPUT_USERNAME, username);
+ selenium.type(INPUT_PASSWORD, password);
+ Assert.assertTrue(selenium.isElementPresent(SUBMIT_LOGIN));
+ selenium.click(SUBMIT_LOGIN);
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isTextPresent("Logged in as: "+username), "Not logged in, login message missing.");
}
protected void logout() {
- selenium.open("/portal/");
+ selenium.open(ADDR_PORTAL);
selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertTrue(selenium.isElementPresent("link=Logout"));
- selenium.click("link=Logout");
+ Assert.assertTrue(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_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/UserInterceptorPortletTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/UserInterceptorPortletTestCase.java 2008-09-25 11:41:52 UTC (rev 11979)
+++ branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/UserInterceptorPortletTestCase.java 2008-09-25 12:57:45 UTC (rev 11980)
@@ -10,7 +10,9 @@
import org.testng.annotations.Test;
import com.sun.org.apache.xerces.internal.impl.dtd.models.DFAContentModel;
-
+/**
+ * @author <a href="mailto:vrockai at redhat.com">Viliam Rockai</a>
+ */
@Test(groups = { "cms_user_interceptor" }, enabled = true, description = "Checking the log of logging of users.")
public class UserInterceptorPortletTestCase extends JBossPortalSeleniumTestCase {
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-09-25 11:41:52 UTC (rev 11979)
+++ branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/WSRPTestCase.java 2008-09-25 12:57:45 UTC (rev 11980)
@@ -8,7 +8,9 @@
import org.testng.Assert;
import com.sun.java_cup.internal.internal_error;
-
+/**
+ * @author <a href="mailto:vrockai at redhat.com">Viliam Rockai</a>
+ */
@Test(groups = { "cms_wsrp" }, enabled = true, description = "WSRP test case.")
public class WSRPTestCase extends JBossPortalSeleniumTestCase {
Modified: branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileManipulationTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileManipulationTestCase.java 2008-09-25 11:41:52 UTC (rev 11979)
+++ branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileManipulationTestCase.java 2008-09-25 12:57:45 UTC (rev 11980)
@@ -5,7 +5,9 @@
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
-
+/**
+ * @author <a href="mailto:vrockai at redhat.com">Viliam Rockai</a>
+ */
@Test(groups = { "cms_file" }, enabled = true)
public class CMSFileManipulationTestCase extends JBossPortalSeleniumTestCase {
private static final String SELECT_CMS_MAIN = "//div[@id='center']/div/div/div[1]/div/select";
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-09-25 11:41:52 UTC (rev 11979)
+++ branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSSecureTestCase.java 2008-09-25 12:57:45 UTC (rev 11980)
@@ -4,7 +4,6 @@
import org.jboss.portal.test.selenium.IdentityAdminTestCase;
import org.jboss.portal.test.selenium.JBossPortalSeleniumTestCase;
-import org.jboss.portal.test.selenium.portal.AdminPortalTestCase;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
@@ -17,6 +16,21 @@
@Test(groups = { "cms_secure" }, enabled = true, description = "Setting permissions on the default portlet.")
public class CMSSecureTestCase extends JBossPortalSeleniumTestCase {
+ private static final String LINK_EXPLORE = "link=Explore";
+ private static final String LINK_SUPPORT_HTML = "link=support.html";
+ private static final String LINK_MEMBERS = "link=Members";
+ private static final String SUBMIT_SECURITY_SET = "submit";
+ private static final String SELECT_SECUREUSERS_MANAGE = "secureusers:manage";
+ private static final String SELECT_SECUREROLES_MANAGE = "secureroles:manage";
+ private static final String SELECT_SECUREUSERS_WRITE = "secureusers:write";
+ private static final String SELECT_SECUREROLES_WRITE = "secureroles:write";
+ private static final String SELECT_SECUREUSERS_READ = "secureusers:read";
+ private static final String SELECT_SECUREROLES_READ = "secureroles:read";
+ private static final String LINK_INDEX_HTML = "link=index.html";
+ private static final String LINK_DEFAULT = "link=default";
+ private static final String LINK_CMS = "link=CMS";
+ private static final String LINK_ADMIN = "link=Admin";
+ private static final String LINK_LOGOUT = "link=Logout";
private static final String SELECT_CMS_ACTION = "//div[@id='center']/div/div/div[1]/div/select";
@AfterMethod(groups = { "log" })
@@ -24,8 +38,8 @@
selenium.open("/portal/");
selenium.waitForPageToLoad(PAGE_LOAD);
- if (selenium.isElementPresent("link=Logout")) {
- selenium.click("link=Logout");
+ if (selenium.isElementPresent(LINK_LOGOUT)) {
+ selenium.click(LINK_LOGOUT);
selenium.waitForPageToLoad(PAGE_LOAD);
}
@@ -34,23 +48,23 @@
private void resetSecurity() {
login("admin", "admin");
- selenium.click("link=Admin");
+ selenium.click(LINK_ADMIN);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=CMS");
+ selenium.click(LINK_CMS);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=default");
+ selenium.click(LINK_DEFAULT);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=index.html");
+ selenium.click(LINK_INDEX_HTML);
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.select(SELECT_CMS_ACTION, "label=Secure");
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.select("secureroles:read", "label=Anonymous");
- selenium.select("secureusers:read", "label=admin");
- selenium.select("secureroles:write", "label=Administrators");
- selenium.select("secureusers:write", "label=admin");
- selenium.select("secureroles:manage", "label=Administrators");
- selenium.select("secureusers:manage", "label=admin");
- selenium.click("submit");
+ selenium.select(SELECT_SECUREROLES_READ, "label=Anonymous");
+ selenium.select(SELECT_SECUREUSERS_READ, "label=admin");
+ selenium.select(SELECT_SECUREROLES_WRITE, "label=Administrators");
+ selenium.select(SELECT_SECUREUSERS_WRITE, "label=admin");
+ selenium.select(SELECT_SECUREROLES_MANAGE, "label=Administrators");
+ selenium.select(SELECT_SECUREUSERS_MANAGE, "label=admin");
+ selenium.click(SUBMIT_SECURITY_SET);
selenium.waitForPageToLoad(PAGE_LOAD);
logout();
}
@@ -62,9 +76,9 @@
login("admin", "admin");
- selenium.click("link=Admin");
+ selenium.click(LINK_ADMIN);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=Members");
+ selenium.click(LINK_MEMBERS);
selenium.waitForPageToLoad(PAGE_LOAD);
clickIfVisible(IdentityAdminTestCase.ID_LINK_ROLETAB);
@@ -84,33 +98,33 @@
public void testSetAdminReadPer() {
login("admin", "admin");
- Assert.assertFalse(selenium.isTextPresent("Access Denied"));
- Assert.assertFalse(selenium.isTextPresent("You are not allowed to access the following resource - /default/index.html"));
+ 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.click(LINK_ADMIN);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=CMS");
+ selenium.click(LINK_CMS);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=default");
+ selenium.click(LINK_DEFAULT);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=index.html");
+ selenium.click(LINK_INDEX_HTML);
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.select(SELECT_CMS_ACTION, "label=Secure");
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.select("secureroles:read", "label=Administrators");
- selenium.select("secureusers:read", "label=admin");
+ selenium.select(SELECT_SECUREROLES_READ, "label=Administrators");
+ selenium.select(SELECT_SECUREUSERS_READ, "label=admin");
- selenium.click("submit");
+ selenium.click(SUBMIT_SECURITY_SET);
selenium.waitForPageToLoad(PAGE_LOAD);
logout();
- Assert.assertTrue(selenium.isTextPresent("Access Denied"));
+ Assert.assertTrue(selenium.isTextPresent("Access Denied"),"Secured resource is visible.#1");
login("user", "user");
- Assert.assertTrue(selenium.isTextPresent("Access Denied"));
+ Assert.assertTrue(selenium.isTextPresent("Access Denied"),"Secured resource is visible.#2");
logout();
}
@@ -119,30 +133,30 @@
public void testSetUserReadPer() {
login("admin", "admin");
- Assert.assertFalse(selenium.isTextPresent("Access Denied"));
- Assert.assertFalse(selenium.isTextPresent("You are not allowed to access the following resource - /default/index.html"));
+ 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.click(LINK_ADMIN);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=CMS");
+ selenium.click(LINK_CMS);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=default");
+ selenium.click(LINK_DEFAULT);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=index.html");
+ selenium.click(LINK_INDEX_HTML);
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.select(SELECT_CMS_ACTION, "label=Secure");
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.select("secureroles:read", "label=Administrators");
- selenium.select("secureusers:read", "label=user");
- selenium.click("submit");
+ selenium.select(SELECT_SECUREROLES_READ, "label=Administrators");
+ selenium.select(SELECT_SECUREUSERS_READ, "label=user");
+ selenium.click(SUBMIT_SECURITY_SET);
selenium.waitForPageToLoad(PAGE_LOAD);
logout();
- Assert.assertTrue(selenium.isTextPresent("Access Denied"));
+ Assert.assertTrue(selenium.isTextPresent("Access Denied"),"Secured resource is visible.#1");
login("user", "user");
- Assert.assertFalse(selenium.isTextPresent("Access Denied"));
+ Assert.assertFalse(selenium.isTextPresent("Access Denied"),"Secured resource is visible.#2");
logout();
}
@@ -153,35 +167,35 @@
assignRole("user", "user at portal.com", "secRole", "secRoleDisp");
- Assert.assertFalse(selenium.isTextPresent("Access Denied"));
- Assert.assertFalse(selenium.isTextPresent("You are not allowed to access the following resource - /default/index.html"));
+ 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.click(LINK_ADMIN);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=CMS");
+ selenium.click(LINK_CMS);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=default");
+ selenium.click(LINK_DEFAULT);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=index.html");
+ selenium.click(LINK_INDEX_HTML);
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.select(SELECT_CMS_ACTION, "label=Secure");
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.select("secureroles:read", "label=secRoleDisp");
- selenium.select("secureusers:read", "label=admin");
- selenium.click("submit");
+ selenium.select(SELECT_SECUREROLES_READ, "label=secRoleDisp");
+ selenium.select(SELECT_SECUREUSERS_READ, "label=admin");
+ selenium.click(SUBMIT_SECURITY_SET);
selenium.waitForPageToLoad(PAGE_LOAD);
logout();
- Assert.assertTrue(selenium.isTextPresent("Access Denied"));
+ Assert.assertTrue(selenium.isTextPresent("Access Denied"),"Secured resource is visible after logout.");
login("user", "user");
- Assert.assertFalse(selenium.isTextPresent("Access Denied"));
+ Assert.assertFalse(selenium.isTextPresent("Access Denied"),"Non secured resource is not visible for the \"user\".");
logout();
}
- @Test(enabled = true, description = "Set admin/secRole read permissions, login as user w/o secRole.")
+ @Test(enabled = true,description = "Set admin/secRole read permissions, login as user w/o secRole.")
public void testSetRoleReadPer2() {
login("admin", "admin");
@@ -190,19 +204,19 @@
Assert.assertFalse(selenium.isTextPresent("Access Denied"));
Assert.assertFalse(selenium.isTextPresent("You are not allowed to access the following resource - /default/index.html"));
- selenium.click("link=Admin");
+ selenium.click(LINK_ADMIN);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=CMS");
+ selenium.click(LINK_CMS);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=default");
+ selenium.click(LINK_DEFAULT);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=index.html");
+ selenium.click(LINK_INDEX_HTML);
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.select(SELECT_CMS_ACTION, "label=Secure");
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.select("secureroles:read", "label=secRoleDisp");
- selenium.select("secureusers:read", "label=admin");
- selenium.click("submit");
+ selenium.select(SELECT_SECUREROLES_READ, "label=secRoleDisp");
+ selenium.select(SELECT_SECUREUSERS_READ, "label=admin");
+ selenium.click(SUBMIT_SECURITY_SET);
selenium.waitForPageToLoad(PAGE_LOAD);
logout();
@@ -225,19 +239,19 @@
Assert.assertFalse(selenium.isTextPresent("Access Denied"));
Assert.assertFalse(selenium.isTextPresent("You are not allowed to access the following resource - /default/index.html"));
- selenium.click("link=Admin");
+ selenium.click(LINK_ADMIN);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=CMS");
+ selenium.click(LINK_CMS);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=default");
+ selenium.click(LINK_DEFAULT);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=index.html");
+ selenium.click(LINK_INDEX_HTML);
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.select(SELECT_CMS_ACTION, "label=Secure");
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.select("secureroles:read", "label=secRoleDisp");
- selenium.select("secureusers:read", "label=admin");
- selenium.click("submit");
+ selenium.select(SELECT_SECUREROLES_READ, "label=secRoleDisp");
+ selenium.select(SELECT_SECUREUSERS_READ, "label=admin");
+ selenium.click(SUBMIT_SECURITY_SET);
selenium.waitForPageToLoad(PAGE_LOAD);
logout();
@@ -250,42 +264,44 @@
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium
.isTextPresent("Thank you for downloading and deploying JBoss Portal. We hope your enjoy working with it as much as we enjoy developing it!"));
- selenium.click("link=Explore");
+ selenium.click(LINK_EXPLORE);
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertFalse(selenium
.isTextPresent("Thank you for downloading and deploying JBoss Portal. We hope your enjoy working with it as much as we enjoy developing it!"));
login("admin", "admin");
- selenium.click("link=Admin");
+ selenium.click(LINK_ADMIN);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=CMS");
+ selenium.click(LINK_CMS);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=default");
+ selenium.click(LINK_DEFAULT);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=support.html");
+ selenium.click(LINK_SUPPORT_HTML);
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.select(SELECT_CMS_ACTION, "label=Secure");
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.select("secureroles:read", "label=Administrators");
- selenium.select("secureusers:read", "label=admin");
- selenium.select("secureroles:write", "label=Administrators");
- selenium.select("secureusers:write", "label=admin");
- selenium.select("secureroles:manage", "label=Administrators");
- selenium.select("secureusers:manage", "label=admin");
- selenium.click("submit");
+ selenium.select(SELECT_SECUREROLES_READ, "label=Administrators");
+ selenium.select(SELECT_SECUREUSERS_READ, "label=admin");
+ selenium.select(SELECT_SECUREROLES_WRITE, "label=Administrators");
+ selenium.select(SELECT_SECUREUSERS_WRITE, "label=admin");
+ selenium.select(SELECT_SECUREROLES_MANAGE, "label=Administrators");
+ selenium.select(SELECT_SECUREUSERS_MANAGE, "label=admin");
+ selenium.click(SUBMIT_SECURITY_SET);
selenium.waitForPageToLoad(PAGE_LOAD);
logout();
Assert.assertTrue(selenium
.isTextPresent("Thank you for downloading and deploying JBoss Portal. We hope your enjoy working with it as much as we enjoy developing it!"));
selenium.open("/portal/portal/default");
- selenium.click("link=Explore");
selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LINK_EXPLORE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium
.isTextPresent("Thank you for downloading and deploying JBoss Portal. We hope your enjoy working with it as much as we enjoy developing it!"));
}
+ //TODO these functions should be used from indetity admin
void assignRole(String user, String email, String role, String roleDisplay) {
searchUser(user, email);
@@ -334,9 +350,9 @@
void searchUser(String username, String email) {
selenium.open("/portal/");
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=Admin");
+ selenium.click(LINK_ADMIN);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=Members");
+ selenium.click(LINK_MEMBERS);
selenium.waitForPageToLoad(PAGE_LOAD);
clickIfVisible(IdentityAdminTestCase.ID_LINK_USERTAB);
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-09-25 11:41:52 UTC (rev 11979)
+++ branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/AdminPortalTestCase.java 2008-09-25 12:57:45 UTC (rev 11980)
@@ -8,6 +8,9 @@
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+/**
+ * @author <a href="mailto:vrockai at redhat.com">Viliam Rockai</a>
+ */
@Test(groups = { "admin_portal" }, enabled = true, description = "Partal administrating.")
public class AdminPortalTestCase extends JBossPortalSeleniumTestCase {
@@ -20,7 +23,7 @@
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 LINK_PORTALS_ID = "link=*Portal Objects*";
private final String LINK_PORTAL_HOME = "_id8jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj:_id11jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj";
@@ -125,8 +128,7 @@
Assert.assertTrue(selenium.isTextPresent("WARNING! You are about to delete the TestDelete portal from the context!"));
Assert.assertTrue(selenium.isTextPresent("Delete portal"));
Assert.assertTrue(selenium.isTextPresent("Are you sure you want to delete this portal?"));
- selenium
- .click(SUBMIT_DELETE_PORTAL_CONF);
+ selenium.click(SUBMIT_DELETE_PORTAL_CONF);
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isTextPresent("TestDelete has successfully been destroyed"));
@@ -148,8 +150,6 @@
final String portalName = "TestAddPortal";
final String portalPage = "tPage";
- // selenium.setSpeed("5000");
-
selenium.type(INPUT_PORTALNAME, portalName);
selenium.click(INPUT_SUBMIT_CREATEPORTAL);
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -158,8 +158,8 @@
selenium.click(MessageFormat.format(POR_TL_MAIN, r));
selenium.waitForPageToLoad(PAGE_LOAD);
-
- Assert.assertFalse(selenium.isTextPresent(portalPage),"Portal page already present");
+
+ Assert.assertFalse(selenium.isTextPresent(portalPage), "Portal page already present");
Assert.assertTrue(selenium.isTextPresent("Create a page named:"));
selenium.type(INPUT_PAGENAME, portalPage);
@@ -255,6 +255,7 @@
private void createPage(String portalName, String pageName) {
selenium.open("/portal/");
+ selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=Admin");
selenium.waitForPageToLoad(PAGE_LOAD);
More information about the portal-commits
mailing list