Author: vrockai
Date: 2009-06-18 08:30:44 -0400 (Thu, 18 Jun 2009)
New Revision: 13472
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/PortletUserCreationTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/locator.properties
Log:
[JBPORTAL-2392] - user creation portlet validation test
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/PortletUserCreationTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/PortletUserCreationTestCase.java 2009-06-18
11:33:53 UTC (rev 13471)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/PortletUserCreationTestCase.java 2009-06-18
12:30:44 UTC (rev 13472)
@@ -15,62 +15,48 @@
/** prefix for locator properties = user.crea.port.*/
public String casePfx = "user.crea.port.";
-
- /** The SUBMI t_ creat e_ conf. */
- private final String SUBMIT_CREATE_CONF =
getLoc(casePfx+"submit.create.conf","//input[contains(@id,'confirm-form:user')]");
-
- /** The SUBMI t_ creat e_ con f_ edit. */
- public final String SUBMIT_CREATE_CONF_EDIT =
getLoc(casePfx+"submit.create.conf.edit","//input[contains(@id,'//input[contains(@id,'confirm-form:revise')]");
-
- /** The SUBMI t_ creat e_ user. */
- private final String SUBMIT_CREATE_USER =
getLoc(casePfx+"submit.create.user","//input[contains(@id,'register-form:submit')]");
-
- /** The SUBMI t_ creat e_ use r_ cancel. */
- private final String SUBMIT_CREATE_USER_CANCEL =
getLoc(casePfx+"submit.create.user.cancel","//input[contains(@id,'register-form:cancel')]");
-
- /** The INPU t_ userpasswdconf. */
- private final String INPUT_USERPASSWDCONF =
getLoc(casePfx+"input.userpasswdconf","//input[contains(@id,'register-form:passwordCheckv");
-
- /** The INPU t_ userpasswd. */
- private final String INPUT_USERPASSWD =
getLoc(casePfx+"input.userpasswd","//input[contains(@id,'register-form:password')]");
-
- /** The INPU t_ usermail. */
- private final String INPUT_USERMAIL =
getLoc(casePfx+"input.usermail","//input[contains(@id,'register-form:email')]");
-
- /** The INPU t_ username. */
- private final String INPUT_USERNAME =
getLoc(casePfx+"input.username","//input[contains(@id,'register-form:username')]");
-
- /** The LIN k_ creat e_ user. */
- private final String LINK_CREATE_USER =
getLoc(casePfx+"link.create.user","//a[contains(@id,'create-account-form:register')]");
-
- /** The TA b_ welcome. */
- private final String TAB_WELCOME =
getLoc(casePfx+"tab.welcome","//a[contains(@id,'register-temp-form:start-link')]");
+
+ private final String SUB_CREATE_CONF =
getLoc(casePfx+"submit.create.conf","//input[contains(@id,'confirm-form:user')]");
+ private final String SUB_CREATE_CONF_EDIT =
getLoc(casePfx+"submit.create.conf.edit","//input[contains(@id,'//input[contains(@id,'confirm-form:revise')]");
+ private final String SUB_CREATE_USER =
getLoc(casePfx+"submit.create.user","//input[contains(@id,'register-form:submit')]");
+ private final String SUB_CREATE_USER_CANCEL =
getLoc(casePfx+"submit.create.user.cancel","//input[contains(@id,'register-form:cancel')]");
+ private final String INP_USERPASSWDCONF =
getLoc(casePfx+"input.userpasswdconf","//input[contains(@id,'register-form:passwordCheck");
+ private final String INP_CAPTCHA=
getLoc(casePfx+"input.captcha","//input[contains(@id,'register-form:validateCaptcha')]");
+ private final String INP_USERPASSWD =
getLoc(casePfx+"input.userpasswd","//input[contains(@id,'register-form:password')]");
+ private final String INP_USERMAIL =
getLoc(casePfx+"input.usermail","//input[contains(@id,'register-form:email')]");
+ private final String INP_USERNAME =
getLoc(casePfx+"input.username","//input[contains(@id,'register-form:username')]");
+ private final String LNK_CREATE_USER =
getLoc(casePfx+"link.create.user","//a[contains(@id,'create-account-form:register')]");
+ private final String TAB_WELCOME =
getLoc(casePfx+"tab.welcome","//a[contains(@id,'register-temp-form:start-link')]");
+ private final String MSG_NAME_VALID =
getMess(casePfx+"msg.name.valid","is an invalid username");
+ private final String MSG_MAIL_VALID =
getMess(casePfx+"msg.mail.valid","Invalid E-Mail address.");
+ private final String MSG_PASS_VALID =
getMess(casePfx+"msg.pass.valid","*");
+ private final String MSG_PASS2_VALID =
getMess(casePfx+"msg.pass2.valid","*");
+ private final String MSG_CAPTCHA_VALID =
getMess(casePfx+"msg.captcha.valid","Captcha incorrect");
-
/**
* User creation test.
*/
- @Test(enabled = true, description = "Simple user creation.")
+ @Test(enabled = false, description = "Simple user creation.")
public void userCreationTest() {
selenium.open("/portal");
selenium.waitForPageToLoad(PAGE_LOAD);
clickIfVisible(TAB_WELCOME);
- Assert.assertTrue((selenium.isElementPresent(LINK_CREATE_USER)));
- selenium.click(LINK_CREATE_USER);
+ Assert.assertTrue((selenium.isElementPresent(LNK_CREATE_USER)));
+ selenium.click(LNK_CREATE_USER);
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue((selenium.isTextPresent("Username *")));
Assert.assertTrue((selenium.isTextPresent("E-Mail *")));
Assert.assertTrue((selenium.isTextPresent("Password *")));
Assert.assertTrue((selenium.isTextPresent("Confirm Password *")));
- selenium.type(INPUT_USERNAME, "portletUser");
- selenium.type(INPUT_USERMAIL, "portletUser(a)redhat.com");
- selenium.type(INPUT_USERPASSWD, "portletUserPassword");
- selenium.type(INPUT_USERPASSWDCONF, "portletUserPassword");
- selenium.click(SUBMIT_CREATE_USER);
+ selenium.type(INP_USERNAME, "portletUser");
+ selenium.type(INP_USERMAIL, "portletUser(a)redhat.com");
+ selenium.type(INP_USERPASSWD, "portletUserPassword");
+ selenium.type(INP_USERPASSWDCONF, "portletUserPassword");
+ selenium.click(SUB_CREATE_USER);
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue((selenium.isTextPresent("portletUser")));
Assert.assertTrue((selenium.isTextPresent("portletUser(a)redhat.com")));
- selenium.click(SUBMIT_CREATE_CONF);
+ selenium.click(SUB_CREATE_CONF);
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue((selenium.isTextPresent("Your account has been successfully
created. You may want to login now.")));
}
@@ -78,55 +64,55 @@
/**
* User creation long test.
*/
- @Test(enabled = true, description = "User creation using most of the active
elements on page.")
+ @Test(enabled = false, description = "User creation using most of the active
elements on page.")
public void userCreationLongTest() {
//canceling of creation
selenium.open("/portal");
selenium.waitForPageToLoad(PAGE_LOAD);
clickIfVisible(TAB_WELCOME);
- Assert.assertTrue((selenium.isElementPresent(LINK_CREATE_USER)));
- selenium.click(LINK_CREATE_USER);
+ Assert.assertTrue((selenium.isElementPresent(LNK_CREATE_USER)));
+ selenium.click(LNK_CREATE_USER);
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue((selenium.isTextPresent("Username *")));
Assert.assertTrue((selenium.isTextPresent("E-Mail *")));
Assert.assertTrue((selenium.isTextPresent("Password *")));
Assert.assertTrue((selenium.isTextPresent("Confirm Password *")));
- selenium.type(INPUT_USERNAME, "portletLongUser");
- selenium.type(INPUT_USERMAIL, "portletLongUser(a)redhat.com");
- selenium.type(INPUT_USERPASSWD, "portletLongUserPassword");
- selenium.type(INPUT_USERPASSWDCONF, "portletLongUserPassword");
+ selenium.type(INP_USERNAME, "portletLongUser");
+ selenium.type(INP_USERMAIL, "portletLongUser(a)redhat.com");
+ selenium.type(INP_USERPASSWD, "portletLongUserPassword");
+ selenium.type(INP_USERPASSWDCONF, "portletLongUserPassword");
- selenium.click(SUBMIT_CREATE_USER_CANCEL);
+ selenium.click(SUB_CREATE_USER_CANCEL);
selenium.waitForPageToLoad(PAGE_LOAD);
// editing of creation
selenium.open("/portal");
selenium.waitForPageToLoad(PAGE_LOAD);
clickIfVisible(TAB_WELCOME);
- Assert.assertTrue((selenium.isElementPresent(LINK_CREATE_USER)));
- selenium.click(LINK_CREATE_USER);
+ Assert.assertTrue((selenium.isElementPresent(LNK_CREATE_USER)));
+ selenium.click(LNK_CREATE_USER);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.type(INPUT_USERNAME, "portlextLongUser");
- selenium.type(INPUT_USERMAIL, "portxletLongUser(a)redhat.com");
- selenium.type(INPUT_USERPASSWD, "porxtletLongUserPassword");
- selenium.type(INPUT_USERPASSWDCONF, "porxtletLongUserPassword");
- selenium.click(SUBMIT_CREATE_USER);
+ selenium.type(INP_USERNAME, "portlextLongUser");
+ selenium.type(INP_USERMAIL, "portxletLongUser(a)redhat.com");
+ selenium.type(INP_USERPASSWD, "porxtletLongUserPassword");
+ selenium.type(INP_USERPASSWDCONF, "porxtletLongUserPassword");
+ selenium.click(SUB_CREATE_USER);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click(SUBMIT_CREATE_CONF_EDIT);
+ selenium.click(SUB_CREATE_CONF_EDIT);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.type(INPUT_USERNAME, "portletLong2User");
- selenium.type(INPUT_USERMAIL, "portletLong2User(a)redhat.com");
- selenium.type(INPUT_USERPASSWD, "portletLong2UserPassword");
- selenium.type(INPUT_USERPASSWDCONF, "portletLong2UserPassword");
- selenium.click(SUBMIT_CREATE_USER);
+ selenium.type(INP_USERNAME, "portletLong2User");
+ selenium.type(INP_USERMAIL, "portletLong2User(a)redhat.com");
+ selenium.type(INP_USERPASSWD, "portletLong2UserPassword");
+ selenium.type(INP_USERPASSWDCONF, "portletLong2UserPassword");
+ selenium.click(SUB_CREATE_USER);
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue((selenium.isTextPresent("portletLong2User")));
Assert.assertTrue((selenium.isTextPresent("portletLong2User(a)redhat.com")));
- selenium.click(SUBMIT_CREATE_CONF);
+ selenium.click(SUB_CREATE_CONF);
selenium.waitForPageToLoad(PAGE_LOAD);
// verification
@@ -136,28 +122,28 @@
/**
* User creation cancel edit test.
*/
- @Test(enabled = true, description = "Canceling of editing during the user
creation.")
+ @Test(enabled = false, description = "Canceling of editing during the user
creation.")
public void userCreationCancelEditTest() {
selenium.open("/portal");
selenium.waitForPageToLoad(PAGE_LOAD);
clickIfVisible(TAB_WELCOME);
- Assert.assertTrue((selenium.isElementPresent(LINK_CREATE_USER)));
- selenium.click(LINK_CREATE_USER);
+ Assert.assertTrue((selenium.isElementPresent(LNK_CREATE_USER)));
+ selenium.click(LNK_CREATE_USER);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.type(INPUT_USERNAME, "portletCLongUser");
- selenium.type(INPUT_USERMAIL, "portletCLongUser(a)redhat.com");
- selenium.type(INPUT_USERPASSWD, "portletCLongUserPassword");
- selenium.type(INPUT_USERPASSWDCONF, "portletCLongUserPassword");
- selenium.click(SUBMIT_CREATE_USER);
+ selenium.type(INP_USERNAME, "portletCLongUser");
+ selenium.type(INP_USERMAIL, "portletCLongUser(a)redhat.com");
+ selenium.type(INP_USERPASSWD, "portletCLongUserPassword");
+ selenium.type(INP_USERPASSWDCONF, "portletCLongUserPassword");
+ selenium.click(SUB_CREATE_USER);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click(SUBMIT_CREATE_CONF_EDIT);
+ selenium.click(SUB_CREATE_CONF_EDIT);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.type(INPUT_USERNAME, "portletCLong2User");
- selenium.type(INPUT_USERMAIL, "portletCLong2User(a)redhat.com");
- selenium.type(INPUT_USERPASSWD, "portletCLong2UserPassword");
- selenium.type(INPUT_USERPASSWDCONF, "portletCLong2UserPassword");
- selenium.click(SUBMIT_CREATE_USER_CANCEL);
+ selenium.type(INP_USERNAME, "portletCLong2User");
+ selenium.type(INP_USERMAIL, "portletCLong2User(a)redhat.com");
+ selenium.type(INP_USERPASSWD, "portletCLong2UserPassword");
+ selenium.type(INP_USERPASSWDCONF, "portletCLong2UserPassword");
+ selenium.click(SUB_CREATE_USER_CANCEL);
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isTextPresent("You can create an account."));
@@ -166,18 +152,18 @@
/**
* Existing user creation test.
*/
- @Test(enabled = true, description = "Creation of already existing user.")
+ @Test(enabled = false, description = "Creation of already existing user.")
public void existingUserCreationTest() {
selenium.open("/portal");
selenium.waitForPageToLoad(PAGE_LOAD);
clickIfVisible(TAB_WELCOME);
- selenium.click(LINK_CREATE_USER);
+ selenium.click(LNK_CREATE_USER);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.type(INPUT_USERNAME, "user");
- selenium.type(INPUT_USERMAIL, "user(a)portal.com");
- selenium.type(INPUT_USERPASSWD, "userpassword");
- selenium.type(INPUT_USERPASSWDCONF, "userpassword");
- selenium.click(SUBMIT_CREATE_USER);
+ selenium.type(INP_USERNAME, "user");
+ selenium.type(INP_USERMAIL, "user(a)portal.com");
+ selenium.type(INP_USERPASSWD, "userpassword");
+ selenium.type(INP_USERPASSWDCONF, "userpassword");
+ selenium.click(SUB_CREATE_USER);
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isTextPresent("This username is already taken.
user"));
}
@@ -190,13 +176,13 @@
selenium.open("/portal");
selenium.waitForPageToLoad(PAGE_LOAD);
clickIfVisible(TAB_WELCOME);
- selenium.click(LINK_CREATE_USER);
+ selenium.click(LNK_CREATE_USER);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.type(INPUT_USERNAME, "invalidMail");
- selenium.type(INPUT_USERMAIL, "invalidMail@");
- selenium.type(INPUT_USERPASSWD, "invalidMailp");
- selenium.type(INPUT_USERPASSWDCONF, "invalidMailp");
- selenium.click(SUBMIT_CREATE_USER);
+ selenium.type(INP_USERNAME, "invalidMail");
+ selenium.type(INP_USERMAIL, "invalidMail@");
+ selenium.type(INP_USERPASSWD, "invalidMailp");
+ selenium.type(INP_USERPASSWDCONF, "invalidMailp");
+ selenium.click(SUB_CREATE_USER);
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isTextPresent("Invalid E-Mail address."));
@@ -205,37 +191,105 @@
/**
* Password not match.
*/
- @Test(enabled = true, description = "Not matching password confirmation.")
+ @Test(enabled = false, description = "Not matching password confirmation.")
public void passwordNotMatch() {
selenium.open("/portal");
selenium.waitForPageToLoad(PAGE_LOAD);
clickIfVisible(TAB_WELCOME);
- selenium.click(LINK_CREATE_USER);
+ selenium.click(LNK_CREATE_USER);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.type(INPUT_USERNAME, "wrongPass");
- selenium.type(INPUT_USERMAIL, "wrongPass(a)redhat.com");
- selenium.type(INPUT_USERPASSWD, "wrongPass1");
- selenium.type(INPUT_USERPASSWDCONF, "wrongPass2");
- selenium.click(SUBMIT_CREATE_USER);
+ selenium.type(INP_USERNAME, "wrongPass");
+ selenium.type(INP_USERMAIL, "wrongPass(a)redhat.com");
+ selenium.type(INP_USERPASSWD, "wrongPass1");
+ selenium.type(INP_USERPASSWDCONF, "wrongPass2");
+ selenium.click(SUB_CREATE_USER);
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isTextPresent("The passwords doesn't
match."));
}
+
+ /**
+ * Tests input validation for all public inputs.
+ */
+ @Test(enabled = true, description = "Using short password.")
+ public void testXSSInputValidation() {
+ String userName = "portlextLongUser";
+ String userMail = "portxletLongUser(a)redhat.com";
+ String userPass = "porxtletLongUserPassword";
+ String captcha = "imCaptcha";
+
+ selenium.open("/portal");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ clickIfVisible(TAB_WELCOME);
+ Assert.assertTrue((selenium.isElementPresent(LNK_CREATE_USER)));
+ selenium.click(LNK_CREATE_USER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.type(INP_USERNAME, XSS_STR1);
+ selenium.type(INP_USERMAIL, userMail);
+ selenium.type(INP_USERPASSWD, userPass);
+ selenium.type(INP_USERPASSWDCONF, userPass);
+ selenium.type(INP_CAPTCHA, captcha);
+ selenium.click(SUB_CREATE_USER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent(MSG_NAME_VALID),"validation error message
missing or other than expected.");
+
+ selenium.type(INP_USERNAME, userName);
+ selenium.type(INP_USERMAIL, XSS_STR1);
+ selenium.type(INP_USERPASSWD, userPass);
+ selenium.type(INP_USERPASSWDCONF, userPass);
+ selenium.type(INP_CAPTCHA, captcha);
+ selenium.click(SUB_CREATE_USER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent(MSG_MAIL_VALID),"validation error message
missing or other than expected.");
+
+ selenium.type(INP_USERNAME, userName);
+ selenium.type(INP_USERMAIL, userMail);
+ selenium.type(INP_USERPASSWD, XSS_STR1);
+ selenium.type(INP_USERPASSWDCONF, userPass);
+ selenium.type(INP_CAPTCHA, captcha);
+ selenium.click(SUB_CREATE_USER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent(MSG_PASS_VALID),"validation error message
missing or other than expected.");
+
+ selenium.type(INP_USERNAME, userName);
+ selenium.type(INP_USERMAIL, userMail);
+ selenium.type(INP_USERPASSWD, userPass);
+ selenium.type(INP_USERPASSWDCONF, XSS_STR1);
+ selenium.type(INP_CAPTCHA, captcha);
+ selenium.click(SUB_CREATE_USER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent(MSG_PASS2_VALID),"validation error
message missing or other than expected.");
+
+ selenium.type(INP_USERNAME, userName);
+ selenium.type(INP_USERMAIL, userMail);
+ selenium.type(INP_USERPASSWD, userPass);
+ selenium.type(INP_USERPASSWDCONF, userPass);
+ selenium.type(INP_CAPTCHA, XSS_STR1);
+ selenium.click(SUB_CREATE_USER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent(MSG_CAPTCHA_VALID),"validation error
message missing or other than expected.");
+ }
+
/**
* Short pass.
*/
- @Test(enabled = true, description = "Using short password.")
+ @Test(enabled = false, description = "Using short password.")
public void shortPass() {
selenium.open("/portal");
selenium.waitForPageToLoad(PAGE_LOAD);
clickIfVisible(TAB_WELCOME);
- selenium.click(LINK_CREATE_USER);
+ selenium.click(LNK_CREATE_USER);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.type(INPUT_USERNAME, "wrongPass");
- selenium.type(INPUT_USERMAIL, "wrongPass(a)redhat.com");
- selenium.type(INPUT_USERPASSWD, "w1");
- selenium.type(INPUT_USERPASSWDCONF, "w1");
- selenium.click(SUBMIT_CREATE_USER);
+ selenium.type(INP_USERNAME, "wrongPass");
+ selenium.type(INP_USERMAIL, "wrongPass(a)redhat.com");
+ selenium.type(INP_USERPASSWD, "w1");
+ selenium.type(INP_USERPASSWDCONF, "w1");
+ selenium.click(SUB_CREATE_USER);
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isTextPresent("password: Validation Error: Value is
less than allowable minimum of '6'"));
}
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-18
11:33:53 UTC (rev 13471)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/locator.properties 2009-06-18
12:30:44 UTC (rev 13472)
@@ -108,7 +108,7 @@
user.crea.port.submit.create.conf.edit=//input[contains(@id,'//input[contains(@id,'confirm-form:revise')]
user.crea.port.submit.create.user=//input[contains(@id,'register-form:submit')]
user.crea.port.submit.create.user.cancel=//input[contains(@id,'register-form:cancel')]
-user.crea.port.input.userpasswdconf=//input[contains(@id,'register-form:passwordCheckv
+user.crea.port.input.userpasswdconf=//input[contains(@id,'register-form:passwordCheck')]
user.crea.port.input.userpasswd=//input[contains(@id,'register-form:password')]
user.crea.port.input.usermail=//input[contains(@id,'register-form:email')]
user.crea.port.input.username=//input[contains(@id,'register-form:username')]