Author: vrockai
Date: 2009-02-04 09:00:11 -0500 (Wed, 04 Feb 2009)
New Revision: 12771
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/JBossSelenium.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/cms/CMSSecureTestCase.java
Log:
identity admin selenium fix
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 2009-02-04
10:06:14 UTC (rev 12770)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/IdentityAdminTestCase.java 2009-02-04
14:00:11 UTC (rev 12771)
@@ -14,7 +14,12 @@
@Test(groups = { "admin_ui" }, enabled = true)
public class IdentityAdminTestCase extends JBossPortalSeleniumTestCase {
+ private static final String SEL_SEARCHUSER_LIMIT =
"//select[contains(@id,'search-user-form:limit')]";
private static final String SUB_EDIT_PROF =
"//input[contains(@id,'profile-form:submit')]";
+
+ private static final String SUB_PAGIN_LEFT =
"//input[contains(@id,'search-user-form1:prev-page')]";
+ private static final String SUB_PAGIN_RIGHT =
"//input[contains(@id,'search-user-form1:next-page')]";
+
private static final String SUB_EDIT_USER_EMAIL_CANCEL =
"//input[contains(@id,'profile-form:cancel')]";
private static final String INP_EDIT_USER_EMAIL =
"//input[contains(@id,'profile-form:email')]";
private static final String SUB_ROLE_SEARCH_USER =
"//input[contains(@id,'search-user-form:search') and
@type='submit']";
@@ -24,64 +29,65 @@
private static final String INP_EDIT_ROLE_NAME =
"//input[contains(@id,'edit-role-link:display-name')]";
private static final String SUB_PASS_CHANGE_SUBMIT =
"//input[contains(@name,'change-pwd-form:j_id31')]";
private static final String SUB_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')]";
+ private static final String INP_PASS_CHANGE_P2 =
"//input[contains(@id,':change-pwd-form:passwordCheck')]";
+ private static final String INP_PASS_CHANGE_P1 =
"//input[contains(@id,':change-pwd-form:password')]";
+ private static final String LNK_CHANGE_PASS =
"//a[contains(@id,':profile-form:change-pwd-adm-link')]";
+ public static final String TBL_USERLIST =
"//table[contains(@id,'search-user-form1:userlist')]";
+ public static final String LNK_T_USRLIST_DEL =
"//a[contains(@id,''search-user-form1:userlist:{0}:delete-user-link'')]";
+ public static final String LNK_T_USRLIST_ROLES =
"//a[contains(@id,''search-user-form1:userlist:{0}:assign-role-link'')]";
+ public static final String LNK_T_USRLIST_DIS =
"//a[contains(@id,''search-user-form1:userlist:{0}:enable-user-link'')]";
+ public static final String LNK_T_USRLIST_EDIT =
"//a[contains(@id,''search-user-form1:userlist:{0}:rename-link'')]";
- public static final String ID_CHECK_ROLE =
"//input[contains(@name,''assign-roles-form:roles'') and
@value=''{0}'']";
-
+ public static final String TBL_ROLELIST =
"//table[contains(@id,':_viewRoot:roles-form:userlist')]";
+ public static final String LNK_T_ROLLIST_DEL =
"//a[contains(@id,''roles-form:userlist:{0}:delete-role-link'')]";
+ public static final String LNK_T_ROLLIST_MEMBERS =
"//a[contains(@id,''roles-form:userlist:{0}:view-role-link'')]";
+ public static final String LNK_T_ROLLIST_EDIT =
"//a[contains(@id,''roles-form:userlist:{0}:edit-role-link'')]";
+
+ public static final String TBL_ROLEMEMBERS =
"//table[contains(@id,'role-members-form:role-data-table')]";
+
+ public static final String SUB_CONF_CREATE_USER =
"//input[contains(@id,'confirm-form:admin')]";
+ public static final String SUB_DELETE_ROLE =
"//input[contains(@id,'delete-role-form:confirm')]";
+ public static final String SUB_ROLE_CREATE =
"//input[contains(@id,':_viewRoot:create-role-form:submit')]";
+ public static final String INP_ROLEDISNAME =
"//input[contains(@id,':_viewRoot:create-role-form:roledisplayname')]";
+ public static final String INP_ROLENAME =
"//input[contains(@id,':_viewRoot:create-role-form:rolename')]";
+
+ public static final String LNK_ROLE_CREATE = "//a[contains(@id,
':_viewRoot:create-role-form:create-role-link')]";
+ public static final String SUB_DEL_USER =
"//input[contains(@id,'delete-user-form:submit')]";
+ public static final String SUB_ASSIGN_ROLE =
"//input[contains(@id,'assign-roles-form:submit')]";
+ public static final String SUB_USER_ROLE =
"//input[contains(@id,'register-role-form:submit')]";
+ public static final String SUB_CREATE_USER =
"//input[contains(@id,'register-form:submit')]";
+ public static final String INP_PASSWORD_CHK =
"//input[contains(@id,'register-form:passwordCheck')]";
+ public static final String INP_PASSWORD =
"//input[contains(@id,'register-form:password')]";
+ public static final String INP_USEREMAIL =
"//input[contains(@id,'register-form:email')]";
+ public static final String INP_USERNAME =
"//input[contains(@id,'register-form:username')]";
+ public static final String SUB_SEARCH_USER =
"//input[contains(@id,'search-user-form:search')]";
+ public static final String INP_SEARCH_USER =
"//input[contains(@id,'search-user-form:searchString')]";
+ public static final String LNK_SEARCH_USER =
"//a[contains(@id,'user-form:search-user-link')]";
+ public static final String LNK_USERTAB =
"//a[contains(@id,'role-temp-form:manage-users')]";
+ public static final String LNK_USERMAIN =
"//a[contains(@id,'user-temp-form1:user-adm-link')]";
+
+ public static final String LNK_ROLETAB =
"//a[contains(@id,'_viewRoot:user-temp-form:role-mgm-link')]";
+
+ public static final String LNK_ROLEMAIN = "//a[contains(@id,
':_viewRoot:role-temp-form1:role-admin-link')]";
+ public static final String LNK_USERMANG_MAIN =
"//a[contains(@id,'user-temp-form1:assign-role-link')]";
+ public static final String LNK_USERMANG_MAIN2 =
"//a[contains(@id,'user-temp-form1:user-mgm-link')]";
+ public static final String LNK_CREATE_USER =
"//a[contains(@id,':user-form:create-user-link')]";
+
+ public static final String CHK_ROLE =
"//input[contains(@name,''assign-roles-form:roles'') and
@value=''{0}'']";
+
+ public static final long SEARCH_TIMEOUT = 5000;
+
private String butDelUsr_id(String userName) {
- String table = TABLE_USERLIST;
+ String table = TBL_USERLIST;
int r = findTableRow(table, userName, 0);
- return MessageFormat.format(LINK_T_USRLIST_DEL, r - 1);
+ return MessageFormat.format(LNK_T_USRLIST_DEL, r - 1);
}
private String butUsrRol_id(String userName) {
- String table = TABLE_USERLIST;
+ String table = TBL_USERLIST;
int r = findTableRow(table, userName, 0);
- return MessageFormat.format(LINK_T_USRLIST_ROLES, r - 1);
+ return MessageFormat.format(LNK_T_USRLIST_ROLES, r - 1);
}
@BeforeMethod(groups = { "log" })
@@ -92,21 +98,20 @@
@AfterMethod(groups = { "log" })
public void logoutAfterTest() {
-
- }
-/*
- // 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");
}
- @AfterClass(groups = { "single" })
- public void logoutAfter() {
- logout();
- }
-*/
+ /*
+ * // 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"); }
+ *
+ * @AfterClass(groups = { "single" }) public void logoutAfter() { logout();
+ * }
+ */
+
@Test(enabled = true, description = "Creation of new user.")
public void testCreateUser() {
createUser("tempUser", "tempPassword",
"tempUser(a)redhat.com");
@@ -128,360 +133,358 @@
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");
-
+ final String userName = "disableMe";
+ final String userPass = "disablePass";
+ final String userMail = "disableMe(a)redhat.com";
+
+ createUser(userName, userPass, userMail);
+
logout();
- login("disableMe", "disablePass");
+ login(userName, userPass);
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 ));
-
+ login("admin", "admin");
+
+ searchUser(userName, userMail);
+ int r = findTableRow(TBL_USERLIST, userName, 0);
+
+ selenium.click(MessageFormat.format(LNK_T_USRLIST_DIS, r - 1));
+
logout();
-
- //trying to log in with disabled account
+
+ // 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.type(INPUT_USERNAME, userName);
+ selenium.type(INPUT_PASSWORD, userPass);
selenium.click(SUBMIT_LOGIN);
selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertTrue(selenium.isTextPresent("Your account is disabled"));
+ Assert.assertTrue(selenium.isTextPresent("Your account is disabled"),
"Message telling that account is disabled is other then expected or missing.");
// 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");
+
+ login("admin", "admin");
+
+ deleteUser(userName, userMail);
}
-
- @Test(enabled = true, dependsOnMethods = {"testDisableUser"},description =
"Enabling disabled user.")
+
+ @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 ));
+ final String userName = "enableMe";
+ final String userPass = "enableMe";
+ final String userMail = "enableMe(a)redhat.com";
+ createUser(userName, userPass, userMail);
+ searchUser(userName, userMail);
+
+ int r = findTableRow(TBL_USERLIST, "Enable", 5);
+ Assert.assertTrue(r < 0, "No user should be disabled.");
+ r = findTableRow(TBL_USERLIST, userName, 0);
+
+ selenium.click(MessageFormat.format(LNK_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 ));
+ searchUser(userName, userMail);
+ r = findTableRow(TBL_USERLIST, "Enable", 5);
+ Assert.assertFalse(r < 0, "One user should have been disabled.");
+
+ r = findTableRow(TBL_USERLIST, userName, 0);
+ selenium.click(MessageFormat.format(LNK_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");
+
+ searchUser(userName, userMail);
+ r = findTableRow(TBL_USERLIST, "Enable", 5);
+ Assert.assertTrue(r < 0, "No user should be disabled.");
+
+ deleteUser(userName, userMail);
}
-
+
@Test(enabled = true, description = "Editing a user.")
public void testEditUser() {
- createUser("editMe", "editPass", "editMe(a)redhat.com");
-
+ final String userName = "editMe";
+ final String userPass = "editPass";
+ final String userMail = "editMe(a)redhat.com";
+
+ createUser(userName, userPass, userMail);
+
// 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));
+ searchUser(userName, userMail);
+
+ int r = findTableRow(TBL_USERLIST, userName, 0);
+ selenium.click(MessageFormat.format(LNK_T_USRLIST_EDIT, r - 1));
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.type(INP_EDIT_USER_EMAIL, "editMe2(a)redhat.com");
selenium.click(SUB_EDIT_USER_EMAIL_CANCEL);
selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertTrue(selenium.isTextPresent("editMe(a)redhat.com"));
-
+ Assert.assertTrue(selenium.isTextPresent(userMail), "User not visible after
cancelling editing.");
+
// 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);
-
+ searchUser(userName, userMail);
+
+ r = findTableRow(TBL_USERLIST, userName, 0);
+ selenium.click(MessageFormat.format(LNK_T_USRLIST_EDIT, r - 1));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
selenium.type(INP_EDIT_USER_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.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(SUB_EDIT_PROF);
selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertTrue(selenium.isTextPresent("editMe2(a)redhat.com"));
- Assert.assertTrue(selenium.isTextPresent("Edit"));
-
- deleteUser("editMe", "editMe2(a)redhat.com");
-
+ Assert.assertTrue(selenium.isTextPresent("editMe2(a)redhat.com"), "Edited
e-mail adress not visible.");
+
+ deleteUser(userName, "editMe2(a)redhat.com");
+
}
-
+
@Test(enabled = true, description = "Editing a user - changing of password.")
public void testEditUserChangePassword() {
- createUser("changePass", "changePassPass",
"changePass(a)redhat.com");
-
+ final String userName = "changePass";
+ final String userPass = "changePassPass";
+ final String userPass2 = "changePass2";
+ final String userMail = "changePass(a)redhat.com";
+
+ createUser(userName, userPass, userMail);
+
logout();
- login("changePass","changePassPass");
+ login(userName, userPass);
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));
+ login("admin", "admin");
+
+ // Canceling of change at the first approach
+
+ searchUser(userName, userMail);
+
+ int r = findTableRow(TBL_USERLIST, userName, 0);
+ selenium.click(MessageFormat.format(LNK_T_USRLIST_EDIT, r - 1));
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click(LINK_CHANGE_PASS);
+ selenium.click(LNK_CHANGE_PASS);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.type(INPUT_PASS_CHANGE_P1, "changePass2");
- selenium.type(INPUT_PASS_CHANGE_P2, "changePass2");
+ selenium.type(INP_PASS_CHANGE_P1, userPass2);
+ selenium.type(INP_PASS_CHANGE_P2, userPass2);
selenium.click(SUB_PASS_CHANGE_CANCEL);
selenium.waitForPageToLoad(PAGE_LOAD);
-
- Assert.assertFalse(selenium.isTextPresent("Password has been updated."));
-
+
+ Assert.assertFalse(selenium.isTextPresent("Password has been updated."),
"Message telling that password has changed appeared after cancel.");
+
logout();
- login("changePass","changePassPass");
+ login(userName, userPass);
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));
+ login("admin", "admin");
+
+ // In the second approach really change the password
+
+ searchUser(userName, userMail);
+
+ r = findTableRow(TBL_USERLIST, userName, 0);
+ selenium.click(MessageFormat.format(LNK_T_USRLIST_EDIT, r - 1));
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click(LINK_CHANGE_PASS);
+ selenium.click(LNK_CHANGE_PASS);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.type(INPUT_PASS_CHANGE_P1, "changePass2");
- selenium.type(INPUT_PASS_CHANGE_P2, "changePass2");
+ selenium.type(INP_PASS_CHANGE_P1, userPass2);
+ selenium.type(INP_PASS_CHANGE_P2, userPass2);
selenium.click(SUB_PASS_CHANGE_SUBMIT);
selenium.waitForPageToLoad(PAGE_LOAD);
-
- Assert.assertTrue(selenium.isTextPresent("Password has been updated."));
-
+
+ Assert.assertTrue(selenium.isTextPresent("Password has been updated."),
"Message telling that password has changed other then expected or missing.");
+
logout();
- login("changePass","changePass2");
+ login(userName, userPass2);
logout();
- login("admin","admin");
-
- deleteUser("changePass","changePass(a)redhat.com");
+ login("admin", "admin");
+
+ deleteUser(userName, userMail);
}
-
+
@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");
-
+ final String roleName = "membersRole";
+ final String roleDisplayName = "membersRoleDisplay";
+ final String userName = "newRoleMember";
+ final String userMail = "newRoleMem(a)redhatqa.com";
+ final String invalidMember = "newRoleNonMember";
+
+ createRole(roleName, roleDisplayName);
+ createUser(userName, userName, userMail);
+ assignRole(userName, userMail, roleName, roleDisplayName);
+
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));
+ clickIfVisible(LNK_ROLETAB);
+ clickIfVisible(LNK_ROLEMAIN);
+
+ int r = findTableRow(TBL_ROLELIST, roleName, 0);
+ selenium.click(MessageFormat.format(LNK_T_ROLLIST_MEMBERS, r - 1));
selenium.waitForPageToLoad(PAGE_LOAD);
-
- //search for the real member of current role
- selenium.type(INP_ROLE_SEARCH_USER, "newRoleMember");
+
+ // search for the real member of current role
+ selenium.type(INP_ROLE_SEARCH_USER, userName);
selenium.click(SUB_ROLE_SEARCH_USER);
waitFor(10000);
-
- 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(INP_ROLE_SEARCH_USER, "newRoleNonMember");
+
+ r = findTableRow(TBL_ROLEMEMBERS, userName, 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(INP_ROLE_SEARCH_USER, invalidMember);
selenium.click(SUB_ROLE_SEARCH_USER);
waitFor(10000);
-
- Assert.assertFalse(selenium.isElementPresent(TABLE_ROLEMEMBERS), "Not assigned
member found in the role members table.");
-
- deleteRole("membersRole");
- deleteUser("newRoleMember" , "newRoleMem(a)redhatqa.com");
+
+ Assert.assertFalse(selenium.isElementPresent(TBL_ROLEMEMBERS), "Not assigned
member found in the role members table.");
+
+ deleteRole(roleName);
+ deleteUser(userName, userMail);
}
-
+
@Test(enabled = true, description = "Creation of new role.")
public void testRoleEdit() {
-
- createRole("editRole", "editRoleDisplay");
-
+ final String roleName = "editRole";
+ final String roleDisplayName = "editRoleDisplay";
+ final String roleDisplayNameEditet = "editedRoleDisplay";
+
+ createRole(roleName, roleDisplayName);
+
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));
+ clickIfVisible(LNK_ROLETAB);
+ clickIfVisible(LNK_ROLEMAIN);
+
+ int r = findTableRow(TBL_ROLELIST, roleDisplayName, 1);
+ Assert.assertTrue(r >= 0, "Renamed display name found in table");
+
+ r = findTableRow(TBL_ROLELIST, roleDisplayNameEditet, 1);
+ Assert.assertFalse(r >= 0, "Not created role display name found in
table");
+
+ // canceling of renaming of displayname for the first time
+ r = findTableRow(TBL_ROLELIST, roleName, 0);
+
+ selenium.click(MessageFormat.format(LNK_T_ROLLIST_EDIT, r - 1));
selenium.waitForPageToLoad(PAGE_LOAD);
-
- selenium.type(INP_EDIT_ROLE_NAME, "editedRoleDisplay");
+
+ selenium.type(INP_EDIT_ROLE_NAME, roleDisplayNameEditet);
selenium.click(SUB_EDIT_ROLE_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");
-
+
+ r = findTableRow(TBL_ROLELIST, roleDisplayName, 1);
+ Assert.assertTrue(r >= 0, "Renamed display name found in table");
+
+ r = findTableRow(TBL_ROLELIST, roleDisplayNameEditet, 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));
+ r = findTableRow(TBL_ROLELIST, roleName, 0);
+ selenium.click(MessageFormat.format(LNK_T_ROLLIST_EDIT, r - 1));
selenium.waitForPageToLoad(PAGE_LOAD);
-
- selenium.type(INP_EDIT_ROLE_NAME, "editedRoleDisplay");
+
+ selenium.type(INP_EDIT_ROLE_NAME, roleDisplayNameEditet);
selenium.click(SUB_EDIT_ROLE_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");
+
+ r = findTableRow(TBL_ROLELIST, roleDisplayName, 1);
+ Assert.assertFalse(r >= 0, "Renamed display name found in table");
+
+ r = findTableRow(TBL_ROLELIST, roleDisplayNameEditet, 1);
+ Assert.assertTrue(r >= 0, "New role display name not found in table");
+
+ deleteRole(roleName);
}
-
- @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.");
+
+ @Test(enabled = true, 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(TBL_USERLIST) - 1, 10, "Wrong number of row in
user table #1.");
+
+ searchSimple("man", "50");
+ Assert.assertEquals(countTableRows(TBL_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.");
+ Assert.assertEquals(countTableRows(TBL_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);
+ searchSimple("man", "100");
+ Assert.assertEquals(countTableRows(TBL_USERLIST) - 1, 95, "Wrong number of row in
user table #4.");
- selenium.click(LINK_SEARCH_USER);
- selenium.waitForPageToLoad(PAGE_LOAD);
+ /*
+ * for(int i=0; i< 95; i++){ deleteUser("man"+i+"us",
+ * "man"+i+"us"+"(a)redhatqa.com"); }
+ */
- 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";
String userMail = "tempUser(a)redhat.com";
String role = "tempRole";
- String roleDisplay = "tempRoleDisplay";
+ final String roleDisplayName = "tempRoleDisplay";
+ final String userPass = "tempPassword";
- createUser(user, "tempPassword", userMail);
- createRole(role, "tempRoleDisplay");
- assignRole(user, userMail, role, roleDisplay);
+ createUser(user, userPass, userMail);
+ createRole(role, roleDisplayName);
+ assignRole(user, userMail, role, roleDisplayName);
- deassignRole(user, userMail, role, roleDisplay);
+ deassignRole(user, userMail, role, roleDisplayName);
deleteRole(role);
deleteUser(user, userMail);
}
- void assignRole(String user, String email, String role, String roleDisplay) {
+ void assignRole(String userName, String userMail, String roleName, String
roleDisplayName) {
- searchUser(user, email);
- selenium.click(butUsrRol_id(user));
+ searchUser(userName, userMail);
+ selenium.click(butUsrRol_id(userName));
selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertTrue(selenium.isTextPresent(roleDisplay), "Role display name: "
+ roleDisplay + " not found on the page.");
+ Assert.assertTrue(selenium.isTextPresent(roleDisplayName), "Role display name:
" + roleDisplayName + " not found on the page.");
- final String CHECK_ROLE = MessageFormat.format(ID_CHECK_ROLE, role);
+ final String CHECK_ROLE = MessageFormat.format(CHK_ROLE, roleName);
selenium.click(CHECK_ROLE);
- selenium.click(ID_SUBMIT_ASSIGN_ROLE);
+ selenium.click(SUB_ASSIGN_ROLE);
selenium.waitForPageToLoad(PAGE_LOAD);
- searchUser(user, email);
+ searchUser(userName, userMail);
- selenium.click(butUsrRol_id(user));
+ selenium.click(butUsrRol_id(userName));
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isChecked(CHECK_ROLE), "The role wasn't correctly
assigned.");
@@ -496,10 +499,10 @@
Assert.assertTrue(selenium.isTextPresent(roleDisplay), "Role display name: "
+ roleDisplay + " not found on the page.");
// check the tempRole check box
- final String CHECK_ROLE = MessageFormat.format(ID_CHECK_ROLE, role);
+ final String CHECK_ROLE = MessageFormat.format(CHK_ROLE, role);
selenium.click(CHECK_ROLE);
- selenium.click(ID_SUBMIT_ASSIGN_ROLE);
+ selenium.click(SUB_ASSIGN_ROLE);
selenium.waitForPageToLoad(PAGE_LOAD);
searchUser(user, email);
@@ -510,7 +513,7 @@
}
- void createUser(String username, String password, String email) {
+ void createUser(String userName, String userPass, String userMail) {
selenium.open("/portal/auth/portal/default");
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -520,30 +523,30 @@
selenium.click("link=Members");
selenium.waitForPageToLoad(PAGE_LOAD);
- clickIfVisible(ID_LINK_USERTAB);
- clickIfVisible(ID_LINK_USERMAIN);
- selenium.click(ID_LINK_CREATE_USER);
+ clickIfVisible(LNK_USERTAB);
+ clickIfVisible(LNK_USERMAIN);
+ selenium.click(LNK_CREATE_USER);
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isTextPresent("Username *"), "Label for
username input is wrong or missing.");
- selenium.type(ID_INPUT_USERNAME, username);
+ selenium.type(INP_USERNAME, userName);
Assert.assertTrue(selenium.isTextPresent("E-Mail *"), "Label for e-mail
input is wrong or missing.");
- selenium.type(ID_INPUT_USEREMAIL, email);
+ selenium.type(INP_USEREMAIL, userMail);
Assert.assertTrue(selenium.isTextPresent("Password *"), "Label for
password input is wrong or missing.");
- selenium.type(ID_INPUT_PASSWORD, password);
+ selenium.type(INP_PASSWORD, userPass);
Assert.assertTrue(selenium.isTextPresent("Confirm Password *"), "Label
for password confirm input is wrong or missing.");
- selenium.type(ID_INPUT_PASSWORD_CHK, password);
+ selenium.type(INP_PASSWORD_CHK, userPass);
- selenium.click(ID_SUBMIT_CREATE_USER);
+ selenium.click(SUB_CREATE_USER);
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertFalse(selenium.isTextPresent("This username is already taken.
tempUser"), "User already exists.");
- selenium.click(ID_SUBMIT_USER_ROLE);
+ selenium.click(SUB_USER_ROLE);
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isTextPresent("Confirmation"), "Confirmation
screen is missing or corrupted.");
- selenium.click(ID_SUBMIT_CONF_CREATE_USER);
+ selenium.click(SUB_CONF_CREATE_USER);
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isTextPresent("User created"), "User was not
created (\"User created\" text missing).");
@@ -558,24 +561,22 @@
selenium.click("link=Members");
selenium.waitForPageToLoad(PAGE_LOAD);
- clickIfVisible(ID_LINK_USERMAIN);
+ clickIfVisible(LNK_USERMAIN);
- selenium.click(ID_LINK_CREATE_USER);
+ selenium.click(LNK_CREATE_USER);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.type(ID_INPUT_USERNAME, username);
- selenium.type(ID_INPUT_USEREMAIL, email);
- selenium.type(ID_INPUT_PASSWORD, password);
- selenium.type(ID_INPUT_PASSWORD_CHK, password);
- selenium.click(ID_SUBMIT_CREATE_USER);
+ selenium.type(INP_USERNAME, username);
+ selenium.type(INP_USEREMAIL, email);
+ selenium.type(INP_PASSWORD, password);
+ selenium.type(INP_PASSWORD_CHK, password);
+ selenium.click(SUB_CREATE_USER);
selenium.waitForPageToLoad(PAGE_LOAD);
- Assert
- .assertTrue(selenium.isTextPresent("This username is already taken."),
- "No user was overwritten, current username wasn't already taken.");
+ Assert.assertTrue(selenium.isTextPresent("This username is already taken."),
"No user was overwritten, current username wasn't already taken.");
}
- void searchUser(String username, String email) {
+ void searchUser(String userName, String userMail) {
selenium.open("/portal/");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=Admin");
@@ -583,21 +584,44 @@
selenium.click("link=Members");
selenium.waitForPageToLoad(PAGE_LOAD);
- clickIfVisible(ID_LINK_USERTAB);
- clickIfVisible(ID_LINK_USERMAIN);
- clickIfVisible(LINK_USERMANG_MAIN);
+ clickIfVisible(LNK_USERTAB);
+ clickIfVisible(LNK_USERMAIN);
+ clickIfVisible(LNK_USERMANG_MAIN);
- selenium.click(LINK_SEARCH_USER);
+ selenium.click(LNK_SEARCH_USER);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.type(ID_INPUT_SEARCH_USER, username);
- selenium.click(ID_SUBMIT_SEARCH_USER);
- //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.");
+ selenium.type(INP_SEARCH_USER, userName);
+
+ selenium.click(SUB_SEARCH_USER);
+ waitFor(SEARCH_TIMEOUT);
+ if (!selenium.isTextPresent(userName) && !selenium.isTextPresent(userMail))
+ paginate(userName, userMail);
+
+ Assert.assertTrue(selenium.isTextPresent(userName), "Username was not
found.");
+ Assert.assertTrue(selenium.isTextPresent(userMail), "User email adress was not
found.");
}
+ private void paginate(String userName, String userMail) {
+
+ while (selenium.isElementPresent(SUB_PAGIN_RIGHT)) {
+ selenium.click(SUB_PAGIN_RIGHT);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ if (selenium.isTextPresent(userName) && selenium.isTextPresent(userMail))
+ return;
+ }
+
+ while (selenium.isElementPresent(SUB_PAGIN_LEFT)) {
+ selenium.click(SUB_PAGIN_RIGHT);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ if (selenium.isTextPresent(userName) && selenium.isTextPresent(userMail))
+ return;
+ }
+
+ }
+
private void deleteUser(String username, String email) {
selenium.open("/portal/");
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -606,30 +630,30 @@
selenium.click("link=Members");
selenium.waitForPageToLoad(PAGE_LOAD);
- clickIfVisible(ID_LINK_USERTAB);
+ clickIfVisible(LNK_USERTAB);
// user home page
- clickIfVisible(ID_LINK_USERMAIN);
- clickIfVisible(LINK_USERMANG_MAIN);
- clickIfVisible(LINK_USERMANG_MAIN2);
+ clickIfVisible(LNK_USERMAIN);
+ clickIfVisible(LNK_USERMANG_MAIN);
+ clickIfVisible(LNK_USERMANG_MAIN2);
- selenium.click(LINK_SEARCH_USER);
+ selenium.click(LNK_SEARCH_USER);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.type(ID_INPUT_SEARCH_USER, username);
- selenium.click(ID_SUBMIT_SEARCH_USER);
- //selenium.waitForPageToLoad(PAGE_LOAD);
- waitBlock();
+ selenium.type(INP_SEARCH_USER, username);
+ selenium.click(SUB_SEARCH_USER);
+ // selenium.waitForPageToLoad(PAGE_LOAD);
+ waitFor(SEARCH_TIMEOUT);
Assert.assertTrue(selenium.isTextPresent(username), "Username was not
found.");
Assert.assertTrue(selenium.isTextPresent(email), "User e-mail adress was not
found.");
selenium.click(butDelUsr_id(username));
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click(ID_BUT_SUBMIT_DEL_USER);
+ selenium.click(SUB_DEL_USER);
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isTextPresent("User deleted"), "user was not
deleted (\"User deleted\" text missing).");
}
- private void clickUntilMembers(){
+ private void clickUntilMembers() {
selenium.open("/portal/");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=Admin");
@@ -637,7 +661,7 @@
selenium.click("link=Members");
selenium.waitForPageToLoad(PAGE_LOAD);
}
-
+
private void createRole(String roleName, String roleDisplayName) {
selenium.open("/portal/");
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -646,19 +670,19 @@
selenium.click("link=Members");
selenium.waitForPageToLoad(PAGE_LOAD);
- clickIfVisible(ID_LINK_ROLETAB);
- clickIfVisible(ID_LINK_ROLEMAIN);
+ clickIfVisible(LNK_ROLETAB);
+ clickIfVisible(LNK_ROLEMAIN);
- Assert.assertTrue(selenium.isElementPresent(ID_BUT_ROLE_CREATE), "Button for role
creating has wrong id or doesn't exist.");
- Assert.assertEquals(selenium.getText(ID_BUT_ROLE_CREATE), "Create role",
"Button for role creating has wrong label.");
- selenium.click(ID_BUT_ROLE_CREATE);
+ Assert.assertTrue(selenium.isElementPresent(LNK_ROLE_CREATE), "Button for role
creating has wrong id or doesn't exist.");
+ Assert.assertEquals(selenium.getText(LNK_ROLE_CREATE), "Create role",
"Button for role creating has wrong label.");
+ selenium.click(LNK_ROLE_CREATE);
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isTextPresent("Role"), "Label for role name
not present or incorrect.");
- selenium.type(ID_INPUT_ROLENAME, roleName);
+ selenium.type(INP_ROLENAME, roleName);
Assert.assertTrue(selenium.isTextPresent("Display name"), "Label for
display role name not present or incorrect.");
- selenium.type(ID_INPUT_ROLEDISNAME, roleDisplayName);
- selenium.click(ID_SUBMIT_ROLE_CREATE);
+ selenium.type(INP_ROLEDISNAME, roleDisplayName);
+ selenium.click(SUB_ROLE_CREATE);
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isTextPresent(roleName), "Name of newly created role is
missing.");
@@ -673,31 +697,44 @@
selenium.click("link=Members");
selenium.waitForPageToLoad(PAGE_LOAD);
- clickIfVisible(ID_LINK_ROLETAB);
- clickIfVisible(ID_LINK_ROLEMAIN);
+ clickIfVisible(LNK_ROLETAB);
+ clickIfVisible(LNK_ROLEMAIN);
Assert.assertTrue(selenium.isTextPresent(roleName), "Role name is missing");
- int r = findTableRow(TABLE_ROLELIST, roleName, 0);
- selenium.click(MessageFormat.format(LINK_T_ROLLIST_DEL, r-1));
+ int r = findTableRow(TBL_ROLELIST, roleName, 0);
+ selenium.click(MessageFormat.format(LNK_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.click(SUB_DELETE_ROLE);
selenium.waitForPageToLoad(PAGE_LOAD);
}
-
- protected void waitBlock(){
- try {
- Thread.sleep(2000);
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
+
+ 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(LNK_USERTAB);
+ clickIfVisible(LNK_USERMAIN);
+ clickIfVisible(LNK_USERMANG_MAIN);
+
+ selenium.click(LNK_SEARCH_USER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.type(INP_SEARCH_USER, name);
+ selenium.select(SEL_SEARCHUSER_LIMIT, "label=" + count);
+ selenium.click(SUB_SEARCH_USER);
+
+ waitFor(SEARCH_TIMEOUT);
+
}
}
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/JBossSelenium.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/JBossSelenium.java 2009-02-04
10:06:14 UTC (rev 12770)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/JBossSelenium.java 2009-02-04
14:00:11 UTC (rev 12771)
@@ -159,5 +159,14 @@
protected int countTableRows(String tableLocation) {
return Integer.valueOf(getEval("selenium.countTableRows(\"" +
tableLocation + "\")"));
}
+
+ protected void waitFor(long time){
+ 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/UserLoginTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/UserLoginTestCase.java 2009-02-04
10:06:14 UTC (rev 12770)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/UserLoginTestCase.java 2009-02-04
14:00:11 UTC (rev 12771)
@@ -35,6 +35,9 @@
@Test(enabled = true, description = "login as default user 'user' with
password 'user'.")
public void testDefaultUserLogin() throws Exception {
+ final String loginName = "user";
+ final String loginPass = "user";
+
selenium.open(ADR_PORTAL);
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -48,14 +51,14 @@
waitForElement(INP_PASSWORD);
Assert.assertTrue(selenium.isElementPresent(INP_USERNAME), "Expected input DOM
element for username doesn't exist.");
- selenium.type(INP_USERNAME, "user");
+ selenium.type(INP_USERNAME, loginName);
Assert.assertTrue(selenium.isElementPresent(INP_PASSWORD), "Expected input DOM
element for password doesn't exist.");
- selenium.type(INP_PASSWORD, "user");
+ selenium.type(INP_PASSWORD, loginPass);
selenium.click(SUB_LOGIN);
selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertTrue(selenium.isTextPresent("Logged in as: user"),
"\"Logged in as\" message missing.");
+ Assert.assertTrue(selenium.isTextPresent("Logged in as: "+loginName),
"\"Logged in as\" message missing.");
Assert.assertTrue(selenium.isElementPresent(LNK_LOGOUT), "Expected DOM element for
login link does not exist.");
Assert.assertEquals(selenium.getText(LNK_LOGOUT), "Logout", "Logout has
wrong label.");
@@ -67,6 +70,9 @@
@Test(enabled = true, description = "login as admin user 'admin' with
password 'admin'.")
public void testAdminLogin() throws Exception {
+ final String loginName = "admin";
+ final String loginPass = "admin";
+
selenium.open(ADR_PORTAL);
selenium.waitForPageToLoad(PAGE_LOAD);
waitForElement(LNK_LOGIN);
@@ -80,9 +86,9 @@
waitForElement(INP_PASSWORD);
Assert.assertTrue(selenium.isElementPresent(INP_USERNAME), "Expected input DOM
element for username doesn't exist.");
- selenium.type(INP_USERNAME, "admin");
+ selenium.type(INP_USERNAME, loginName);
Assert.assertTrue(selenium.isElementPresent(INP_PASSWORD), "Expected input DOM
element for password doesn't exist.");
- selenium.type(INP_PASSWORD, "admin");
+ selenium.type(INP_PASSWORD, loginPass);
selenium.click(SUB_LOGIN);
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -99,6 +105,9 @@
@Test(enabled = true, description = "canceling of the login form.")
public void testUserLoginCancel() throws Exception {
+ final String loginName = "saki";
+ final String loginPass = "paki";
+
selenium.open(ADR_PORTAL);
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -114,9 +123,9 @@
waitForElement(INP_PASSWORD);
Assert.assertTrue(selenium.isElementPresent(INP_USERNAME), "Expected input DOM
element for username doesn't exist.");
- selenium.type(INP_USERNAME, "saki");
+ selenium.type(INP_USERNAME, loginName);
Assert.assertTrue(selenium.isElementPresent(INP_PASSWORD), "Expected input DOM
element for password doesn't exist.");
- selenium.type(INP_PASSWORD, "paki");
+ selenium.type(INP_PASSWORD, loginPass);
selenium.click(SUB_CANCEL);
selenium.selectFrame(FRM_MAIN);
@@ -129,6 +138,9 @@
@Test(enabled = true, description = "login as 'us2er' which does not
exist.")
public void testFalseNameLogin() throws Exception {
+ final String loginName = "us2er";
+ final String loginPass = "user";
+
selenium.open(ADR_PORTAL);
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -142,9 +154,9 @@
waitForElement(INP_PASSWORD);
Assert.assertTrue(selenium.isElementPresent(INP_USERNAME), "Expected input DOM
element for username doesn't exist.");
- selenium.type(INP_USERNAME, "us2er");
+ selenium.type(INP_USERNAME, loginName);
Assert.assertTrue(selenium.isElementPresent(INP_PASSWORD), "Expected input DOM
element for password doesn't exist.");
- selenium.type(INP_PASSWORD, "user");
+ selenium.type(INP_PASSWORD, loginPass);
selenium.click(SUB_LOGIN);
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -154,6 +166,9 @@
@Test(enabled = true, description = "login as 'user' with wrong password
'us2er'.")
public void testFalsePasswordLogin() throws Exception {
+ final String loginName = "user";
+ final String loginPass = "us2er";
+
selenium.open(ADR_PORTAL);
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -167,9 +182,9 @@
waitForElement(INP_PASSWORD);
Assert.assertTrue(selenium.isElementPresent(INP_USERNAME), "Expected input DOM
element for username doesn't exist.");
- selenium.type(INP_USERNAME, "user");
+ selenium.type(INP_USERNAME, loginName);
Assert.assertTrue(selenium.isElementPresent(INP_PASSWORD), "Expected input DOM
element for password doesn't exist.");
- selenium.type(INP_PASSWORD, "us2er");
+ selenium.type(INP_PASSWORD, loginPass);
selenium.click(SUB_LOGIN);
selenium.waitForPageToLoad(PAGE_LOAD);
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 2009-02-04
10:06:14 UTC (rev 12770)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSSecureTestCase.java 2009-02-04
14:00:11 UTC (rev 12771)
@@ -10,7 +10,7 @@
import org.testng.annotations.Test;
/**
- * @author <a href="mailto:vrockai@redhat.com">Viliam Rockai</a>
+ * @author <a href="mailto:vrockai@redhat.com">Viliam Rockai</a>
*/
@Test(groups = { "cms_secure" }, enabled = true, description = "Setting
permissions on the default portlet.")
@@ -81,15 +81,15 @@
selenium.click(LNK_MEMBERS);
selenium.waitForPageToLoad(PAGE_LOAD);
- clickIfVisible(IdentityAdminTestCase.ID_LINK_ROLETAB);
- clickIfVisible(IdentityAdminTestCase.ID_LINK_ROLEMAIN);
+ clickIfVisible(IdentityAdminTestCase.LNK_ROLETAB);
+ clickIfVisible(IdentityAdminTestCase.LNK_ROLEMAIN);
- selenium.click(IdentityAdminTestCase.ID_BUT_ROLE_CREATE);
+ selenium.click(IdentityAdminTestCase.LNK_ROLE_CREATE);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.type(IdentityAdminTestCase.ID_INPUT_ROLENAME, roleName);
- selenium.type(IdentityAdminTestCase.ID_INPUT_ROLEDISNAME, roleDisplayName);
- selenium.click(IdentityAdminTestCase.ID_SUBMIT_ROLE_CREATE);
+ selenium.type(IdentityAdminTestCase.INP_ROLENAME, roleName);
+ selenium.type(IdentityAdminTestCase.INP_ROLEDISNAME, roleDisplayName);
+ selenium.click(IdentityAdminTestCase.SUB_ROLE_CREATE);
selenium.waitForPageToLoad(PAGE_LOAD);
logout();
}
@@ -338,11 +338,11 @@
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isTextPresent(roleDisplay), "Role display name: "
+ roleDisplay + " not found on the page.");
- final String CHECK_ROLE = MessageFormat.format(IdentityAdminTestCase.ID_CHECK_ROLE,
role);
+ final String CHECK_ROLE = MessageFormat.format(IdentityAdminTestCase.CHK_ROLE, role);
if (!selenium.isChecked(CHECK_ROLE)) {
selenium.click(CHECK_ROLE);
- selenium.click(IdentityAdminTestCase.ID_SUBMIT_ASSIGN_ROLE);
+ selenium.click(IdentityAdminTestCase.SUB_ASSIGN_ROLE);
selenium.waitForPageToLoad(PAGE_LOAD);
}
searchUser(user, email);
@@ -362,11 +362,11 @@
Assert.assertTrue(selenium.isTextPresent(roleDisplay), "Role display name: "
+ roleDisplay + " not found on the page.");
// check the tempRole check box
- final String CHECK_ROLE = MessageFormat.format(IdentityAdminTestCase.ID_CHECK_ROLE,
role);
+ final String CHECK_ROLE = MessageFormat.format(IdentityAdminTestCase.CHK_ROLE, role);
if (selenium.isChecked(CHECK_ROLE)) {
selenium.click(CHECK_ROLE);
- selenium.click(IdentityAdminTestCase.ID_SUBMIT_ASSIGN_ROLE);
+ selenium.click(IdentityAdminTestCase.SUB_ASSIGN_ROLE);
selenium.waitForPageToLoad(PAGE_LOAD);
}
searchUser(user, email);
@@ -386,15 +386,15 @@
selenium.click("link=Members");
selenium.waitForPageToLoad(PAGE_LOAD);
- clickIfVisible(IdentityAdminTestCase.ID_LINK_USERTAB);
- clickIfVisible(IdentityAdminTestCase.ID_LINK_USERMAIN);
- clickIfVisible(IdentityAdminTestCase.LINK_USERMANG_MAIN);
+ clickIfVisible(IdentityAdminTestCase.LNK_USERTAB);
+ clickIfVisible(IdentityAdminTestCase.LNK_USERMAIN);
+ clickIfVisible(IdentityAdminTestCase.LNK_USERMANG_MAIN);
- selenium.click(IdentityAdminTestCase.LINK_SEARCH_USER);
+ selenium.click(IdentityAdminTestCase.LNK_SEARCH_USER);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.type(IdentityAdminTestCase.ID_INPUT_SEARCH_USER, username);
- selenium.click(IdentityAdminTestCase.ID_SUBMIT_SEARCH_USER);
+ selenium.type(IdentityAdminTestCase.INP_SEARCH_USER, username);
+ selenium.click(IdentityAdminTestCase.SUB_SEARCH_USER);
try {
Thread.sleep(5000);
@@ -408,8 +408,8 @@
}
private String butUsrRol_id(String userName) {
- String table = IdentityAdminTestCase.TABLE_USERLIST;
+ String table = IdentityAdminTestCase.TBL_USERLIST;
int r = findTableRow(table, userName, 0);
- return MessageFormat.format(IdentityAdminTestCase.LINK_T_USRLIST_ROLES, r - 1);
+ return MessageFormat.format(IdentityAdminTestCase.LNK_T_USRLIST_ROLES, r - 1);
}
}