-
Notifications
You must be signed in to change notification settings - Fork 283
Add session to generate screenshots from html #877
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
Add session to generate screenshots from html #877
Conversation
The used tool doesn't support CSS variables and isn't maintained anymore.
The screenshots are generated by a server running in a docker container which uses a headless Chrome to render the HTML.
The examples generated the reports to STDOUT but in the docs the filename used by the test was mentioned. Now the docs match to the call in the shell script. The test reads the original content before executing the test because the test changes the content directly.
@latk Please can you check if this dependency is OK? I want to get rid of the manual capturing of the HTML for the documentation. Maybe we can try to capture the screenshots during the build of the documentation, if there is nothing changed in the HTML the file is binary identical. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #877 +/- ##
==========================================
+ Coverage 95.27% 95.30% +0.03%
==========================================
Files 54 54
Lines 4525 4534 +9
Branches 893 893
==========================================
+ Hits 4311 4321 +10
Misses 130 130
+ Partials 84 83 -1 ☔ View full report in Codecov by Sentry. |
sure, wkhtml2pdf seems obsolete, and https://github.com/bedrockio/export-html looks OK (open source, easy to use via scripts)
Not the biggest fan of this because that's a manual step. We already automatically build and launch Docker containers for tests, so starting the Chrome container automatically could make sense as well.
That's tolerable if there's no other way, but nice crisp PNGs would be nicer. The container's docs mention PNG export – what challenges did you encounter when using that feature?
If that's the case that's great. Previously, the screenshots would include metadata like the creation date (I think), which made it impossible to check if the screenshots were up to date. |
36bff53
to
a0ec119
Compare
- Generate screenshots if documentation isn't build in a container - If documentation is generated in the pipeline fail if files are modified.
2a8a69c
to
765ac5a
Compare
276a96c
to
745e77f
Compare
745e77f
to
41f69fb
Compare
The used tool wkhtmltoimage was hard to get running on my Mac and I discovered that the tool can't handle CSS variables. The tool isn't developed any further and I searched for something else.
This PR adds a session to generate a JPEG from a HTML by using a server running a Chrome in a headless mode. The server needs to be started manually by the user if it's not started yet. The server wasn't able to provide PNG therefore I switched to JPEG.
I updated the docs and the examples that they fit together.