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

Support embedding images directly in html files #696

Merged

Conversation

brasmusson
Copy link
Contributor

This PR sets out to fix part 2 of #651 ("some kind of official option on embed images [using the HTML formatter]"), or at least it does remove the need to prefix the image data with "data:image/<format>;base64,, manually (a prefix that is not relevant for files produces by other formatters, like the JSON formatter).

The idea is to support the following construct in step definitions:

encoded_img = @browser.driver.screenshot_as(:base64)
embed("#{encoded_img}",'image/png;base64')

The HTML formatter will now check whether the first argument to the embed method is a file, or if it starts with the image embedding directive ("data:image/<format>;base64,), and if so insert the first argument as is in the src attribute of the HTML image element. Otherwise it will insert the image embedding directive first in the content of the first argument to the embed method, and insert the result as is in the src attribute of the HTML image element.

@aslakhellesoy
Copy link
Contributor

I have tried this approach before, and I remember there were some problems when there are many images that are big. I think the browser just crashed or hung. Might be worthwhile trying out.

mattwynne added a commit that referenced this pull request Aug 25, 2014
….3.x

Support embedding images directly in html files
@mattwynne mattwynne merged commit 4b2b948 into cucumber:v1.3.x-bugfix Aug 25, 2014
@brasmusson brasmusson deleted the html-formatter-embed-image-v1.3.x branch August 25, 2014 16:35
@lock
Copy link

lock bot commented Oct 25, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants