Author: vrockai
Date: 2008-10-13 10:45:21 -0400 (Mon, 13 Oct 2008)
New Revision: 12059
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/DashboardTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/IdentityAdminTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/JBossPortalSeleniumTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/PortletUserCreationTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/UserLoginTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/WSRPTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSArchiveUploadTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSDirectoryTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileWorkflowTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSSecureTestCase.java
Log:
id fixes
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/DashboardTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/DashboardTestCase.java 2008-10-09
14:23:21 UTC (rev 12058)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/DashboardTestCase.java 2008-10-13
14:45:21 UTC (rev 12059)
@@ -75,8 +75,6 @@
Assert.assertEquals(selenium.getSelectedLabel(SELECT_THEME), "renaissance",
"Previously selected theme other then expected.");
}
-
-
@Test(enabled = true, dependsOnMethods = { "testCreatePage" })
public void testUpdateLayout() {
selenium.click(LINK_DASHBOARD);
@@ -124,6 +122,47 @@
Assert.assertTrue(selenium.isTextPresent("[admin]"));
}
+ @Test(enabled = true, dependsOnMethods = {
"testCreatePage","testAddPortlet" })
+ public void testMovePortlet() {
+ final String pageName = "DashMovePage";
+
+
+ selenium.click(LINK_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LINK_CONFIGURE_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.type(INPUT_PAGENAME, pageName);
+ selenium.click(SUBMIT_CREATEPAGE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click(LINK_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LINK_CONFIGURE_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selectIfNotSelected(SELECT_PAGE,pageName);
+ selenium.click("link=ExceptionPortletInstance");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(SUBMIT_ADDCENTER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selectIfNotSelected(SELECT_PAGE,pageName);
+ selenium.click("link=Who's online portlet");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(SUBMIT_ADDCENTER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click(LINK_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link="+pageName);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertFalse(assertTextOrder("Current;Exception"));
+ Assert.assertTrue(assertTextOrder("Exception;Current"));
+
+ }
+
@Test(enabled = true, dependsOnMethods = { "testAddPortlet" })
public void testDeletePortlet() {
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/IdentityAdminTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/IdentityAdminTestCase.java 2008-10-09
14:23:21 UTC (rev 12058)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/IdentityAdminTestCase.java 2008-10-13
14:45:21 UTC (rev 12059)
@@ -16,37 +16,55 @@
@Test(groups = { "admin_ui" }, enabled = true)
public class IdentityAdminTestCase extends JBossPortalSeleniumTestCase {
- public static final String LINK_T_USRLIST_DEL =
"search-user-form1:userlist:{0}:delete-user-link";
- public static final String LINK_T_USRLIST_ROLES =
"search-user-form1:userlist:{0}:assign-role-link";
- public static final String LINK_T_ROLLIST_DEL =
"roles-form:userlist:{0}:delete-role-link";
- public static final String TABLE_ROLELIST = "roles-form:userlist";
- public static final String TABLE_USERLIST = "search-user-form1:userlist";
- public static final String ID_SUBMIT_CONF_CREATE_USER = "confirm-form:admin";
- public static final String ID_SUBMIT_DELETE_ROLE =
"delete-role-form:confirm";
- public static final String ID_SUBMIT_ROLE_CREATE = "create-role-form:submit";
- public static final String ID_INPUT_ROLEDISNAME =
"create-role-form:roledisplayname";
- public static final String ID_INPUT_ROLENAME = "create-role-form:rolename";
- public static final String ID_BUT_ROLE_CREATE =
"create-role-form:create-role-link";
- public static final String ID_BUT_SUBMIT_DEL_USER =
"delete-user-form:submit";
- public static final String ID_SUBMIT_ASSIGN_ROLE =
"assign-roles-form:submit";
- public static final String ID_SUBMIT_USER_ROLE = "register-role-form:submit";
- public static final String ID_SUBMIT_CREATE_USER = "register-form:submit";
- public static final String ID_INPUT_PASSWORD_CHK =
"register-form:passwordCheck";
- public static final String ID_INPUT_PASSWORD = "register-form:password";
- public static final String ID_INPUT_USEREMAIL = "register-form:email";
- public static final String ID_INPUT_USERNAME = "register-form:username";
- public static final String ID_SUBMIT_SEARCH_USER = "search-user-form:search";
- public static final String ID_INPUT_SEARCH_USER =
"search-user-form:searchString";
- public static final String LINK_SEARCH_USER = "user-form:search-user-link";
- public static final String ID_LINK_USERTAB = "role-temp-form:manage-users";
- public static final String ID_LINK_USERMAIN =
"user-temp-form1:user-adm-link";
- public static final String ID_LINK_ROLETAB = "user-temp-form:role-mgm-link";
- public static final String ID_LINK_ROLEMAIN =
"role-temp-form1:role-mgm-link";
- public static final String LINK_USERMANG_MAIN =
"user-temp-form1:assign-role-link";
- public static final String LINK_USERMANG_MAIN2 =
"user-temp-form1:user-mgm-link";
- public static final String ID_LINK_CREATE_USER =
"user-form:create-user-link";
+ private static final String INPUT_PASS_CHANGE_SUBMIT =
"//input[contains(@id,'jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj:_viewRoot:change-pwd-form:j_id31')]";
+ private static final String INPUT_PASS_CHANGE_CANCEL =
"//input[contains(@id,'change-pwd-form:cancel')]";
+ private static final String INPUT_PASS_CHANGE_P2 =
"//input[contains(@id,':change-pwd-form:passwordCheck')]";
+ private static final String INPUT_PASS_CHANGE_P1 =
"//input[contains(@id,':change-pwd-form:password')]";
+ private static final String LINK_CHANGE_PASS =
"//a[contains(@id,':profile-form:change-pwd-adm-link')]";
+ public static final String TABLE_USERLIST =
"//table[contains(@id,'search-user-form1:userlist')]";
+ public static final String LINK_T_USRLIST_DEL =
"//a[contains(@id,''search-user-form1:userlist:{0}:delete-user-link'')]";
+ public static final String LINK_T_USRLIST_ROLES =
"//a[contains(@id,''search-user-form1:userlist:{0}:assign-role-link'')]";
+ public static final String LINK_T_USRLIST_DIS =
"//a[contains(@id,''search-user-form1:userlist:{0}:enable-user-link'')]";
+ public static final String LINK_T_USRLIST_EDIT =
"//a[contains(@id,''search-user-form1:userlist:{0}:rename-link'')]";
+
+ public static final String TABLE_ROLELIST =
"//table[contains(@id,':_viewRoot:roles-form:userlist')]";
+
+ public static final String LINK_T_ROLLIST_DEL =
"//a[contains(@id,''roles-form:userlist:{0}:delete-role-link'')]";
+ public static final String LINK_T_ROLLIST_MEMBERS =
"//a[contains(@id,''roles-form:userlist:{0}:view-role-link'')]";
+ public static final String LINK_T_ROLLIST_EDIT =
"//a[contains(@id,''roles-form:userlist:{0}:edit-role-link'')]";
+
+ public static final String TABLE_ROLEMEMBERS =
"//table[contains(@id,'role-members-form:role-data-table')]";
+
+ public static final String ID_SUBMIT_CONF_CREATE_USER =
"//input[contains(@id,'confirm-form:admin')]";
+ public static final String ID_SUBMIT_DELETE_ROLE =
"//input[contains(@id,'delete-role-form:confirm')]";
+ public static final String ID_SUBMIT_ROLE_CREATE =
"//input[contains(@id,':_viewRoot:create-role-form:submit')]";
+ public static final String ID_INPUT_ROLEDISNAME =
"//input[contains(@id,':_viewRoot:create-role-form:roledisplayname')]";
+ public static final String ID_INPUT_ROLENAME =
"//input[contains(@id,':_viewRoot:create-role-form:rolename')]";
+
+ public static final String ID_BUT_ROLE_CREATE = "//a[contains(@id,
':_viewRoot:create-role-form:create-role-link')]";
+ public static final String ID_BUT_SUBMIT_DEL_USER =
"//input[contains(@id,'delete-user-form:submit')]";
+ public static final String ID_SUBMIT_ASSIGN_ROLE =
"//input[contains(@id,'assign-roles-form:submit')]";
+ public static final String ID_SUBMIT_USER_ROLE =
"//input[contains(@id,'register-role-form:submit')]";
+ public static final String ID_SUBMIT_CREATE_USER =
"//input[contains(@id,'register-form:submit')]";
+ public static final String ID_INPUT_PASSWORD_CHK =
"//input[contains(@id,'register-form:passwordCheck')]";
+ public static final String ID_INPUT_PASSWORD =
"//input[contains(@id,'register-form:password')]";
+ public static final String ID_INPUT_USEREMAIL =
"//input[contains(@id,'register-form:email')]";
+ public static final String ID_INPUT_USERNAME =
"//input[contains(@id,'register-form:username')]";
+ public static final String ID_SUBMIT_SEARCH_USER =
"//input[contains(@id,'search-user-form:search')]";
+ public static final String ID_INPUT_SEARCH_USER =
"//input[contains(@id,'search-user-form:searchString')]";
+ public static final String LINK_SEARCH_USER =
"//a[contains(@id,'user-form:search-user-link')]";
+ public static final String ID_LINK_USERTAB =
"//a[contains(@id,'role-temp-form:manage-users')]";
+ public static final String ID_LINK_USERMAIN =
"//a[contains(@id,'user-temp-form1:user-adm-link')]";
+
+ public static final String ID_LINK_ROLETAB =
"//a[contains(@id,'_viewRoot:user-temp-form:role-mgm-link')]";
+
+ public static final String ID_LINK_ROLEMAIN = "//a[contains(@id,
':_viewRoot:role-temp-form1:role-admin-link')]";
+ public static final String LINK_USERMANG_MAIN =
"//a[contains(@id,'user-temp-form1:assign-role-link')]";
+ public static final String LINK_USERMANG_MAIN2 =
"//a[contains(@id,'user-temp-form1:user-mgm-link')]";
+ public static final String ID_LINK_CREATE_USER =
"//a[contains(@id,':user-form:create-user-link')]";
- public static final String ID_CHECK_ROLE =
"//input[@name=''assign-roles-form:roles'' and
@value=''{0}'']";
+ public static final String ID_CHECK_ROLE =
"//input[contains(@name,''assign-roles-form:roles'') and
@value=''{0}'']";
+
private String butDelUsr_id(String userName) {
String table = TABLE_USERLIST;
@@ -54,12 +72,6 @@
return MessageFormat.format(LINK_T_USRLIST_DEL, r - 1);
}
- private String butDelRol_id(String roleName) {
- String table = TABLE_ROLELIST;
- int r = findTableRow(table, roleName, 0);
- return MessageFormat.format(LINK_T_ROLLIST_DEL, r - 1);
- }
-
private String butUsrRol_id(String userName) {
String table = TABLE_USERLIST;
int r = findTableRow(table, userName, 0);
@@ -73,9 +85,11 @@
@AfterMethod(groups = { "log" })
public void logoutAfterTest() {
- logout();
+ logoutIfPossible();
}
+/*
+ // For this mode to be functional, the user which is logged in must be
"admin" after each test
@BeforeClass(groups = { "single" })
public void loginBefore() {
login("admin", "admin");
@@ -85,7 +99,7 @@
public void logoutAfter() {
logout();
}
-
+*/
@Test(enabled = true, description = "Creation of new user.")
public void testCreateUser() {
createUser("tempUser", "tempPassword",
"tempUser(a)redhat.com");
@@ -107,7 +121,325 @@
createRole(role, "tempRoleDisplay");
deleteRole(role);
}
+
+ @Test(enabled = true, description = "Creating and deteling a user.")
+ public void testDeleteUser() {
+ createUser("deleteMe", "deleterPass",
"disableMe(a)redhat.com");
+ deleteUser("deleteMe", "disableMe(a)redhat.com");
+ }
+
+ @Test(enabled = true, description = "Creating and disabling a user.")
+ public void testDisableUser() {
+ createUser("disableMe", "disablePass",
"disableMe(a)redhat.com");
+
+ logout();
+ login("disableMe", "disablePass");
+ logout();
+ login("admin","admin");
+
+ searchUser("disableMe", "disableMe(a)redhat.com");
+ int r = findTableRow(TABLE_USERLIST, "disableMe", 0);
+
+ selenium.click(MessageFormat.format(LINK_T_USRLIST_DIS, r - 1 ));
+
+ logout();
+
+ //trying to log in with disabled account
+ selenium.open(ADDR_PORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click(LINK_LOGIN);
+ selenium.selectFrame(FRAME_LOGIN_CONTENT);
+
+ try {
+ Thread.sleep(2000);
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ selenium.type(INPUT_USERNAME, "disableMe");
+ selenium.type(INPUT_PASSWORD, "disablePass");
+ selenium.click(SUBMIT_LOGIN);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("Your account is disabled"));
+ // we should be unable to login with disabled account
+ // logging as user to end the test correctly
+
+ login("admin","admin");
+
+ deleteUser("disableMe", "disableMe(a)redhat.com");
+ }
+
+ @Test(enabled = true, dependsOnMethods = {"testDisableUser"},description =
"Enabling disabled user.")
+ public void testEnableUser() {
+ createUser("enableMe", "enableMe",
"enableMe(a)redhat.com");
+ searchUser("enableMe", "enableMe(a)redhat.com");
+
+ int r = findTableRow(TABLE_USERLIST, "Enable", 5);
+ Assert.assertTrue(r<0,"No user should be disabled.");
+ r = findTableRow(TABLE_USERLIST, "enableMe", 0);
+
+ selenium.click(MessageFormat.format(LINK_T_USRLIST_DIS, r - 1 ));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ searchUser("enableMe", "enableMe(a)redhat.com");
+ r = findTableRow(TABLE_USERLIST, "Enable", 5);
+ Assert.assertFalse(r<0,"One user should have been disabled.");
+
+ r = findTableRow(TABLE_USERLIST, "enableMe", 0);
+ selenium.click(MessageFormat.format(LINK_T_USRLIST_DIS, r - 1 ));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ searchUser("enableMe", "enableMe(a)redhat.com");
+ r = findTableRow(TABLE_USERLIST, "Enable", 5);
+ Assert.assertTrue(r<0,"No user should be disabled.");
+
+ deleteUser("enableMe", "enableMe(a)redhat.com");
+ }
+
+ @Test(enabled = true, description = "Editing a user.")
+ public void testEditUser() {
+ createUser("editMe", "editPass", "editMe(a)redhat.com");
+
+ // canceling the edit form
+ searchUser("editMe", "editMe(a)redhat.com");
+
+ int r = findTableRow(TABLE_USERLIST, "editMe", 0);
+ selenium.click(MessageFormat.format(LINK_T_USRLIST_EDIT, r - 1));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.type("profile-form:email", "editMe2(a)redhat.com");
+ selenium.click("profile-form:cancel");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("editMe(a)redhat.com"));
+
+ // filling out the edit page
+ searchUser("editMe", "editMe(a)redhat.com");
+
+ r = findTableRow(TABLE_USERLIST, "editMe", 0);
+ selenium.click(MessageFormat.format(LINK_T_USRLIST_EDIT, r - 1));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.type("profile-form:email", "editMe2(a)redhat.com");
+ selenium.select("profile-form:timezone", "label=(GMT -12:00 hours)
Eniwetok, Kwajalein");
+ selenium.select("profile-form:theme", "label=portal.industrial");
+ selenium.select("profile-form:locale", "label=Albanian");
+ selenium.type("profile-form:givenname", "Edit");
+ selenium.type("profile-form:lastname", "Meme");
+ selenium.type("profile-form:location", "Editoland");
+ selenium.type("profile-form:skype", "editor");
+ selenium.type("profile-form:icq", "112113114");
+ selenium.type("profile-form:aim", "83838495");
+ selenium.type("profile-form:msnm", "u8u8i9o0");
+ selenium.type("profile-form:yim", "99384875");
+ selenium.type("profile-form:xmmp", "10309128");
+ selenium.type("profile-form:homepage", "http://www.edit.com");
+ selenium.type("profile-form:occupation", "editor");
+ selenium.type("profile-form:interests", "editing");
+ selenium.type("profile-form:signature", "----\n\ni like to edit");
+ selenium.type("profile-form:extra", "me edit good");
+ selenium.click("profile-form:submit");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("editMe2(a)redhat.com"));
+ Assert.assertTrue(selenium.isTextPresent("Edit"));
+ Assert.assertTrue(selenium.isTextPresent("Meme"));
+
+ deleteUser("editMe", "editMe2(a)redhat.com");
+
+ }
+
+ @Test(enabled = true, description = "Editing a user - changing of password.")
+ public void testEditUserChangePassword() {
+ createUser("changePass", "changePassPass",
"changePass(a)redhat.com");
+
+ logout();
+ login("changePass","changePassPass");
+ logout();
+ login("admin","admin");
+
+ /*
+ * Canceling of change at the first approach
+ */
+
+ searchUser("changePass", "changePass(a)redhat.com");
+
+ int r = findTableRow(TABLE_USERLIST, "changePass", 0);
+ selenium.click(MessageFormat.format(LINK_T_USRLIST_EDIT, r - 1));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LINK_CHANGE_PASS);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.type(INPUT_PASS_CHANGE_P1, "changePass2");
+ selenium.type(INPUT_PASS_CHANGE_P2, "changePass2");
+ selenium.click(INPUT_PASS_CHANGE_CANCEL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertFalse(selenium.isTextPresent("Password has been updated."));
+
+ logout();
+ login("changePass","changePassPass");
+ logout();
+ login("admin","admin");
+
+ /*
+ * In the second approach really change the password
+ */
+
+ searchUser("changePass", "changePass(a)redhat.com");
+
+ r = findTableRow(TABLE_USERLIST, "changePass", 0);
+ selenium.click(MessageFormat.format(LINK_T_USRLIST_EDIT, r - 1));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LINK_CHANGE_PASS);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.type(INPUT_PASS_CHANGE_P1, "changePass2");
+ selenium.type(INPUT_PASS_CHANGE_P2, "changePass2");
+ selenium.click(INPUT_PASS_CHANGE_SUBMIT);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent("Password has been updated."));
+
+ logout();
+ login("changePass","changePass2");
+ logout();
+ login("admin","admin");
+
+ deleteUser("changePass","changePass(a)redhat.com");
+ }
+
+ @Test(enabled = true, description = "Managing members of role.")
+ public void testRoleMembers() {
+ createRole("membersRole", "membersRoleDisplay");
+ createUser("newRoleMember" , "newRoleMember",
"newRoleMem(a)redhatqa.com");
+ assignRole("newRoleMember", "newRoleMem(a)redhatqa.com",
"membersRole", "membersRoleDisplay");
+
+ clickUntilMembers();
+ clickIfVisible(ID_LINK_ROLETAB);
+ clickIfVisible(ID_LINK_ROLEMAIN);
+
+ int r = findTableRow(TABLE_ROLELIST, "membersRole", 0);
+ selenium.click(MessageFormat.format(LINK_T_ROLLIST_MEMBERS, r-1));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ //search for the real member of current role
+ selenium.type("search-user-form:searchString", "newRoleMember");
+ selenium.click("search-user-form:search");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ r = findTableRow(TABLE_ROLEMEMBERS, "newRoleMember", 0);
+ Assert.assertTrue(r>0, "Assigned member not found in the role members
table.");
+
+ //search for the non-member user of current role
+ selenium.type("search-user-form:searchString",
"newRoleNonMember");
+ selenium.click("search-user-form:search");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertFalse(selenium.isElementPresent(TABLE_ROLEMEMBERS), "Not assigned
member found in the role members table.");
+
+ deleteRole("membersRole");
+ deleteUser("newRoleMember" , "newRoleMem(a)redhatqa.com");
+ }
+
+ @Test(enabled = true, description = "Creation of new role.")
+ public void testRoleEdit() {
+
+ createRole("editRole", "editRoleDisplay");
+
+ clickUntilMembers();
+ clickIfVisible(ID_LINK_ROLETAB);
+ clickIfVisible(ID_LINK_ROLEMAIN);
+
+ int r = findTableRow(TABLE_ROLELIST, "editRoleDisplay", 1);
+ Assert.assertTrue(r>=0,"Renamed display name found in table");
+
+ r = findTableRow(TABLE_ROLELIST, "editedRoleDisplay", 1);
+ Assert.assertFalse(r>=0,"Not created role display name found in table");
+
+ //canceling of renaming of displayname for the first time
+ r = findTableRow(TABLE_ROLELIST, "editRole", 0);
+
+ selenium.click(MessageFormat.format(LINK_T_ROLLIST_EDIT, r -1));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.type("edit-role-link:display-Name", "editedRoleDisplay");
+ selenium.click("edit-role-link:cancel");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ r = findTableRow(TABLE_ROLELIST, "editRoleDisplay", 1);
+ Assert.assertTrue(r>=0,"Renamed display name found in table");
+
+ r = findTableRow(TABLE_ROLELIST, "editedRoleDisplay", 1);
+ Assert.assertFalse(r>=0,"Not created role display name found in table");
+
+ // real renaming
+ r = findTableRow(TABLE_ROLELIST, "editRole", 0);
+ selenium.click(MessageFormat.format(LINK_T_ROLLIST_EDIT, r-1));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.type("edit-role-link:display-Name", "editedRoleDisplay");
+ selenium.click("edit-role-link:submit");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ r = findTableRow(TABLE_ROLELIST, "editRoleDisplay", 1);
+ Assert.assertFalse(r>=0,"Renamed display name found in table");
+
+ r = findTableRow(TABLE_ROLELIST, "editedRoleDisplay", 1);
+ Assert.assertTrue(r>=0,"New role display name not found in table");
+
+ deleteRole("editRole");
+ }
+
+ @Test(enabled= false, description = "Altering the number of rows in user
search")
+ public void testSearchUserCount() {
+
+ for(int i=0; i< 95; i++){
+ createUser("man"+i+"us", "man"+i+"pas",
"man"+i+"us"+"(a)redhatqa.com");
+ }
+
+ searchSimple("man","10");
+ Assert.assertEquals(countTableRows(TABLE_USERLIST)-1,10,"Wrong number of row in
user table #1.");
+
+ searchSimple("man","50");
+ Assert.assertEquals(countTableRows(TABLE_USERLIST)-1,50,"Wrong number of row in
user table #2.");
+ selenium.click("search-user-form1:next-page");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertEquals(countTableRows(TABLE_USERLIST)-1,45,"Wrong number of row in
user table #3.");
+ selenium.click("search-user-form1:prev-page");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ searchSimple("man","100");
+ Assert.assertEquals(countTableRows(TABLE_USERLIST)-1,95,"Wrong number of row in
user table #4.");
+ /*
+ for(int i=0; i< 95; i++){
+ deleteUser("man"+i+"us",
"man"+i+"us"+"(a)redhatqa.com");
+ }
+ */
+
+ }
+
+ private void searchSimple(String name, String count){
+ selenium.open("/portal/");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Members");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ clickIfVisible(ID_LINK_USERTAB);
+ clickIfVisible(ID_LINK_USERMAIN);
+ clickIfVisible(LINK_USERMANG_MAIN);
+
+ selenium.click(LINK_SEARCH_USER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.type(ID_INPUT_SEARCH_USER, name);
+ selenium.select("search-user-form:limit", "label="+count);
+ selenium.click(ID_SUBMIT_SEARCH_USER);
+ //selenium.waitForPageToLoad(PAGE_LOAD);
+ waitBlock();
+ }
+
+
@Test(enabled = true, dependsOnMethods = { "testCreateUser",
"testCreateRole" }, description = "Assigning of the role to the
user.")
public void testAssignRole2User() {
String user = "tempUser";
@@ -251,8 +583,8 @@
selenium.type(ID_INPUT_SEARCH_USER, username);
selenium.click(ID_SUBMIT_SEARCH_USER);
- selenium.waitForPageToLoad(PAGE_LOAD);
-
+ //selenium.waitForPageToLoad(PAGE_LOAD);
+ waitBlock();
Assert.assertTrue(selenium.isTextPresent(username), "Username was not
found.");
Assert.assertTrue(selenium.isTextPresent(email), "User email adress was not
found.");
}
@@ -276,8 +608,8 @@
selenium.type(ID_INPUT_SEARCH_USER, username);
selenium.click(ID_SUBMIT_SEARCH_USER);
- selenium.waitForPageToLoad(PAGE_LOAD);
-
+ //selenium.waitForPageToLoad(PAGE_LOAD);
+ waitBlock();
Assert.assertTrue(selenium.isTextPresent(username), "Username was not
found.");
Assert.assertTrue(selenium.isTextPresent(email), "User e-mail adress was not
found.");
@@ -288,6 +620,15 @@
Assert.assertTrue(selenium.isTextPresent("User deleted"), "user was not
deleted (\"User deleted\" text missing).");
}
+ private void clickUntilMembers(){
+ selenium.open("/portal/");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Members");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ }
+
private void createRole(String roleName, String roleDisplayName) {
selenium.open("/portal/");
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -328,14 +669,26 @@
Assert.assertTrue(selenium.isTextPresent(roleName), "Role name is missing");
- selenium.click(butDelRol_id(roleName));
+ int r = findTableRow(TABLE_ROLELIST, roleName, 0);
+ selenium.click(MessageFormat.format(LINK_T_ROLLIST_DEL, r-1));
+ selenium.waitForPageToLoad(PAGE_LOAD);
selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertTrue(selenium.isTextPresent("Warning! You are about to delete the
role " + roleName),
+ Assert.assertTrue(selenium.isTextPresent("Warning! You are about to delete the
role '" + roleName+"'"),
"Confirmation text for role deletion missing missing.");
selenium.click(ID_SUBMIT_DELETE_ROLE);
selenium.waitForPageToLoad(PAGE_LOAD);
}
+
+ public void waitBlock(){
+ try {
+ Thread.sleep(2000);
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
}
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/JBossPortalSeleniumTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/JBossPortalSeleniumTestCase.java 2008-10-09
14:23:21 UTC (rev 12058)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/JBossPortalSeleniumTestCase.java 2008-10-13
14:45:21 UTC (rev 12059)
@@ -10,13 +10,13 @@
* @author <a href="mailto:vrockai@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";
+ public static final String LINK_LOGOUT = "link=Logout";
+ public static final String SUBMIT_LOGIN = "login";
+ public static final String ADDR_PORTAL = "/portal/";
+ public static final String FRAME_LOGIN_CONTENT = "login-content";
+ public static final String LINK_LOGIN = "link=Login";
+ public static final String INPUT_PASSWORD = "j_password";
+ public static final String INPUT_USERNAME = "j_username";
protected Selenium selenium;
protected static final String PAGE_LOAD = "250000";
@@ -38,7 +38,6 @@
if (selenium.isElementPresent(id)){
selenium.click(id);
-
selenium.waitForPageToLoad(PAGE_LOAD);
}
}
@@ -92,9 +91,12 @@
selenium.waitForPageToLoad(PAGE_LOAD);
}
}
+
+ protected boolean assertTextOrder(String text){
+ return Boolean.valueOf(selenium.getEval("selenium.assertTextOrder(\"" +
text + "\")"));
+ }
protected void login(String username, String password) {
- selenium.setTimeout("0");
selenium.open(ADDR_PORTAL);
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -125,4 +127,15 @@
Assert.assertFalse(selenium.isTextPresent("Logged in as:"), "Not logged
in, login message missing.");
Assert.assertTrue(selenium.isElementPresent("Link=Login"), "Login link
not present.");
}
+
+ protected void logoutIfPossible() {
+ selenium.open(ADDR_PORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ if (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_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/PortletUserCreationTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/PortletUserCreationTestCase.java 2008-10-09
14:23:21 UTC (rev 12058)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/PortletUserCreationTestCase.java 2008-10-13
14:45:21 UTC (rev 12059)
@@ -10,8 +10,10 @@
@Test(groups = { "portlet_user_creation" }, enabled = true)
public class PortletUserCreationTestCase extends JBossPortalSeleniumTestCase {
private static final String SUBMIT_CREATE_CONF = "confirm-form:user";
+ public static final String SUBMIT_CREATE_CONF_EDIT = "confirm-form:revise";
private static final String SUBMIT_CREATE_USER = "register-form:submit";
+ private static final String SUBMIT_CREATE_USER_CANCEL =
"register-form:cancel";
private static final String INPUT_USERPASSWDCONF =
"register-form:passwordCheck";
@@ -47,9 +49,91 @@
Assert.assertTrue((selenium.isTextPresent("portletUser(a)redhat.com")));
selenium.click(SUBMIT_CREATE_CONF);
selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertTrue((selenium.isTextPresent("* Your account has been successfully
created. You may want to login now.")));
+ Assert.assertTrue((selenium.isTextPresent("Your account has been successfully
created. You may want to login now.")));
}
+
+ @Test(enabled = true, description = "User creation using most of the active
elements on page.")
+ public void userCreationLongTest() {
+
+ //canceling of creation
+ selenium.open("/portal");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ clickIfVisible(TAB_WELCOME);
+ Assert.assertTrue((selenium.isElementPresent(LINK_CREATE_USER)));
+ selenium.click(LINK_CREATE_USER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue((selenium.isTextPresent("Username *")));
+ Assert.assertTrue((selenium.isTextPresent("E-Mail *")));
+ Assert.assertTrue((selenium.isTextPresent("Password *")));
+ Assert.assertTrue((selenium.isTextPresent("Confirm Password *")));
+ selenium.type(INPUT_USERNAME, "portletLongUser");
+ selenium.type(INPUT_USERMAIL, "portletLongUser(a)redhat.com");
+ selenium.type(INPUT_USERPASSWD, "portletLongUserPassword");
+ selenium.type(INPUT_USERPASSWDCONF, "portletLongUserPassword");
+
+ selenium.click(SUBMIT_CREATE_USER_CANCEL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ // editing of creation
+ selenium.open("/portal");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ clickIfVisible(TAB_WELCOME);
+ Assert.assertTrue((selenium.isElementPresent(LINK_CREATE_USER)));
+ selenium.click(LINK_CREATE_USER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.type(INPUT_USERNAME, "portlextLongUser");
+ selenium.type(INPUT_USERMAIL, "portxletLongUser(a)redhat.com");
+ selenium.type(INPUT_USERPASSWD, "porxtletLongUserPassword");
+ selenium.type(INPUT_USERPASSWDCONF, "porxtletLongUserPassword");
+ selenium.click(SUBMIT_CREATE_USER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(SUBMIT_CREATE_CONF_EDIT);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.type(INPUT_USERNAME, "portletLong2User");
+ selenium.type(INPUT_USERMAIL, "portletLong2User(a)redhat.com");
+ selenium.type(INPUT_USERPASSWD, "portletLong2UserPassword");
+ selenium.type(INPUT_USERPASSWDCONF, "portletLong2UserPassword");
+ selenium.click(SUBMIT_CREATE_USER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue((selenium.isTextPresent("portletLong2User")));
+ Assert.assertTrue((selenium.isTextPresent("portletLong2User(a)redhat.com")));
+
+ selenium.click(SUBMIT_CREATE_CONF);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ // verification
+ Assert.assertTrue((selenium.isTextPresent("Your account has been successfully
created. You may want to login now.")));
+ }
+ @Test(enabled = true, description = "Canceling of editing during the user
creation.")
+ public void userCreationCancelEditTest() {
+ selenium.open("/portal");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ clickIfVisible(TAB_WELCOME);
+ Assert.assertTrue((selenium.isElementPresent(LINK_CREATE_USER)));
+ selenium.click(LINK_CREATE_USER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.type(INPUT_USERNAME, "portletCLongUser");
+ selenium.type(INPUT_USERMAIL, "portletCLongUser(a)redhat.com");
+ selenium.type(INPUT_USERPASSWD, "portletCLongUserPassword");
+ selenium.type(INPUT_USERPASSWDCONF, "portletCLongUserPassword");
+ selenium.click(SUBMIT_CREATE_USER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(SUBMIT_CREATE_CONF_EDIT);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.type(INPUT_USERNAME, "portletCLong2User");
+ selenium.type(INPUT_USERMAIL, "portletCLong2User(a)redhat.com");
+ selenium.type(INPUT_USERPASSWD, "portletCLong2UserPassword");
+ selenium.type(INPUT_USERPASSWDCONF, "portletCLong2UserPassword");
+ selenium.click(SUBMIT_CREATE_USER_CANCEL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent("You can create an account."));
+ }
+
@Test(enabled = true, description = "Creation of already existing user.")
public void existingUserCreationTest() {
selenium.open("/portal");
@@ -66,7 +150,7 @@
Assert.assertTrue(selenium.isTextPresent("This username is already taken.
user"));
}
- @Test(enabled = true, description = "Using invalid e-mail within user
creation.")
+ @Test(enabled = false, description = "Using invalid e-mail within user
creation.")
public void invalidEmail() {
selenium.open("/portal");
selenium.waitForPageToLoad(PAGE_LOAD);
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/UserLoginTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/UserLoginTestCase.java 2008-10-09
14:23:21 UTC (rev 12058)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/UserLoginTestCase.java 2008-10-13
14:45:21 UTC (rev 12059)
@@ -45,22 +45,6 @@
Assert.assertTrue(selenium.isTextPresent("Logged in as: user"),
"\"Logged in as\" message missing.");
- Assert.assertTrue(selenium.isElementPresent("xpath=id('regionA')/div[2]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[1]/td[1]/"),
- "DOM Element with username label not available.");
- Assert.assertEquals(selenium.getText("xpath=id('regionA')/div[2]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[1]/td[1]/"),
"Username:");
-
- Assert.assertTrue(selenium.isElementPresent("xpath=id('regionA')/div[2]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[1]/td[2]/"),
- "Incorrect username for default user \"user\".");
- Assert.assertEquals(selenium.getText("xpath=id('regionA')/div[2]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[1]/td[2]/"),
"user");
-
- Assert.assertTrue(selenium.isElementPresent("xpath=id('regionA')/div[2]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[2]/td[1]/"),
- "DOM Element with e-mail label not available.");
- Assert.assertEquals(selenium.getText("xpath=id('regionA')/div[2]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[2]/td[1]/"),
"E-Mail:");
-
- Assert.assertTrue(selenium.isElementPresent("xpath=id('regionA')/div[2]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[2]/td[2]/"),
- "Incorrect e-mail for default user \"user\".");
- Assert.assertEquals(selenium.getText("xpath=id('regionA')/div[2]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[2]/td[2]/"),
"user(a)portal.com");
-
Assert.assertTrue(selenium.isElementPresent("link=Logout"), "Expected
DOM element for login link does not exist.");
Assert.assertEquals(selenium.getText("link=Logout"), "Logout",
"Logout has wrong label.");
@@ -90,24 +74,6 @@
Assert.assertTrue(selenium.isTextPresent("Logged in as: admin"),
"\"Logged in as\" message missing.");
- Assert.assertTrue(selenium.isElementPresent("xpath=id('regionA')/div[2]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[1]/td[1]/"),
- "DOM Element with username label not available.");
- Assert.assertEquals(selenium.getText("xpath=id('regionA')/div[2]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[1]/td[1]/"),
"Username:");
-
- Assert.assertTrue(selenium.isElementPresent("xpath=id('regionA')/div[2]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[1]/td[2]/"),
- "Incorrect username for default user \"user\".");
- Assert.assertEquals(selenium.getText("xpath=id('regionA')/div[2]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[1]/td[2]/"),
"admin");
-
- Assert.assertTrue(selenium.isElementPresent("xpath=id('regionA')/div[2]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[2]/td[1]/"),
- "DOM Element with e-mail label not available.");
- Assert.assertEquals(selenium.getText("xpath=id('regionA')/div[2]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[2]/td[1]/"),
"E-Mail:");
-
- Assert.assertTrue(selenium.isElementPresent("xpath=id('regionA')/div[2]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[2]/td[2]/"),
- "Incorrect e-mail for default user \"user\".");
- Assert
- .assertEquals(selenium.getText("xpath=id('regionA')/div[2]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[2]/td[2]/"),
- "admin(a)portal.com");
-
Assert.assertTrue(selenium.isElementPresent("link=Logout"), "Expected
DOM element for login link does not exist.");
Assert.assertEquals(selenium.getText("link=Logout"), "Logout",
"Logout has wrong label.");
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/WSRPTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/WSRPTestCase.java 2008-10-09
14:23:21 UTC (rev 12058)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/WSRPTestCase.java 2008-10-13
14:45:21 UTC (rev 12059)
@@ -301,6 +301,9 @@
selenium.type(INPUT_CREATECONS, name);
selenium.click(SUBMIT_CREATECONS);
selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.setSpeed("5000");
+
selenium.type(INPUT_CACHEEXP, timeout);
selenium.type(INPUT_CONSWSDL, address);
selenium.click(SUBMIT_REFRESHSAVE);
@@ -308,6 +311,9 @@
selenium.type(INPUT_CONS_REGVALUE, "public");
selenium.click(SUBMIT_CONS_REGVAL);
selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.setSpeed("0");
+
selenium.click(SUBMIT_REFRESHFINAL);
selenium.waitForPageToLoad(PAGE_LOAD);
}
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSArchiveUploadTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSArchiveUploadTestCase.java 2008-10-09
14:23:21 UTC (rev 12058)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSArchiveUploadTestCase.java 2008-10-13
14:45:21 UTC (rev 12059)
@@ -13,6 +13,9 @@
@Test(groups = { "cms_archive_upload" }, enabled = true)
public class CMSArchiveUploadTestCase extends JBossPortalSeleniumTestCase {
+ /* uncomment following lines and set the right path to the workspace in the case
+ * you want to use this test case locally from eclipse */
+
/*
{
System.setProperty("workspace","/home/vrockai/workspace/selenium/selenium/");
@@ -34,7 +37,29 @@
@Test(enabled = true, description = "Test archive consisting of two files
upload.")
public void testArchiveUpload() {
//System.out.println("archive adress:" + WORKSPACE);
+ // canceling at the first stage
+ 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=Upload Archive");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.waitForPopUp("_top", PAGE_LOAD);
+ selenium.type("response", WORKSPACE + "/test_files/archive.zip");
+ selenium.click("cancel");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+
+ Assert.assertFalse(selenium.isTextPresent("Your archive has been accepted for
processing"));
+ Assert.assertFalse(selenium.isElementPresent("link=archive"));
+
+ selenium.open(ADDR_PORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertFalse(selenium.isElementPresent("link=archive"));
+
+ // really uploading the file now
selenium.click("link=Admin");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=CMS");
@@ -46,8 +71,10 @@
selenium.type("response", WORKSPACE + "/test_files/archive.zip");
selenium.click("submit");
-
selenium.waitForPageToLoad(PAGE_LOAD);
+ //
+
+ selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertEquals(selenium.getText("//div[@id='center']/div/div/table/tbody/tr[2]/td/font"),
"Your archive has been accepted for processing. The resources will appear in
your Folder once the processing is finished");
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSDirectoryTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSDirectoryTestCase.java 2008-10-09
14:23:21 UTC (rev 12058)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSDirectoryTestCase.java 2008-10-13
14:45:21 UTC (rev 12059)
@@ -32,6 +32,9 @@
@Test(enabled = true, description="Directory creation.")
public void testCreateDirectory() {
+
+ // cancelling of creating
+
selenium.click("link=Admin");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=CMS");
@@ -40,14 +43,38 @@
selenium.open("/portal/auth/portal/admin/CMS");
selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertFalse(selenium.isTextPresent("TestFolder["), "Test folder
is already present.");
+ Assert.assertFalse(selenium.isTextPresent(tempDirName), "Test folder is already
present.");
selenium.select("//div[@id='center']/div/div/div[1]/div/select",
"label=Create Folder");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.waitForPopUp("_top", PAGE_LOAD);
selenium.type("newcollectionname", tempDirName);
selenium.type("newcollectiondescription", "test folder");
+ selenium.click("cancel");
+
+ // really creating
+ selenium.open(ADDR_PORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.open("/portal/auth/portal/admin/CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertFalse(selenium.isTextPresent(tempDirName), "Test folder is already
present.");
+
+ selenium.select("//div[@id='center']/div/div/div[1]/div/select",
"label=Create Folder");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.waitForPopUp("_top", PAGE_LOAD);
+ selenium.type("newcollectionname", tempDirName);
+ selenium.type("newcollectiondescription", "test folder");
selenium.click("submit");
+
+ // assuring that the directory is deleted
+
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isElementPresent("//div[@id='center']/div/div/ul/li[3]"));
Assert.assertEquals(tempDirName,
selenium.getText("//div[@id='center']/div/div/ul/li[3]"));
@@ -59,11 +86,36 @@
@Test(enabled = true, dependsOnMethods =
"testCreateDirectory",description="Directory delete.")
public void testDeleteDirectory() {
+
+ // firstly cancel the delete process
+
selenium.click("link=Admin");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=CMS");
selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isElementPresent("link=" + tempDirName));
+ selenium.select(takeAction(tempDirName) + "/select",
"label=Delete");
+ selenium.click(takeAction(tempDirName) + "/select/option[4]");
+ selenium.click(takeAction(tempDirName) + "/input");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent("Confirm Deletion of /" +
tempDirName));
+ 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);
+
+ // really deleting
+ selenium.open(ADDR_PORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isElementPresent("link=" + tempDirName));
selenium.select(takeAction(tempDirName) + "/select",
"label=Delete");
selenium.click(takeAction(tempDirName) + "/select/option[4]");
selenium.click(takeAction(tempDirName) + "/input");
@@ -76,6 +128,14 @@
selenium.click("submit");
selenium.waitForPageToLoad(PAGE_LOAD);
+ // assuring that the deletition was processed
+ selenium.open(ADDR_PORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
Assert.assertFalse(selenium.isElementPresent("link=" + tempDirName));
}
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileTestCase.java 2008-10-09
14:23:21 UTC (rev 12058)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileTestCase.java 2008-10-13
14:45:21 UTC (rev 12059)
@@ -14,6 +14,7 @@
public class CMSFileTestCase extends JBossPortalSeleniumTestCase {
private final String CMS_FILE_TABLE =
"//div[@id='center']/div/div/div[3]/table";
+ public static final String CMS_FILE_PENDING_TABLE =
"//div[@id='center']/div/div/table[2]";
@BeforeMethod(groups = { "log" })
public void loginBeforeTest() {
@@ -109,6 +110,13 @@
selenium.select("language", "label=Czech");
selenium.click("save");
selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(findTableRow(CMS_FILE_PENDING_TABLE, "text/plain", 0) >=
0);
+ Assert.assertTrue(findTableRow(CMS_FILE_PENDING_TABLE, "0kb", 1) >= 0);
+ Assert.assertTrue(findTableRow(CMS_FILE_PENDING_TABLE, "admin", 3) >= 0);
+
+ selenium.click("link=Approve");
+
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]"));
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileWorkflowTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileWorkflowTestCase.java 2008-10-09
14:23:21 UTC (rev 12058)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileWorkflowTestCase.java 2008-10-13
14:45:21 UTC (rev 12059)
@@ -34,9 +34,11 @@
logout();
}
-
@Test(enabled = true, description = "Simple file creation.")
public void testCreateFileApprove() {
+
+ // canceling first
+
selenium.click("link=Admin");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=CMS");
@@ -50,6 +52,25 @@
selenium.type("title", "newFile title");
selenium.select("language", "label=Czech");
+ selenium.click("cancel");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ // saving
+ selenium.open(ADDR_PORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select(SELECT_CMS_MAIN, "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);
@@ -101,10 +122,33 @@
@Test(enabled = true, description = "Simple file creation.")
public void testCreateFilePreview(){
+ String name = "file2preview";
- //TODO after the bug with empty content is repaired
+ selenium.open(ADDR_PORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Home");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select(SELECT_CMS_MAIN, "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");
+ fillInEditor("vivat!");
+ selenium.click("save");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Preview");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("Pending Approval Queue"));
+ Assert.assertTrue(selenium.isTextPresent("vivat!"));
+
}
@Test(enabled = true, dependsOnMethods = "testCreateFileApprove", description
= "Simple file delete Cancel in first step, and then delete.")
@@ -131,9 +175,9 @@
row = findTableRow(CMS_FILE_TABLE, "newFile", 0) + 1;
- selenium.select("//div[@id='center']/div/div/div[3]/table/tbody/tr["+row+"]/td[2]/form/select",
"label=Delete");
- selenium.click("//div[@id='center']/div/div/div[3]/table/tbody/tr["+row+"]/td[2]/form/select/option[4]");
- selenium.click("//div[@id='center']/div/div/div[3]/table/tbody/tr["+row+"]/td[2]/form/input");
+ selenium.select(CMS_FILE_TABLE +
"/tbody/tr["+row+"]/td[2]/form/select", "label=Delete");
+ selenium.click(CMS_FILE_TABLE +
"/tbody/tr["+row+"]/td[2]/form/select/option[4]");
+ selenium.click(CMS_FILE_TABLE +
"/tbody/tr["+row+"]/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!"));
@@ -145,19 +189,54 @@
@Test(enabled = true, description = "File creation and moving to default
directory.")
public void testMoveFile() {
createFile("fileToMove","");
+
+ //canceling first
+
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.select(CMS_FILE_TABLE + "/tbody/tr[" + row +
"]/td[2]/form/select", "label=Move");
+ selenium.click(CMS_FILE_TABLE + "/tbody/tr[" + row +
"]/td[2]/form/select/option[3]");
+ selenium.click(CMS_FILE_TABLE + "/tbody/tr[" + row +
"]/td[2]/form/input");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=default");
+ selenium.click("cancel");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ // assuming file is not moved
+
+ selenium.click("link=default");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertFalse(selenium.isElementPresent("link=fileToMove"));
+
+ selenium.click("link=Home");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isElementPresent("link=fileToMove"));
+
+ // really moving file
+ selenium.open(ADDR_PORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ row = findTableRow(CMS_FILE_TABLE, "fileToMove", 0) + 1;
+
+ selenium.select(CMS_FILE_TABLE + "/tbody/tr[" + row +
"]/td[2]/form/select", "label=Move");
+ selenium.click(CMS_FILE_TABLE + "/tbody/tr[" + row +
"]/td[2]/form/select/option[3]");
+ selenium.click(CMS_FILE_TABLE + "/tbody/tr[" + row +
"]/td[2]/form/input");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=default");
selenium.click("submit");
selenium.waitForPageToLoad(PAGE_LOAD);
+
+ // assuming file is moved
+
selenium.click("link=default");
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -178,9 +257,9 @@
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.select(CMS_FILE_TABLE + "/tbody/tr[" + row +
"]/td[2]/form/select", "label=Copy");
+ selenium.click(CMS_FILE_TABLE + "/tbody/tr[" + row +
"]/td[2]/form/select/option[3]");
+ selenium.click(CMS_FILE_TABLE + "/tbody/tr[" + row +
"]/td[2]/form/input");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=default");
selenium.click("submit");
@@ -204,6 +283,8 @@
createFile(file,"contentstring1");
+ // canceling for the first time
+
selenium.click("link=Admin");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=CMS");
@@ -211,11 +292,31 @@
selenium.click("link="+file);
selenium.waitForPageToLoad(PAGE_LOAD);
- //selenium.setSpeed("5000");
+
row = findTableRow(CMS_FV_TABLE, "1.1", 2) + 1;
- selenium.click("//div[@id='center']/div/div/table/tbody/tr["+row+"]/td[1]/a");
+ selenium.click(CMS_FV_TABLE + "/tbody/tr["+row+"]/td[1]/a");
selenium.waitForPageToLoad(PAGE_LOAD);
fillInEditor("contentstring2");
+ selenium.click("cancel");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ // really creating and approving
+ selenium.open(ADDR_PORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Home");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click("link="+file);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ row = findTableRow(CMS_FV_TABLE, "1.1", 2) + 1;
+ selenium.click(CMS_FV_TABLE + "/tbody/tr["+row+"]/td[1]/a");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ fillInEditor("contentstring2");
selenium.click("save");
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -223,7 +324,7 @@
selenium.waitForPageToLoad(PAGE_LOAD);
row = findTableRow(CMS_FV_TABLE, "1.3", 2) + 1;
- selenium.click("//div[@id='center']/div/div/table/tbody/tr["+row+"]/td[1]/a");
+ selenium.click(CMS_FV_TABLE + "/tbody/tr["+row+"]/td[1]/a");
selenium.waitForPageToLoad(PAGE_LOAD);
fillInEditor("contentstring3");
selenium.click("save");
@@ -235,19 +336,26 @@
Assert.assertFalse(selenium.isTextPresent("1.5"));
row = findTableRow(CMS_FV_TABLE, "1.3", 2) + 1;
- selenium.click("//div[@id='center']/div/div/table/tbody/tr["+row+"]/td[1]/a");
+ selenium.click(CMS_FV_TABLE + "/tbody/tr["+row+"]/td[1]/a");
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isTextPresent("contentstring2"));
}
+
private void createFile(String name,String content) {
+
+ // save and approve
+ selenium.open(ADDR_PORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
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.click("link=Home");
selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select(SELECT_CMS_MAIN, "label=Create File");
+ selenium.waitForPageToLoad(PAGE_LOAD);
selenium.waitForPopUp("_top", PAGE_LOAD);
selenium.type("filename", name);
selenium.type("description", name + " description");
@@ -256,6 +364,7 @@
selenium.click("save");
selenium.waitForPageToLoad(PAGE_LOAD);
+
selenium.click("link=Approve");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=Home");
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSSecureTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSSecureTestCase.java 2008-10-09
14:23:21 UTC (rev 12058)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSSecureTestCase.java 2008-10-13
14:45:21 UTC (rev 12059)
@@ -131,6 +131,9 @@
@Test(enabled = true, description = "Set user read permissions, login as
user.")
public void testSetUserReadPer() {
+
+ // cancelling at first stage
+
login("admin", "admin");
Assert.assertFalse(selenium.isTextPresent("Access Denied"),"Non secured
resource is not visible.#1");
@@ -148,6 +151,30 @@
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.select(SELECT_SECUREROLES_READ, "label=Administrators");
selenium.select(SELECT_SECUREUSERS_READ, "label=user");
+ selenium.click("cancel");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ logout();
+
+ // really setting the permissions
+
+ login("admin", "admin");
+
+ 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.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LINK_CMS);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LINK_DEFAULT);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LINK_INDEX_HTML);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select(SELECT_CMS_ACTION, "label=Secure");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select(SELECT_SECUREROLES_READ, "label=Administrators");
+ selenium.select(SELECT_SECUREUSERS_READ, "label=user");
selenium.click(SUBMIT_SECURITY_SET);
selenium.waitForPageToLoad(PAGE_LOAD);