]> source.dussan.org Git - archiva.git/commitdiff
add capturetohtml in parallel to be able to parse a bit selenium failed test result.
authorskygo <skygo@unknown>
Thu, 6 Jun 2013 22:20:03 +0000 (22:20 +0000)
committerskygo <skygo@unknown>
Thu, 6 Jun 2013 22:20:03 +0000 (22:20 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1490463 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-webapp-test/pom.xml
archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java
archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/tools/ArchivaSeleniumExecutionRule.java

index 7ea85c86e62fe69d99ed2aed6684ed04c2a6158a..46b44b8b6d4da0411f572a23c9164aa2e4819596 100644 (file)
                     <copy todir="${project.build.directory}/local-repo">
                       <fileset dir="src/test/resources/local-repo"/>
                     </copy>
+                    <copy todir="${project.build.directory}/errorshtmlsnap/css">
+                      <fileset dir="${webappDirectory}/css"/>
+                    </copy>
+                    <copy todir="${project.build.directory}/errorshtmlsnap/js">
+                      <fileset dir="${webappDirectory}/js"/>
+                    </copy>
+                    <copy todir="${project.build.directory}/errorshtmlsnap/img">
+                      <fileset dir="${webappDirectory}/img"/>
+                    </copy>
+                    <copy todir="${project.build.directory}/errorshtmlsnap/imgages">
+                      <fileset dir="${webappDirectory}/images"/>
+                    </copy>
                   </tasks>
                 </configuration>
               </execution>
index 0ee53aac421e6f885c2202c399509ca86d67ad08..fbff5d7c7f5e7079f5e6aa917d5134ef1f70b06f 100644 (file)
@@ -27,6 +27,7 @@ import org.junit.Rule;
 
 import java.io.File;
 import java.io.FileInputStream;
+import java.io.IOException;
 import java.text.SimpleDateFormat;
 import java.util.Arrays;
 import java.util.Date;
@@ -35,6 +36,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Properties;
+import org.apache.commons.io.FileUtils;
 
 /**
  * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
@@ -683,11 +685,23 @@ public abstract class AbstractSeleniumTest
         String fileBaseName = methodName + "_" + className + ".java_" + lineNumber + "-" + time;
 
         selenium.windowMaximize();
-
+        
+        try
+        {
+            // save html to have a minimum feedback if jenkins firefox not up
+            File fileNameHTML = new File( new File( "target", "errorshtmlsnap" ) , fileBaseName + ".html" );
+            FileUtils.writeStringToFile( fileNameHTML, selenium.getHtmlSource() );
+        }
+        catch ( IOException e )
+        {
+            System.out.print( e.getMessage() );
+            e.printStackTrace();
+        }
+        
         File fileName = new File( targetPath, fileBaseName + ".png" );
 
         selenium.captureEntirePageScreenshot( fileName.getAbsolutePath(), "background=#FFFFFF" );
-
+        
         return fileName.getAbsolutePath();
     }
 
index b113ccf4e179e9ecdbecb30d8e4b5d00f3a41edc..08cb9605cb4b3fee0b693a2c9c18a86016a60b37 100644 (file)
@@ -46,7 +46,7 @@ public class ArchivaSeleniumExecutionRule
             String fileName =
                 ( (AbstractSeleniumTest) target ).captureScreenShotOnFailure( e, method.getMethod().getName(),
                                                                               target.getClass().getName() );
-
+            
             throw new RuntimeException( e.getMessage() + " see screenShot file:" + fileName, e );
         }
         finally