Skip to content

feat(client): implement printing pages as PDF#285

Merged
jonhoo merged 3 commits intojonhoo:mainfrom
M4SS-Code:print-api
Mar 29, 2025
Merged

feat(client): implement printing pages as PDF#285
jonhoo merged 3 commits intojonhoo:mainfrom
M4SS-Code:print-api

Conversation

@manuelpelloni
Copy link
Contributor

@manuelpelloni manuelpelloni commented Feb 7, 2025

This implements print page to PDF through the WebDriver2 API, which can for example be used to generate PDF documents from HTML + CSS templates.
I found the webdriver API really unforgiving, so I wrapped everything in constructors and tried to check as much as possible ahead of time.

Copy link
Owner

@jonhoo jonhoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really good PR, thank you! Some smaller notes. I also wonder how we could write a test for this?

@manuelpelloni manuelpelloni force-pushed the print-api branch 5 times, most recently from 51071e4 to 2c59560 Compare February 18, 2025 16:27
@manuelpelloni
Copy link
Contributor Author

Really good PR, thank you! Some smaller notes. I also wonder how we could write a test for this?

I wrote unit tests to cover all the builder error variants and an integration test that checks the magic bytes of the PDF.

@manuelpelloni manuelpelloni requested a review from jonhoo February 18, 2025 16:30
Copy link
Owner

@jonhoo jonhoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, we're super close now!

Copy link
Owner

@jonhoo jonhoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect, thank you! I'm going to hold off on releasing this just until #289 lands (which should be very soon) since it also has breaking changes. Thanks for sticking with it!

@jonhoo
Copy link
Owner

jonhoo commented Mar 22, 2025

Ah, some of the CI is racy: fixed in #293.

Btw, easier if you merge into this MR than force-push. It makes reviews much simpler on my end. I'll still squash before merging!

@jonhoo jonhoo mentioned this pull request Mar 29, 2025
@codecov
Copy link

codecov bot commented Mar 29, 2025

Codecov Report

Attention: Patch coverage is 78.83212% with 58 lines in your changes missing coverage. Please review.

Project coverage is 65.24%. Comparing base (1e4d29b) to head (d19c13c).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/print.rs 81.60% 46 Missing ⚠️
src/error.rs 0.00% 11 Missing ⚠️
src/client.rs 92.30% 1 Missing ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
src/lib.rs 96.15% <ø> (ø)
src/wd.rs 65.07% <ø> (ø)
src/client.rs 63.78% <92.30%> (+0.61%) ⬆️
src/error.rs 24.87% <0.00%> (-1.20%) ⬇️
src/print.rs 81.60% <81.60%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jonhoo jonhoo merged commit 7ccf9a6 into jonhoo:main Mar 29, 2025
19 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants