Author: vrockai
Date: 2009-06-10 06:52:37 -0400 (Wed, 10 Jun 2009)
New Revision: 13445
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/IdentityAdminTestCase.java
Log:
[selenium] - identity admin new tests and javadoc
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-06-10
02:47:09 UTC (rev 13444)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/IdentityAdminTestCase.java 2009-06-10
10:52:37 UTC (rev 13445)
@@ -81,7 +81,7 @@
private final String LNK_ROLETAB = getLoc(casePfx + "lnk.roletab",
"//a[contains(@id,'user-temp-form:role-mgm-link')]");
private final String LNK_ROLEMAIN = getLoc(casePfx + "lnk.rolemain",
"//a[contains(@id, 'role-temp-form1:role-adm-link')]");
private final String LNK_ROLEMAIN2 = getLoc(casePfx + "lnk.rolemain2",
"//a[contains(@id, 'role-admin-link')]");
-
+
private final String LNK_USERMANG_MAIN = getLoc(casePfx + "lnk.usermang.main",
"//a[contains(@id,'user-temp-form1:assign-role-link')]");
private final String LNK_USERMANG_MAIN2 = getLoc(casePfx +
"lnk.usermang.main2",
"//a[contains(@id,'user-temp-form1:user-mgm-link')]");
private final String LNK_CREATE_USER = getLoc(casePfx + "lnk.create.user",
"//a[contains(@id,':user-form:create-user-link')]");
@@ -505,7 +505,7 @@
// TODO Q: password can be anystring?
// TODO Q: what about serach input?
@Test(enabled = true)
- public void testUserCreateXss() {
+ public void testXssUserCreate() {
openAndWait(ADR_PORTAL);
clickAndWait(LNK_ADMIN);
clickAndWait(LNK_MEMBERS);
@@ -532,10 +532,16 @@
}
/**
- *
+ * When creating a role, firstly the XSS string is put into role name input
+ * and "diddi" is put into role display name. After pressing the create
+ * button it is asserted, that an error message about invalid role name was
+ * printed. In the second approach, the role name is "rolee" and XSS string
+ * is used as a role display name. After pressing the create button it is
+ * asserted, that an error message about invalid role display name was
+ * printed.
*/
@Test(enabled = true)
- public void testRoleCreateXss() {
+ public void testXssRoleCreate() {
openAndWait(ADR_PORTAL);
clickIfVisible(LNK_ADMIN);
clickIfVisible(LNK_ADMIN);
@@ -568,10 +574,13 @@
}
/**
- *
+ * After creating a role (editRole/editRoleDisplay), the role is about to be
+ * edited. The role display name is changed to to XSS string and submit
+ * button is pressed. It is asserted that the error message about invalid
+ * role display name was printed.
*/
@Test(enabled = true)
- public void testRoleEditXss() {
+ public void testXssRoleEdit() {
// EDIT ROLE
final String roleName = "editRole";
@@ -608,10 +617,14 @@
}
/**
- *
+ * User (editXssMe, editXssPass, editXssMe(a)redhat.com) is created. The user
+ * is then edited. The Xss string is written to each input on the edit user
+ * screen and the submit button is pressed. Other field are left blank. It
+ * is asserted, that the error message about invalid input for each input is
+ * written on the screen after pressing the submit button.
*/
@Test(enabled = true, dependsOnMethods = { "testEditUser" })
- public void testEditUserXss() {
+ public void testXssEditUser() {
final String userName = "editXssMe";
final String userPass = "editXssPass";
final String userMail = "editXssMe(a)redhat.com";
@@ -666,6 +679,54 @@
deleteUser(userName, userMail);
}
+ /**
+ * Into the search user input a XSS string is written and search button is
+ * pressed. The presence of input validation error is asserted.
+ */
+ @Test(enabled = false, dependsOnMethods = { "testing input validation for user
search input" })
+ public void testXssSearchUser() {
+ selenium.open("/portal/");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LNK_ADMIN);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LNK_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, XSS_STR1);
+ selenium.click(SUB_SEARCH_USER);
+
+ waitFor(SEARCH_TIMEOUT);
+
+ Assert.assertTrue(selenium.isTextPresent("is an invalid"));
+ }
+
+ /**
+ * Into the search role members input a XSS string is written and search
+ * button is pressed. The presence of input validation error is asserted.
+ */
+ @Test(enabled = false, dependsOnMethods = { "testing input validation for role
members search input" })
+ public void testXssSearchRoleMembers() {
+
+ clickUntilMembers();
+ clickIfVisible(LNK_ROLETAB);
+ clickIfVisible(LNK_ROLEMAIN);
+ clickIfVisible(LNK_ROLEMAIN2);
+
+ // search for the real member of current role
+ selenium.type(INP_ROLE_SEARCH_USER, XSS_STR1);
+ selenium.click(SUB_ROLE_SEARCH_USER);
+ waitFor(10000);
+
+ Assert.assertTrue(selenium.isTextPresent("is an invalid"));
+ }
+
private void goToEdit(String userName, String userMail) {
searchUser(userName, userMail);
@@ -721,6 +782,13 @@
}
+ /**
+ * User (tempUser, tempPassword, tempUser(a)redhat.com) and role (tempRole,
+ * tempRoleDisplay) are created. The role is assigned to the user and it is
+ * asserted by the checked button in user roles. The role is then deassigned
+ * and it is asserted the same way as before. At the end of the test both
+ * the user and the role are deleted.
+ */
@Test(enabled = true, dependsOnMethods = { "testCreateUser",
"testCreateRole" }, description = "Assigning of the role to the
user.")
public void testAssignRole2User() {
String user = "tempUser";
@@ -969,9 +1037,9 @@
selenium.click(LNK_MEMBERS);
selenium.waitForPageToLoad(PAGE_LOAD);
- clickIfVisible(LNK_ROLETAB);
+ clickIfVisible(LNK_ROLETAB);
clickIfVisible(LNK_ROLEMAIN);
-
+
clickIfVisible(LNK_ROLEMAIN2);
Assert.assertTrue(selenium.isTextPresent(roleName), "Role name is missing");