[portal-commits] JBoss Portal SVN: r11952 - in branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium: cms and 1 other directory.
portal-commits at lists.jboss.org
portal-commits at lists.jboss.org
Tue Sep 23 11:12:31 EDT 2008
Author: vrockai
Date: 2008-09-23 11:12:31 -0400 (Tue, 23 Sep 2008)
New Revision: 11952
Added:
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/CMSFileNoWorkflowTestCase.java
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/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/CMSDirectoryTestCase.java
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSSecureTestCase.java
Log:
2.6 tests update
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-23 14:53:05 UTC (rev 11951)
+++ branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/DashboardTestCase.java 2008-09-23 15:12:31 UTC (rev 11952)
@@ -10,6 +10,14 @@
@Test(groups = { "cms_dashboard" }, enabled = true, description = "Dashboard issues test case.")
public class DashboardTestCase extends JBossPortalSeleniumTestCase {
+ 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";
+ private static final String SELECT_LAYOUT = "dashboardLayoutForm:layoutSelector";
+ private static final String SUBMIT_LAYOUTSEL = "dashboardLayoutForm:update-layout";
+ private static final String SELECT_THEME = "dashboardThemeForm:themeSelector";
+ private static final String SUBMIT_THEMESEL = "dashboardThemeForm:update-theme";
+
@BeforeMethod(groups = { "log" })
public void loginBeforeTest() {
//selenium.setSpeed("3000");
@@ -27,8 +35,8 @@
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=Configure dashboard");
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.type("_id3jbpnsabcsnpbj:pageName", "DashTestPage");
- selenium.click("_id3jbpnsabcsnpbj:_id4jbpnsabcsnpbj");
+ selenium.type(INPUT_PAGENAME, "DashTestPage");
+ selenium.click(SUBMIT_CREATEPAGE);
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=Dashboard");
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -38,59 +46,65 @@
Assert.assertTrue(selenium.isTextPresent("Powered by JBoss Portal"));
}
- @Test(enabled = false, dependsOnMethods = { "testCreatePage" })
+ @Test(enabled = true, dependsOnMethods = { "testCreatePage" })
public void testUpdateTheme() {
selenium.click("link=Dashboard");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=Configure dashboard");
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.select("page_selector_form:pageNameSelector", "label=DashTestPage");
- selenium.waitForPageToLoad(PAGE_LOAD);
+
+
+ System.out.println(selenium.getSelectedLabel(SELECT_PAGE));
+ if (!selenium.getSelectedLabel(SELECT_PAGE).equals("DashTestPage"))
+ selenium.select(SELECT_PAGE, "label=DashTestPage");
+
+ //selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.select("_id15jbpnsabcsnpbj:themeSelector", "label=renaissance");
- selenium.click("_id15jbpnsabcsnpbj:_id18jbpnsabcsnpbj");
+ selenium.select(SELECT_THEME, "label=renaissance");
+ selenium.click(SUBMIT_THEMESEL);
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=Dashboard");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=Configure dashboard");
selenium.waitForPageToLoad(PAGE_LOAD);
- if (!selenium.getSelectedLabel("page_selector_form:pageNameSelector").equals("DashTestPage")) {
- selenium.select("page_selector_form:pageNameSelector", "label=DashTestPage");
+ if (!selenium.getSelectedLabel(SELECT_PAGE).equals("DashTestPage")) {
+ selenium.select(SELECT_PAGE, "label=DashTestPage");
selenium.waitForPageToLoad(PAGE_LOAD);
}
//System.out.println(selenium.isElementPresent("_id15jbpnsabcsnpbj:themeSelector"));
//System.out.println(selenium.getSelectedLabel("_id15jbpnsabcsnpbj:themeSelector"));
- Assert.assertEquals("renaissance", selenium.getSelectedLabel("_id15jbpnsabcsnpbj:themeSelector"));
+ Assert.assertEquals("renaissance", selenium.getSelectedLabel(SELECT_THEME));
}
- @Test(enabled = false, dependsOnMethods = { "testCreatePage" })
+ @Test(enabled = true, dependsOnMethods = { "testCreatePage" })
public void testUpdateLayout() {
selenium.click("link=Dashboard");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=Configure dashboard");
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.select("page_selector_form:pageNameSelector", "label=DashTestPage");
- 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("_id10jbpnsabcsnpbj:layoutSelector"));
+ Assert.assertEquals("default", selenium.getSelectedLabel(SELECT_LAYOUT));
- selenium.select("_id10jbpnsabcsnpbj:layoutSelector", "label=generic");
- selenium.click("_id15jbpnsabcsnpbj:_id18jbpnsabcsnpbj");
+ selenium.select(SELECT_LAYOUT, "label=generic");
+ selenium.click(SUBMIT_LAYOUTSEL);
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=Dashboard");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=Configure dashboard");
selenium.waitForPageToLoad(PAGE_LOAD);
- if (!selenium.getSelectedLabel("page_selector_form:pageNameSelector").equals("DashTestPage")) {
- selenium.select("page_selector_form:pageNameSelector", "label=DashTestPage");
+ if (!selenium.getSelectedLabel(SELECT_PAGE).equals("DashTestPage")) {
+ selenium.select(SELECT_PAGE, "label=DashTestPage");
selenium.waitForPageToLoad(PAGE_LOAD);
}
- Assert.assertEquals("generic", selenium.getSelectedLabel("_id10jbpnsabcsnpbj:layoutSelector"));
+ Assert.assertEquals("generic", selenium.getSelectedLabel(SELECT_LAYOUT));
}
@Test(enabled = true, dependsOnMethods = { "testCreatePage" })
@@ -100,8 +114,9 @@
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=Configure dashboard");
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.select("page_selector_form:pageNameSelector", "label=DashTestPage");
- selenium.waitForPageToLoad(PAGE_LOAD);
+ if (!selenium.getSelectedLabel(SELECT_PAGE).equals("DashTestPage"))
+ selenium.select(SELECT_PAGE, "label=DashTestPage");
+ //selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=Who's online portlet");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("layoutForm:a_center");
@@ -115,14 +130,15 @@
Assert.assertTrue(selenium.isTextPresent("[admin]"));
}
- @Test(enabled = false, dependsOnMethods = { "testCreatePage" })
+ @Test(enabled = true, dependsOnMethods = { "testCreatePage" })
public void testAddGooglePortlet() {
selenium.click("link=Dashboard");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=Configure dashboard");
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.select("page_selector_form:pageNameSelector", "label=DashTestPage");
- selenium.waitForPageToLoad(PAGE_LOAD);
+ if (!selenium.getSelectedLabel(SELECT_PAGE).equals("DashTestPage"))
+ selenium.select(SELECT_PAGE, "label=DashTestPage");
+ //selenium.waitForPageToLoad(PAGE_LOAD);
selenium.select("abc:instanceId", "label=widget/google");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=Hindu God of the Week");
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-23 14:53:05 UTC (rev 11951)
+++ branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/JBossPortalSeleniumTestCase.java 2008-09-23 15:12:31 UTC (rev 11952)
@@ -18,7 +18,6 @@
selenium = new DefaultSelenium("127.0.0.1", 44444, browser, "http://localhost:8080/portal/");
selenium.start();
- selenium.setTimeout("300000");
}
@AfterClass
@@ -27,12 +26,10 @@
}
protected void clickIfVisible(String id) {
- if (findLink(id)) {
- selenium.click(id);
- selenium.waitForPageToLoad(PAGE_LOAD);
- }
+
if (selenium.isElementPresent(id)){
selenium.click(id);
+
selenium.waitForPageToLoad(PAGE_LOAD);
}
}
@@ -62,6 +59,7 @@
}
protected void login(String username, String password) {
+ selenium.setTimeout("0");
selenium.open("/portal/");
selenium.waitForPageToLoad(PAGE_LOAD);
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-09-23 14:53:05 UTC (rev 11951)
+++ branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/PortletUserCreationTestCase.java 2008-09-23 15:12:31 UTC (rev 11952)
@@ -9,21 +9,21 @@
@Test(groups = { "portlet_user_creation" }, enabled = true)
public class PortletUserCreationTestCase extends JBossPortalSeleniumTestCase {
- private static final String SUBMIT_CREATE_CONF = "_id14jbpns_2fdefault_2fdefault_2fIdentityUserPortletWindowsnpbj:user";
+ private static final String SUBMIT_CREATE_CONF = "confirm-form:user";
- private static final String SUBMIT_CREATE_USER = "_id14jbpns_2fdefault_2fdefault_2fIdentityUserPortletWindowsnpbj:submit";
+ private static final String SUBMIT_CREATE_USER = "register-form:submit";
- private static final String INPUT_USERPASSWDCONF = "_id14jbpns_2fdefault_2fdefault_2fIdentityUserPortletWindowsnpbj:passwordCheck";
+ private static final String INPUT_USERPASSWDCONF = "register-form:passwordCheck";
- private static final String INPUT_USERPASSWD = "_id14jbpns_2fdefault_2fdefault_2fIdentityUserPortletWindowsnpbj:password";
+ private static final String INPUT_USERPASSWD = "register-form:password";
- private static final String INPUT_USERMAIL = "_id14jbpns_2fdefault_2fdefault_2fIdentityUserPortletWindowsnpbj:email";
+ private static final String INPUT_USERMAIL = "register-form:email";
- private static final String INPUT_USERNAME = "_id14jbpns_2fdefault_2fdefault_2fIdentityUserPortletWindowsnpbj:username";
+ private static final String INPUT_USERNAME = "register-form:username";
- private static final String LINK_CREATE_USER = "_id14jbpns_2fdefault_2fdefault_2fIdentityUserPortletWindowsnpbj:_id16jbpns_2fdefault_2fdefault_2fIdentityUserPortletWindowsnpbj";
+ private static final String LINK_CREATE_USER = "create-account-form:register";
- private static final String TAB_WELCOME = "_id1jbpns_2fdefault_2fdefault_2fIdentityUserPortletWindowsnpbj:_id3jbpns_2fdefault_2fdefault_2fIdentityUserPortletWindowsnpbj";
+ private static final String TAB_WELCOME = "register-temp-form:start-link";
@Test(enabled = true, description = "Simple user creation.")
public void userCreationTest() {
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-23 14:53:05 UTC (rev 11951)
+++ branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/WSRPTestCase.java 2008-09-23 15:12:31 UTC (rev 11952)
@@ -1,5 +1,7 @@
package org.jboss.portal.test.selenium;
+import java.text.MessageFormat;
+
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -10,6 +12,9 @@
@Test(groups = { "cms_wsrp" }, enabled = true, description = "WSRP test case.")
public class WSRPTestCase extends JBossPortalSeleniumTestCase {
+ private static final String SUBMIT_REFRESH_CANCEL = "edit-cons-form:list-cons-link_1";
+ private static final String SUBMIT_PROD_SAVE = "producer-form:save-producer";
+ private static final String SUBMIT_CONSDEL_CONF = "confirm-delete-form:destroy-link";
// private static final String ID_LINK_PRODCONF =
// "_id1jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:_id3jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj"
// ;
@@ -17,11 +22,37 @@
// "_id1jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:_id3jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj"
// ;
- private static final String ID_LINK_PRODCONF = "link=*Producer Configuration*";
- private static final String ID_LINK_CONSCONF = "link=*Consumers Configuration*";
+
- public static String WSRP_CONSUMER_TABLE = "//div[@id='center']/div/div/div/table";
-
+ // TODO shouldn't be same as REFRESH?
+ private static final String SUBMIT_CONS_REGVAL = "edit-cons-form:refresh-cons-link";
+ private static final String SUBMIT_REFRESHFINAL = "edit-cons-form:refresh-cons-link";
+
+ private static final String INPUT_CONS_REGVALUE = "edit-cons-form:prop-value-input";
+ private static final String SUBMIT_REFRESHSAVE = "edit-cons-form:refresh-cons-link";
+ private static final String INPUT_CONSWSDL = "edit-cons-form:wsdl";
+ private static final String INPUT_CACHEEXP = "edit-cons-form:cache";
+ private static final String SUBMIT_ADDPROP_INIT = "producer-form:add-reg-prop";
+ private static final String SUBMIT_ADDPROP = "producer-form:add-reg-prop";
+ private static final String INPUT_PROPHINT = "producer-form:reg-properties:0:_id33jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj";
+ private static final String INPUT_PROPLABEL = "producer-form:reg-properties:0:_id30jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj";
+ private static final String INPUT_PROPNAME = "producer-form:reg-properties:0:_id24jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj";
+ private static final String SUBMIT_CREATECONS = "createConsumer:createConsumerButton";
+ private static final String INPUT_CREATECONS = "createConsumer:consumerName";
+ private static final String ID_LINK_PRODCONF = "cons-temp-form:producer-link";
+ private static final String ID_LINK_CONSCONF = "producer-temp-form:consumersTab";
+ private static final String LINK_CONSUMER_HOME ="cons-temp-form1:list-cons-link";
+ private static final String LINK_T_CONS_CON="consumer-list-form:consumersList:{0}:configure";
+ private static final String LINK_T_CONS_REF="consumer-list-form:consumersList:{0}:refresh";
+ private static final String LINK_T_CONS_ACT="consumer-list-form:consumersList:{0}:activate";
+ private static final String LINK_T_CONS_DEA="consumer-list-form:consumersList:{0}:activate";
+ private static final String LINK_T_CONS_REG="consumer-list-form:consumersList:{0}:register";
+ private static final String LINK_T_CONS_DER="consumer-list-form:consumersList:{0}:register";
+ private static final String LINK_T_CONS_DEL="consumer-list-form:consumersList:{0}:delete";
+
+
+// public static String WSRP_CONSUMER_TABLE = "//form[@id='_id18jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj']/table";
+ public static String WSRP_CONSUMER_TABLE = "consumer-list-form:consumersList";
@BeforeMethod(groups = { "log" })
public void loginBeforeTest() {
@@ -36,32 +67,30 @@
@Test(enabled = true, description = "Creating a standard BEA consumer.")
public void testCreateBeaConsumer() {
selenium.open("/portal/");
+ selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=Admin");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=WSRP");
selenium.waitForPageToLoad(PAGE_LOAD);
clickIfVisible(ID_LINK_CONSCONF);
- selenium.type("_id16jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:consumerName", "BEA");
- selenium.click("_id16jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:_id18jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj");
+ selenium.type(INPUT_CREATECONS, "BEA");
+
+ selenium.click(SUBMIT_CREATECONS);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.type("_id21jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:cache", "600");
- // selenium.click("link=14. Web Services for Remote Portlets (WSRP)");
- selenium.type("_id21jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:wsdl", "http://wsrp.bea.com:7001/producer/producer?WSDL");
- selenium.click("_id21jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:_id34jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj");
+ selenium.type(INPUT_CACHEEXP, "600");
+
+ selenium.type(INPUT_CONSWSDL, "http://wsrp.bea.com:7001/producer/producer?WSDL");
+ selenium.click(SUBMIT_REFRESHSAVE);
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isTextPresent("Refresh failed (probably because the registration information was not valid)."));
- Assert
- .assertEquals(
- "Missing value",
- selenium
- .getText("//form[@id='_id21jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj']/table/tbody/tr[4]/td/span/table/tbody/tr[2]/td[3]/span"));
- selenium.type("_id21jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:_id38jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj",
- "public");
- selenium.click("_id21jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:_id48jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj");
+ Assert.assertTrue(selenium.isTextPresent("Missing value"));
+
+ selenium.type(INPUT_CONS_REGVALUE, "public");
+ selenium.click(SUBMIT_CONS_REGVAL);
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isTextPresent("Refresh was successful."));
- selenium.click("_id6jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:_id8jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj");
+ selenium.click(SUBMIT_REFRESHFINAL);
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isTextPresent("BEA"));
}
@@ -70,23 +99,24 @@
public void testBeaConsumerRegister() {
selenium.open("/portal/");
+ selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=Admin");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=WSRP");
selenium.waitForPageToLoad(PAGE_LOAD);
clickIfVisible(ID_LINK_CONSCONF);
-
- int r = findTableRow(WSRP_CONSUMER_TABLE, "BEAreg", 0);
- selenium.click(WSRP_CONSUMER_TABLE + "/tbody/tr[" + r + "]/td[2]/a[4]");
+ clickIfVisible(LINK_CONSUMER_HOME);
+ int r = findTableRow(WSRP_CONSUMER_TABLE, "BEAreg", 0)-1 ;
+ selenium.click(MessageFormat.format(LINK_T_CONS_REG,r));
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("_id21jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:_id52jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj");
+ selenium.click(SUBMIT_REFRESHSAVE);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("_id6jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:_id8jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj");
+ selenium.click(LINK_CONSUMER_HOME);
selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertEquals(selenium.getText(WSRP_CONSUMER_TABLE + "/tbody/tr[" + r + "]/td[2]/a[4]"), "Deregister");
+ Assert.assertEquals(selenium.getText(MessageFormat.format(LINK_T_CONS_DER,r)), "Deregister");
}
@Test(enabled = true, dependsOnMethods = { "testCreateBeaConsumer" }, description = "Standard BEA consumer deregistering.")
@@ -94,36 +124,40 @@
createConsumer("BEAreg", "100", "http://wsrp.bea.com:7001/producer/producer?WSDL");
selenium.open("/portal/");
+ selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=Admin");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=WSRP");
selenium.waitForPageToLoad(PAGE_LOAD);
clickIfVisible(ID_LINK_CONSCONF);
+ clickIfVisible(LINK_CONSUMER_HOME);
+
+ int r = findTableRow(WSRP_CONSUMER_TABLE, "BEAreg", 0) -1;
- int r = findTableRow(WSRP_CONSUMER_TABLE, "BEAreg", 0);
-
- selenium.click(WSRP_CONSUMER_TABLE + "/tbody/tr[" + r + "]/td[2]/a[4]");
+ selenium.click(MessageFormat.format(LINK_T_CONS_DER,r));
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("_id21jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:_id49jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj");
+ selenium.click(SUBMIT_REFRESH_CANCEL);
selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertEquals(selenium.getText(WSRP_CONSUMER_TABLE + "/tbody/tr[" + r + "]/td[2]/a[4]"), "Register");
+ Assert.assertEquals(selenium.getText(MessageFormat.format(LINK_T_CONS_DER,r)), "Register");
}
@Test(enabled = true, dependsOnMethods = { "testCreateBeaConsumer", "testBeaConsumerDeactivate" }, description = "Standard BEA consumer activating.")
public void testBeaConsumerActivate() {
selenium.open("/portal/");
+
+ selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=Admin");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=WSRP");
selenium.waitForPageToLoad(PAGE_LOAD);
clickIfVisible(ID_LINK_CONSCONF);
+ clickIfVisible(LINK_CONSUMER_HOME);
+ int r = findTableRow(WSRP_CONSUMER_TABLE, "BEAact", 0)-1;
- int r = findTableRow(WSRP_CONSUMER_TABLE, "BEAact", 0);
-
Assert.assertTrue(selenium.isTextPresent("BEAact (inactive) (refresh needed)"));
- selenium.click(WSRP_CONSUMER_TABLE + "/tbody/tr[" + r + "]/td[2]/a[3]");
+ selenium.click(MessageFormat.format(LINK_T_CONS_ACT,r));
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertFalse(selenium.isTextPresent("BEAact (inactive) (refresh needed)"));
@@ -135,16 +169,19 @@
createConsumer("BEAact", "100", "http://wsrp.bea.com:7001/producer/producer?WSDL");
selenium.open("/portal/");
+ selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=Admin");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=WSRP");
selenium.waitForPageToLoad(PAGE_LOAD);
clickIfVisible(ID_LINK_CONSCONF);
- int r = findTableRow(WSRP_CONSUMER_TABLE, "BEAact", 0);
+ clickIfVisible(LINK_CONSUMER_HOME);
+
+ int r = findTableRow(WSRP_CONSUMER_TABLE, "BEAact", 0)-1;
Assert.assertFalse(selenium.isTextPresent("BEAact (inactive) (refresh needed)"));
- selenium.click(WSRP_CONSUMER_TABLE + "/tbody/tr[" + r + "]/td[2]/a[3]");
+ selenium.click(MessageFormat.format(LINK_T_CONS_DEA,r));
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isTextPresent("BEAact (inactive) (refresh needed)"));
@@ -159,22 +196,28 @@
public void testBeaConsumerDelete() {
createConsumer("BEAdel", "100", "http://wsrp.bea.com:7001/producer/producer?WSDL");
-
+ //selenium.setSpeed("2000");
selenium.open("/portal/");
+ selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=Admin");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=WSRP");
-
selenium.waitForPageToLoad(PAGE_LOAD);
clickIfVisible(ID_LINK_CONSCONF);
+ clickIfVisible(LINK_CONSUMER_HOME);
Assert.assertTrue(selenium.isTextPresent("BEAdel"));
- int r = findTableRow(WSRP_CONSUMER_TABLE, "BEAdel", 0);
+ selenium.captureScreenshot("tabletable");
+ Assert.assertTrue(selenium.isElementPresent(WSRP_CONSUMER_TABLE),"Consumer table not available.");
+ int r = findTableRow(WSRP_CONSUMER_TABLE, "BEAdel", 0)-1;
+ Assert.assertFalse(r < 0,"Consumer BEAdel not found");
- selenium.click(WSRP_CONSUMER_TABLE + "/tbody/tr[" + r + "]/td[2]/a[5]");
+ selenium.click(MessageFormat.format(LINK_T_CONS_DEL,r));
selenium.waitForPageToLoad(PAGE_LOAD);
-
- selenium.click("_id29jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:_id30jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj");
+ selenium.captureScreenshot("delete");
+ Assert.assertTrue(selenium.isTextPresent("Delete 'BEAdel' consumer?"));
+
+ selenium.click(SUBMIT_CONSDEL_CONF);
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertFalse(selenium.isTextPresent("BEAdel"));
@@ -183,73 +226,53 @@
@Test(enabled = true, description = "Basic configuring of WSRP producer.")
public void testConfigureProducer() {
selenium.open("/portal/");
+ selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=Admin");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=WSRP");
selenium.waitForPageToLoad(PAGE_LOAD);
-
clickIfVisible(ID_LINK_PRODCONF);
-
-
- selenium.click("_id10jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:_id26jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj");
+
+ selenium.click(SUBMIT_ADDPROP_INIT);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium
- .type(
- "_id10jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:registrationProperties:0:_id27jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj",
- "testProp");
- selenium
- .type(
- "_id10jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:registrationProperties:0:_id34jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj",
- "testProp label");
- selenium
- .type(
- "_id10jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:registrationProperties:0:_id37jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj",
- "tetsPropHint");
- selenium.click("_id10jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:_id45jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj");
+ selenium.type(INPUT_PROPNAME, "testProp");
+ selenium.type(INPUT_PROPLABEL, "testProp label");
+ selenium.type(INPUT_PROPHINT, "tetsPropHint");
+
+ selenium.click(SUBMIT_PROD_SAVE);
selenium.waitForPageToLoad(PAGE_LOAD);
+
Assert.assertTrue(selenium.isTextPresent("Producer configuration successfully saved!"));
clickIfVisible(ID_LINK_CONSCONF);
clickIfVisible(ID_LINK_PRODCONF);
- Assert
- .assertEquals(
- "testProp",
- selenium
- .getValue("_id10jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:registrationProperties:0:_id27jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj"));
- Assert
- .assertEquals(
- "testProp label",
- selenium
- .getValue("_id10jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:registrationProperties:0:_id34jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj"));
- Assert
- .assertEquals(
- "tetsPropHint",
- selenium
- .getValue("_id10jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:registrationProperties:0:_id37jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj"));
+ Assert.assertEquals("testProp", selenium.getValue(INPUT_PROPNAME));
+ Assert.assertEquals("testProp label", selenium.getValue(INPUT_PROPLABEL));
+ Assert.assertEquals("tetsPropHint", selenium.getValue(INPUT_PROPHINT));
}
private void createConsumer(String name, String timeout, String address) {
selenium.open("/portal/");
+ selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=Admin");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=WSRP");
selenium.waitForPageToLoad(PAGE_LOAD);
clickIfVisible(ID_LINK_CONSCONF);
- selenium.type("_id16jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:consumerName", name);
- selenium.click("_id16jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:_id18jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj");
+ selenium.type(INPUT_CREATECONS, name);
+ selenium.click(SUBMIT_CREATECONS);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.type("_id21jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:cache", timeout);
+ selenium.type(INPUT_CACHEEXP, timeout);
// selenium.click("link=14. Web Services for Remote Portlets (WSRP)");
- selenium.type("_id21jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:wsdl", address);
- selenium.click("_id21jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:_id34jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj");
+ selenium.type(INPUT_CONSWSDL, address);
+ selenium.click(SUBMIT_REFRESHSAVE);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.type("_id21jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:_id38jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj",
- "public");
- selenium.click("_id21jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:_id48jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj");
+ selenium.type(INPUT_CONS_REGVALUE, "public");
+ selenium.click(SUBMIT_CONS_REGVAL);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("_id6jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:_id8jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj");
+ selenium.click(SUBMIT_REFRESHFINAL);
selenium.waitForPageToLoad(PAGE_LOAD);
}
}
\ No newline at end of file
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-09-23 14:53:05 UTC (rev 11951)
+++ branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSDirectoryTestCase.java 2008-09-23 15:12:31 UTC (rev 11952)
@@ -38,6 +38,8 @@
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.open("/portal/auth/portal/admin/CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
Assert.assertFalse(selenium.isTextPresent("TestFolder["), "Test folder is already present.");
selenium.select("//div[@id='center']/div/div/div[1]/div/select", "label=Create Folder");
Added: 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 (rev 0)
+++ branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileManipulationTestCase.java 2008-09-23 15:12:31 UTC (rev 11952)
@@ -0,0 +1,109 @@
+package org.jboss.portal.test.selenium.cms;
+
+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;
+
+ at 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";
+
+ private final String CMS_FILE_TABLE = "//div[@id='center']/div/div/div[3]/table";
+
+ // file workflow table in CMS
+ private final String CMS_WF_TABLE = "//div[@id='center']/div/div/table[2]";
+
+ // file version table in CMS
+ private final String CMS_FV_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 = "File creation and moving to default directory.")
+ public void testMoveFile() {
+ createFile("fileToMove");
+ 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.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=default");
+ selenium.click("submit");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=default");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isElementPresent("link=fileToMove"));
+
+ selenium.click("link=Home");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertFalse(selenium.isElementPresent("link=fileToMove"));
+ }
+
+ @Test(enabled = true, description = "File creation and copying to default directory.")
+ public void testCopyFile() {
+ createFile("file2copy");
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ 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.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=default");
+ selenium.click("submit");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=default");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isElementPresent("link=file2copy"));
+
+ selenium.click("link=Home");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isElementPresent("link=file2copy"));
+ }
+
+
+
+ private void createFile(String name) {
+ 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.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");
+ selenium.click("save");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Approve");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Home");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertEquals(name, selenium.getText("link=" + name));
+ logout();login("admin","admin");
+ }
+}
Property changes on: branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileManipulationTestCase.java
___________________________________________________________________
Name: svn:executable
+ *
Added: branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileNoWorkflowTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileNoWorkflowTestCase.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileNoWorkflowTestCase.java 2008-09-23 15:12:31 UTC (rev 11952)
@@ -0,0 +1,378 @@
+package org.jboss.portal.test.selenium.cms;
+
+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;
+
+/**
+ * @author <a href="mailto:vrockai at redhat.com">Viliam Rockai</a>
+ */
+
+ at Test(groups = { "cms_file" }, enabled = false)
+public class CMSFileNoWorkflowTestCase extends JBossPortalSeleniumTestCase {
+
+ private final String CMS_FILE_TABLE = "//div[@id='center']/div/div/div[3]/table";
+
+ @BeforeMethod(groups = { "log" })
+ public void loginBeforeTest() {
+ login("admin", "admin");
+ }
+
+ @AfterMethod( groups = { "log" })
+ public void logoutAfterTest() {
+ logout();
+ }
+
+ @Test(enabled = false, description = "Common file structure browsing test.")
+ public void testDefaultBrowsing() {
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isElementPresent("link=default"));
+ selenium.click("link=default");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isElementPresent("link=images"));
+ Assert.assertTrue(selenium.isElementPresent("link=private"));
+ Assert.assertTrue(selenium.isElementPresent("link=index.html"));
+ Assert.assertTrue(selenium.isElementPresent("link=project.html"));
+ Assert.assertTrue(selenium.isElementPresent("link=support.html"));
+ selenium.click("link=index.html");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isElementPresent("link=text/html"));
+ Assert.assertTrue(selenium.isElementPresent("//div[@id='center']/div/div/table/tbody/tr[4]/td[6]"));
+ Assert.assertEquals("JBoss Portal", selenium.getText("//div[@id='center']/div/div/table/tbody/tr[4]/td[6]"));
+ selenium.click("link=Home");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=default");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=images");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isElementPresent("link=logo.gif"));
+ }
+
+ @Test(enabled = false, description = "File properties checking.")
+ public void testFileProperties() {
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.open("/portal/auth/portal/admin/CMS/CMSAdminPortletWindow?op=main&action=2&path=%2F");
+ selenium.click("link=default");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=index.html");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+
+
+ Assert.assertEquals("text/html", selenium.getText("link=text/html"));
+ Assert.assertEquals("English", selenium.getText("link=English"));
+ Assert.assertEquals("Type", selenium.getText("//div[@id='center']/div/div/table/tbody/tr[3]/td[1]/b"));
+ Assert.assertEquals("Size", selenium.getText("//div[@id='center']/div/div/table/tbody/tr[3]/td[2]/b"));
+ Assert.assertEquals("Version", selenium.getText("//div[@id='center']/div/div/table/tbody/tr[3]/td[3]/b"));
+ Assert.assertEquals("Created", selenium.getText("//div[@id='center']/div/div/table/tbody/tr[3]/td[4]/b"));
+ Assert.assertEquals("Modified", selenium.getText("//div[@id='center']/div/div/table/tbody/tr[3]/td[5]/b"));
+ Assert.assertEquals("Title", selenium.getText("//div[@id='center']/div/div/table/tbody/tr[3]/td[6]/b"));
+
+ Assert.assertEquals("2kb", selenium.getText("//div[@id='center']/div/div/table/tbody/tr[4]/td[2]"));
+ Assert.assertEquals("1.0", selenium.getText("//div[@id='center']/div/div/table/tbody/tr[4]/td[3]"));
+ Assert.assertEquals("JBoss Portal", selenium.getText("//div[@id='center']/div/div/table/tbody/tr[4]/td[6]"));
+
+ Assert.assertEquals("index.html", selenium.getText("//div[@id='center']/div/div/ul/li[5]"));
+ Assert.assertEquals("Manage Content", selenium.getText("//div[@id='center']/div/h3"));
+
+ Assert.assertTrue(selenium.isElementPresent("//div[@id='center']/div/div/div/div/select/option[.='Create']"));
+ Assert.assertTrue(selenium.isElementPresent("//div[@id='center']/div/div/div/div/select/option[.='Copy']"));
+ Assert.assertTrue(selenium.isElementPresent("//div[@id='center']/div/div/div/div/select/option[.='Move']"));
+ Assert.assertTrue(selenium.isElementPresent("//div[@id='center']/div/div/div/div/select/option[.='Delete']"));
+ Assert.assertTrue(selenium.isElementPresent("//div[@id='center']/div/div/div/div/select/option[.='Secure']"));
+
+ }
+
+ @Test(enabled = true, description = "Simple file creation.")
+ public void testCreateFile() {
+ 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.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);
+ 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]"));
+ Assert.assertEquals("0kb", selenium.getText("//div[@id='center']/div/div/table/tbody/tr[4]/td[2]"));
+ Assert.assertEquals("newFile title", selenium.getText("//div[@id='center']/div/div/table/tbody/tr[4]/td[6]"));
+ selenium.click("link=Home");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertEquals("newFile", selenium.getText("link=newFile"));
+
+ }
+
+ @Test(enabled = false, description = "Editing of file.")
+ public void testEditFile() {
+
+ 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.waitForPageToLoad(PAGE_LOAD);
+ selenium.waitForPopUp("_top", PAGE_LOAD);
+ selenium.type("filename", "file2edit");
+ selenium.type("description", "file2edit description");
+ selenium.type("title", "file2edit title");
+ selenium.select("language", "label=Czech");
+ selenium.selectFrame("mce_editor_0");
+
+ String s = selenium.getEval("document.getElementById('mce_editor_0')contentDocument.body.innerHTML=\"jaja\"");
+ //System.out.println(s);
+
+ ////*[@id="mce_editor_0"]
+ selenium.type("elm1","it's nice to work for RH");
+ selenium.selectFrame("_top");
+ selenium.click("save");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ int row = findTableRow("//div[@id='center']/div/div/table", "1.0", 2)+1;
+
+ 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["+ row +"]/td[3]"));
+ Assert.assertEquals("0kb", selenium.getText("//div[@id='center']/div/div/table/tbody/tr["+ row +"]/td[2]"));
+ Assert.assertEquals("file2edit title", selenium.getText("//div[@id='center']/div/div/table/tbody/tr["+ row +"]/td[6]"));
+
+ selenium.click("link=text/plain");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("save");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("1.1"));
+ Assert.assertTrue(selenium.isElementPresent("//div[@id='center']/div/div/table/tbody/tr[5]/td[3]/img"));
+
+
+ selenium.click("link=Home");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertEquals("file2edit", selenium.getText("link=file2edit"));
+
+ }
+
+ @Test(enabled = false, dependsOnMethods = "testDeleteFile", description = "Creation of existing file.")
+ public void testCreateExistingFile() {
+ String filename = "existingFile";
+
+ createFile(filename);
+
+ 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.waitForPageToLoad(PAGE_LOAD);
+ selenium.waitForPopUp("_top", PAGE_LOAD);
+ selenium.type("filename", "existingFile");
+ selenium.type("description", "existingFile description");
+ selenium.type("title", "existingFile title");
+ selenium.select("language", "label=Czech");
+ selenium.click("save");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertEquals("Czech", selenium.getText("link=Czech"));
+ Assert.assertEquals("text/plain", selenium.getText("link=text/plain"));
+ Assert.assertTrue(selenium.isTextPresent("1.0"));
+ Assert.assertTrue(selenium.isTextPresent("1.1"));
+ Assert.assertFalse(selenium.isTextPresent("1.2"));
+ selenium.click("link=Home");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertEquals("existingFile", selenium.getText("link=" + filename));
+
+ deleteFile(filename);
+ }
+
+ @Test(enabled = false, description = "File creation and moving to default directory.")
+ public void testMoveFile() {
+ 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.waitForPageToLoad(PAGE_LOAD);
+ selenium.waitForPopUp("_top", PAGE_LOAD);
+ selenium.type("filename", "fileToMove");
+ selenium.type("description", "fileToMove description");
+ selenium.type("title", "fileToMove title");
+ selenium.select("language", "label=Czech");
+ selenium.click("save");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ 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]"));
+ Assert.assertEquals("0kb", selenium.getText("//div[@id='center']/div/div/table/tbody/tr[4]/td[2]"));
+ Assert.assertEquals("fileToMove title", selenium.getText("//div[@id='center']/div/div/table/tbody/tr[4]/td[6]"));
+ selenium.click("link=Home");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertEquals("fileToMove", selenium.getText("link=fileToMove"));
+
+ 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.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=default");
+ selenium.click("submit");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=default");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isElementPresent("link=fileToMove"));
+
+ selenium.click("link=Home");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertFalse(selenium.isElementPresent("link=fileToMove"));
+ }
+
+ @Test(enabled = false, description = "File creation and copying to default directory.")
+ public void testCopyFile() {
+ 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.waitForPageToLoad(PAGE_LOAD);
+ selenium.waitForPopUp("_top", PAGE_LOAD);
+ selenium.type("filename", "file2copy");
+ selenium.type("description", "file2copy description");
+ selenium.type("title", "file2copy title");
+ selenium.select("language", "label=Czech");
+ selenium.click("save");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ int row = findTableRow("//div[@id='center']/div/div/table", "1.0", 2)+1;
+
+ 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["+row+"]/td[3]"));
+ Assert.assertEquals("0kb", selenium.getText("//div[@id='center']/div/div/table/tbody/tr["+row+"]/td[2]"));
+ Assert.assertEquals("file2copy title", selenium.getText("//div[@id='center']/div/div/table/tbody/tr["+row+"]/td[6]"));
+ selenium.click("link=Home");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertEquals("file2copy", selenium.getText("link=file2copy"));
+
+ 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.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=default");
+ selenium.click("submit");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=default");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isElementPresent("link=file2copy"));
+
+ selenium.click("link=Home");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isElementPresent("link=file2copy"));
+ }
+
+ @Test(enabled = false, description = "Not implemented!")
+ public void testMoveOverwriteFile() {
+
+ }
+
+ @Test(enabled = false, description = "Not implemented!")
+ public void testMoveNotOverwriteFile() {
+
+ }
+
+ @Test(enabled = false, dependsOnMethods = "testCreateFile", description = "Simple file delete.")
+ public void testDeleteFile() {
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.select("//div[@id='center']/div/div/div[3]/table/tbody/tr[3]/td[2]/form/select", "label=Delete");
+ selenium.click("//div[@id='center']/div/div/div[3]/table/tbody/tr[3]/td[2]/form/select/option[4]");
+ selenium.click("//div[@id='center']/div/div/div[3]/table/tbody/tr[3]/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!"));
+ Assert.assertTrue(selenium.isTextPresent("Are you sure you want to delete this resource?"));
+ selenium.click("cancel");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select("//div[@id='center']/div/div/div[3]/table/tbody/tr[3]/td[2]/form/select", "label=Delete");
+ selenium.click("//div[@id='center']/div/div/div[3]/table/tbody/tr[3]/td[2]/form/select/option[4]");
+ selenium.click("//div[@id='center']/div/div/div[3]/table/tbody/tr[3]/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!"));
+ Assert.assertTrue(selenium.isTextPresent("Are you sure you want to delete this resource?"));
+ selenium.click("submit");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ }
+
+ @Test(enabled = false)
+ public void testDeleteCancelFile() {
+
+ }
+
+ private void createFile(String name) {
+ 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.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");
+ selenium.click("save");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ 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]"));
+ Assert.assertEquals("0kb", selenium.getText("//div[@id='center']/div/div/table/tbody/tr[4]/td[2]"));
+ Assert.assertEquals(name + " title", selenium.getText("//div[@id='center']/div/div/table/tbody/tr[4]/td[6]"));
+ selenium.click("link=Home");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertEquals(name, selenium.getText("link=" + name));
+ logout();login("admin","admin");
+ }
+
+ private void deleteFile(String name) {
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.select("//div[@id='center']/div/div/div[3]/table/tbody/tr[3]/td[2]/form/select", "label=Delete");
+ selenium.click("//div[@id='center']/div/div/div[3]/table/tbody/tr[3]/td[2]/form/select/option[4]");
+ selenium.click("//div[@id='center']/div/div/div[3]/table/tbody/tr[3]/td[2]/form/input");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("Confirm Deletion of /" + name));
+ 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("submit");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ logout();login("admin","admin");
+ }
+}
Property changes on: branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileNoWorkflowTestCase.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-09-23 14:53:05 UTC (rev 11951)
+++ branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSSecureTestCase.java 2008-09-23 15:12:31 UTC (rev 11952)
@@ -1,7 +1,10 @@
package org.jboss.portal.test.selenium.cms;
+import java.text.MessageFormat;
+
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;
@@ -14,7 +17,22 @@
@Test(groups = { "cms_secure" }, enabled = true, description = "Setting permissions on the default portlet.")
public class CMSSecureTestCase extends JBossPortalSeleniumTestCase {
- //@AfterMethod()
+ private static final String SELECT_CMS_ACTION = "//div[@id='center']/div/div/div[1]/div/select";
+
+ @AfterMethod(groups = { "log" })
+ public void logoutAfterTestIfPossible() {
+
+ selenium.open("/portal/");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ if (selenium.isElementPresent("link=Logout")) {
+ selenium.click("link=Logout");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ }
+
+ resetSecurity();
+ }
+
+ // @AfterMethod()
private void resetSecurity() {
login("admin", "admin");
selenium.click("link=Admin");
@@ -25,7 +43,7 @@
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=index.html");
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.select("//div[@id='center']/div/div/div/div/select", "label=Secure");
+ selenium.select(SELECT_CMS_ACTION, "label=Secure");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.select("secureroles:read", "label=Anonymous");
selenium.select("secureusers:read", "label=admin");
@@ -78,29 +96,28 @@
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=index.html");
selenium.waitForPageToLoad(PAGE_LOAD);
-
-
- selenium.select("//div[@id='center']/div/div/div/div/select", "label=Secure");
+
+ selenium.select(SELECT_CMS_ACTION, "label=Secure");
selenium.waitForPageToLoad(PAGE_LOAD);
-
+
selenium.select("secureroles:read", "label=Administrators");
selenium.select("secureusers:read", "label=admin");
-
+
selenium.click("submit");
selenium.waitForPageToLoad(PAGE_LOAD);
logout();
Assert.assertTrue(selenium.isTextPresent("Access Denied"));
- Assert.assertTrue(selenium.isTextPresent("You are not allowed to access the following resource - /default/index.html"));
+ //Assert.assertTrue(selenium.isTextPresent("You are not allowed to access the following resource - /default/index.html"));
login("user", "user");
Assert.assertTrue(selenium.isTextPresent("Access Denied"));
- Assert.assertTrue(selenium.isTextPresent("You are not allowed to access the following resource - /default/index.html"));
+ //Assert.assertTrue(selenium.isTextPresent("You are not allowed to access the following resource - /default/index.html"));
logout();
-
+
resetSecurity();
}
@@ -119,7 +136,7 @@
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=index.html");
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.select("//div[@id='center']/div/div/div/div/select", "label=Secure");
+ selenium.select(SELECT_CMS_ACTION, "label=Secure");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.select("secureroles:read", "label=Administrators");
selenium.select("secureusers:read", "label=user");
@@ -129,15 +146,15 @@
logout();
Assert.assertTrue(selenium.isTextPresent("Access Denied"));
- Assert.assertTrue(selenium.isTextPresent("You are not allowed to access the following resource - /default/index.html"));
+ //Assert.assertTrue(selenium.isTextPresent("You are not allowed to access the following resource - /default/index.html"));
login("user", "user");
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("You are not allowed to access the following resource - /default/index.html"));
logout();
-
+
resetSecurity();
}
@@ -158,7 +175,7 @@
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=index.html");
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.select("//div[@id='center']/div/div/div/div/select", "label=Secure");
+ selenium.select(SELECT_CMS_ACTION, "label=Secure");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.select("secureroles:read", "label=secRoleDisp");
selenium.select("secureusers:read", "label=admin");
@@ -168,15 +185,15 @@
logout();
Assert.assertTrue(selenium.isTextPresent("Access Denied"));
- Assert.assertTrue(selenium.isTextPresent("You are not allowed to access the following resource - /default/index.html"));
+ //Assert.assertTrue(selenium.isTextPresent("You are not allowed to access the following resource - /default/index.html"));
login("user", "user");
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("You are not allowed to access the following resource - /default/index.html"));
logout();
-
+
resetSecurity();
}
@@ -197,7 +214,7 @@
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=index.html");
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.select("//div[@id='center']/div/div/div/div/select", "label=Secure");
+ selenium.select(SELECT_CMS_ACTION, "label=Secure");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.select("secureroles:read", "label=secRoleDisp");
selenium.select("secureusers:read", "label=admin");
@@ -207,20 +224,20 @@
logout();
Assert.assertTrue(selenium.isTextPresent("Access Denied"));
- Assert.assertTrue(selenium.isTextPresent("You are not allowed to access the following resource - /default/index.html"));
+ //Assert.assertTrue(selenium.isTextPresent("You are not allowed to access the following resource - /default/index.html"));
login("user", "user");
Assert.assertTrue(selenium.isTextPresent("Access Denied"));
- Assert.assertTrue(selenium.isTextPresent("You are not allowed to access the following resource - /default/index.html"));
+ //Assert.assertTrue(selenium.isTextPresent("You are not allowed to access the following resource - /default/index.html"));
logout();
-
+
resetSecurity();
}
-
+
@Test(enabled = false, description = "Recursive permission test")
- public void testRecursiveSecurity(){
+ public void testRecursiveSecurity() {
login("admin", "admin");
deassignRole("user", "user at portal.com", "secRole", "secRoleDisp");
@@ -236,7 +253,7 @@
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=index.html");
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.select("//div[@id='center']/div/div/div/div/select", "label=Secure");
+ selenium.select(SELECT_CMS_ACTION, "label=Secure");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.select("secureroles:read", "label=secRoleDisp");
selenium.select("secureusers:read", "label=admin");
@@ -246,15 +263,19 @@
logout();
resetSecurity();
}
-
+
@Test(enabled = true, description = "Subpage permission test")
- public void testSubpageSecurity(){
+ public void testSubpageSecurity() {
selenium.open("/portal/portal/default");
- 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.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.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!"));
-
+ 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.waitForPageToLoad(PAGE_LOAD);
@@ -264,7 +285,7 @@
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=support.html");
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.select("//div[@id='center']/div/div/div/div/select", "label=Secure");
+ selenium.select(SELECT_CMS_ACTION, "label=Secure");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.select("secureroles:read", "label=Administrators");
selenium.select("secureusers:read", "label=admin");
@@ -276,23 +297,25 @@
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!"));
+ 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);
- 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!"));
-
+ 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!"));
+
resetSecurity();
}
- private void assignRole(String user, String email, String role, String roleDisplay) {
+ void assignRole(String user, String email, String role, String roleDisplay) {
searchUser(user, email);
- selenium.click(butSeaUsrRol_id(user));
+ selenium.click(butUsrRol_id(user));
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isTextPresent(roleDisplay), "Role display name: " + roleDisplay + " not found on the page.");
- final String ID_CHECK_ROLE = "//input[@name='_id28jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj:roles' and @value='" + role + "']";
+ final String ID_CHECK_ROLE = "//input[@name='assign-roles-form:roles' and @value='" + role + "']";
selenium.click(ID_CHECK_ROLE);
@@ -301,37 +324,36 @@
searchUser(user, email);
- selenium.click(butSeaUsrRol_id(user));
+ selenium.click(butUsrRol_id(user));
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isChecked(ID_CHECK_ROLE), "The role wasn't correctly assigned.");
}
- private void deassignRole(String user, String email, String role, String roleDisplay) {
+ void deassignRole(String user, String email, String role, String roleDisplay) {
searchUser(user, email);
- selenium.click(butSeaUsrRol_id(user));
+ selenium.click(butUsrRol_id(user));
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isTextPresent(roleDisplay), "Role display name: " + roleDisplay + " not found on the page.");
- // uncheck the tempRole check box
- final String ID_CHECK_ROLE = "//input[@name='_id28jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj:roles' and @value='" + role + "']";
- Assert.assertTrue(selenium.isChecked(ID_CHECK_ROLE), "Role to unassign wasn't really assigned (checked).");
+ // check the tempRole check box
+ final String ID_CHECK_ROLE = "//input[@name='assign-roles-form:roles' and @value='" + role + "']";
selenium.click(ID_CHECK_ROLE);
selenium.click(IdentityAdminTestCase.ID_SUBMIT_ASSIGN_ROLE);
selenium.waitForPageToLoad(PAGE_LOAD);
searchUser(user, email);
- selenium.click(butSeaUsrRol_id(user));
+ selenium.click(butUsrRol_id(user));
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertFalse(selenium.isChecked(ID_CHECK_ROLE), "Unassigned role is assigned (checked).");
}
- private void searchUser(String username, String email) {
+ void searchUser(String username, String email) {
selenium.open("/portal/");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=Admin");
@@ -342,7 +364,7 @@
clickIfVisible(IdentityAdminTestCase.ID_LINK_USERTAB);
clickIfVisible(IdentityAdminTestCase.ID_LINK_USERMAIN);
- selenium.click(IdentityAdminTestCase.ID_BUT_SEARCH_USER);
+ selenium.click(IdentityAdminTestCase.LINK_SEARCH_USER);
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.type(IdentityAdminTestCase.ID_INPUT_SEARCH_USER, username);
@@ -353,10 +375,9 @@
Assert.assertTrue(selenium.isTextPresent(email), "User email adress was not found.");
}
- private String butSeaUsrRol_id(String userName) {
- String table = "_id28jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj:userlist";
+ private String butUsrRol_id(String userName) {
+ String table = IdentityAdminTestCase.TABLE_USERLIST;
int r = findTableRow(table, userName, 0);
- return "_id28jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj:userlist:" + (r - 1)
- + ":_id51jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj";
+ return MessageFormat.format(IdentityAdminTestCase.LINK_T_USRLIST_ROLES, r - 1);
}
}
More information about the portal-commits
mailing list