Author: vrockai
Date: 2008-10-01 10:38:26 -0400 (Wed, 01 Oct 2008)
New Revision: 12008
Modified:
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/build.xml
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/IdentityAdminTestCase.java
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/JBossPortalSeleniumTestCase.java
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/PortletUserCreationTestCase.java
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/AdminPortalTestCase.java
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/testng.xml
Log:
several fixes
Modified: branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/build.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/build.xml 2008-09-30 22:27:59 UTC
(rev 12007)
+++ branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/build.xml 2008-10-01 14:38:26 UTC
(rev 12008)
@@ -6,24 +6,19 @@
<property name="suitename" location="testng-files" />
<property name="testname" location="testng-files" />
-
+
+ <property name="workspace" location="./" />
+
<property name="testng.dir" location="testng-files" />
<property name="testng.output.dir" location="test-output" />
<property name="test.build.dir" location="output/classes" />
<property name="test.src.dir" location="src" />
<property name="lib.dir" location="lib" />
- <property name="hudson.lib.dir" location="/qa/tools/opt/" />
- <property name="jboss-test.jar"
location="${hudson.lib.dir}/jboss-test.jar" />
- <available file="${jboss-test.jar}"
property="jboss-test.jar.present" />
- <property name="junit.report.dir" location="test-report" />
<property name="selsrv.dir" location="selenium-rc-server" />
- <property name="node0" value="localhost" />
- <property name="jboss.test.home" value="${env.JBOSS_TEST_HOME}"
/>
+
<property name="jboss.home" value="${env.JBOSS_HOME}" />
- <property name="jboss.test.jar" value="${env.JBOSSTESTJAR}"
/>
- <property name="jboss.portal.dir"
value="${env.JBOSS_UNZIPED_DIR}" />
- <property name="portal_archive" value="${env.JBOSS_ARCHIVE}"
/>
+
<property name="portal.instance" value="default" />
<path id="jboss.test.classpath">
@@ -44,7 +39,7 @@
<taskdef name="testng" classpathref="libraries.cp"
classname="org.testng.TestNGAntTask" />
-<target name="init">
+ <target name="init">
<echo message="Browser : ${browser}" />
<echo message="Workspace : ${workspace}" />
<echo message="Deleting testng report directory"/>
@@ -75,10 +70,16 @@
<get taskname="selenium-shutdown"
src="http://localhost:44444/selenium-server/driver/?cmd=shutDown"
dest="result.txt" ignoreerrors="true" />
<echo taskname="selenium-shutdown" message="DGF Errors during
shutdown are expected" />
</target>
+
+ <target name="checkJBossHome" unless="env.JBOSS_HOME">
+ <fail message="JBOSS_HOME must be set!"/>
+ </target>
- <target name="copyApps">
+ <target name="copyApps" depends="checkJBossHome">
+
+ <available
file="${env.JBOSS_HOME}/server/${portal.instance}/deploy/userDetail-portlet.war"
property="jaxp.jar.present"/>
<echo message="Copying userInterceptor portlet into the ${portal.instance}
server"/>
- <copy file="apps/userDetail-portlet.war"
tofile="${jboss.home}/server/${portal.instance}/deploy/userDetail-portlet.war"/>
+ <copy file="apps/userDetail-portlet.war"
tofile="${env.JBOSS_HOME}/server/${portal.instance}/deploy/userDetail-portlet.war"/>
</target>
<target name="clean">
@@ -92,6 +93,24 @@
</target>
+ <target name="single-test" depends="init, compile,
run-src">
+ <antcall target="copyApps" />
+ <echo message="Runing TestNG : ${testclass}" />
+ <mkdir dir="test-output" />
+ <testng classpathref="test.cp"
sourcedir="${test.src.dir}" outputdir="test-output">
+ <classfileset dir="${test.build.dir}">
+ <include name="${testclass}"/>
+ </classfileset>
+ <sysproperty key="browser"
value="${browser}" />
+ <sysproperty key="workspace"
value="${workspace}"/>
+
+ <jvmarg value="-ea" />
+ </testng>
+ <antcall target="cleanup" />
+ </target>
+
+
+
<target name="selenium-test" depends="init, compile,
run-src">
<antcall target="copyApps" />
@@ -109,6 +128,7 @@
</testng>
<antcall target="cleanup" />
+ <antcall target="stop-src" />
</target>
</project>
Modified:
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/IdentityAdminTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/IdentityAdminTestCase.java 2008-09-30
22:27:59 UTC (rev 12007)
+++
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/IdentityAdminTestCase.java 2008-10-01
14:38:26 UTC (rev 12008)
@@ -16,11 +16,19 @@
@Test(groups = { "admin_ui" }, enabled = true)
public class IdentityAdminTestCase extends JBossPortalSeleniumTestCase {
+ public static final String TABLE_USERLIST = "search-user-form1:userlist";
public static final String LINK_T_USRLIST_DEL =
"search-user-form1:userlist:{0}:delete-user-link";
public static final String LINK_T_USRLIST_ROLES =
"search-user-form1:userlist:{0}:assign-role-link";
+ public static final String LINK_T_USRLIST_DIS =
"search-user-form1:userlist:{0}:enable-user-link";
+ public static final String LINK_T_USRLIST_EDIT =
"search-user-form1:userlist:{0}:rename-link";
+
+ public static final String TABLE_ROLELIST = "roles-form:userlist";
public static final String LINK_T_ROLLIST_DEL =
"roles-form:userlist:{0}:delete-role-link";
- public static final String TABLE_ROLELIST = "roles-form:userlist";
- public static final String TABLE_USERLIST = "search-user-form1:userlist";
+ public static final String LINK_T_ROLLIST_MEMBERS =
"roles-form:userlist:{0}:view-role-link";
+ public static final String LINK_T_ROLLIST_EDIT =
"roles-form:userlist:{0}:edit-role-link";
+
+ public static final String TABLE_ROLEMEMBERS =
"role-members-form:role-data-table";
+
public static final String ID_SUBMIT_CONF_CREATE_USER = "confirm-form:admin";
public static final String ID_SUBMIT_DELETE_ROLE =
"delete-role-form:confirm";
public static final String ID_SUBMIT_ROLE_CREATE = "create-role-form:submit";
@@ -47,6 +55,7 @@
public static final String ID_LINK_CREATE_USER =
"user-form:create-user-link";
public static final String ID_CHECK_ROLE =
"//input[@name=''assign-roles-form:roles'' and
@value=''{0}'']";
+
private String butDelUsr_id(String userName) {
String table = TABLE_USERLIST;
@@ -54,12 +63,6 @@
return MessageFormat.format(LINK_T_USRLIST_DEL, r - 1);
}
- private String butDelRol_id(String roleName) {
- String table = TABLE_ROLELIST;
- int r = findTableRow(table, roleName, 0);
- return MessageFormat.format(LINK_T_ROLLIST_DEL, r - 1);
- }
-
private String butUsrRol_id(String userName) {
String table = TABLE_USERLIST;
int r = findTableRow(table, userName, 0);
@@ -73,9 +76,11 @@
@AfterMethod(groups = { "log" })
public void logoutAfterTest() {
- logout();
+ logoutIfPossible();
}
+
+ // For this mode to be functional, the user which is logged in must be
"admin" after each test
@BeforeClass(groups = { "single" })
public void loginBefore() {
login("admin", "admin");
@@ -107,7 +112,323 @@
createRole(role, "tempRoleDisplay");
deleteRole(role);
}
+
+ @Test(enabled = true, description = "Creating and deteling a user.")
+ public void testDeleteUser() {
+ createUser("deleteMe", "deleterPass",
"disableMe(a)redhat.com");
+ deleteUser("deleteMe", "disableMe(a)redhat.com");
+ }
+
+ @Test(enabled = true, description = "Creating and disabling a user.")
+ public void testDisableUser() {
+ createUser("disableMe", "disablePass",
"disableMe(a)redhat.com");
+
+ logout();
+ login("disableMe", "disablePass");
+ logout();
+ login("admin","admin");
+
+ searchUser("disableMe", "disableMe(a)redhat.com");
+ int r = findTableRow(TABLE_USERLIST, "disableMe", 0);
+
+ selenium.click(MessageFormat.format(LINK_T_USRLIST_DIS, r - 1 ));
+
+ logout();
+
+ //trying to log in with disabled account
+ selenium.open(ADDR_PORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click(LINK_LOGIN);
+ selenium.selectFrame(FRAME_LOGIN_CONTENT);
+
+ try {
+ Thread.sleep(2000);
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ selenium.type(INPUT_USERNAME, "disableMe");
+ selenium.type(INPUT_PASSWORD, "disablePass");
+ selenium.click(SUBMIT_LOGIN);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("Your account is disabled"));
+ // we should be unable to login with disabled account
+ // logging as user to end the test correctly
+
+ login("admin","admin");
+
+ deleteUser("disableMe", "disableMe(a)redhat.com");
+ }
+
+ @Test(enabled = true, dependsOnMethods = {"testDisableUser"},description =
"Enabling disabled user.")
+ public void testEnableUser() {
+ createUser("enableMe", "enableMe",
"enableMe(a)redhat.com");
+ searchUser("enableMe", "enableMe(a)redhat.com");
+
+ int r = findTableRow(TABLE_USERLIST, "Enable", 5);
+ Assert.assertTrue(r<0,"No user should be disabled.");
+ r = findTableRow(TABLE_USERLIST, "enableMe", 0);
+
+ selenium.click(MessageFormat.format(LINK_T_USRLIST_DIS, r - 1 ));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ searchUser("enableMe", "enableMe(a)redhat.com");
+ r = findTableRow(TABLE_USERLIST, "Enable", 5);
+ Assert.assertFalse(r<0,"One user should have been disabled.");
+
+ r = findTableRow(TABLE_USERLIST, "enableMe", 0);
+ selenium.click(MessageFormat.format(LINK_T_USRLIST_DIS, r - 1 ));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ searchUser("enableMe", "enableMe(a)redhat.com");
+ r = findTableRow(TABLE_USERLIST, "Enable", 5);
+ Assert.assertTrue(r<0,"No user should be disabled.");
+
+ deleteUser("enableMe", "enableMe(a)redhat.com");
+ }
+
+ @Test(enabled = true, description = "Editing a user.")
+ public void testEditUser() {
+ createUser("editMe", "editPass", "editMe(a)redhat.com");
+
+ // canceling the edit form
+ searchUser("editMe", "editMe(a)redhat.com");
+
+ int r = findTableRow(TABLE_USERLIST, "editMe", 0);
+ selenium.click(MessageFormat.format(LINK_T_USRLIST_EDIT, r - 1));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.type("profile-form:email", "editMe2(a)redhat.com");
+ selenium.click("profile-form:cancel");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("editMe(a)redhat.com"));
+
+ // filling out the edit page
+ searchUser("editMe", "editMe(a)redhat.com");
+
+ r = findTableRow(TABLE_USERLIST, "editMe", 0);
+ selenium.click(MessageFormat.format(LINK_T_USRLIST_EDIT, r - 1));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.type("profile-form:email", "editMe2(a)redhat.com");
+ selenium.select("profile-form:timezone", "label=(GMT -12:00 hours)
Eniwetok, Kwajalein");
+ selenium.select("profile-form:theme", "label=portal.industrial");
+ selenium.select("profile-form:locale", "label=Albanian");
+ selenium.type("profile-form:givenname", "Edit");
+ selenium.type("profile-form:lastname", "Meme");
+ selenium.type("profile-form:location", "Editoland");
+ selenium.type("profile-form:skype", "editor");
+ selenium.type("profile-form:icq", "112113114");
+ selenium.type("profile-form:aim", "83838495");
+ selenium.type("profile-form:msnm", "u8u8i9o0");
+ selenium.type("profile-form:yim", "99384875");
+ selenium.type("profile-form:xmmp", "10309128");
+ selenium.type("profile-form:homepage", "http://www.edit.com");
+ selenium.type("profile-form:occupation", "editor");
+ selenium.type("profile-form:interests", "editing");
+ selenium.type("profile-form:signature", "----\n\ni like to edit");
+ selenium.type("profile-form:extra", "me edit good");
+ selenium.click("profile-form:submit");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("editMe2(a)redhat.com"));
+ Assert.assertTrue(selenium.isTextPresent("Edit"));
+ Assert.assertTrue(selenium.isTextPresent("Meme"));
+
+ deleteUser("editMe", "editMe2(a)redhat.com");
+
+ }
+
+ @Test(enabled = true, description = "Editing a user - changing of password.")
+ public void testEditUserChangePassword() {
+ createUser("changePass", "changePassPass",
"changePass(a)redhat.com");
+
+ logout();
+ login("changePass","changePassPass");
+ logout();
+ login("admin","admin");
+
+ /*
+ * Canceling of change at the first approach
+ */
+
+ searchUser("changePass", "changePass(a)redhat.com");
+
+ int r = findTableRow(TABLE_USERLIST, "changePass", 0);
+ selenium.click(MessageFormat.format(LINK_T_USRLIST_EDIT, r - 1));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("profile-form:change-pwd-adm-link");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.type("change-pwd-form:password", "changePass2");
+ selenium.type("change-pwd-form:passwordCheck", "changePass2");
+ selenium.click("change-pwd-form:cancel");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertFalse(selenium.isTextPresent("Password has been updated."));
+
+ logout();
+ login("changePass","changePassPass");
+ logout();
+ login("admin","admin");
+
+ /*
+ * In the second approach really change the password
+ */
+
+ searchUser("changePass", "changePass(a)redhat.com");
+
+ r = findTableRow(TABLE_USERLIST, "changePass", 0);
+ selenium.click(MessageFormat.format(LINK_T_USRLIST_EDIT, r - 1));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("profile-form:change-pwd-adm-link");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.type("change-pwd-form:password", "changePass2");
+ selenium.type("change-pwd-form:passwordCheck", "changePass2");
+ selenium.click("change-pwd-form:_id32jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent("Password has been updated."));
+
+ logout();
+ login("changePass","changePass2");
+ logout();
+ login("admin","admin");
+
+ deleteUser("changePass","changePass(a)redhat.com");
+ }
+
+ @Test(enabled = true, description = "Managing members of role.")
+ public void testRoleMembers() {
+ createRole("membersRole", "membersRoleDisplay");
+ createUser("newRoleMember" , "newRoleMember",
"newRoleMem(a)redhatqa.com");
+ assignRole("newRoleMember", "newRoleMem(a)redhatqa.com",
"membersRole", "membersRoleDisplay");
+
+ clickUntilMembers();
+ clickIfVisible(ID_LINK_ROLETAB);
+ clickIfVisible(ID_LINK_ROLEMAIN);
+
+ int r = findTableRow(TABLE_ROLELIST, "membersRole", 0);
+ selenium.click(MessageFormat.format(LINK_T_ROLLIST_MEMBERS, r-1));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ //search for the real member of current role
+ selenium.type("search-user-form:searchString", "newRoleMember");
+ selenium.click("search-user-form:search");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ r = findTableRow(TABLE_ROLEMEMBERS, "newRoleMember", 0);
+ Assert.assertTrue(r>0, "Assigned member not found in the role members
table.");
+
+ //search for the non-member user of current role
+ selenium.type("search-user-form:searchString",
"newRoleNonMember");
+ selenium.click("search-user-form:search");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertFalse(selenium.isElementPresent(TABLE_ROLEMEMBERS), "Not assigned
member found in the role members table.");
+
+ deleteRole("membersRole");
+ deleteUser("newRoleMember" , "newRoleMem(a)redhatqa.com");
+ }
+
+ @Test(enabled = true, description = "Creation of new role.")
+ public void testRoleEdit() {
+
+ createRole("editRole", "editRoleDisplay");
+
+ clickUntilMembers();
+ clickIfVisible(ID_LINK_ROLETAB);
+ clickIfVisible(ID_LINK_ROLEMAIN);
+
+ int r = findTableRow(TABLE_ROLELIST, "editRoleDisplay", 1);
+ Assert.assertTrue(r>=0,"Renamed display name found in table");
+
+ r = findTableRow(TABLE_ROLELIST, "editedRoleDisplay", 1);
+ Assert.assertFalse(r>=0,"Not created role display name found in table");
+
+ //canceling of renaming of displayname for the first time
+ r = findTableRow(TABLE_ROLELIST, "editRole", 0);
+
+ selenium.click(MessageFormat.format(LINK_T_ROLLIST_EDIT, r -1));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.type("edit-role-link:display-Name", "editedRoleDisplay");
+ selenium.click("edit-role-link:cancel");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ r = findTableRow(TABLE_ROLELIST, "editRoleDisplay", 1);
+ Assert.assertTrue(r>=0,"Renamed display name found in table");
+
+ r = findTableRow(TABLE_ROLELIST, "editedRoleDisplay", 1);
+ Assert.assertFalse(r>=0,"Not created role display name found in table");
+
+ // real renaming
+ r = findTableRow(TABLE_ROLELIST, "editRole", 0);
+ selenium.click(MessageFormat.format(LINK_T_ROLLIST_EDIT, r-1));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.type("edit-role-link:display-Name", "editedRoleDisplay");
+ selenium.click("edit-role-link:submit");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ r = findTableRow(TABLE_ROLELIST, "editRoleDisplay", 1);
+ Assert.assertFalse(r>=0,"Renamed display name found in table");
+
+ r = findTableRow(TABLE_ROLELIST, "editedRoleDisplay", 1);
+ Assert.assertTrue(r>=0,"New role display name not found in table");
+
+ deleteRole("editRole");
+ }
+
+ @Test(enabled= false, description = "Altering the number of rows in user
search")
+ public void testSearchUserCount() {
+
+ for(int i=0; i< 95; i++){
+ createUser("man"+i+"us", "man"+i+"pas",
"man"+i+"us"+"(a)redhatqa.com");
+ }
+
+ searchSimple("man","10");
+ Assert.assertEquals(countTableRows(TABLE_USERLIST)-1,10,"Wrong number of row in
user table #1.");
+
+ searchSimple("man","50");
+ Assert.assertEquals(countTableRows(TABLE_USERLIST)-1,50,"Wrong number of row in
user table #2.");
+ selenium.click("search-user-form1:next-page");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertEquals(countTableRows(TABLE_USERLIST)-1,45,"Wrong number of row in
user table #3.");
+ selenium.click("search-user-form1:prev-page");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ searchSimple("man","100");
+ Assert.assertEquals(countTableRows(TABLE_USERLIST)-1,95,"Wrong number of row in
user table #4.");
+
+ for(int i=0; i< 95; i++){
+ deleteUser("man"+i+"us",
"man"+i+"us"+"(a)redhatqa.com");
+ }
+
+ }
+
+ private void searchSimple(String name, String count){
+ selenium.open("/portal/");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Members");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ clickIfVisible(ID_LINK_USERTAB);
+ clickIfVisible(ID_LINK_USERMAIN);
+ clickIfVisible(LINK_USERMANG_MAIN);
+
+ selenium.click(LINK_SEARCH_USER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.type(ID_INPUT_SEARCH_USER, name);
+ selenium.select("search-user-form:limit", "label="+count);
+ selenium.click(ID_SUBMIT_SEARCH_USER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ }
+
+
@Test(enabled = true, dependsOnMethods = { "testCreateUser",
"testCreateRole" }, description = "Assigning of the role to the
user.")
public void testAssignRole2User() {
String user = "tempUser";
@@ -288,6 +609,15 @@
Assert.assertTrue(selenium.isTextPresent("User deleted"), "user was not
deleted (\"User deleted\" text missing).");
}
+ private void clickUntilMembers(){
+ selenium.open("/portal/");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Members");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ }
+
private void createRole(String roleName, String roleDisplayName) {
selenium.open("/portal/");
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -328,7 +658,9 @@
Assert.assertTrue(selenium.isTextPresent(roleName), "Role name is missing");
- selenium.click(butDelRol_id(roleName));
+ int r = findTableRow(TABLE_ROLELIST, roleName, 0);
+ selenium.click(MessageFormat.format(LINK_T_ROLLIST_DEL, r-1));
+ selenium.waitForPageToLoad(PAGE_LOAD);
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isTextPresent("Warning! You are about to delete the
role " + roleName),
Modified:
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/JBossPortalSeleniumTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/JBossPortalSeleniumTestCase.java 2008-09-30
22:27:59 UTC (rev 12007)
+++
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/JBossPortalSeleniumTestCase.java 2008-10-01
14:38:26 UTC (rev 12008)
@@ -10,13 +10,13 @@
* @author <a href="mailto:vrockai@redhat.com">Viliam Rockai</a>
*/
public class JBossPortalSeleniumTestCase {
- private static final String LINK_LOGOUT = "link=Logout";
- private static final String SUBMIT_LOGIN = "login";
- private static final String ADDR_PORTAL = "/portal/";
- private static final String FRAME_LOGIN_CONTENT = "login-content";
- private static final String LINK_LOGIN = "link=Login";
- private static final String INPUT_PASSWORD = "j_password";
- private static final String INPUT_USERNAME = "j_username";
+ public static final String LINK_LOGOUT = "link=Logout";
+ public static final String SUBMIT_LOGIN = "login";
+ public static final String ADDR_PORTAL = "/portal/";
+ public static final String FRAME_LOGIN_CONTENT = "login-content";
+ public static final String LINK_LOGIN = "link=Login";
+ public static final String INPUT_PASSWORD = "j_password";
+ public static final String INPUT_USERNAME = "j_username";
protected Selenium selenium;
protected static final String PAGE_LOAD = "250000";
@@ -42,6 +42,15 @@
selenium.waitForPageToLoad(PAGE_LOAD);
}
}
+
+ protected void clickIfVisible(String id, String awaited) {
+
+ if (selenium.isElementPresent(id)){
+ selenium.click(id);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ }
+ Assert.assertTrue(selenium.isTextPresent(awaited));
+ }
@Deprecated
protected boolean findLink(String id) {
@@ -72,6 +81,11 @@
selenium.waitForPageToLoad(PAGE_LOAD);
}
+ protected void openAndWait(String locator){
+ selenium.open(locator);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ }
+
protected void selectIfNotSelected(String selector, String label) {
if (!selenium.getSelectedLabel(selector).equals(label)) {
selenium.select(selector, "label=" + label);
@@ -80,7 +94,6 @@
}
protected void login(String username, String password) {
- selenium.setTimeout("0");
selenium.open(ADDR_PORTAL);
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -111,4 +124,15 @@
Assert.assertFalse(selenium.isTextPresent("Logged in as:"), "Not logged
in, login message missing.");
Assert.assertTrue(selenium.isElementPresent("Link=Login"), "Login link
not present.");
}
+
+ protected void logoutIfPossible() {
+ selenium.open(ADDR_PORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ if (selenium.isElementPresent(LINK_LOGOUT)){
+ selenium.click(LINK_LOGOUT);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertFalse(selenium.isTextPresent("Logged in as:"), "Not logged
in, login message missing.");
+ Assert.assertTrue(selenium.isElementPresent("Link=Login"), "Login link
not present.");
+ }
+ }
}
Modified:
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/PortletUserCreationTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/PortletUserCreationTestCase.java 2008-09-30
22:27:59 UTC (rev 12007)
+++
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/PortletUserCreationTestCase.java 2008-10-01
14:38:26 UTC (rev 12008)
@@ -10,8 +10,10 @@
@Test(groups = { "portlet_user_creation" }, enabled = true)
public class PortletUserCreationTestCase extends JBossPortalSeleniumTestCase {
private static final String SUBMIT_CREATE_CONF = "confirm-form:user";
+ public static final String SUBMIT_CREATE_CONF_EDIT = "confirm-form:revise";
private static final String SUBMIT_CREATE_USER = "register-form:submit";
+ private static final String SUBMIT_CREATE_USER_CANCEL =
"register-form:cancel";
private static final String INPUT_USERPASSWDCONF =
"register-form:passwordCheck";
@@ -47,9 +49,93 @@
Assert.assertTrue((selenium.isTextPresent("portletUser(a)redhat.com")));
selenium.click(SUBMIT_CREATE_CONF);
selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertTrue((selenium.isTextPresent("* Your account has been successfully
created. You may want to login now.")));
+ Assert.assertTrue((selenium.isTextPresent("Your account has been successfully
created. You may want to login now.")));
}
+
+ @Test(enabled = true, description = "User creation using most of the active
elements on page.")
+ public void userCreationLongTest() {
+
+ //canceling of creation
+ selenium.open("/portal");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ clickIfVisible(TAB_WELCOME);
+ Assert.assertTrue((selenium.isElementPresent(LINK_CREATE_USER)));
+ selenium.click(LINK_CREATE_USER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue((selenium.isTextPresent("Username *")));
+ Assert.assertTrue((selenium.isTextPresent("E-Mail *")));
+ Assert.assertTrue((selenium.isTextPresent("Password *")));
+ Assert.assertTrue((selenium.isTextPresent("Confirm Password *")));
+ selenium.type(INPUT_USERNAME, "portletLongUser");
+ selenium.type(INPUT_USERMAIL, "portletLongUser(a)redhat.com");
+ selenium.type(INPUT_USERPASSWD, "portletLongUserPassword");
+ selenium.type(INPUT_USERPASSWDCONF, "portletLongUserPassword");
+
+ selenium.click(SUBMIT_CREATE_USER_CANCEL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ // editing of creation
+ selenium.open("/portal");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ clickIfVisible(TAB_WELCOME);
+ Assert.assertTrue((selenium.isElementPresent(LINK_CREATE_USER)));
+ selenium.click(LINK_CREATE_USER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.type(INPUT_USERNAME, "portlextLongUser");
+ selenium.type(INPUT_USERMAIL, "portxletLongUser(a)redhat.com");
+ selenium.type(INPUT_USERPASSWD, "porxtletLongUserPassword");
+ selenium.type(INPUT_USERPASSWDCONF, "porxtletLongUserPassword");
+ selenium.click(SUBMIT_CREATE_USER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(SUBMIT_CREATE_CONF_EDIT);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ //selenium.setSpeed("3000");
+
+ selenium.type(INPUT_USERNAME, "portletLong2User");
+ selenium.type(INPUT_USERMAIL, "portletLong2User(a)redhat.com");
+ selenium.type(INPUT_USERPASSWD, "portletLong2UserPassword");
+ selenium.type(INPUT_USERPASSWDCONF, "portletLong2UserPassword");
+ selenium.click(SUBMIT_CREATE_USER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue((selenium.isTextPresent("portletLong2User")));
+ Assert.assertTrue((selenium.isTextPresent("portletLong2User(a)redhat.com")));
+
+ selenium.click(SUBMIT_CREATE_CONF);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ // verification
+ Assert.assertTrue((selenium.isTextPresent("Your account has been successfully
created. You may want to login now.")));
+ }
+ @Test(enabled = true, description = "Canceling of editing during the user
creation.")
+ public void userCreationCancelEditTest() {
+ selenium.open("/portal");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ clickIfVisible(TAB_WELCOME);
+ Assert.assertTrue((selenium.isElementPresent(LINK_CREATE_USER)));
+ selenium.click(LINK_CREATE_USER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.type(INPUT_USERNAME, "portletCLongUser");
+ selenium.type(INPUT_USERMAIL, "portletCLongUser(a)redhat.com");
+ selenium.type(INPUT_USERPASSWD, "portletCLongUserPassword");
+ selenium.type(INPUT_USERPASSWDCONF, "portletCLongUserPassword");
+ selenium.click(SUBMIT_CREATE_USER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(SUBMIT_CREATE_CONF_EDIT);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.type(INPUT_USERNAME, "portletCLong2User");
+ selenium.type(INPUT_USERMAIL, "portletCLong2User(a)redhat.com");
+ selenium.type(INPUT_USERPASSWD, "portletCLong2UserPassword");
+ selenium.type(INPUT_USERPASSWDCONF, "portletCLong2UserPassword");
+ selenium.click(SUBMIT_CREATE_USER_CANCEL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent("You can create an account."));
+ }
+
@Test(enabled = true, description = "Creation of already existing user.")
public void existingUserCreationTest() {
selenium.open("/portal");
@@ -66,7 +152,7 @@
Assert.assertTrue(selenium.isTextPresent("This username is already taken.
user"));
}
- @Test(enabled = true, description = "Using invalid e-mail within user
creation.")
+ @Test(enabled = false, description = "Using invalid e-mail within user
creation.")
public void invalidEmail() {
selenium.open("/portal");
selenium.waitForPageToLoad(PAGE_LOAD);
Modified:
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/AdminPortalTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/AdminPortalTestCase.java 2008-09-30
22:27:59 UTC (rev 12007)
+++
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/AdminPortalTestCase.java 2008-10-01
14:38:26 UTC (rev 12008)
@@ -238,7 +238,45 @@
Assert.assertTrue(selenium.isTextPresent("Current users"));
}
+
+ @Test(enabled = true, dependsOnMethods={"testPortalCreate"})
+ public void testPageRename(){
+ String portalName = "TestPortal";
+ String pageName = "PageToRename";
+
+ createPage("TestPortal", "PageToRename");
+
+ openAndWait("/portal");
+ clickAndWait("link=Admin");
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LINK_PORTALS_ID, "Create a portal named:");
+
+ int r = findTableRow(TABLE_PORTAL_ADMIN, portalName, 0) - 1;
+
+ clickAndWait(MessageFormat.format(POR_TL_MAIN, r));
+
+ r = findTableRow(TABLE_PORTALPAGE_ADMIN, pageName, 0) - 1;
+
+ clickAndWait(MessageFormat.format(PAG_TL_RENAME, r));
+
+ }
+
+ @Test(enabled = false)
+ public void testPageSecurity(){
+
+ }
+
+ @Test(enabled = false)
+ public void testPageTheme(){
+
+ }
+
+ @Test(enabled = false)
+ public void testPageLayout(){
+
+ }
+
private void createPortal(String name) {
selenium.open("/portal/");
selenium.waitForPageToLoad(PAGE_LOAD);
Modified: branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/testng.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/testng.xml 2008-09-30 22:27:59 UTC
(rev 12007)
+++ branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/testng.xml 2008-10-01 14:38:26 UTC
(rev 12008)
@@ -1,5 +1,6 @@
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="SeleniumTest">
+
<test verbose="2"
name="org.jboss.portal.test.selenium.UserLoginTestCase"
annotations="JDK">
<classes>
<class name="org.jboss.portal.test.selenium.UserLoginTestCase"/>
@@ -14,7 +15,7 @@
<classes>
<class
name="org.jboss.portal.test.selenium.IdentityAdminTestCase"></class></classes>
</test>
-
+
<test name="org.jboss.portal.test.selenium.IdentityAdminTestCase -
SingleLogin"
verbose="2" annotations="JDK">
<groups>
@@ -83,8 +84,4 @@
<classes>
<class
name="org.jboss.portal.test.selenium.portal.AdminPortalTestCase"></class></classes>
</test>
-<!--
-<listeners>
- <listener
class-name="org.testng.reporters.JUnitXMLReporter"></listener></listeners>
--->
</suite>