CVS: Products/Zelenium - CHANGES.txt:1.24 zuite.py:1.16

Tres Seaver <[email protected]>
Newsgroups gmane.comp.web.zope.public-cvs
Message-ID <[email protected]>
Update of /cvs-repository/Products/Zelenium
In directory cvs.zope.org:/tmp/cvs-serv1080

Modified Files:
	CHANGES.txt zuite.py 
Log Message:


   - Make passing / failing test cases in results view more obvious in
     printed representation by adding icons.  N.B.: at the moment, we do
     this by sniffing the HTML of the test case for the "pink" backgrounds.


=== Products/Zelenium/CHANGES.txt 1.23 => 1.24 ===
--- Products/Zelenium/CHANGES.txt:1.23	Fri May  6 08:00:04 2005
+++ Products/Zelenium/CHANGES.txt	Fri May  6 16:00:38 2005
@@ -2,6 +2,10 @@
 
   After Zelenium-0.5
 
+    - Make passing / failing test cases in results view more obvious in
+      printed representation by adding icons.  N.B.: at the moment, we do
+      this by sniffing the HTML of the test case for the "pink" backgrounds.
+
     - Apply patch from the selenium-devel list to fix regression in
       testcase HTML extraction in 'postTestResults'.
 


=== Products/Zelenium/zuite.py 1.15 => 1.16 ===
--- Products/Zelenium/zuite.py:1.15	Wed May  4 12:03:26 2005
+++ Products/Zelenium/zuite.py	Fri May  6 16:00:38 2005
@@ -5,12 +5,14 @@
 $Id$
 """
 import os
+import re
 from urllib import unquote
 import zipfile
 import StringIO
 
 from AccessControl.SecurityInfo import ClassSecurityInfo
 from App.special_dtml import DTMLFile
+from App.ImageFile import ImageFile
 from DateTime.DateTime import DateTime
 from Globals import package_home
 from Globals import InitializeClass
@@ -25,6 +27,8 @@
 
 _NOW = None   # set only for testing
 
+_PINK_BACKGROUND = re.compile('bgcolor="#ffcfcf"')
+
 def _getNow():
     if _NOW is not None:
         return _NOW
@@ -104,6 +108,20 @@
     security.declareProtected( View, 'splash_html' )
     splash_html = PageTemplateFile( 'suiteSplash', _WWW_DIR )
 
+
+    def __getitem__( self, key, default=_MARKER ):
+
+        if key in self.objectIds():
+            return self._getOb( key )
+
+        if key in _SUPPORT_FILE_NAMES:
+            return _SUPPORT_FILES[ key ].__of__( self )
+
+        if default is not _MARKER:
+            return default
+
+        raise KeyError, key
+
     security.declareProtected( View, 'listTestCases' )
     def listTestCases( self, prefix=() ):
         """ Return a list of our contents which qualify as test cases.
@@ -126,20 +144,6 @@
         return result
 
 
-    def __getitem__( self, key, default=_MARKER ):
-
-        if key in self.objectIds():
-            return self._getOb( key )
-
-        if key in _SUPPORT_FILE_NAMES:
-            return _SUPPORT_FILES[ key ].__of__( self )
-
-        if default is not _MARKER:
-            return default
-
-        raise KeyError, key
-
-
     security.declarePrivate('_listProductInfo')
     def _listProductInfo( self ):
         """ Return a list of strings of form '%(name)s %(version)s'.
@@ -352,12 +356,19 @@
         test_ids.sort()
 
         for test_id in test_ids:
+            body = unquote( rfg( test_id ) )
             result._setObject( test_id
                              , File( test_id
                                    , 'Test case: %s' % test_id
-                                   , unquote( rfg( test_id ) )
+                                   , body
                                    , 'text/html'
                                    ) )
+            testcase = result._getOb( test_id )
+            testcase._setProperty( 'passed'
+                                 , _PINK_BACKGROUND.search( body ) is None
+                                 , 'boolean'
+                                 )
+
 
 InitializeClass( Zuite )
 
@@ -430,7 +441,30 @@
     security.declarePublic( 'index_html' )
     index_html = PageTemplateFile( 'resultsView', _WWW_DIR )
 
-InitializeClass( Zuite )
+    security.declareProtected( View, 'error_icon' )
+    error_icon = ImageFile( 'error.gif', _WWW_DIR )
+
+    security.declareProtected( View, 'check_icon' )
+    check_icon = ImageFile( 'check.gif', _WWW_DIR )
+
+
+    def __getitem__( self, key, default=_MARKER ):
+
+        if key in self.objectIds():
+            return self._getOb( key )
+
+        if key == 'error.gif':
+            return self.error_icon
+
+        if key == 'check.gif':
+            return self.check_icon
+
+        if default is not _MARKER:
+            return default
+
+        raise KeyError, key
+
+InitializeClass( ZuiteResults )
 
 #
 #   Factory methods

_______________________________________________
Zope-CVS maillist  -  [email protected]
http://mail.zope.org/mailman/listinfo/zope-cvs

Zope CVS instructions: http://dev.zope.org/CVS
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.