cucumber / godog

Cucumber for golang
MIT License
2.22k stars 250 forks source link

Godog needs Embed Screenshot #124

Open papitorcks opened 6 years ago

papitorcks commented 6 years ago

I've been working with Cucumber Ruby for years. I am testing the Godog integrated with Selenium and it was wonderful. But I would like to be able to include Screenshots in the JSON report

Examples: embed "screenshot.png", "image / png"

Does Godog support this? When will Godog support this feature?

l3pp4rd commented 6 years ago

Hi, currently godog does not have errors with attachments. Probably will be added with #88 but cannot say when it will be available, I have much interest in other things at the moment. If you do need it badly, you may fork and add a small extension to it or:

  1. save screenshots somewhere on disk
  2. godog -f cucumber | embed-screenshots | html-report

Where embed-screenshots would check the directory where your screenshots are saved (named as identifier so that you know to which scenario it should be embedded) and if there are any screenshots there embed them where appropriate and produce json then finally whatever tool you are using to html report

I would still need to investigate how cucumber ruby, js manages attachments and decide how to integrate them. maybe it will be enough just for custom AttachmentErr type.

llonchj commented 5 years ago

@papitoio have a look at https://github.com/llonchj/browsersteps

linuxramu commented 5 years ago

:

If you do need it badly, you may fork and add a small extension to it or:

I am intrested to know on what to FORK? Link please

l3pp4rd commented 5 years ago

@linuxramu you can create a custom error and return it in your step on failure with a screenshot attached, then the change in godog would require to edit this function and attach it correctly to the report if error instance is the one with attachment.

this is not yet implemented internally, since I do not yet know what could be an appropriate way to manage it.

cbush06 commented 5 years ago

@papitoio I added this feature: https://github.com/DATA-DOG/godog/pull/174

@l3pp4rd Please review and approve pull request to add this new feature to godog. I tried to keep everything as consistent as possible with how godog works. I also added documentation to your README file with an example.

inluxc commented 4 years ago

With the recent update, we can start thinking about implementing this issue. It's quite important for test selenium based. As the standard says it's not only screenshots but any type of embedded files. In my example, I have ate leased 3 types of files.

andrewesweet commented 3 years ago

What’s the current thinking on how we’d like to expose this? Is there a suggested API, for example?

Johnlon commented 1 month ago

Still doesn't seem to be a way to get this working in godog - or more generally no way to add "attachments" or "embeddings" at all. Any ideas?