[seam-commits] Seam SVN: r14120 - in branches/community/Seam_2_2/src/test/ftest/examples/dvdstore: src/org/jboss/seam/example/dvd/test/selenium and 1 other directory.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Wed Jun 29 07:52:06 EDT 2011


Author: maschmid
Date: 2011-06-29 07:52:05 -0400 (Wed, 29 Jun 2011)
New Revision: 14120

Added:
   branches/community/Seam_2_2/src/test/ftest/examples/dvdstore/src/org/jboss/seam/example/dvd/test/selenium/ExceptionRedirectTest.java
Modified:
   branches/community/Seam_2_2/src/test/ftest/examples/dvdstore/jboss-embedded.xml
   branches/community/Seam_2_2/src/test/ftest/examples/dvdstore/jboss4.xml
   branches/community/Seam_2_2/src/test/ftest/examples/dvdstore/jboss5.xml
   branches/community/Seam_2_2/src/test/ftest/examples/dvdstore/src/org/jboss/seam/example/dvd/test/selenium/dvd.properties
Log:
Adding a test for exception redirect messages to the dvdstore ftest.


Modified: branches/community/Seam_2_2/src/test/ftest/examples/dvdstore/jboss-embedded.xml
===================================================================
--- branches/community/Seam_2_2/src/test/ftest/examples/dvdstore/jboss-embedded.xml	2011-06-29 11:36:57 UTC (rev 14119)
+++ branches/community/Seam_2_2/src/test/ftest/examples/dvdstore/jboss-embedded.xml	2011-06-29 11:52:05 UTC (rev 14120)
@@ -25,6 +25,7 @@
 			<class name="org.jboss.seam.example.dvd.test.selenium.RegistrationTest" />
 			<class name="org.jboss.seam.example.dvd.test.selenium.SearchTest" />
 			<class name="org.jboss.seam.example.dvd.test.selenium.ShoppingCartTest" />
+			<class name="org.jboss.seam.example.dvd.test.selenium.ExceptionRedirectTest" />
 		</classes>
 	</test>
-</suite>
\ No newline at end of file
+</suite>

Modified: branches/community/Seam_2_2/src/test/ftest/examples/dvdstore/jboss4.xml
===================================================================
--- branches/community/Seam_2_2/src/test/ftest/examples/dvdstore/jboss4.xml	2011-06-29 11:36:57 UTC (rev 14119)
+++ branches/community/Seam_2_2/src/test/ftest/examples/dvdstore/jboss4.xml	2011-06-29 11:52:05 UTC (rev 14120)
@@ -25,6 +25,7 @@
 			<class name="org.jboss.seam.example.dvd.test.selenium.RegistrationTest" />
 			<class name="org.jboss.seam.example.dvd.test.selenium.SearchTest" />
 			<class name="org.jboss.seam.example.dvd.test.selenium.ShoppingCartTest" />
+			<class name="org.jboss.seam.example.dvd.test.selenium.ExceptionRedirectTest" />
 		</classes>
 	</test>
-</suite>
\ No newline at end of file
+</suite>

Modified: branches/community/Seam_2_2/src/test/ftest/examples/dvdstore/jboss5.xml
===================================================================
--- branches/community/Seam_2_2/src/test/ftest/examples/dvdstore/jboss5.xml	2011-06-29 11:36:57 UTC (rev 14119)
+++ branches/community/Seam_2_2/src/test/ftest/examples/dvdstore/jboss5.xml	2011-06-29 11:52:05 UTC (rev 14120)
@@ -25,6 +25,7 @@
 			<class name="org.jboss.seam.example.dvd.test.selenium.RegistrationTest" />
 			<class name="org.jboss.seam.example.dvd.test.selenium.SearchTest" />
 			<class name="org.jboss.seam.example.dvd.test.selenium.ShoppingCartTest" />
+			<class name="org.jboss.seam.example.dvd.test.selenium.ExceptionRedirectTest" />
 		</classes>
 	</test>
-</suite>
\ No newline at end of file
+</suite>

Added: branches/community/Seam_2_2/src/test/ftest/examples/dvdstore/src/org/jboss/seam/example/dvd/test/selenium/ExceptionRedirectTest.java
===================================================================
--- branches/community/Seam_2_2/src/test/ftest/examples/dvdstore/src/org/jboss/seam/example/dvd/test/selenium/ExceptionRedirectTest.java	                        (rev 0)
+++ branches/community/Seam_2_2/src/test/ftest/examples/dvdstore/src/org/jboss/seam/example/dvd/test/selenium/ExceptionRedirectTest.java	2011-06-29 11:52:05 UTC (rev 14120)
@@ -0,0 +1,75 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.example.dvd.test.selenium;
+
+import static org.testng.AssertJUnit.*;
+
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+/**
+ * This class tests messages specified in exception redirects in pages.xml
+ * 
+ * @author maschmid
+ * 
+ */
+public class ExceptionRedirectTest extends SeleniumDvdTest {
+
+    @Override
+    @BeforeMethod
+    public void setUp() {
+        browser = startBrowser();
+    }
+
+    @Test
+    public void notLoggedInExceptionRedirectTest() {
+        browser.open(CONTEXT_PATH + "/" + getProperty("ADMIN_URL"));
+
+        assertFalse("On the admin page despite not logged in", 
+                browser.getLocation().contains(getProperty("ADMIN_URL")));
+        assertTrue("Not redirected to home", 
+                browser.getLocation().contains(getProperty("HOME_URL")));
+        
+        assertFalse("The word `Exception' appeared on the page", 
+                browser.isTextPresent("Exception"));
+        assertTrue("Expected message didn't appear",
+                browser.isTextPresent(getProperty(
+                        "REDIRECT_NOT_LOGGED_IN_EXCEPTION_MESSAGE")));
+    }
+    
+    @Test
+    public void authorizationExceptionRedirectTest() {
+        login(DEFAULT_USERNAME, DEFAULT_PASSWORD);
+        browser.open(CONTEXT_PATH + "/" + getProperty("ADMIN_URL"));
+
+        assertFalse("On the admin page despite logged in as an ordinary user",
+                browser.getLocation().contains(getProperty("ADMIN_URL")));
+        assertTrue("Not redirected to home", 
+                browser.getLocation().contains(getProperty("HOME_URL")));
+        
+        assertFalse("The word `Exception' appeared on the page", 
+                browser.isTextPresent("Exception"));
+        assertTrue("Expected message didn't appear",
+                browser.isTextPresent(getProperty(
+                        "REDIRECT_AUTHORIZATION_EXCEPTION_MESSAGE")));
+    }
+}


Property changes on: branches/community/Seam_2_2/src/test/ftest/examples/dvdstore/src/org/jboss/seam/example/dvd/test/selenium/ExceptionRedirectTest.java
___________________________________________________________________
Added: svn:executable
   + *

Modified: branches/community/Seam_2_2/src/test/ftest/examples/dvdstore/src/org/jboss/seam/example/dvd/test/selenium/dvd.properties
===================================================================
--- branches/community/Seam_2_2/src/test/ftest/examples/dvdstore/src/org/jboss/seam/example/dvd/test/selenium/dvd.properties	2011-06-29 11:36:57 UTC (rev 14119)
+++ branches/community/Seam_2_2/src/test/ftest/examples/dvdstore/src/org/jboss/seam/example/dvd/test/selenium/dvd.properties	2011-06-29 11:52:05 UTC (rev 14120)
@@ -75,4 +75,7 @@
 CART_NOT_ENOUGH_COPIES_LEFT xpath\=//*[normalize-space(text()) \= "There were not enough copies of {0} in stock to fulfill your order."]
 CART_UNABLE_TO_COMPLETE_ORDER_MESSAGE xpath=//*[normalize-space(text()) = 'Your order could not be completed.']
 DVD_URL dvd
-ADMIN_URL admin/admin
\ No newline at end of file
+ADMIN_URL admin/admin
+HOME_URL home
+REDIRECT_NOT_LOGGED_IN_EXCEPTION_MESSAGE You must be logged in to access administrative pages.
+REDIRECT_AUTHORIZATION_EXCEPTION_MESSAGE You are not authorized to access administrative pages.



More information about the seam-commits mailing list