-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Closed
Labels
Description
The following test (
| pytestmark = pytest.mark.asyncio |
@pytest.mark.parametrize(
"margin",
[
{"top": 27.94},
{"left": 21.59},
{"right": 21.59},
{"bottom": 27.94},
{"top": 27.94, "left": 21.59, "right": 21.59, "bottom": 27.94},
],
ids=[
"top",
"left",
"right",
"bottom",
"all",
],
)
async def test_margin_same_as_page_dimension(
bidi_session,
top_context,
inline,
assert_pdf_content,
margin,
):
page = inline("Text")
await bidi_session.browsing_context.navigate(
context=top_context["context"], url=page, wait="complete"
)
print_value = await bidi_session.browsing_context.print(
context=top_context["context"],
shrink_to_fit=False,
margin=margin,
)
# Check that content is out of page dimensions.
await assert_pdf_content(print_value, [{"type": "string", "value": ""}])...tries to assert that setting the margin the same as the page dimension produces an empty PDF. This works on Firefox, but it does not work on Chromium.
On Chromium, it throws webdriver.bidi.error.UnknownErrorException: unknown error (invalid print parameters: content area is empty), which is technically correct. Chromium cannot handle printing an empty content area.
This condition does not seem to be enforced by the Classic spec in any way (c.f. https://w3c.github.io/webdriver/#print-page), suggesting it's just an arbitrary test. BiDi mostly mirrors the classic spec for print.
Can we rewrite this test so that it does not try to generate a PDF for a 0x0 page? I mean, what is the utility of doing so anyway?
Reactions are currently unavailable