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
+60 -1
View File
@@ -37,7 +37,11 @@ def _goto_feed_until(page, predicate, timeout=5.0):
import re
from uuid import uuid4
from datetime import datetime, timedelta, timezone
from tests.conftest import BASE_URL, assert_share_copies
from tests.conftest import (
BASE_URL,
assert_no_horizontal_overflow,
assert_share_copies,
)
from devplacepy.database import get_table
from devplacepy.utils import make_combined_slug
def _seed_posts(count):
@@ -965,3 +969,58 @@ def test_feed_scroll_not_restored_on_fresh_visit(alice):
page.goto(f"{BASE_URL}/feed", wait_until="domcontentloaded")
page.wait_for_timeout(600)
assert page.evaluate("window.scrollY") < 60
def _seed_post_with_long_code_line(topic="devlog"):
owner = str(uuid4())
get_table("users").insert(
{
"uid": owner,
"username": f"code_{owner[:8]}",
"email": f"{owner[:8]}@code.seed",
"password_hash": "x",
"role": "Member",
"is_active": True,
"created_at": datetime.now(timezone.utc).isoformat(),
}
)
uid = str(uuid4())
marker = f"longcode-{uid[:8]}"
line = "unbreakable_identifier_" * 10
get_table("posts").insert(
{
"deleted_at": None,
"deleted_by": None,
"uid": uid,
"user_uid": owner,
"slug": make_combined_slug(marker, uid),
"title": marker,
"content": f"```python\n{line}\n```",
"topic": topic,
"project_uid": None,
"image": None,
"stars": 0,
"created_at": datetime.now(timezone.utc).isoformat(),
}
)
return marker
def test_feed_long_code_line_does_not_widen_layout(alice):
page, user = alice
marker = _seed_post_with_long_code_line()
page.goto(f"{BASE_URL}/feed", wait_until="domcontentloaded")
card = page.locator(".post-card").filter(has_text=marker).first
card.wait_for(state="visible")
assert card.locator("pre").count() == 1
assert_no_horizontal_overflow(page, ".feed-layout")
def test_dashboard_long_code_line_does_not_widen_layout(alice):
page, user = alice
marker = _seed_post_with_long_code_line()
page.goto(f"{BASE_URL}/", wait_until="domcontentloaded")
card = page.locator(".dashboard-post-card").filter(has_text=marker).first
card.wait_for(state="visible")
assert card.locator("pre").count() == 1
assert_no_horizontal_overflow(page, ".dashboard-main")