How do I include screenshots of the full page in my serenity report (and not only of the viewport) using ChromeDriver?
Asked Answered
D

1

5

I am using serenity in combination with cucumber for automated screen tests and want to include full-page screenshots in my serenity report. The screenshots in the report are normally only a capture of the viewport. Oftentimes however, this doesn't provide enough information as this is only a part of the screen.

I found that the capturing of serenity screenshots is a part of driver implementation. As most drivers conform with the W3C definition of screenshots those drivers only capture the current viewport.

In this discussion I found that this is a common problem for test-automation. Comment 143 mentions this great library for customizing screenshots.

I got this to work in my code, however I would now like to integrate this into the serenity report and this is where I got stuck.

Does anyone know how to replace (or add) the standard screenshot-capturing-part of the serenity using the above library?

I would already be helped a lot if someone could tell me where the screenshot-capturing part of the serenity code is located.. Is it somewhere inside serenity-core?

Doodlebug answered 10/1, 2017 at 11:37 Comment(2)
For now, I solve this problem by generating my most important report using FirefoxDriver, as this one does capture screenshots of the full page for now. However, I am still looking for the answer to this question as this isn't going to stay like this forever. For more information see my other question [to be posted].Doodlebug
link to my other questionDoodlebug
K
2

The above mentioned Selenium - Shutterbug library can be used in combination with Serenity-BDD in a PageObject use the following line.

Shutterbug.shootPage(getDriver()).save();

Tip Serenity-BDD fine-tuning screenshots in your living documentation

Through the serenity.properties as shown below:

serenity.take.screenshots.for.tasks=after_each_step
serenity.take.screenshots.for.interactions=for_failure
serenity.take.screenshots.for.questions=after_each_step
Kraft answered 10/1, 2017 at 18:15 Comment(4)
What you say is to specify the frequency of screenshots being taken. My problem is the implementation of the taking of screenshots; being only of the viewport instead of the whole page. To my knowledge this can't be done anywhere with Serenity's standard methods so I'm wishing for a way to alter Serenity's inner workings so to say.Doodlebug
Serenity-BDD uses Selenium, so I guess, also for taking screenshots. And there are issues with some browser, taking full page screenshots. What browser are you using ? See also for example: #17885669Kraft
I might not understand you correctly, but you are not providing a way to integrate this custom screenshot in the report or are you? Like I said, I already got the custom screenshot to work at a time of my choosing, but I would like to let serenity use this custom method for the screenshots in the report.Doodlebug
To answer your other question: ideally I would like this to work in Chrome, FF ánd IE. But initially I am trying to get it to work with ChromeDoodlebug

© 2022 - 2024 — McMap. All rights reserved.