Author: brett
Date: Tue Feb 16 03:57:37 2010
New Revision: 910389
URL: http://svn.apache.org/viewvc?rev=910389&view=rev
Log:
check user is logged in at end of test
Modified:
archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArchivaAdminTest.java
archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/UserRolesTest.java
archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractArchivaTest.java
Modified:
archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArchivaAdminTest.java
URL:
http://svn.apache.org/viewvc/archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArchivaAdminTest.java?rev=910389&r1=910388&r2=910389&view=diff
==============================================================================
---
archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArchivaAdminTest.java
(original)
+++
archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArchivaAdminTest.java
Tue Feb 16 03:57:37 2010
@@ -62,8 +62,8 @@
String username = getProperty( "ADMIN_USERNAME" );
String mail = getProperty( "ADMIN_EMAIL" );
String password = getProperty( "ADMIN_PASSWORD" );
- submitAdminData( fullname, mail, password );
- assertAuthenticatedPage( username );
+ submitAdminData( fullname, mail, password );
+ assertUserLoggedIn( username );
submit();
clickLinkWithText( "Logout" );
}
Modified:
archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/UserRolesTest.java
URL:
http://svn.apache.org/viewvc/archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/UserRolesTest.java?rev=910389&r1=910388&r2=910389&view=diff
==============================================================================
---
archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/UserRolesTest.java
(original)
+++
archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/UserRolesTest.java
Tue Feb 16 03:57:37 2010
@@ -34,8 +34,8 @@
createUser( username, fullname, getUserEmail(),
getUserRolePassword(), true);
deleteUser( username, fullname, getUserEmail() );
- clickLinkWithText( "Logout" );
- login( getAdminUsername() , getAdminPassword() );
+ logout();
+ login( getAdminUsername() , getAdminPassword() );
}
@Test (dependsOnMethods = { "testBasicAddDeleteUser" } )
@@ -49,20 +49,20 @@
clickLinkWithText( "Edit Roles" );
checkUserRoleWithValue( fullname );
clickButtonWithValue( "Submit" );
-
- clickLinkWithText("Logout");
- login(username, getUserRolePassword());
+
+ logout();
+ login(username, getUserRolePassword());
changePassword( getUserRolePassword(),
getUserRoleNewPassword());
// this section will be removed if issue from redback after
changing password will be fixed.
getSelenium().goBack();
- clickLinkWithText("Logout");
- //assertTextPresent("You are already logged in.");
+ logout();
+ //assertTextPresent("You are already logged in.");
login(username, getUserRoleNewPassword());
assertLeftNavMenuWithRole( fullname );
- clickLinkWithText("Logout");
- login( getAdminUsername() , getAdminPassword() );
+ logout();
+ login( getAdminUsername() , getAdminPassword() );
}
@Test (dependsOnMethods = { "testUserWithGuestRole" } )
@@ -76,20 +76,20 @@
clickLinkWithText( "Edit Roles" );
checkUserRoleWithValue( fullname );
clickButtonWithValue( "Submit" );
-
- clickLinkWithText("Logout");
- login(username, getUserRolePassword());
+
+ logout();
+ login(username, getUserRolePassword());
changePassword( getUserRolePassword(),
getUserRoleNewPassword());
// this section will be removed if issue from redback after
changing password will be fixed.
getSelenium().goBack();
- clickLinkWithText("Logout");
- //assertTextPresent("You are already logged in.");
+ logout();
+ //assertTextPresent("You are already logged in.");
login(username, getUserRoleNewPassword());
assertLeftNavMenuWithRole( fullname );
- clickLinkWithText("Logout");
- login( getAdminUsername() , getAdminPassword() );
+ logout();
+ login( getAdminUsername() , getAdminPassword() );
}
@Test (dependsOnMethods = { "testUserWithRegisteredUserRole" } )
@@ -103,20 +103,20 @@
clickLinkWithText( "Edit Roles" );
checkUserRoleWithValue( fullname );
clickButtonWithValue( "Submit" );
-
- clickLinkWithText("Logout");
- login(username, getUserRolePassword());
+
+ logout();
+ login(username, getUserRolePassword());
changePassword( getUserRolePassword(),
getUserRoleNewPassword());
// this section will be removed if issue from redback after
changing password will be fixed.
getSelenium().goBack();
- clickLinkWithText("Logout");
- //assertTextPresent("You are already logged in.");
+ logout();
+ //assertTextPresent("You are already logged in.");
login(username, getUserRoleNewPassword());
assertLeftNavMenuWithRole( fullname );
- clickLinkWithText("Logout");
- login( getAdminUsername() , getAdminPassword() );
+ logout();
+ login( getAdminUsername() , getAdminPassword() );
}
@Test (dependsOnMethods = { "testUserWithSysAdminUserRole" } )
@@ -130,20 +130,20 @@
clickLinkWithText( "Edit Roles" );
checkUserRoleWithValue( fullname );
clickButtonWithValue( "Submit" );
-
- clickLinkWithText("Logout");
- login(username, getUserRolePassword());
+
+ logout();
+ login(username, getUserRolePassword());
changePassword( getUserRolePassword(),
getUserRoleNewPassword());
// this section will be removed if issue from redback after
changing password will be fixed.
getSelenium().goBack();
- clickLinkWithText("Logout");
- //assertTextPresent("You are already logged in.");
+ logout();
+ //assertTextPresent("You are already logged in.");
login(username, getUserRoleNewPassword());
assertLeftNavMenuWithRole( fullname );
- clickLinkWithText("Logout");
- login( getAdminUsername() , getAdminPassword() );
+ logout();
+ login( getAdminUsername() , getAdminPassword() );
}
@Test (dependsOnMethods = { "testUserWithUserAdminUserRole" } )
@@ -157,20 +157,20 @@
clickLinkWithText( "Edit Roles" );
checkUserRoleWithValue( fullname );
clickButtonWithValue( "Submit" );
-
- clickLinkWithText("Logout");
- login(username, getUserRolePassword());
+
+ logout();
+ login(username, getUserRolePassword());
changePassword( getUserRolePassword(),
getUserRoleNewPassword());
// this section will be removed if issue from redback after
changing password will be fixed.
getSelenium().goBack();
- clickLinkWithText("Logout");
- //assertTextPresent("You are already logged in.");
+ logout();
+ //assertTextPresent("You are already logged in.");
login(username, getUserRoleNewPassword());
assertLeftNavMenuWithRole( fullname );
- clickLinkWithText("Logout");
- login( getAdminUsername() , getAdminPassword() );
+ logout();
+ login( getAdminUsername() , getAdminPassword() );
}
@Test (dependsOnMethods = { "testUserWithGlobalRepoManagerRole" } )
@@ -184,20 +184,20 @@
clickLinkWithText( "Edit Roles" );
checkUserRoleWithValue( fullname );
clickButtonWithValue( "Submit" );
-
- clickLinkWithText("Logout");
- login(username, getUserRolePassword());
+
+ logout();
+ login(username, getUserRolePassword());
changePassword( getUserRolePassword(),
getUserRoleNewPassword());
// this section will be removed if issue from redback after
changing password will be fixed.
getSelenium().goBack();
- clickLinkWithText("Logout");
- //assertTextPresent("You are already logged in.");
+ logout();
+ //assertTextPresent("You are already logged in.");
login(username, getUserRoleNewPassword());
assertLeftNavMenuWithRole( fullname );
- clickLinkWithText("Logout");
- login( getAdminUsername() , getAdminPassword() );
+ logout();
+ login( getAdminUsername() , getAdminPassword() );
}
@Test (dependsOnMethods = { "testUserWithGlobalRepoObserverRole" } )
@@ -211,20 +211,20 @@
clickLinkWithText( "Edit Roles" );
checkResourceRoleWithValue( fullname );
clickButtonWithValue( "Submit" );
-
- clickLinkWithText("Logout");
- login(username, getUserRolePassword());
+
+ logout();
+ login(username, getUserRolePassword());
changePassword( getUserRolePassword(),
getUserRoleNewPassword());
// this section will be removed if issue from redback after
changing password will be fixed.
getSelenium().goBack();
- clickLinkWithText("Logout");
- //assertTextPresent("You are already logged in.");
+ logout();
+ //assertTextPresent("You are already logged in.");
login(username, getUserRoleNewPassword());
assertLeftNavMenuWithRole( fullname );
- clickLinkWithText("Logout");
- login( getAdminUsername() , getAdminPassword() );
+ logout();
+ login( getAdminUsername() , getAdminPassword() );
}
/*...@test (dependsOnMethods = { "testUserWithRepoManagerInternalRole"
} )
@@ -265,46 +265,46 @@
clickLinkWithText( "Edit Roles" );
checkResourceRoleWithValue( fullname );
clickButtonWithValue( "Submit" );
-
- clickLinkWithText("Logout");
- login(username, getUserRolePassword());
+
+ logout();
+ login(username, getUserRolePassword());
changePassword( getUserRolePassword(),
getUserRoleNewPassword());
// this section will be removed if issue from redback after
changing password will be fixed.
getSelenium().goBack();
- clickLinkWithText("Logout");
- //assertTextPresent("You are already logged in.");
+ logout();
+ //assertTextPresent("You are already logged in.");
login(username, getUserRoleNewPassword());
assertLeftNavMenuWithRole( fullname );
- clickLinkWithText("Logout");
- login( getAdminUsername() , getAdminPassword() );
+ logout();
+ login( getAdminUsername() , getAdminPassword() );
}
-
- /*...@test (dependsOnMethods = { "testUserWithRepoObserverInternalRole"
} )
- public void testUserWithRepoObserverSnapshotsRole()
- {
- username = getProperty( "REPOOBSERVER_SNAPSHOTS_USERNAME" );
- fullname = getProperty( "REPOOBSERVER_SNAPSHOTS_FULLNAME" );
-
- createUser(username, fullname, getUserEmail(),
getUserRolePassword(), true);
- clickLinkWithText( username );
- clickLinkWithText( "Edit Roles" );
- checkResourceRoleWithValue( fullname );
- clickButtonWithValue( "Submit" );
-
- clickLinkWithText("Logout");
- login(username, getUserRolePassword());
- changePassword( getUserRolePassword(),
getUserRoleNewPassword());
-
- // this section will be removed if issue from redback after
changing password will be fixed.
- getSelenium().goBack();
- clickLinkWithText("Logout");
- //assertTextPresent("You are already logged in.");
-
- login(username, getUserRoleNewPassword());
- assertLeftNavMenuWithRole( fullname );
- clickLinkWithText("Logout");
- login( getAdminUsername() , getAdminPassword() );
- }*/
+
+ /*...@test (dependsOnMethods = { "testUserWithRepoObserverInternalRole" } )
+ public void testUserWithRepoObserverSnapshotsRole()
+ {
+ username = getProperty( "REPOOBSERVER_SNAPSHOTS_USERNAME" );
+ fullname = getProperty( "REPOOBSERVER_SNAPSHOTS_FULLNAME" );
+
+ createUser(username, fullname, getUserEmail(), getUserRolePassword(),
true);
+ clickLinkWithText( username );
+ clickLinkWithText( "Edit Roles" );
+ checkResourceRoleWithValue( fullname );
+ clickButtonWithValue( "Submit" );
+
+ clickLinkWithText("Logout");
+ login(username, getUserRolePassword());
+ changePassword( getUserRolePassword(), getUserRoleNewPassword());
+
+ // this section will be removed if issue from redback after changing
password will be fixed.
+ getSelenium().goBack();
+ clickLinkWithText("Logout");
+ //assertTextPresent("You are already logged in.");
+
+ login(username, getUserRoleNewPassword());
+ assertLeftNavMenuWithRole( fullname );
+ clickLinkWithText("Logout");
+ login( getAdminUsername() , getAdminPassword() );
+ }*/
}
Modified:
archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractArchivaTest.java
URL:
http://svn.apache.org/viewvc/archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractArchivaTest.java?rev=910389&r1=910388&r2=910389&view=diff
==============================================================================
---
archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractArchivaTest.java
(original)
+++
archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractArchivaTest.java
Tue Feb 16 03:57:37 2010
@@ -118,8 +118,8 @@
submit();
if ( success )
{
- assertAuthenticatedPage( username );
- }
+ assertUserLoggedIn( username );
+ }
else
{
assertLoginPage();
@@ -142,18 +142,8 @@
assertTextPresent( "Need an Account? Register!" );
assertTextPresent( "Forgot your Password? Request a password
reset." );
}
-
- public void assertAuthenticatedPage( String username )
- {
- assertTextPresent( "Current User" );
- assertTextPresent( "Edit Details" );
- assertTextPresent( "Logout" );
- assertTextNotPresent( "Login" );
- assertTextPresent( username );
- }
-
-
- //User Management
+
+ //User Management
public void goToUserManagementPage()
{
clickLinkWithText( "User Management" );
@@ -278,6 +268,10 @@
submitLoginPage( username, password, false, valid,
assertReturnPage );
}
+ if ( valid )
+ {
+ assertUserLoggedIn( username );
+ }
}
public void submitLoginPage( String username, String password )
@@ -304,10 +298,7 @@
if ( validUsernamePassword )
{
- assertTextPresent( "Current User:" );
- assertTextPresent( username );
- assertLinkPresent( "Edit Details" );
- assertLinkPresent( "Logout" );
+ assertUserLoggedIn( username );
}
else
{
@@ -321,8 +312,17 @@
}
}
}
-
- // User Roles
+
+ protected void assertUserLoggedIn( String username )
+ {
+ assertTextPresent( "Current User:" );
+ assertTextPresent( username );
+ assertLinkPresent( "Edit Details" );
+ assertLinkPresent( "Logout" );
+ assertTextNotPresent( "Login" );
+ }
+
+ // User Roles
public void assertUserRoleCheckBoxPresent(String value)
{
getSelenium()
.isElementPresent("xpath=//inp...@id='addRolesToUser_addNDSelectedRoles' and
@name='addNDSelectedRoles' and @value='" + value + "']");
@@ -553,4 +553,13 @@
//TODO
clickButtonWithValue( "Add Repository" );
}
+
+ protected void logout()
+ {
+ clickLinkWithText("Logout");
+ assertTextNotPresent( "Current User:" );
+ assertLinkNotPresent( "Edit Details" );
+ assertLinkNotPresent( "Logout" );
+ assertLinkPresent( "Login" );
+ }
}