pytest-html icon indicating copy to clipboard operation
pytest-html copied to clipboard

Add logo to htmlreport.

Open nirajnagle opened this issue 4 years ago • 7 comments
trafficstars

Enhancement to add logo to Test Reports. Screen Shot 2021-02-15 at 11 11 59 PM

nirajnagle avatar Feb 16 '21 05:02 nirajnagle

Hello @BeyondEvil @gnikonorov Bumping this up for review. Thanks

nirajnagle avatar Feb 18 '21 00:02 nirajnagle

Hi @nirajnagle I've been busy with work, but perhaps @BeyondEvil or @ssbarnea can review

gnikonorov avatar Feb 18 '21 00:02 gnikonorov

Nice!

Going to add this to the next-gen report.

BeyondEvil avatar Jan 26 '22 15:01 BeyondEvil

Thanks @BeyondEvil

nirajnagle avatar Jan 26 '22 22:01 nirajnagle

I'm also looking to add a logo and I stumbled upon this: @BeyondEvil any chances it can be merged now or has been found another solution in the meantime? Or maybe should I consider to fork and apply it on my own? Thank you again.

Edit

Already found a quick alternative without forking, by using the option --css=logo.css

with a logo.css like

h1 { 
	background : url(./logo-my-com-dark.svg) no-repeat top right; margin-right: 30px;
}

giuliohome avatar May 28 '22 11:05 giuliohome

BTW I've also tested this patch but it looks like the call of the hook is missing in the report generator: I had to add the hook call session.config.hook.pytest_html_report_logo(report=self) in the code of html_report.py to make it work.

However (on my side) I've already solved my requirement via css, as explained above (and I'm happy with it atm)

giuliohome avatar May 29 '22 10:05 giuliohome

I wonder if the easiest and best solution here is to just allow HTML in the title hook. That way the user can add a logo using HTML and CSS (via the --css option).

BeyondEvil avatar Nov 04 '23 16:11 BeyondEvil