Unable to embed a screenshot to the SpecFlow html Report - screenshot

I am executing my automation scenarios using SpecFlow with Visual Studio.
I want to Embed a custom image to the HTML report which was generated by SpecFlow. That image is a screenshot i am taking whenever scenario is failed in Hooks.
Please help me out.
This is what i am seeing in the html report - enter image description here

Take a look at the SeleniumWebTest sample project here. This sample project shows how to include a screenshot in your report. While the example is Selenium-based, the same principles apply to other frameworks.
A more in-depth explanation of how this works can be found here under "Including Screenshots". Essentially, you need to abuse the console and use it to output your images' file paths.
Any data written to the console is available in your report (this is how the trace details are received by the report). You will need to parse the data written to the console and strip out the file path you want to embed. Make sure that you strip the image path completely so that you don't output the file path as part of the other trace information received from the console.
Edit: I've since discovered that there seems to be an issue with the template in the sample project. The following section in the template is bugged:
class="log">#Raw(FormatTechMessages(traceEvent.TechMessages.TrimEnd()).Replace("SCREENSHOT[ <a href="http://specflow.org/plus/documentation/,-/" data-page=",-"<img width='1000' src=").Replace("</a> ]SCREENSHOT", "</img>"))</pre>
This is because the console no longer seems to be formatting the file as a hyperlink, so the replacement string is never found. Updating this line in ReportTemplate.cshtml seems to have done the trick:
<pre class="log">#Raw(FormatTechMessages(traceEvent.TechMessages.TrimEnd()).Replace("SCREENSHOT[ ", "<img width='1000' src=\"").Replace(" ]SCREENSHOT", "\"</img>"))</pre>
As the console is no longer formatting the file as a hyperlink, you only need to replace the padding (in this case the "SCREENSHOT[]SCREENSHOT") from the string and instead enclose the path with the <IMG> tag. You also need to add the quotes around the file path.

Related

Typo3 LTS9 PDF dimensions are not read and displayed in 0x0

I am having an issue with PDF's in the latest Typo3 release. If I add PDF to the Image content element, I get this:
The file info looks like this:
Checking the Image Processing Test of Typo3, no errors are returned. PDF/AI also seems to be fine.
I tested several PDF's and AI files as well, they won't show dimensions either.
I have the suspicion that the command 'identify' does not work within Typo3, it still returns perfect results from shell.
Any idea where to look?
multiple reasons possible:
you just need to reimport metadata (scheduler task)
your PDF is coded in an unsual format (there is more then one option in PDF to include the title image)
missing/wrong rights:
maybe another program is executed from commandline than from PHP.
maybe the file can't be accessed correctly from ghostscript started from web

Which procedure in Moqui transforms XML Screen into script?

I would like to see what is happening behind the scenes when the engine transforms XML file with screen definition into Groovy (I suppose) script. So that I can see the definition turning into more readable script, hopefully.
Where shall I place the breakpoint while debugging?
Also, in Tools (/apps/tools/Service) if you click on 'Service detail' you get a nicely rendered view of the generated groovy for any of your services called from screens (or otherwise called). 'Services' are a very intuitive unit for debugging in moqui.
XML Screens are not transformed into scripts like XML Actions are. XML Screens and Forms are transformed by FreeMarker macros into the desired output text (html, xsl-fo, csv, etc). These macros are defined in the DefaultScreenMacros.html.ftl file for html output, and similarly named files (in the runtime/template/screen-macro directory) for other types of output.

when I load .off file in CGAL Polyhedron demo, nothing were showed in the window

enter image description here
I have build the demo succesfully, and runs the demo, but when I try to load .off file, it comes out nothing. In the console window, the error message " QWindowsNativeFieDialogBase::shellitem:SHCreateItemFromParsingName(file:debug)failed(no such file or direcory)"
Could somebody give me any instruction?
It seams the problem is similar to this one : [http://cgal-discuss.949826.n4.nabble.com/Problem-with-loading-off-files-in-Polyhedron-demo-td4661212.html][1]
Do you build any plugin ? You need at least off_plugin to load an off file in addition of Polyhedron_3

xaml layout file won't link to Strings in Resource.resw

I have created a simple hub app
the default template has this HubPage.xaml
since x:Uid the strings should be yet linked to Resurces.resw in Strings folder (if I have understod the documentation)
so I have created the folder for another language and edited both Resurces.resw files to show the name Bla Bla Test rather than default "application name"
unfortunately this doesn't work and header continues to show "application name" ignoring Resurces.resw
What is wrong?
update: following the suggestion of Romasz(see the comments) when I run the emulator is correctly shown the value of Resurces.resw...why in the preview this not happens
From what I've tried with default template (Hub App), there seems to be a little mistake in Resources.resw file. Instead of HubSection1 -> Section 1 there should be HubSection1.Header -> Section 1 - x:Uid defines the name of an element, but in resources there should be added a path to property.
Nevertheless, from my experience and what I've tried, the designer preview won't show values from Resources.resw file. To see the effect you will have to build and run your project on emulator/devidce.

Responsive website screenshot with Pageres with URLs from a text file

I am trying to use pageres(https://github.com/sindresorhus/pageres) module to take screenshots of my website in different resolutions.
It works fine when I provide the URL and the size in command line but it doesn't work when I have my urls in a text file. It takes a screenshot of only the last URL in the file. I use the following command to run pageres:
pageres 640x768 < urls.txt
URLs in the text file are newline separated so they look like this:
http://www.yahoo.com
http://www.msn.com
http://www.apple.com
So it basically takes a screenshot of only apple.com and throws the error below for each of the screenshot above it.
The error I get is:
TypeError: 'undefined' is not an object <evaluating 'options.windowSize.width'>
and the file it points to is webshot.phantom.js line 13.
Am I running the command incorrectly or something? I use it the way it is mentioned on their site.
Thank you for your help.
It might have been a bug at some point, but it works fine in the latest version. Just tested.