Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

images/failing_screenshot.png missing? #15

Closed
aukevanleeuwen opened this issue Aug 14, 2014 · 2 comments
Closed

images/failing_screenshot.png missing? #15

aukevanleeuwen opened this issue Aug 14, 2014 · 2 comments

Comments

@aukevanleeuwen
Copy link

In commit f6a545f a reference to images/failing_screenshot.png was added, however I don't see a corresponding commit in https://github.com/jbehave/jbehave-site/tree/master/site-resources/src/main/resources/images?

Futhermore I don't quite understand why the screenshot itself isn't inlined by default. There is a link to the correct screenshot, but the 'thumbnail image' isn't found. How about:

<img src=\"../screenshots/failed-scenario-{3}.png\" alt=\"failing screenshot\"/>

instead of

<a color=\"black\" href=\"../screenshots/failed-scenario-{3}.png\"><img src=\"images/failing_screenshot.png\" alt=\"failing screenshot\"/></a>

We are only talking about the 'failed' case here so it's not like the complete report is littered with screenshots (assuming of course your tests succeed most of the time 😉)

Lastly, as a workaround you can use this format instead if you want to have inline images:

public class MyWebDriverHtmlOutput extends HtmlOutput {

   public static final org.jbehave.core.reporters.Format MY_WEB_DRIVER_HTML = new MyWebDriverHtmlFormat();

   public MyWebDriverHtmlOutput(PrintStream output, Keywords keywords) {
      super(output, failedPatternProperties(), keywords);
   }

   private static Properties failedPatternProperties() {
      Properties properties = new Properties();
      properties.put("failed",
            "<div class=\"step failed\">{0} <span class=\"keyword failed\">({1})</span><br/>" +
                  "<span class=\"message failed\">{2}</span><br/>" +
                  "<img src=\"../screenshots/failed-scenario-{3}.png\" alt=\"failing screenshot\"/></div>\n");
      return properties;
   }

   private static class MyWebDriverHtmlFormat extends org.jbehave.core.reporters.Format {

      public MyWebDriverHtmlFormat() {
         super("HTML");
      }

      @Override
      public StoryReporter createStoryReporter(FilePrintStreamFactory factory, StoryReporterBuilder storyReporterBuilder) {
         factory.useConfiguration(storyReporterBuilder.fileConfiguration("html"));
         return new MyWebDriverHtmlOutput(factory.createPrintStream(), storyReporterBuilder.keywords())
               .doReportFailureTrace(storyReporterBuilder.reportFailureTrace())
               .doCompressFailureTrace(storyReporterBuilder.compressFailureTrace());
      }
   }
}
@maurotalevi
Copy link
Contributor

Please post all issues to mailing lists
(http://jbehave.org/mailing-lists.html) or create issue on JIRA
(http://jira.codehaus.org/browse/JBEHAVE).

Github is only used as a repo replicator. Thanks

On 14/08/2014 10:26, Auke van Leeuwen wrote:

In commit f6a545f
f6a545f
a reference to |images/failing_screenshot.png| was added, however I
don't see a corresponding commit in
https://github.com/jbehave/jbehave-site/tree/master/site-resources/src/main/resources/images?

Futhermore I don't quite understand why the screenshot itself isn't
inlined by default. There is a link to the correct screenshot, but the
'thumbnail image' isn't found. How about:

|<img src="../screenshots/failed-scenario-{3}.png" alt="failing screenshot"/>
|

instead of

|<a color="black" href="../screenshots/failed-scenario-{3}.png"><img src="images/failing_screenshot.png" alt="failing screenshot"/>
|

We are only talking about the 'failed' case here so it's not like the
complete report is littered with screenshots (assuming of course your
tests succeed most of the time 😉)

Lastly, as a workaround you can use this format instead if you want to
have inline images:

|public class MyWebDriverHtmlOutput extends HtmlOutput {

public static final org.jbehave.core.reporters.Format MY_WEB_DRIVER_HTML = new MyWebDriverHtmlFormat();

public MyWebDriverHtmlOutput(PrintStream output, Keywords keywords) {
   super(output, failedPatternProperties(), keywords);
}

private static Properties failedPatternProperties() {
   Properties properties = new Properties();
   properties.put("failed",
         "<div class=\"step failed\">{0} <span class=\"keyword failed\">({1})</span><br/>" +
               "<span class=\"message failed\">{2}</span><br/>" +
               "<img src=\"../screenshots/failed-scenario-{3}.png\" alt=\"failing screenshot\"/></div>\n");
   return properties;
}

private static class MyWebDriverHtmlFormat extends org.jbehave.core.reporters.Format {

   public MyWebDriverHtmlFormat() {
      super("HTML");
   }

   @Override
   public StoryReporter createStoryReporter(FilePrintStreamFactory factory, StoryReporterBuilder storyReporterBuilder) {
      factory.useConfiguration(storyReporterBuilder.fileConfiguration("html"));
      return new MyWebDriverHtmlOutput(factory.createPrintStream(), storyReporterBuilder.keywords())
            .doReportFailureTrace(storyReporterBuilder.reportFailureTrace())
            .doCompressFailureTrace(storyReporterBuilder.compressFailureTrace());
   }
}

}
|


Reply to this email directly or view it on GitHub
#15.

@aukevanleeuwen
Copy link
Author

Added an issue in JIRA instead: http://jira.codehaus.org/browse/JBEHAVE-1040

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants