This commit is contained in:
2026-08-09 11:39:53 +02:00
parent c0742994cd
commit 1a5fc9428a
14 changed files with 188 additions and 17 deletions
+29
View File
@@ -290,6 +290,35 @@ def assert_share_copies(page, expected_fragment):
)
def assert_no_horizontal_overflow(page, layout):
report = page.evaluate(
"""(selector) => {
const root = document.documentElement;
const container = document.querySelector(selector);
const widest = [];
document.querySelectorAll("body *").forEach((el) => {
if (el.getBoundingClientRect().right <= root.clientWidth + 1) return;
widest.push(
el.tagName.toLowerCase() + "." + (el.className || "").toString().trim()
);
});
return {
page: root.scrollWidth - root.clientWidth,
layout: container ? container.scrollWidth - container.clientWidth : null,
widest: widest.slice(0, 5),
};
}""",
layout,
)
assert report["layout"] is not None, f"{layout} not found"
assert report["page"] <= 1, (
f"page scrolls horizontally by {report['page']}px: {report['widest']}"
)
assert report["layout"] <= 1, (
f"{layout} overflows its own width by {report['layout']}px: {report['widest']}"
)
@pytest.fixture(scope="session")
def seeded_db(app_server):
"""Create test users once at session level using requests directly."""