Skip to content

Add logo to htmlreport.#445

Open
nirajnagle wants to merge 2 commits intopytest-dev:masterfrom
nirajnagle:add_logo
Open

Add logo to htmlreport.#445
nirajnagle wants to merge 2 commits intopytest-dev:masterfrom
nirajnagle:add_logo

Conversation

@nirajnagle
Copy link
Copy Markdown

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

@nirajnagle
Copy link
Copy Markdown
Author

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

@gnikonorov
Copy link
Copy Markdown
Member

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

@BeyondEvil BeyondEvil added the next-gen Candidate for the next-gen project label Jan 26, 2022
@BeyondEvil
Copy link
Copy Markdown
Contributor

Nice!

Going to add this to the next-gen report.

@nirajnagle
Copy link
Copy Markdown
Author

Thanks @BeyondEvil

@giuliohome
Copy link
Copy Markdown

giuliohome commented May 28, 2022

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
Copy link
Copy Markdown

giuliohome commented May 29, 2022

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)

@BeyondEvil
Copy link
Copy Markdown
Contributor

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

next-gen Candidate for the next-gen project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants