Author: vrockai
Date: 2009-06-05 11:17:37 -0400 (Fri, 05 Jun 2009)
New Revision: 13438
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/build.xml
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/WSRPTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/locator.properties
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/AdminPortalTestCase.java
Log:
[selenium] - more xss tests
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/build.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/build.xml 2009-06-05 04:01:09 UTC
(rev 13437)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/build.xml 2009-06-05 15:17:37 UTC
(rev 13438)
@@ -113,6 +113,8 @@
<echo message="Starting Selenium Remote Control" />
<java jar="${selsrv.dir}/selenium-server.jar" fork="true"
spawn="true">
<arg value="-multiWindow" />
+ <arg value="-timeout" />
+ <arg value="320000" />
<arg value="-port" />
<arg value="44444" />
<arg value="-log" />
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-05
04:01:09 UTC (rev 13437)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/IdentityAdminTestCase.java 2009-06-05
15:17:37 UTC (rev 13438)
@@ -8,15 +8,14 @@
import org.testng.annotations.Test;
/**
- * IdentityAdminTestCase is responsible for
+ * IdentityAdminTestCase is responsible for
+ *
* @author <a href="mailto:vrockai@redhat.com">Viliam Rockai</a>
*/
@Test(groups = { "admin_ui" }, enabled = true)
public class IdentityAdminTestCase extends JBossPortalSeleniumTestCase {
-
-
private static final String LNK_MEMBERS = "link=Members";
private static final String LNK_ADMIN = "link=Admin";
@@ -50,7 +49,6 @@
private final String LNK_T_USRLIST_ROLES = getLoc(casePfx +
"lnk.t.usrlist.roles",
"//a[contains(@id,''search-user-form1:userlist:{0}:assign-role-link'')]");
private final String LNK_T_USRLIST_DIS = getLoc(casePfx + "lnk.t.usrlist.dis",
"//a[contains(@id,''search-user-form1:userlist:{0}:enable-user-link'')]");
private final String LNK_T_USRLIST_EDIT = getLoc(casePfx +
"lnk.t.usrlist.edit",
"//a[contains(@id,''search-user-form1:userlist:{0}:rename-link'')]");
-
private final String TBL_ROLELIST = getLoc(casePfx + "tbl.rolelist",
"//table[contains(@id,'roles-form:userlist')]");
private final String LNK_T_ROLLIST_DEL = getLoc(casePfx + "lnk.t.rollist.del",
"//a[contains(@id,''roles-form:userlist:{0}:delete-role-link'')]");
@@ -81,8 +79,7 @@
private final String LNK_USERMAIN = getLoc(casePfx + "lnk.usermain",
"//a[contains(@id,'user-temp-form1:user-adm-link')]");
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-admin-link')]");
+ private final String LNK_ROLEMAIN = getLoc(casePfx + "lnk.rolemain",
"//a[contains(@id, 'role-temp-form1:role-adm-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')]");
@@ -90,7 +87,7 @@
private final String CHK_ROLE = getLoc(casePfx + "chk.role",
"//input[contains(@name,''assign-roles-form:roles'') and
@value=''{0}'']");
private final String MSG_CREATE_ROLE = getMess(casePfx + "chk.role",
"Create role");
-
+
/** The timeout used to wait after clicking submit button in user search. */
public final long SEARCH_TIMEOUT = 10000;
@@ -129,10 +126,10 @@
*/
/**
- * Test create user is responsible for user creation.
- * It creates a user named "tempUser" with password "TempPassword"
and e-mail "tempUser(a)redhat.com".
- * Then it tries to look up the user with search function.
- * At the end, it deletes the temp user.
+ * Test create user is responsible for user creation. It creates a user
+ * named "tempUser" with password "TempPassword" and e-mail
+ * "tempUser(a)redhat.com". Then it tries to look up the user with search
+ * function. At the end, it deletes the temp user.
*/
@Test(enabled = true, description = "Creation of new user.")
public void testCreateUser() {
@@ -142,11 +139,11 @@
}
/**
- * Test create existing user is respnosible for testing already created user creation.
- * It creates a user named "tempUser" with password "TempPassword"
and e-mail "tempUser(a)redhat.com".
- * Then it tries to look up the user with search function.
- * After success it tries to create the same user again and asserts that it is not
possible.
- * At the end, it deletes the temp user.
+ * Test create existing user is respnosible for testing already created user
+ * creation. It creates a user named "tempUser" with password
"TempPassword"
+ * and e-mail "tempUser(a)redhat.com". Then it tries to look up the user with
+ * search function. After success it tries to create the same user again and
+ * asserts that it is not possible. At the end, it deletes the temp user.
*/
@Test(enabled = true, dependsOnMethods = { "testCreateUser" }, description =
"Creation of already existing user.")
public void testCreateExistingUser() {
@@ -157,9 +154,9 @@
}
/**
- * Test create role is responsible for user creation.
- * It creates a role named "tempRole" with display name
"tempRoleDisplay".
- * At the end, it deletes the temp user.
+ * Test create role is responsible for user creation. It creates a role
+ * named "tempRole" with display name "tempRoleDisplay". At the end,
it
+ * deletes the temp user.
*/
@Test(enabled = true, description = "Creation of new role.")
public void testCreateRole() {
@@ -169,9 +166,9 @@
}
/**
- * Test delete user is responsible for deleting a user.
- * At first it creates user "deleteMe" with password "deleterPass"
and e-mail "disableMe(a)redhat.com"
- * At the end it deletes the user.
+ * Test delete user is responsible for deleting a user. At first it creates
+ * user "deleteMe" with password "deleterPass" and e-mail
+ * "disableMe(a)redhat.com" At the end it deletes the user.
*/
@Test(enabled = true, description = "Creating and deteling a user.")
public void testDeleteUser() {
@@ -180,11 +177,13 @@
}
/**
- * Test disable user is responsible for disabling a user.
- * At first it creates user "disableMe" with password "disablePass"
and e-mail "disableMe(a)redhat.com"
- * After that, it logs out and try to login as disableMe/disablePass.
- * After success it logs out again, and login as admin.
- * It disables the disableMe user and tries to login as disableMe/disablePass again
asserting that login is not possible ( message about disabled account has to appear ).
+ * Test disable user is responsible for disabling a user. At first it
+ * creates user "disableMe" with password "disablePass" and e-mail
+ * "disableMe(a)redhat.com" After that, it logs out and try to login as
+ * disableMe/disablePass. After success it logs out again, and login as
+ * admin. It disables the disableMe user and tries to login as
+ * disableMe/disablePass again asserting that login is not possible (
+ * message about disabled account has to appear ).
*
*/
@Test(enabled = true, description = "Creating and disabling a user.")
@@ -224,7 +223,7 @@
selenium.type(INPUT_USERNAME, userName);
selenium.type(INPUT_PASSWORD, userPass);
selenium.fireEvent(INPUT_PASSWORD, "keydown");
-
+
selenium.click(SUBMIT_LOGIN);
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isTextPresent("Your account is disabled"),
"Message telling that account is disabled is other then expected or missing.");
@@ -238,12 +237,14 @@
}
/**
- * Test enable user is responsible for enabling a user.
- * At first it creates user "enableMe" with password "enableMe" and
e-mail "enableMe(a)redhat.com"
- * Then it disables the user, asserts the user is really disabled and at the end it
enables the user.
- * Only the appereance (or non-appereance ) of the "Enable" button for the
user is used for assertions.
+ * Test enable user is responsible for enabling a user. At first it creates
+ * user "enableMe" with password "enableMe" and e-mail
"enableMe(a)redhat.com"
+ * Then it disables the user, asserts the user is really disabled and at the
+ * end it enables the user. Only the appereance (or non-appereance ) of the
+ * "Enable" button for the user is used for assertions.
*/
- //TODO better chcecking of the user status should be reconsidered (logging in)
+ // TODO better chcecking of the user status should be reconsidered (logging
+ // in)
@Test(enabled = true, dependsOnMethods = { "testDisableUser" }, description =
"Enabling disabled user.")
public void testEnableUser() {
final String userName = "enableMe";
@@ -275,11 +276,12 @@
}
/**
- * Test edit user is responsible for user editing.
- * At first it creates user "editMe" with password "editPass" and
e-mail "editMe(a)redhat.com".
- * Then it searches for the user and click on edit link. The e-mail of user is changed
to "editMe2(a)redhat.com".
- * The user is searched again and assert for his e-mail is made at the end.
- * The user is deleted at the end of this test.
+ * Test edit user is responsible for user editing. At first it creates user
+ * "editMe" with password "editPass" and e-mail
"editMe(a)redhat.com". Then it
+ * searches for the user and click on edit link. The e-mail of user is
+ * changed to "editMe2(a)redhat.com". The user is searched again and assert
+ * for his e-mail is made at the end. The user is deleted at the end of this
+ * test.
*/
@Test(enabled = true, description = "Editing a user.")
public void testEditUser() {
@@ -318,10 +320,12 @@
}
/**
- * Test edit user change password is responsible for testing the change of password for
a user.
- * At first it creates user "changePass" with password
"changePassPass" and e-mail "changePass(a)redhat.com".
- * Then the password change orm is filled, but canceled. The next step is submitting the
password change to new value "changePass2".
- * At the end the test tries to login with the new password and then it deletes the
"changePass" user.
+ * Test edit user change password is responsible for testing the change of
+ * password for a user. At first it creates user "changePass" with password
+ * "changePassPass" and e-mail "changePass(a)redhat.com". Then the
password
+ * change orm is filled, but canceled. The next step is submitting the
+ * password change to new value "changePass2". At the end the test tries to
+ * login with the new password and then it deletes the "changePass" user.
*/
@Test(enabled = true, description = "Editing a user - changing of password.")
public void testEditUserChangePassword() {
@@ -383,12 +387,13 @@
}
/**
- * Test role members is responsible for role assignment.
- * At first it creates user "newRoleMember" with password
"newRoleMember" and e-mail "newRoleMem(a)redhatqa.com".
- * Then it creates role with name "membersRole" and display name
"membersRoleDisplay".
- * At next step it assignes the role to the user.
- * It click for the "members" button for the "membersRole" and tries
to find "newRoleMember".
- * At the end it deletes the "newRoleMember" user and "membersRole"
role.
+ * Test role members is responsible for role assignment. At first it creates
+ * user "newRoleMember" with password "newRoleMember" and e-mail
+ * "newRoleMem(a)redhatqa.com". Then it creates role with name
"membersRole"
+ * and display name "membersRoleDisplay". At next step it assignes the role
+ * to the user. It click for the "members" button for the
"membersRole" and
+ * tries to find "newRoleMember". At the end it deletes the
"newRoleMember"
+ * user and "membersRole" role.
*/
@Test(enabled = true, description = "Managing members of role.")
public void testRoleMembers() {
@@ -430,9 +435,10 @@
}
/**
- * Test role edit is responsible for testing of role editing.
- * At first it creates role with name "editRole" and display name
"editRoleDisplay".
- * At the end it change the display name to "editedRoleDisplay" and delete the
role.
+ * Test role edit is responsible for testing of role editing. At first it
+ * creates role with name "editRole" and display name
"editRoleDisplay". At
+ * the end it change the display name to "editedRoleDisplay" and delete the
+ * role.
*/
@Test(enabled = true, description = "Creation of new role.")
public void testRoleEdit() {
@@ -487,43 +493,46 @@
}
/**
- * Xss testing of user creating dialog. XSS string is passed to user name input, the
form is submitted and text indicating incorrect username input is asserted.
- * The page is realoaded and XSS string is passed to user e-mail input, the form is
submitted and text indicating incorrect user e-mail input is asserted.
+ * Xss testing of user creating dialog. XSS string is passed to user name
+ * input, the form is submitted and text indicating incorrect username input
+ * is asserted. The page is realoaded and XSS string is passed to user
+ * e-mail input, the form is submitted and text indicating incorrect user
+ * e-mail input is asserted.
*/
- //TODO Q: password can be anystring?
- //TODO Q: what about serach input?
+ // TODO Q: password can be anystring?
+ // TODO Q: what about serach input?
@Test(enabled = true)
- public void testUserCreateXss() {
+ public void testUserCreateXss() {
openAndWait(ADR_PORTAL);
clickAndWait(LNK_ADMIN);
clickAndWait(LNK_MEMBERS);
clickAndWait(LNK_CREATE_USER);
-
+
selenium.type(INP_USERNAME, XSS_STR1);
clickAndWait(SUB_CREATE_USER);
-
+
Assert.assertTrue(selenium.isTextPresent("is an invalid username"));
-
+
openAndWait(ADR_PORTAL);
-
+
clickIfVisible(LNK_ADMIN);
clickIfVisible(LNK_MEMBERS);
clickIfVisible(LNK_CREATE_USER);
-
+
selenium.type(INP_USERNAME, "user");
selenium.type(INP_USEREMAIL, XSS_STR1);
-
+
clickAndWait(SUB_CREATE_USER);
-
+
Assert.assertTrue(selenium.isTextPresent("Invalid E-Mail address."));
-
+
}
-
+
/**
*
- */
+ */
@Test(enabled = true)
- public void testRoleCreateXss() {
+ public void testRoleCreateXss() {
openAndWait(ADR_PORTAL);
clickIfVisible(LNK_ADMIN);
clickIfVisible(LNK_ADMIN);
@@ -531,109 +540,150 @@
clickIfVisible(LNK_ROLETAB);
clickIfVisible(LNK_ROLEMAIN);
clickIfVisible(LNK_ROLE_CREATE);
-
+
selenium.type(INP_ROLENAME, XSS_STR1);
- selenium.type(INP_ROLEDISNAME,"diddi");
+ selenium.type(INP_ROLEDISNAME, "diddi");
clickAndWait(SUB_ROLE_CREATE);
-
+
Assert.assertTrue(selenium.isTextPresent("is an invalid role name"));
-
+
openAndWait(ADR_PORTAL);
-
clickIfVisible(LNK_ADMIN);
clickIfVisible(LNK_ADMIN);
clickIfVisible(LNK_MEMBERS);
clickIfVisible(LNK_ROLETAB);
clickIfVisible(LNK_ROLEMAIN);
clickIfVisible(LNK_ROLE_CREATE);
-
+
selenium.type(INP_ROLENAME, "rolee");
selenium.type(INP_ROLEDISNAME, XSS_STR1);
-
+
clickAndWait(SUB_ROLE_CREATE);
-
- Assert.assertTrue(selenium.isTextPresent("is an invalid role display
name"));
+
+ Assert.assertTrue(selenium.isTextPresent("is an invalid role display
name"));
+
}
-
+
/**
*
- */
- @Test(enabled = true, dependsOnMethods = {"testEditUser"})
- public void testEditUserXss() {
+ */
+ @Test(enabled = true)
+ public void testRoleEditXss() {
+ // EDIT ROLE
+
+ final String roleName = "editRole";
+ final String roleDisplayName = "editRoleDisplay";
+
+ openAndWait(ADR_PORTAL);
+ clickIfVisible(LNK_ADMIN);
+ clickIfVisible(LNK_ADMIN);
+ clickIfVisible(LNK_MEMBERS);
+ clickIfVisible(LNK_ROLETAB);
+ clickIfVisible(LNK_ROLEMAIN);
+ clickIfVisible(LNK_ROLE_CREATE);
+
+ createRole(roleName, roleDisplayName);
+
+ openAndWait(ADR_PORTAL);
+ clickIfVisible(LNK_ADMIN);
+ clickIfVisible(LNK_ADMIN);
+ clickIfVisible(LNK_MEMBERS);
+ clickIfVisible(LNK_ROLETAB);
+ clickIfVisible(LNK_ROLEMAIN);
+
+ int 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, XSS_STR1);
+ selenium.click(SUB_EDIT_ROLE_SUBMIT);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent("is an invalid role display
name"));
+
+ deleteRole(roleName);
+ }
+
+ /**
+ *
+ */
+ @Test(enabled = true, dependsOnMethods = { "testEditUser" })
+ public void testEditUserXss() {
final String userName = "editXssMe";
final String userPass = "editXssPass";
final String userMail = "editXssMe(a)redhat.com";
createUser(userName, userPass, userMail);
goToEdit(userName, userMail);
-
+
testInput(INP_EDIT_USER_EMAIL, XSS_STR1, SUB_EDIT_PROF, "Invalid E-Mail
address.");
-
- //firstname
+
+ // firstname
goToEdit(userName, userMail);
testInput("//input[contains(@id,'profile-form:givenname')]",
XSS_STR1, SUB_EDIT_PROF, "is an invalid value");
- //lastname
+ // lastname
goToEdit(userName, userMail);
testInput("//input[contains(@id,'profile-form:familyname')]",
XSS_STR1, SUB_EDIT_PROF, "is an invalid value");
- //location
+ // location
goToEdit(userName, userMail);
testInput("//input[contains(@id,'profile-form:location')]", XSS_STR1,
SUB_EDIT_PROF, "is an invalid value");
- //skype
+ // skype
goToEdit(userName, userMail);
testInput("//input[contains(@id,'profile-form:skype')]", XSS_STR1,
SUB_EDIT_PROF, "is an invalid value");
- //icq
+ // icq
goToEdit(userName, userMail);
testInput("//input[contains(@id,'profile-form:icq')]", XSS_STR1,
SUB_EDIT_PROF, "is an invalid value");
- //aim
+ // aim
goToEdit(userName, userMail);
testInput("//input[contains(@id,'profile-form:aim')]", XSS_STR1,
SUB_EDIT_PROF, "is an invalid value");
- //msn
+ // msn
goToEdit(userName, userMail);
testInput("//input[contains(@id,'profile-form:msnm')]", XSS_STR1,
SUB_EDIT_PROF, "is an invalid value");
- //yahoo
+ // yahoo
goToEdit(userName, userMail);
testInput("//input[contains(@id,'profile-form:yim')]", XSS_STR1,
SUB_EDIT_PROF, "is an invalid value");
- //xmmp
+ // xmmp
goToEdit(userName, userMail);
testInput("//input[contains(@id,'profile-form:xmmp')]", XSS_STR1,
SUB_EDIT_PROF, "is an invalid value");
- //homepage
+ // homepage
goToEdit(userName, userMail);
testInput("//input[contains(@id,'profile-form:homepage')]", XSS_STR1,
SUB_EDIT_PROF, "is an invalid value");
- //occup
+ // occup
goToEdit(userName, userMail);
testInput("//input[contains(@id,'profile-form:occupation')]",
XSS_STR1, SUB_EDIT_PROF, "is an invalid value");
- //hobby
+ // hobby
goToEdit(userName, userMail);
testInput("//input[contains(@id,'profile-form:interests')]",
XSS_STR1, SUB_EDIT_PROF, "is an invalid value");
- //sign
+ // sign
goToEdit(userName, userMail);
testInput("//textarea[contains(@id,'profile-form:signature')]",
XSS_STR1, SUB_EDIT_PROF, "is an invalid value");
- //extra
+ // extra
goToEdit(userName, userMail);
testInput("//textarea[contains(@id,'profile-form:extra')]", XSS_STR1,
SUB_EDIT_PROF, "is an invalid value");
-
+
deleteUser(userName, userMail);
}
- private void goToEdit(String userName, String userMail){
+ private void goToEdit(String userName, String userMail) {
searchUser(userName, userMail);
int r = findTableRow(TBL_USERLIST, userName, 0);
selenium.click(MessageFormat.format(LNK_T_USRLIST_EDIT, r - 1));
selenium.waitForPageToLoad(PAGE_LOAD);
-
+
}
-
- private void testInput(String inpLoc, String inpStr, String subLoc, String mes){
+
+ private void testInput(String inpLoc, String inpStr, String subLoc, String mes) {
selenium.type(inpLoc, inpStr);
clickAndWait(subLoc);
Assert.assertTrue(selenium.isTextPresent(mes));
}
/**
- * Test search user count is responsible for the search functions for users..
- * The test creates 95 users named man0us - man94us.
- * Then it tests the paginator of the search functions. It sets count of results to
10,50 and 100,
- * traverse through paginator and check, whether the amount of returned results is
correct.
+ * Test search user count is responsible for the search functions for
+ * users.. The test creates 95 users named man0us - man94us. Then it tests
+ * the paginator of the search functions. It sets count of results to 10,50
+ * and 100, traverse through paginator and check, whether the amount of
+ * returned results is correct.
*/
@Test(enabled = true, description = "Altering the number of rows in user
search")
public void testSearchUserCount() {
@@ -655,12 +705,12 @@
selenium.click(INP_USER_SEARCH_PREV);
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertEquals(countTableRows(TBL_USERLIST) - 1, 50, "Wrong number of row in
user table #2.");
-
+
searchSimple("man", "100");
selenium.waitForPageToLoad(PAGE_LOAD);
- //selenium.setSpeed("60000");
+ // selenium.setSpeed("60000");
Assert.assertEquals(countTableRows(TBL_USERLIST) - 1, 95, "Wrong number of row in
user table #4.");
- //selenium.setSpeed("0");
+ // selenium.setSpeed("0");
/*
* for(int i=0; i< 95; i++){ deleteUser("man"+i+"us",
* "man"+i+"us"+"(a)redhatqa.com"); }
@@ -744,7 +794,7 @@
clickIfVisible(LNK_USERMAIN);
selenium.click(LNK_CREATE_USER);
waitFor(AJAX_LOAD);
- //selenium.waitForPageToLoad(PAGE_LOAD);
+ // selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isTextPresent("Username *"), "Label for
username input is wrong or missing.");
selenium.type(INP_USERNAME, userName);
@@ -917,6 +967,7 @@
selenium.waitForPageToLoad(PAGE_LOAD);
clickIfVisible(LNK_ROLETAB);
+
clickIfVisible(LNK_ROLEMAIN);
Assert.assertTrue(selenium.isTextPresent(roleName), "Role name is missing");
@@ -949,10 +1000,10 @@
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.select(SEL_SEARCHUSER_LIMIT, "label=" + count);
- //waitFor(SEARCH_TIMEOUT);
+ // waitFor(SEARCH_TIMEOUT);
selenium.type(INP_SEARCH_USER, name);
selenium.click(SUB_SEARCH_USER);
-
+
waitFor(SEARCH_TIMEOUT);
}
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 2009-06-05
04:01:09 UTC (rev 13437)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/JBossPortalSeleniumTestCase.java 2009-06-05
15:17:37 UTC (rev 13438)
@@ -266,6 +266,13 @@
selenium.waitForPageToLoad(PAGE_LOAD);
}
}
+
+ public void check(String locator, boolean d) {
+ waitForElement(locator);
+ if (selenium.isChecked(locator) != d) {
+ selenium.click(locator);
+ }
+ }
/**
* Asserts the text order on the page. The messages which order is to be determined are
inputed in a comma separated way. i.e. "string1;string2;string3". The method
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 2009-06-05
04:01:09 UTC (rev 13437)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/WSRPTestCase.java 2009-06-05
15:17:37 UTC (rev 13438)
@@ -8,45 +8,48 @@
import org.testng.annotations.Test;
/**
- * The Class WSRPTestCase is reponsible for testing the WSRP GUI of JBoss Portal.
+ * The Class WSRPTestCase is reponsible for testing the WSRP GUI of JBoss
+ * Portal.
*
* @author <a href="mailto:vrockai@redhat.com">Viliam Rockai</a>
*/
@Test(groups = { "cms_wsrp" }, enabled = true, description = "WSRP test
case.")
public class WSRPTestCase extends JBossPortalSeleniumTestCase {
-
+
/** prefix for locator properties */
public static String casePfx = "test.wsrp.";
-
- private final String INP_CONSUMER_NAME =
getLoc(casePfx+"inp.consumer.name","//input[contains(@id,'edit-cons-form:id')]");
- private final String SUB_REFRESH_CANCEL =
getLoc(casePfx+"submit.refresh.cancel","//a[contains(@id,'edit-cons-form:list-cons-link')]");
- private final String SUB_PROD_SAVE =
getLoc(casePfx+"submit.prod.save","//input[contains(@id,'producer-form:save-producer')]");
- private final String SUB_CONSDEL_CONF =
getLoc(casePfx+"submit.consdel.conf","//a[contains(@id,'confirm-delete-form:destroy-link')]");
- private final String SUB_CONS_REGVAL =
getLoc(casePfx+"submit.cons.regval","//input[contains(@id,'edit-cons-form:refresh-cons-link')]");
- private final String SUB_REFRESHFINAL =
getLoc(casePfx+"submit.refreshfinal","//input[contains(@id,'edit-cons-form:refresh-cons-link')]");
- private final String INPUT_CONS_REGVALUE =
getLoc(casePfx+"input.cons.regvalue","//input[contains(@id,'edit-cons-form:existingProps:0:prop-value-input')]");
- private final String SUBMIT_REFRESHSAVE =
getLoc(casePfx+"submit.refreshsave","//input[contains(@id,'edit-cons-form:refresh-cons-link')]");
- private final String INPUT_CONSWSDL =
getLoc(casePfx+"input.conswsdl","//input[contains(@id,'edit-cons-form:wsdl')]");
- private final String INPUT_CACHEEXP =
getLoc(casePfx+"input.cacheexp","//input[contains(@id,'edit-cons-form:cache')]");
- private final String SUBMIT_ADDPROP_INIT =
getLoc(casePfx+"submit.addprop.init","//a[contains(@id,'producer-form:add-reg-prop')]");
- private final String SUBMIT_ADDPROP =
getLoc(casePfx+"submit.addprop","//a[contains(@id,'producer-form:add-reg-prop')]");
- private final String INPUT_PROPHINT =
getLoc(casePfx+"input.prophint","//input[contains(@id,'producer-form:reg-properties:0:hint')]");
- private final String INPUT_PROPLABEL =
getLoc(casePfx+"input.proplabel","//input[contains(@id,'producer-form:reg-properties:0:label')]");
- private final String INPUT_PROPNAME =
getLoc(casePfx+"input.propname","//input[contains(@id,'producer-form:reg-properties:0:name')]");
- private final String SUBMIT_CREATECONS =
getLoc(casePfx+"submit.createcons","//input[contains(@id,'createConsumer:createConsumerButton')]");
- private final String INPUT_CREATECONS =
getLoc(casePfx+"input.createcons","//input[contains(@id,'createConsumer:consumerName')]");
- private final String ID_LINK_PRODCONF =
getLoc(casePfx+"id.link.prodconf","//a[contains(@id,'cons-temp-form:producer-link')]");
- private final String ID_LINK_CONSCONF =
getLoc(casePfx+"id.link.consconf","//a[contains(@id,'producer-temp-form:consumersTab')]");
- private final String LINK_CONSUMER_HOME
=getLoc(casePfx+"link.consumer.home","//a[contains(@id,'cons-temp-form1:list-cons-link')]");
- private final String
LINK_T_CONS_CON=getLoc(casePfx+"link.t.cons.con","//a[contains(@id,''consumer-list-form:consumersList:{0}:configure'')]");
- private final String
LINK_T_CONS_REF=getLoc(casePfx+"link.t.cons.ref","//a[contains(@id,''consumer-list-form:consumersList:{0}:refresh'')]");
- private final String
LINK_T_CONS_ACT=getLoc(casePfx+"link.t.cons.act","//a[contains(@id,''consumer-list-form:consumersList:{0}:activate'')]");
- private final String
LINK_T_CONS_DEA=getLoc(casePfx+"link.t.cons.dea","//a[contains(@id,''consumer-list-form:consumersList:{0}:activate'')]");
- private final String
LINK_T_CONS_REG=getLoc(casePfx+"link.t.cons.reg","//a[contains(@id,''consumer-list-form:consumersList:{0}:register'')]");
- private final String
LINK_T_CONS_DER=getLoc(casePfx+"link.t.cons.der","//a[contains(@id,''consumer-list-form:consumersList:{0}:register'')]");
- private final String
LINK_T_CONS_DEL=getLoc(casePfx+"link.t.cons.del","//a[contains(@id,''consumer-list-form:consumersList:{0}:delete'')]");
- private final String WSRP_CONSUMER_TABLE =
getLoc(casePfx+"link.wsrp.consumer.table","//table[contains(@id,':consumer-list-form:consumersList')]");
-
+
+ private final String INP_CONSUMER_NAME = getLoc(casePfx + "inp.consumer.name",
"//input[contains(@id,'edit-cons-form:id')]");
+ private final String INP_PRODID = getLoc(casePfx + "inp.prodid",
"//input[contains(@id,'edit-cons-form:id')]");
+ private final String SUB_REFRESH_CANCEL = getLoc(casePfx +
"submit.refresh.cancel",
"//a[contains(@id,'edit-cons-form:list-cons-link')]");
+ private final String SUB_PROD_SAVE = getLoc(casePfx + "submit.prod.save",
"//input[contains(@id,'producer-form:save-producer')]");
+ private final String SUB_CONSDEL_CONF = getLoc(casePfx +
"submit.consdel.conf",
"//a[contains(@id,'confirm-delete-form:destroy-link')]");
+ private final String SUB_CONS_REGVAL = getLoc(casePfx + "submit.cons.regval",
"//input[contains(@id,'edit-cons-form:refresh-cons-link')]");
+ private final String SUB_REFRESHFINAL = getLoc(casePfx +
"submit.refreshfinal",
"//input[contains(@id,'edit-cons-form:refresh-cons-link')]");
+ private final String INPUT_CONS_REGVALUE = getLoc(casePfx +
"input.cons.regvalue",
+ "//input[contains(@id,'edit-cons-form:existingProps:0:prop-value-input')]");
+ private final String SUBMIT_REFRESHSAVE = getLoc(casePfx +
"submit.refreshsave",
"//input[contains(@id,'edit-cons-form:refresh-cons-link')]");
+ private final String INPUT_CONSWSDL = getLoc(casePfx + "input.conswsdl",
"//input[contains(@id,'edit-cons-form:wsdl')]");
+ private final String INPUT_CACHEEXP = getLoc(casePfx + "input.cacheexp",
"//input[contains(@id,'edit-cons-form:cache')]");
+ private final String SUBMIT_ADDPROP_INIT = getLoc(casePfx +
"submit.addprop.init",
"//a[contains(@id,'producer-form:add-reg-prop')]");
+ private final String SUBMIT_ADDPROP = getLoc(casePfx + "submit.addprop",
"//a[contains(@id,'producer-form:add-reg-prop')]");
+ private final String INPUT_PROPHINT = getLoc(casePfx + "input.prophint",
"//input[contains(@id,'producer-form:reg-properties:0:hint')]");
+ private final String INPUT_PROPLABEL = getLoc(casePfx + "input.proplabel",
"//input[contains(@id,'producer-form:reg-properties:0:label')]");
+ private final String INPUT_PROPNAME = getLoc(casePfx + "input.propname",
"//input[contains(@id,'producer-form:reg-properties:0:name')]");
+ private final String SUBMIT_CREATECONS = getLoc(casePfx + "submit.createcons",
"//input[contains(@id,'createConsumer:createConsumerButton')]");
+ private final String INPUT_CREATECONS = getLoc(casePfx + "input.createcons",
"//input[contains(@id,'createConsumer:consumerName')]");
+ private final String ID_LINK_PRODCONF = getLoc(casePfx + "id.link.prodconf",
"//a[contains(@id,'cons-temp-form:producer-link')]");
+ private final String ID_LINK_CONSCONF = getLoc(casePfx + "id.link.consconf",
"//a[contains(@id,'producer-temp-form:consumersTab')]");
+ private final String LINK_CONSUMER_HOME = getLoc(casePfx +
"link.consumer.home",
"//a[contains(@id,'cons-temp-form1:list-cons-link')]");
+ private final String LINK_T_CONS_CON = getLoc(casePfx + "link.t.cons.con",
"//a[contains(@id,''consumer-list-form:consumersList:{0}:configure'')]");
+ private final String LINK_T_CONS_REF = getLoc(casePfx + "link.t.cons.ref",
"//a[contains(@id,''consumer-list-form:consumersList:{0}:refresh'')]");
+ private final String LINK_T_CONS_ACT = getLoc(casePfx + "link.t.cons.act",
"//a[contains(@id,''consumer-list-form:consumersList:{0}:activate'')]");
+ private final String LINK_T_CONS_DEA = getLoc(casePfx + "link.t.cons.dea",
"//a[contains(@id,''consumer-list-form:consumersList:{0}:activate'')]");
+ private final String LINK_T_CONS_REG = getLoc(casePfx + "link.t.cons.reg",
"//a[contains(@id,''consumer-list-form:consumersList:{0}:register'')]");
+ private final String LINK_T_CONS_DER = getLoc(casePfx + "link.t.cons.der",
"//a[contains(@id,''consumer-list-form:consumersList:{0}:register'')]");
+ private final String LINK_T_CONS_DEL = getLoc(casePfx + "link.t.cons.del",
"//a[contains(@id,''consumer-list-form:consumersList:{0}:delete'')]");
+ private final String WSRP_CONSUMER_TABLE = getLoc(casePfx +
"link.wsrp.consumer.table",
"//table[contains(@id,':consumer-list-form:consumersList')]");
+
@BeforeMethod(groups = { "log" })
private void loginBeforeTest() {
logoutIfPossible();
@@ -55,31 +58,38 @@
@AfterMethod(groups = { "log" })
private void logoutAfterTest() {
- //logout();
+ // logout();
}
/**
- * Test create bea consume is responsible for creating BEA consumer named
<b>BEA</b>. Navigate to WSRP gui and create consumer with these parameters:
- * <br/>
+ * Test create bea consume is responsible for creating BEA consumer named
+ * <b>BEA</b>. Navigate to WSRP gui and create consumer with these
+ * parameters: <br/>
* <table>
* <tr>
- * <td><b>Producer id:</b></td><td>BEA</td>
+ * <td><b>Producer id:</b></td>
+ * <td>BEA</td>
* </tr>
* <tr>
- * <td><b>Cache expiration:</b></td><td>600</td>
+ * <td><b>Cache expiration:</b></td>
+ * <td>600</td>
* </tr>
* <tr>
- * <td><b>Endpoint
configuration:</b></td><td>http://wsrp.bea.com:7001/producer/producer?WSDL
(using WSDL)</td>
+ * <td><b>Endpoint configuration:</b></td>
+ * <td>http://wsrp.bea.com:7001/producer/producer?WSDL (using WSDL)</td>
* </tr>
* <tr>
- * <td><b>Registration
information:</b></td><td><code>{urn:bea:wlp:prop:reg:registration}consumerRole</code>
: public</td>
+ * <td><b>Registration information:</b></td>
+ * <td><code>{urn:bea:wlp:prop:reg:registration}consumerRole</code> :
public
+ * </td>
* </tr>
* </table>
- * <br/>
- * After clicking refresh&save button, the test checks for text message about
successful refresh.
- * Then it check whether the BEA consumer is appearing in the main consumers table.
+ * <br/> After clicking refresh&save button, the test checks for text
+ * message about successful refresh. Then it check whether the BEA consumer
+ * is appearing in the main consumers table.
*/
- //TODO checking for the resulting consumer in table should be using selenium extension
+ // TODO checking for the resulting consumer in table should be using
+ // selenium extension
@Test(enabled = true, description = "Creating a standard BEA consumer.")
public void testCreateBeaConsumer() {
selenium.open("/portal/");
@@ -91,11 +101,11 @@
clickIfVisible(ID_LINK_CONSCONF);
selenium.type(INPUT_CREATECONS, "BEA");
-
+
selenium.click(SUBMIT_CREATECONS);
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.type(INPUT_CACHEEXP, "600");
-
+
selenium.type(INPUT_CONSWSDL,
"http://wsrp.bea.com:7001/producer/producer?WSDL");
selenium.click(SUBMIT_REFRESHSAVE);
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -112,9 +122,10 @@
}
/**
- * Test bea consumer register is reponsible for registering previously deregistered
consumer <b>BEAreg</b>.
- * It finds the <b>BEAreg</b> consumer in the main consumer table and clicks
on its register icon.
- * After that, it checks whether the register icon changed its text to
"deregister"
+ * Test bea consumer register is reponsible for registering previously
+ * deregistered consumer <b>BEAreg</b>. It finds the
<b>BEAreg</b> consumer
+ * in the main consumer table and clicks on its register icon. After that,
+ * it checks whether the register icon changed its text to "deregister"
*/
@Test(enabled = true, dependsOnMethods = { "testCreateBeaConsumer",
"testBeaConsumerDeregister" }, description = "Standard BEA consumer
registering.")
public void testBeaConsumerRegister() {
@@ -127,8 +138,8 @@
selenium.waitForPageToLoad(PAGE_LOAD);
clickIfVisible(ID_LINK_CONSCONF);
clickIfVisible(LINK_CONSUMER_HOME);
- int r = findTableRow(WSRP_CONSUMER_TABLE, "BEAreg", 0)-1 ;
- selenium.click(MessageFormat.format(LINK_T_CONS_REG,r));
+ int r = findTableRow(WSRP_CONSUMER_TABLE, "BEAreg", 0) - 1;
+ selenium.click(MessageFormat.format(LINK_T_CONS_REG, r));
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click(SUBMIT_REFRESHSAVE);
@@ -137,13 +148,15 @@
selenium.click(LINK_CONSUMER_HOME);
selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertEquals(selenium.getText(MessageFormat.format(LINK_T_CONS_DER,r)),
"Deregister");
+ Assert.assertEquals(selenium.getText(MessageFormat.format(LINK_T_CONS_DER, r)),
"Deregister");
}
/**
- * Test bea consumer deregister is responsible for deleting previously created BEA
consumer.
- * It creates BEA consumer with name BEA and values similiar to that from
testCreateBeaConsumer.
- * Then it clicks on deregister link for the consumer and checks whether deregister link
has changed into register link.
+ * Test bea consumer deregister is responsible for deleting previously
+ * created BEA consumer. It creates BEA consumer with name BEA and values
+ * similiar to that from testCreateBeaConsumer. Then it clicks on deregister
+ * link for the consumer and checks whether deregister link has changed into
+ * register link.
*/
@Test(enabled = true, dependsOnMethods = { "testCreateBeaConsumer" },
description = "Standard BEA consumer deregistering.")
public void testBeaConsumerDeregister() {
@@ -157,26 +170,28 @@
selenium.waitForPageToLoad(PAGE_LOAD);
clickIfVisible(ID_LINK_CONSCONF);
clickIfVisible(LINK_CONSUMER_HOME);
-
- int r = findTableRow(WSRP_CONSUMER_TABLE, "BEAreg", 0) -1;
- selenium.click(MessageFormat.format(LINK_T_CONS_DER,r));
+ int r = findTableRow(WSRP_CONSUMER_TABLE, "BEAreg", 0) - 1;
+
+ selenium.click(MessageFormat.format(LINK_T_CONS_DER, r));
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click(SUB_REFRESH_CANCEL);
selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertEquals(selenium.getText(MessageFormat.format(LINK_T_CONS_DER,r)),
"Register");
+ Assert.assertEquals(selenium.getText(MessageFormat.format(LINK_T_CONS_DER, r)),
"Register");
}
/**
- * Test bea consumer activate is responsible for activating previously deactivated
consumer.
- * It works with consumer named <b>BEAact</b> and checks whether the
consumer has message showing it's inactive and refresh is needed.
- * Then it click on activate link and check that the message has disappeared.
+ * Test bea consumer activate is responsible for activating previously
+ * deactivated consumer. It works with consumer named <b>BEAact</b> and
+ * checks whether the consumer has message showing it's inactive and refresh
+ * is needed. Then it click on activate link and check that the message has
+ * disappeared.
*/
@Test(enabled = true, dependsOnMethods = { "testCreateBeaConsumer",
"testBeaConsumerDeactivate" }, description = "Standard BEA consumer
activating.")
public void testBeaConsumerActivate() {
selenium.open("/portal/");
-
+
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=Admin");
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -184,21 +199,23 @@
selenium.waitForPageToLoad(PAGE_LOAD);
clickIfVisible(ID_LINK_CONSCONF);
clickIfVisible(LINK_CONSUMER_HOME);
- int r = findTableRow(WSRP_CONSUMER_TABLE, "BEAact", 0)-1;
+ int r = findTableRow(WSRP_CONSUMER_TABLE, "BEAact", 0) - 1;
Assert.assertTrue(selenium.isTextPresent("BEAact (inactive) (refresh
needed)"));
- selenium.click(MessageFormat.format(LINK_T_CONS_ACT,r));
+ selenium.click(MessageFormat.format(LINK_T_CONS_ACT, r));
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertFalse(selenium.isTextPresent("BEAact (inactive) (refresh
needed)"));
}
/**
- * Test bea consumer deactivate is responsible for deactivating a bea consumer.
- * Firstly it creates bea consumer named <b>BEAact</b> with parameters
similiar to that from testCreateBeaConsumer.
- * Then it asserts that message signalling the consumer non-active state is missing.
- * After clicking on deactivation link it assert, that the message signalling non-active
state of consumer has appeared.
+ * Test bea consumer deactivate is responsible for deactivating a bea
+ * consumer. Firstly it creates bea consumer named <b>BEAact</b> with
+ * parameters similiar to that from testCreateBeaConsumer. Then it asserts
+ * that message signalling the consumer non-active state is missing. After
+ * clicking on deactivation link it assert, that the message signalling
+ * non-active state of consumer has appeared.
*/
@Test(enabled = true, dependsOnMethods = { "testCreateBeaConsumer" },
description = "Standard BEA consumer deactivating.")
public void testBeaConsumerDeactivate() {
@@ -213,31 +230,33 @@
selenium.waitForPageToLoad(PAGE_LOAD);
clickIfVisible(ID_LINK_CONSCONF);
clickIfVisible(LINK_CONSUMER_HOME);
-
- int r = findTableRow(WSRP_CONSUMER_TABLE, "BEAact", 0)-1;
+ int r = findTableRow(WSRP_CONSUMER_TABLE, "BEAact", 0) - 1;
+
Assert.assertFalse(selenium.isTextPresent("BEAact (inactive) (refresh
needed)"));
- selenium.click(MessageFormat.format(LINK_T_CONS_DEA,r));
+ selenium.click(MessageFormat.format(LINK_T_CONS_DEA, r));
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isTextPresent("BEAact (inactive) (refresh
needed)"));
}
/**
- * Test bea consumer configure. Test is disabled - deleting of the method should be
considered.
+ * Test bea consumer configure. Test is disabled - deleting of the method
+ * should be considered.
*/
- //TODO deleting of the method should be considered.
+ // TODO deleting of the method should be considered.
@Test(enabled = false, dependsOnMethods = { "testCreateBeaConsumer" },
description = "Standard BEA consumer configuring.")
public void testBeaConsumerConfigure() {
}
-
/**
* Test bea consumer delete is responsible for deleting a bea consumer.
- * Firstly it creates bea consumer named <b>BEAdel</b> with parameters
similiar to that from testCreateBeaConsumer.
- * It click on the delete icon for the consumer and then it asserts the consumer has
disappeared from the table.
+ * Firstly it creates bea consumer named <b>BEAdel</b> with parameters
+ * similiar to that from testCreateBeaConsumer. It click on the delete icon
+ * for the consumer and then it asserts the consumer has disappeared from
+ * the table.
*/
@Test(enabled = true, dependsOnMethods = { "testCreateBeaConsumer" },
description = "Standard BEA consumer deleting.")
public void testBeaConsumerDelete() {
@@ -253,16 +272,16 @@
clickIfVisible(ID_LINK_CONSCONF);
clickIfVisible(LINK_CONSUMER_HOME);
Assert.assertTrue(selenium.isTextPresent("BEAdel"));
-
- Assert.assertTrue(selenium.isElementPresent(WSRP_CONSUMER_TABLE),"Consumer table
not available.");
- int r = findTableRow(WSRP_CONSUMER_TABLE, "BEAdel", 0)-1;
- Assert.assertFalse(r < 0,"Consumer BEAdel not found");
- selenium.click(MessageFormat.format(LINK_T_CONS_DEL,r));
+ Assert.assertTrue(selenium.isElementPresent(WSRP_CONSUMER_TABLE), "Consumer table
not available.");
+ int r = findTableRow(WSRP_CONSUMER_TABLE, "BEAdel", 0) - 1;
+ Assert.assertFalse(r < 0, "Consumer BEAdel not found");
+
+ selenium.click(MessageFormat.format(LINK_T_CONS_DEL, r));
selenium.waitForPageToLoad(PAGE_LOAD);
-
+
Assert.assertTrue(selenium.isTextPresent("Delete 'BEAdel'
consumer?"));
-
+
clickAndWait(SUB_CONSDEL_CONF);
Assert.assertFalse(selenium.isTextPresent("BEAdel"));
@@ -273,17 +292,22 @@
* If fills up the registration properties with these values:
* <table>
* <tr>
- * <td><b>Name</b></td><td>testProp</td>
- * <td><b>Label</b></td><td>testProp label</td>
- * <td><b>Hint</b></td><td>tetsPropHint</td>
+ * <td><b>Name</b></td>
+ * <td>testProp</td>
+ * <td><b>Label</b></td>
+ * <td>testProp label</td>
+ * <td><b>Hint</b></td>
+ * <td>tetsPropHint</td>
* </tr>
* </table>
*
- * It saves the properties and checks they were saved.
- * <br/>
- * Missing: It doesn't test the function of cancel button and checkboxes in producer
configuration.
+ * It saves the properties and checks they were saved. <br/> Missing: It
+ * doesn't test the function of cancel button and checkboxes in producer
+ * configuration.
*/
- //TODO the function of cancel button and checkboxes in producer configuration.
+ // TODO the function of cancel button and checkboxes in producer
+ // configuration.
+ // TODO registration policy properties tests missing
@Test(enabled = true, description = "Basic configuring of WSRP producer.")
public void testConfigureProducer() {
selenium.open("/portal/");
@@ -300,10 +324,10 @@
selenium.type(INPUT_PROPNAME, "testProp");
selenium.type(INPUT_PROPLABEL, "testProp label");
selenium.type(INPUT_PROPHINT, "tetsPropHint");
-
+
selenium.click(SUB_PROD_SAVE);
selenium.waitForPageToLoad(PAGE_LOAD);
-
+
Assert.assertTrue(selenium.isTextPresent("Producer configuration successfully
saved!"));
clickIfVisible(ID_LINK_CONSCONF);
clickIfVisible(ID_LINK_PRODCONF);
@@ -313,12 +337,14 @@
Assert.assertEquals("tetsPropHint", selenium.getValue(INPUT_PROPHINT));
}
-
+
/**
* Test configure consumer is responsible for configuring bea consumer.
- * Firstly it creates bea consumer named <b>renameMe</b> with parameters
similiar to that from testCreateBeaConsumer.
- * Then it clicks on configure button for the consumer and rename it to
<b>renameNewMe</b>.
- * At the end it asserts that the previous name is missing in the consumers table and
the new name has appeared.
+ * Firstly it creates bea consumer named <b>renameMe</b> with parameters
+ * similiar to that from testCreateBeaConsumer. Then it clicks on configure
+ * button for the consumer and rename it to <b>renameNewMe</b>. At the end
+ * it asserts that the previous name is missing in the consumers table and
+ * the new name has appeared.
*/
@Test(enabled = true, description = "Renaming a consumer through the configure
button.")
public void testConfigureConsumer() {
@@ -335,37 +361,160 @@
clickIfVisible(ID_LINK_CONSCONF);
clickIfVisible(LINK_CONSUMER_HOME);
-
int r = findTableRow(WSRP_CONSUMER_TABLE, name, 0);
-
- Assert.assertTrue(r<0, "Not created consumer already in table");
-
+
+ Assert.assertTrue(r < 0, "Not created consumer already in table");
+
// create consumer to be renamed
createConsumer(name, "100",
"http://wsrp.bea.com:7001/producer/producer?WSDL");
-
+
clickIfVisible(ID_LINK_CONSCONF);
clickIfVisible(LINK_CONSUMER_HOME);
-
+
r = findTableRow(WSRP_CONSUMER_TABLE, name, 0);
- Assert.assertTrue(r>0, "Created consumer not found in table");
-
+ Assert.assertTrue(r > 0, "Created consumer not found in table");
+
// rename the consumer
- clickAndWait(MessageFormat.format(LINK_T_CONS_CON,r-1));
-
+ clickAndWait(MessageFormat.format(LINK_T_CONS_CON, r - 1));
+
selenium.type(INP_CONSUMER_NAME, nameNew);
- clickAndWait(SUBMIT_REFRESHSAVE);
-
+ clickAndWait(SUBMIT_REFRESHSAVE);
+
clickIfVisible(ID_LINK_CONSCONF);
clickIfVisible(LINK_CONSUMER_HOME);
-
+
waitForElement(WSRP_CONSUMER_TABLE);
r = findTableRow(WSRP_CONSUMER_TABLE, name, 0);
- Assert.assertTrue(r<0, "Renamed consumer still in table");
-
+ Assert.assertTrue(r < 0, "Renamed consumer still in table");
+
r = findTableRow(WSRP_CONSUMER_TABLE, nameNew, 0);
- Assert.assertTrue(r>0, "Renamed consumer not found in table");
+ Assert.assertTrue(r > 0, "Renamed consumer not found in table");
}
-
+
+ /*
+ *
+ */
+ @Test(enabled = true)
+ public void testXssConsumerManage() {
+ String beaName = "XssBeaConsumer";
+
+ selenium.open("/portal/");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=WSRP");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ clickIfVisible(ID_LINK_CONSCONF);
+ clickIfVisible(LINK_CONSUMER_HOME);
+
+ selenium.type(INPUT_CREATECONS, XSS_STR1);
+ selenium.click(SUBMIT_CREATECONS);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent("is an invalid Consumer name"));
+
+ selenium.type(INPUT_CREATECONS, beaName);
+
+ selenium.click(SUBMIT_CREATECONS);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.type(INPUT_CACHEEXP, "600");
+
+ selenium.type(INPUT_CONSWSDL, XSS_STR1);
+ selenium.click(SUBMIT_REFRESHSAVE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent("Require a well-formed URL"));
+
+ selenium.type(INPUT_CACHEEXP, XSS_STR1);
+ selenium.type(INPUT_CONSWSDL,
"http://wsrp.bea.com:7001/producer/producer?WSDL");
+ selenium.click(SUBMIT_REFRESHSAVE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent("must be a number between"));
+
+ selenium.type(INP_PRODID, XSS_STR1);
+ selenium.type(INPUT_CACHEEXP, "600");
+ selenium.type(INPUT_CONSWSDL,
"http://wsrp.bea.com:7001/producer/producer?WSDL");
+ selenium.click(SUBMIT_REFRESHSAVE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent("is an invalid Consumer name"));
+
+ selenium.type(INP_PRODID, beaName);
+ selenium.type(INPUT_CACHEEXP, "600");
+ selenium.type(INPUT_CONSWSDL,
"http://wsrp.bea.com:7001/producer/producer?WSDL");
+ selenium.click(SUBMIT_REFRESHSAVE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.type(INPUT_CONS_REGVALUE, XSS_STR1);
+ selenium.click(SUB_CONS_REGVAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent("An unexpected error occured"));
+ }
+
+ /*
+ *
+ */
+ @Test(enabled = true)
+ public void testXssProducerManage() {
+
+ goToProducers();
+ selenium.type("_WSRPConfigurationPortletWindow:j_id24:producer-form:registrationPolicy",
XSS_STR1);
+ selenium.click(SUB_PROD_SAVE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("Couldn't find policy class"));
+
+ // goToProducers();
+ // selenium.type(
+ // "_WSRPConfigurationPortletWindow:j_id24:producer-form:validator"
+ // ,XSS_STR1);
+ // selenium.click(SUB_PROD_SAVE);
+ // selenium.waitForPageToLoad(PAGE_LOAD);
+ //Assert.assertTrue(selenium.isTextPresent("Couldn't find policy class")
+ // );
+
+ // properties
+ selenium.open("/portal/");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=WSRP");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ clickIfVisible(ID_LINK_PRODCONF);
+ Assert.assertTrue(selenium.isTextPresent("Producer configuration"));
+ clickAndWait(SUBMIT_ADDPROP_INIT);
+
+ selenium.type(INPUT_PROPNAME, "testProp");
+ selenium.type(INPUT_PROPLABEL, "testProp label");
+ selenium.type(INPUT_PROPHINT, "tetsPropHint");
+
+ selenium.click(SUB_PROD_SAVE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent("Producer configuration successfully
saved!"));
+ clickIfVisible(ID_LINK_CONSCONF);
+ clickIfVisible(ID_LINK_PRODCONF);
+
+ Assert.assertEquals("testProp", selenium.getValue(INPUT_PROPNAME));
+ Assert.assertEquals("testProp label", selenium.getValue(INPUT_PROPLABEL));
+ Assert.assertEquals("tetsPropHint", selenium.getValue(INPUT_PROPHINT));
+ }
+
+ private void goToProducers() {
+ selenium.open("/portal/");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=WSRP");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ clickIfVisible(ID_LINK_PRODCONF);
+ Assert.assertTrue(selenium.isTextPresent("Producer configuration"));
+ }
+
private void createConsumer(String name, String timeout, String address) {
selenium.open("/portal/");
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -377,7 +526,7 @@
selenium.type(INPUT_CREATECONS, name);
selenium.click(SUBMIT_CREATECONS);
selenium.waitForPageToLoad(PAGE_LOAD);
-
+
waitForElement(INPUT_CACHEEXP);
selenium.type(INPUT_CACHEEXP, timeout);
waitForElement(INPUT_CONSWSDL);
@@ -388,7 +537,7 @@
selenium.type(INPUT_CONS_REGVALUE, "public");
selenium.click(SUB_CONS_REGVAL);
selenium.waitForPageToLoad(PAGE_LOAD);
-
+
selenium.click(SUB_REFRESHFINAL);
selenium.waitForPageToLoad(PAGE_LOAD);
}
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/locator.properties
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/locator.properties 2009-06-05
04:01:09 UTC (rev 13437)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/locator.properties 2009-06-05
15:17:37 UTC (rev 13438)
@@ -68,8 +68,8 @@
iden.man.lnk.search.user=//a[contains(@id,'user-form:search-user-link')]
iden.man.lnk.usertab=//a[contains(@id,'role-temp-form:manage-users')]
iden.man.lnk.usermain=//a[contains(@id,'user-temp-form1:user-adm-link')]
-iden.man.lnk.roletab=//a[contains(@id,'user-temp-form:role-mgm-link')]
-iden.man.lnk.rolemain=//a[contains(@id, 'role-temp-form1:role-admin-link')]
+iden.man.lnk.roletab=//a[contains(@id,'role-mgm-link')]
+iden.man.lnk.rolemain=//a[contains(@id, 'role-adm-link')]
iden.man.lnk.usermang.main=//a[contains(@id,'user-temp-form1:assign-role-link')]
iden.man.lnk.usermang.main2=//a[contains(@id,'user-temp-form1:user-mgm-link')]
iden.man.lnk.create.user=//a[contains(@id,':user-form:create-user-link')]
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/AdminPortalTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/AdminPortalTestCase.java 2009-06-05
04:01:09 UTC (rev 13437)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/AdminPortalTestCase.java 2009-06-05
15:17:37 UTC (rev 13438)
@@ -22,21 +22,21 @@
/** prefix for locator properties = portal.admin. */
public final String casePfx = "portal.admin.";
- private final String SUB_SEC_SUBMIT = getLoc(casePfx +
"sub.sec.submit","//input[contains(@id,'common-edit-security-form:update')]");
- private final String SUB_SEC_CANCEL = getLoc(casePfx +
"sub.sec.cancel","//input[contains(@id,'common-edit-security-form:cancel')]");
+ private final String SUB_SEC_SUBMIT = getLoc(casePfx + "sub.sec.submit",
"//input[contains(@id,'common-edit-security-form:update')]");
+ private final String SUB_SEC_CANCEL = getLoc(casePfx + "sub.sec.cancel",
"//input[contains(@id,'common-edit-security-form:cancel')]");
- private final String CHK_SEC_RUN_PR = getLoc(casePfx +
"chk.sec.run.pr","//input[contains(@id,'common-edit-security-form:cars_2:3')]");
- private final String CHK_SEC_RUN_P = getLoc(casePfx +
"chk.sec.run.p","//input[contains(@id,'common-edit-security-form:cars_2:2')]");
- private final String CHK_SEC_RUN_VR = getLoc(casePfx +
"chk.sec.run.vr","//input[contains(@id,'common-edit-security-form:cars_2:1')]");
- private final String CHK_SEC_RUN_V = getLoc(casePfx +
"chk.sec.run.v","//input[contains(@id,'common-edit-security-form:cars_2:0')]");
- private final String CHK_SEC_RU_PR = getLoc(casePfx +
"chk.sec.ru.pr","//input[contains(@id,'common-edit-security-form:cars_1:3')]");
- private final String CHK_SEC_RU_P = getLoc(casePfx +
"chk.sec.ru.p","//input[contains(@id,'common-edit-security-form:cars_1:2')]");
- private final String CHK_SEC_RU_VR = getLoc(casePfx +
"chk.sec.ru.vr","//input[contains(@id,'common-edit-security-form:cars_1:1')]");
- private final String CHK_SEC_RU_V = getLoc(casePfx +
"chk.sec.ru.v","//input[contains(@id,'common-edit-security-form:cars_1:0')]");
- private final String CHK_SEC_RA_PR = getLoc(casePfx +
"chk.sec.ra.pr","//input[contains(@id,'common-edit-security-form:cars_0:3')]");
- private final String CHK_SEC_RA_P = getLoc(casePfx +
"chk.sec.ra.p","//input[contains(@id,'common-edit-security-form:cars_0:2')]");
- private final String CHK_SEC_RA_VR = getLoc(casePfx +
"chk.sec.ra.vr","//input[contains(@id,'common-edit-security-form:cars_0:1')]");
- private final String CHK_SEC_RA_V = getLoc(casePfx +
"chk.sec.ra.v","//input[contains(@id,'common-edit-security-form:cars_0:0')]");
+ private final String CHK_SEC_RUN_PR = getLoc(casePfx + "chk.sec.run.pr",
"//input[contains(@id,'common-edit-security-form:cars_2:3')]");
+ private final String CHK_SEC_RUN_P = getLoc(casePfx + "chk.sec.run.p",
"//input[contains(@id,'common-edit-security-form:cars_2:2')]");
+ private final String CHK_SEC_RUN_VR = getLoc(casePfx + "chk.sec.run.vr",
"//input[contains(@id,'common-edit-security-form:cars_2:1')]");
+ private final String CHK_SEC_RUN_V = getLoc(casePfx + "chk.sec.run.v",
"//input[contains(@id,'common-edit-security-form:cars_2:0')]");
+ private final String CHK_SEC_RU_PR = getLoc(casePfx + "chk.sec.ru.pr",
"//input[contains(@id,'common-edit-security-form:cars_1:3')]");
+ private final String CHK_SEC_RU_P = getLoc(casePfx + "chk.sec.ru.p",
"//input[contains(@id,'common-edit-security-form:cars_1:2')]");
+ private final String CHK_SEC_RU_VR = getLoc(casePfx + "chk.sec.ru.vr",
"//input[contains(@id,'common-edit-security-form:cars_1:1')]");
+ private final String CHK_SEC_RU_V = getLoc(casePfx + "chk.sec.ru.v",
"//input[contains(@id,'common-edit-security-form:cars_1:0')]");
+ private final String CHK_SEC_RA_PR = getLoc(casePfx + "chk.sec.ra.pr",
"//input[contains(@id,'common-edit-security-form:cars_0:3')]");
+ private final String CHK_SEC_RA_P = getLoc(casePfx + "chk.sec.ra.p",
"//input[contains(@id,'common-edit-security-form:cars_0:2')]");
+ private final String CHK_SEC_RA_VR = getLoc(casePfx + "chk.sec.ra.vr",
"//input[contains(@id,'common-edit-security-form:cars_0:1')]");
+ private final String CHK_SEC_RA_V = getLoc(casePfx + "chk.sec.ra.v",
"//input[contains(@id,'common-edit-security-form:cars_0:0')]");
private final String MES_P1 = getMess(casePfx + "p1", "Who's online
portlet");
private final String MES_P2 = getMess(casePfx + "p1",
"CharsetPortletInstance");
@@ -70,7 +70,7 @@
private final String CHK_PPA_ACCESS_CHECK = getLoc(casePfx +
"chk.ppa.access.check",
"//input[contains(@id,'common-edit-page-error-form:page-access-check')]");
private final String SUB_PP_ERROR_FORM_UPDATE = getLoc(casePfx +
"sub.pp.error.form.update",
- "//input[contains(@id,'common-edit-portal-error-form:update')]");
+ "//input[contains(@id,'common-edit-portal-error-form:update')]");
private final String INP_PP_RES_INPUT = getLoc(casePfx + "inp.pp.res.input",
"//input[contains(@id,'common-edit-portal-error-form:portal-res-input')]");
private final String SEL_PP_NF_SELECT = getLoc(casePfx + "sel.pp.nf.select",
"//select[contains(@id,'common-edit-portal-error-form:portal-not-found-select')]");
@@ -725,23 +725,27 @@
Assert.assertTrue(r < 0, "Renamed page was found with the old name.");
}
-
+
/**
- * Page security testing. New page "PageToSecure" is created in
"TestPortal". The security page for the page is opened. It is asserted that all
checkboxes are off by
- * default. All checkboxes are set to "checked" and cancel is clicked. The
security page is loaded again and it is asserted that all checkboxes are off after
cancel.
- * All checkboxes are then set to "checked" and update button is clicked. The
security page is loaded again and it is asserted that all the checkboxes are in the
+ * Page security testing. New page "PageToSecure" is created in
+ * "TestPortal". The security page for the page is opened. It is asserted
+ * that all checkboxes are off by default. All checkboxes are set to
+ * "checked" and cancel is clicked. The security page is loaded again and it
+ * is asserted that all checkboxes are off after cancel. All checkboxes are
+ * then set to "checked" and update button is clicked. The security page is
+ * loaded again and it is asserted that all the checkboxes are in the
* "checked" state.
*/
@Test(enabled = true, dependsOnMethods = { "testPortalCreate",
"testAddPage" }, description = "Tests page security")
public void testPageSecurity() {
-
+
String portalName = "TestPortal";
String pageName = "PageToSecure";
createPage(portalName, pageName);
- // cancel
-
+ // cancel
+
clickIfVisible(TAB_PORTALOBJ_ID);
clickIfVisible(LINK_PORTALS_ID);
clickIfVisible(LINK_PORTAL_HOME);
@@ -753,22 +757,22 @@
r = findTableRow(TABLE_PORTALPAGE_ADMIN, pageName, 0) - 1;
clickAndWait(MessageFormat.format(PAG_TL_SECURITY, r));
-
- Assert.assertFalse(selenium.isChecked(CHK_SEC_RA_V),"Checkbox should not be
checked");
- Assert.assertFalse(selenium.isChecked(CHK_SEC_RA_VR),"Checkbox should not be
checked");
- Assert.assertFalse(selenium.isChecked(CHK_SEC_RA_P),"Checkbox should not be
checked");
- Assert.assertFalse(selenium.isChecked(CHK_SEC_RA_PR),"Checkbox should not be
checked");
- Assert.assertFalse(selenium.isChecked(CHK_SEC_RU_V),"Checkbox should not be
checked");
- Assert.assertFalse(selenium.isChecked(CHK_SEC_RU_VR),"Checkbox should not be
checked");
- Assert.assertFalse(selenium.isChecked(CHK_SEC_RU_P),"Checkbox should not be
checked");
- Assert.assertFalse(selenium.isChecked(CHK_SEC_RU_PR),"Checkbox should not be
checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RA_V), "Checkbox should not be
checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RA_VR), "Checkbox should not be
checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RA_P), "Checkbox should not be
checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RA_PR), "Checkbox should not be
checked");
- Assert.assertFalse(selenium.isChecked(CHK_SEC_RUN_V),"Checkbox should not be
checked");
- Assert.assertFalse(selenium.isChecked(CHK_SEC_RUN_VR),"Checkbox should not be
checked");
- Assert.assertFalse(selenium.isChecked(CHK_SEC_RUN_P),"Checkbox should not be
checked");
- Assert.assertFalse(selenium.isChecked(CHK_SEC_RUN_PR),"Checkbox should not be
checked");
-
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RU_V), "Checkbox should not be
checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RU_VR), "Checkbox should not be
checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RU_P), "Checkbox should not be
checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RU_PR), "Checkbox should not be
checked");
+
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RUN_V), "Checkbox should not be
checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RUN_VR), "Checkbox should not be
checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RUN_P), "Checkbox should not be
checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RUN_PR), "Checkbox should not be
checked");
+
selenium.click(CHK_SEC_RA_V);
selenium.click(CHK_SEC_RA_VR);
selenium.click(CHK_SEC_RA_P);
@@ -786,9 +790,9 @@
selenium.click(SUB_SEC_CANCEL);
selenium.waitForPageToLoad(PAGE_LOAD);
-
+
// update
-
+
clickIfVisible(TAB_PORTALOBJ_ID);
clickIfVisible(LINK_PORTALS_ID);
clickIfVisible(LINK_PORTAL_HOME);
@@ -800,22 +804,22 @@
r = findTableRow(TABLE_PORTALPAGE_ADMIN, pageName, 0) - 1;
clickAndWait(MessageFormat.format(PAG_TL_SECURITY, r));
-
- Assert.assertFalse(selenium.isChecked(CHK_SEC_RA_V),"Checkbox should not be
checked");
- Assert.assertFalse(selenium.isChecked(CHK_SEC_RA_VR),"Checkbox should not be
checked");
- Assert.assertFalse(selenium.isChecked(CHK_SEC_RA_P),"Checkbox should not be
checked");
- Assert.assertFalse(selenium.isChecked(CHK_SEC_RA_PR),"Checkbox should not be
checked");
- Assert.assertFalse(selenium.isChecked(CHK_SEC_RU_V),"Checkbox should not be
checked");
- Assert.assertFalse(selenium.isChecked(CHK_SEC_RU_VR),"Checkbox should not be
checked");
- Assert.assertFalse(selenium.isChecked(CHK_SEC_RU_P),"Checkbox should not be
checked");
- Assert.assertFalse(selenium.isChecked(CHK_SEC_RU_PR),"Checkbox should not be
checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RA_V), "Checkbox should not be
checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RA_VR), "Checkbox should not be
checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RA_P), "Checkbox should not be
checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RA_PR), "Checkbox should not be
checked");
- Assert.assertFalse(selenium.isChecked(CHK_SEC_RUN_V),"Checkbox should not be
checked");
- Assert.assertFalse(selenium.isChecked(CHK_SEC_RUN_VR),"Checkbox should not be
checked");
- Assert.assertFalse(selenium.isChecked(CHK_SEC_RUN_P),"Checkbox should not be
checked");
- Assert.assertFalse(selenium.isChecked(CHK_SEC_RUN_PR),"Checkbox should not be
checked");
-
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RU_V), "Checkbox should not be
checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RU_VR), "Checkbox should not be
checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RU_P), "Checkbox should not be
checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RU_PR), "Checkbox should not be
checked");
+
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RUN_V), "Checkbox should not be
checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RUN_VR), "Checkbox should not be
checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RUN_P), "Checkbox should not be
checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RUN_PR), "Checkbox should not be
checked");
+
selenium.click(CHK_SEC_RA_V);
selenium.click(CHK_SEC_RA_VR);
selenium.click(CHK_SEC_RA_P);
@@ -835,7 +839,7 @@
selenium.waitForPageToLoad(PAGE_LOAD);
// assert
-
+
clickIfVisible(TAB_PORTALOBJ_ID);
clickIfVisible(LINK_PORTALS_ID);
clickIfVisible(LINK_PORTAL_HOME);
@@ -847,22 +851,22 @@
r = findTableRow(TABLE_PORTALPAGE_ADMIN, pageName, 0) - 1;
clickAndWait(MessageFormat.format(PAG_TL_SECURITY, r));
-
- Assert.assertTrue(selenium.isChecked(CHK_SEC_RA_V),"Checkbox should be
checked");
- Assert.assertTrue(selenium.isChecked(CHK_SEC_RA_VR),"Checkbox should be
checked");
- Assert.assertTrue(selenium.isChecked(CHK_SEC_RA_P),"Checkbox should be
checked");
- Assert.assertTrue(selenium.isChecked(CHK_SEC_RA_PR),"Checkbox should be
checked");
- Assert.assertTrue(selenium.isChecked(CHK_SEC_RU_V),"Checkbox should be
checked");
- Assert.assertTrue(selenium.isChecked(CHK_SEC_RU_VR),"Checkbox should be
checked");
- Assert.assertTrue(selenium.isChecked(CHK_SEC_RU_P),"Checkbox should be
checked");
- Assert.assertTrue(selenium.isChecked(CHK_SEC_RU_PR),"Checkbox should be
checked");
+ Assert.assertTrue(selenium.isChecked(CHK_SEC_RA_V), "Checkbox should be
checked");
+ Assert.assertTrue(selenium.isChecked(CHK_SEC_RA_VR), "Checkbox should be
checked");
+ Assert.assertTrue(selenium.isChecked(CHK_SEC_RA_P), "Checkbox should be
checked");
+ Assert.assertTrue(selenium.isChecked(CHK_SEC_RA_PR), "Checkbox should be
checked");
- Assert.assertTrue(selenium.isChecked(CHK_SEC_RUN_V),"Checkbox should be
checked");
- Assert.assertTrue(selenium.isChecked(CHK_SEC_RUN_VR),"Checkbox should be
checked");
- Assert.assertTrue(selenium.isChecked(CHK_SEC_RUN_P),"Checkbox should be
checked");
- Assert.assertTrue(selenium.isChecked(CHK_SEC_RUN_PR),"Checkbox should be
checked");
+ Assert.assertTrue(selenium.isChecked(CHK_SEC_RU_V), "Checkbox should be
checked");
+ Assert.assertTrue(selenium.isChecked(CHK_SEC_RU_VR), "Checkbox should be
checked");
+ Assert.assertTrue(selenium.isChecked(CHK_SEC_RU_P), "Checkbox should be
checked");
+ Assert.assertTrue(selenium.isChecked(CHK_SEC_RU_PR), "Checkbox should be
checked");
+ Assert.assertTrue(selenium.isChecked(CHK_SEC_RUN_V), "Checkbox should be
checked");
+ Assert.assertTrue(selenium.isChecked(CHK_SEC_RUN_VR), "Checkbox should be
checked");
+ Assert.assertTrue(selenium.isChecked(CHK_SEC_RUN_P), "Checkbox should be
checked");
+ Assert.assertTrue(selenium.isChecked(CHK_SEC_RUN_PR), "Checkbox should be
checked");
+
}
/**
@@ -1066,6 +1070,140 @@
}
+ @Test(enabled = true)
+ public void testXssPortalCreate() {
+ selenium.open("/portal/");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LINK_PORTALS_ID);
+
+ selenium.type(INPUT_PORTALNAME, XSS_STR1);
+ selenium.click(INPUT_SUBMIT_CREATEPORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent("is an invalid portal name"));
+ }
+
+ @Test(enabled = true)
+ public void testXssPageCreate() {
+ final String portalName = "XssPortal";
+
+ createPortal(portalName);
+
+ selenium.open("/portal/");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LINK_PORTALS_ID);
+
+ int r = findTableRow(TABLE_PORTAL_ADMIN, portalName, 0) - 1;
+
+ selenium.click(MessageFormat.format(POR_TL_MAIN, r));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.type(INP_PP_RES_INPUT, XSS_STR1);
+ selenium.click(SUB_PP_ERROR_FORM_UPDATE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent("is an invalid page name"));
+
+ selenium.type(INP_PPA_RES_SELECT, XSS_STR1);
+ selenium.click(SUB_PPA_FORM_UPDATE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent("is an invalid page name"));
+ }
+
+ @Test(enabled = true)
+ public void testXssWindowCreate() {
+ final String portalName = "XssPortal";
+ final String pageName = "XssPage";
+
+ createPortal(portalName);
+ createPage(portalName, pageName);
+
+ selenium.open("/portal/");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LINK_PORTALS_ID);
+ clickIfVisible(LINK_PORTAL_HOME);
+
+ int r = findTableRow(TABLE_PORTAL_ADMIN, portalName, 0) - 1;
+ selenium.click(MessageFormat.format(POR_TL_MAIN, r));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ r = findTableRow(TABLE_PORTALPAGE_ADMIN, pageName, 0) - 1;
+
+ // click on the page layout
+ selenium.click(MessageFormat.format(PAG_TL_LAYOUT, r));
+
+ waitFor(AJAX_LOAD);
+
+ selenium.click("link=Who's online portlet");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.type(INP_WINDOW_NAME, XSS_STR1);
+
+ selenium.click(SUB_LAYOUT_ADD_CENTER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("is an invalid window name"));
+
+ }
+
+ @Test(enabled = true)
+ public void testXssPortalProperties() {
+ final String portalName = "XssPropertiesPortal";
+
+ createPortal(portalName);
+
+ // then property it
+
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LINK_PORTALS_ID);
+
+ int r = findTableRow(TABLE_PORTAL_ADMIN, portalName, 0) - 1;
+
+ selenium.click(MessageFormat.format(POR_TL_PROPERTIES, r));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ // Properties
+
+ selenium.type(INP_PP_PROPNAME, XSS_STR1);
+ selenium.click(SUB_PP_PROPADD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent("is an invalid property name"));
+
+ // redirection
+
+ check(CHK_PP_RES_CHECK, false);
+ waitFor(AJAX_LOAD);
+ selenium.type(INP_PP_RES_INPUT, XSS_STR1);
+ selenium.click(SUB_PP_ERROR_FORM_UPDATE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("is an invalid property path"));
+
+ check(CHK_PPA_RES_CHECK, false);
+ waitFor(AJAX_LOAD);
+ selenium.type(INP_PPA_RES_SELECT, XSS_STR1);
+ selenium.click(SUB_PPA_FORM_UPDATE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("is an invalid property path"));
+
+ }
+
private void createPortal(String name) {
selenium.open("/portal/");
selenium.waitForPageToLoad(PAGE_LOAD);