allure2
allure2 copied to clipboard
Expand html attachments to iframe content height
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
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
that is not possible without adding custom code into html attachment
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;
In my view, 150px realy small, but what about the very large html attachments?
Also have such problem. We have many large html attachments and in report they present with scroll bar. Maybe better to enlarge them?
I'm having this same problem. Any movement/resolution on this issue?
Hi teams,
I've a case to embed iframe with kibana dashboard.
However, the 150px is too small to show clear dashboard
I have to click open a new tab to view whole kibana page.
It's better if the default attchment html height is suitable or around 600px.
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
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");