elvetemedve/behat-screenshot

Add HTML fallback in case screenshot taking is not supported by the current driver

leymannx opened this issue · 2 comments

Currently screenshots are only taken in JavaScript sessions. Let's add a fallback similar to what integratedexperts/behat-screenshot does, where as fallback an HTML file gets generated using the Goutte driver.

Remaining tasks:

  • Code needs to be written
  • Tests need to be updated
  • Documentation needs to be updated

I was thinking about this one today and this extension takes screenshots then using the configured image driver it saves the image somewhere (local file system or any remote location).
The problem is that the image driver normally expects to get an image, e.g. https://github.com/tkotosz/behat-screenshot-image-driver-uploadpie will upload the image to upload pie. If we would introduce saving html content instead then all the image drivers which expect image would be broken.

Also someone might want to generate the html file anyway even if a screenshot created, etc. All of these would introduce a lot of additional complexity in this extension, so I think the best would be to create a separate extension for this feature.

This way both extension (this one and the new one) will have only 1 responsibility, this one takes screenshots, while the other one dumps html and maybe some additional debug info as well like request headers and stuff like that.

Thanks for having a look at this one.

I was hoping for some low hanging fruit. Like "(if current driver !== selenium/js) { then parse DOM and save as HTML file and skip all other following tasks that normally are done saving an image }".

One of the biggest positive side effects maybe would be that the extension generates output regardless of the driver, and therefore it may avoid a lot of confusion Behat beginners have about the "screenshot only taken when JS" issues.