allure2 icon indicating copy to clipboard operation
allure2 copied to clipboard

Expand html attachments to iframe content height

Open rovner opened this issue 7 years ago • 9 comments

I'm submitting a ...

  • [ ] bug report
  • [x] feature request
  • [ ] support request => Please do not submit support request here, see note at the top of this template.

What is the current behavior?

Html attachments height is 150px 2017-12-20_12-50-42

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem

What is the expected behavior?

Html attacments height is equal to html content height (the same as for txt, png, etc attachments)

What is the motivation / use case for changing the behavior?

150px is not enoth to view attached html

Please tell us about your environment:

Allure version 2.4.1
Test framework [email protected]
Allure adaptor [email protected]
Generate report using [email protected]

Other information

rovner avatar Dec 20 '17 09:12 rovner

that is not possible without adding custom code into html attachment

baev avatar Dec 20 '17 09:12 baev

For iframes loaded from the same domain it is possible to access to document

var iframe = jQuery('iframe')[0];
iframe.height = iframe.contentWindow.document.documentElement.scrollHeight;

rovner avatar Dec 20 '17 10:12 rovner

In my view, 150px realy small, but what about the very large html attachments?

skhomuti avatar Jan 15 '18 15:01 skhomuti

Also have such problem. We have many large html attachments and in report they present with scroll bar. Maybe better to enlarge them?

sidelnikovmike avatar Mar 02 '18 10:03 sidelnikovmike

I'm having this same problem. Any movement/resolution on this issue?

rab2215 avatar Oct 04 '18 18:10 rab2215

Hi teams, I've a case to embed iframe with kibana dashboard. However, the 150px is too small to show clear dashboard Screen Shot 2022-02-11 at 2 32 19 PM

I have to click open a new tab to view whole kibana page. Screen Shot 2022-02-11 at 2 32 36 PM

It's better if the default attchment html height is suitable or around 600px.

currysunxu avatar Feb 11 '22 06:02 currysunxu

Has anyone found a solution on how to increase the default attachment iframe height?

@baev I use a HTML file as attachment (with a video player inside) can I add something in the HTML to increase the Allure iframe height so the video player looks ok?

sergiu-mezei-aera avatar Dec 09 '22 14:12 sergiu-mezei-aera

@sergiu-mezei-aera

My workaround, you can try this code inside your TestListener:

String videoUrl = "<Your video URL>";
String htmlContent = String.format("<html><body><video width=\"400\" height=\"750\" controls><source src=\"%s\" type=\"video/mp4\">Video</video><script type=\"text/javascript\">\n" +
                    "this.parent.document.getElementsByClassName(\"attachment__iframe\")[0].height = this.document.documentElement.scrollHeight;" +
                    "</script>" +
                    "</body></html>", videoUrl);
Allure.addAttachment("video", "text/html", htmlContent, ".html");

vietphamqq avatar Jan 18 '23 16:01 vietphamqq