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

Feature request: rebot - Option to embed images in html #5125

Open
damies13 opened this issue May 7, 2024 · 4 comments
Open

Feature request: rebot - Option to embed images in html #5125

damies13 opened this issue May 7, 2024 · 4 comments

Comments

@damies13
Copy link

damies13 commented May 7, 2024

Not sure if this is the right place for this feature request?

Feature request to add an option to rebot's command line to embed images (e.g. screenshots) into the html body rather then linking to the image file on the filesystem, so the log.html would be a self contained file.
I'd expect this option would be disabled by default, so images would only be embedded if someone specifically asked for it.

This feature request was inspired by this forum post and other like it I've seen in the past:
https://forum.robotframework.org/t/how-to-add-screenshot-in-allure-report-for-failure-test-cases-allure-repot/7263

@pekkaklarck
Copy link
Member

I can see that this would be convenient in some cases. Implementing it would require parsing logged HTML messages, finding references to images, and replacing them with embedded versions. It wouldn't be too hard with <img src='...'>, but I'm not sure are there other ways to embed images.

A problem would be that embedding images could easily increase the log file size considerably. It would often make sense to reduce the image size to mitigate that issue, but that would require using an external module like Pillow. Such a module could also be useful otherwise to support various image formats.

Because I consider the possibility to change image sizes pretty much a must and because we don't want to have external dependencies, I got a feeling this would be best to be implemented as an external tool that could then be used with --pre-rebot-modifier. What do others think about that?

@damies13
Copy link
Author

The increase in file size was the reason I said it should be disabled by default, not desirable by default.

My thought is just have a warning/note about the large file size in the help text for the option and embed the images as provided, then no need for Pillow or any extra code to resize images.

@pekkaklarck
Copy link
Member

I'm fairly certain users would request that images could be resized and/or quality dropped to make the file size smaller if this kind of functionality would be added. That would then require an external dependency or implementing a more powerful tool externally. The more I think about this, the less I see benefits with the functionality being in the core. It anyway needed to be enabled with something like --embed-images and needing to use --pre-rebot-modifier EmbedImages wouldn't be much more complicated. The tool being developed outside the core would also allow using it with older Robot versions and enhancing it independently from Robot's release schedule. If such a tool would be implemented and it turned out to be widely used, we could then consider making it part of the core later.

@damies13
Copy link
Author

Sounds good to me 👍

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