]> source.dussan.org Git - archiva.git/commitdiff
fix selenium test add/delete user with webapp-js
authorOlivier Lamy <olamy@apache.org>
Thu, 29 Dec 2011 13:54:33 +0000 (13:54 +0000)
committerOlivier Lamy <olamy@apache.org>
Thu, 29 Dec 2011 13:54:33 +0000 (13:54 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1225534 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/message.html
archiva-modules/archiva-web/archiva-webapp-test-js/src/test/resources/testng.properties
archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/parent/AbstractArchivaTest.java
archiva-modules/archiva-web/archiva-webapp-test-js/src/test/testng/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java

index 21a9872168d2749dcbc35f07b8257669e4c5521f..09b5bdaff3f4895bf2f5fd90f73254b2b633837e 100644 (file)
@@ -1,18 +1,18 @@
 <script id='alert-message-success' type='text/x-jquery-tmpl'>
   <div class="alert-message fade in success" data-alert="alert">
-    <a class="close" href="#">×</a>
+    <a class="close" href="#" id='alert-message-success-close-a'>×</a>
     <p>${message}</p>
   </div>
 </script>
 <script id='alert-message-error' type='text/x-jquery-tmpl'>
   <div class="alert-message fade in error" data-alert="alert">
-    <a class="close" href="#">×</a>
+    <a class="close" href="#" id='alert-message-error-close-a'>×</a>
     <p>${message}</p>
   </div>
 </script>
 <script id='alert-message-warning' type='text/x-jquery-tmpl'>
   <div class="alert-message fade in warning" data-alert="alert">
-    <a class="close" href="#">×</a>
+    <a class="close" href="#" id='alert-message-warning-close-a'>×</a>
     <p>${message}</p>
   </div>
 </script>
index c7ea281a284653d5d6c3034a90b5fffb42e272c2..1913b032f63921436508b0cbae474c9b27e02978 100644 (file)
@@ -59,7 +59,7 @@ NEW_USERROLE_PASSWORD=password123
 
 # Guest Role
 GUEST_USERNAME=guest_user
-GUEST_FULLNAME=Guest
+GUEST_FULLNAME=The Test Guest
 # Registered User Role
 REGISTERED_USERNAME=reg_user
 REGISTERED_FULLNAME=Registered User
index b4adefc83a3ad2e41704e73a60563dbac46bae03..a785d221d5e43ad19bfc8d647d9d3103cdcf964d 100644 (file)
@@ -234,11 +234,7 @@ public abstract class AbstractArchivaTest
 
         clickLinkWithLocator( "user-create-form-register-button", true );
 
-        assertTextPresent( "user created:guest_user" );
-
-        //assertUserRolesPage();
-
-        //clickButtonWithName( "submitRolesButton", true );
+        assertTextPresent( "user created:"+userName );
 
         if ( valid )
         {
@@ -265,8 +261,12 @@ public abstract class AbstractArchivaTest
 
         clickLinkWithLocator( "users-grid-delete-" + userName );
 
+        clickLinkWithLocator( "dialog-confirm-modal-ok" );
+
         assertTextPresent( "user " + userName + " deleted" );
 
+        clickLinkWithLocator( "alert-message-success-close-a" );
+
         assertTextNotPresent( userName );
         assertTextNotPresent( fullName );
 
@@ -724,8 +724,8 @@ public abstract class AbstractArchivaTest
     {
         clickLinkWithText( "Logout" );
         assertTextNotPresent( "Current User:" );
-        assertLinkNotPresent( "Edit Details" );
-        assertLinkNotPresent( "Logout" );
-        assertLinkPresent( "Login" );
+        assertLinkNotVisible( "Edit Details" );
+        assertLinkNotVisible( "Logout" );
+        assertLinkVisible( "Login" );
     }
 }
\ No newline at end of file
index 1619d33bfcd14c26708b5193efc9a8984b6af330..03d88395d48e44519eccd8d6a8c30c3561427d3b 100644 (file)
@@ -212,6 +212,16 @@ public abstract class AbstractSeleniumTest
         Assert.assertFalse( isElementPresent( "link=" + text ), "The link('" + text + "' is present." );
     }
 
+    public void assertLinkNotVisible( String text )
+    {
+        Assert.assertFalse( isElementVisible( "link=" + text ), "The link('" + text + "' is visible." );
+    }
+
+    public void assertLinkVisible( String text )
+    {
+        Assert.assertTrue( isElementVisible( "link=" + text ), "The link('" + text + "' is not visible." );
+    }
+
     public void assertImgWithAlt( String alt )
     {
         assertElementPresent( "/¯img[@alt='" + alt + "']" );