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")
+48 -1
View File
@@ -6,7 +6,11 @@ import requests
from uuid import uuid4
from datetime import datetime, timedelta, timezone
from playwright.sync_api import expect
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
DPBOT_SIZE = 112147
@@ -473,3 +477,46 @@ def test_gists_list_preserves_comment_hierarchy(page, app_server):
expect(card.locator(".post-card-comments")).not_to_contain_text(f"{marker}-excluded")
nested = card.locator(".post-card-comments .comment-replies .comment-text")
expect(nested).to_contain_text(f"{marker}-reply")
def _seed_gist_with_long_code_line():
owner = str(uuid4())
get_table("users").insert(
{
"uid": owner,
"username": f"gcode_{owner[:8]}",
"email": f"{owner[:8]}@gcode.seed",
"password_hash": "x",
"role": "Member",
"is_active": True,
"created_at": datetime.now(timezone.utc).isoformat(),
}
)
uid = str(uuid4())
marker = f"gistcode-{uid[:8]}"
line = "unbreakable_identifier_" * 8
get_table("gists").insert(
{
"deleted_at": None,
"deleted_by": None,
"uid": uid,
"user_uid": owner,
"slug": make_combined_slug(marker, uid),
"title": marker,
"description": f"```python\n{line}\n```",
"source_code": "print('x')",
"language": "python",
"stars": 0,
"created_at": datetime.now(timezone.utc).isoformat(),
}
)
return marker
def test_gists_long_code_line_does_not_widen_layout(page, app_server):
marker = _seed_gist_with_long_code_line()
page.goto(f"{BASE_URL}/gists", wait_until="domcontentloaded")
card = page.locator(".gist-card").filter(has_text=marker).first
card.wait_for(state="visible")
assert card.locator("pre").count() == 1
assert_no_horizontal_overflow(page, ".gists-layout")
+21 -1
View File
@@ -2,7 +2,7 @@
from playwright.sync_api import expect
from tests.conftest import BASE_URL
from tests.conftest import BASE_URL, assert_no_horizontal_overflow
CONSENT = "ai_third_party"
@@ -65,3 +65,23 @@ def test_a_stranger_never_reaches_the_privacy_panel(bob):
)
expect(page.locator(".privacy-panel")).to_have_count(0)
expect(page.locator("form[action='/profile/alice_test/consent']")).to_have_count(0)
def test_profile_mobile_long_code_bio_does_not_widen_layout(mobile_page):
page, user = mobile_page
bio = "```python\n" + "unbreakable_identifier_" * 8 + "\n```"
page.request.post(
f"{BASE_URL}/profile/update",
form={"bio": bio, "location": "", "git_link": "", "website": ""},
)
try:
page.goto(
f"{BASE_URL}/profile/{user['username']}", wait_until="domcontentloaded"
)
page.locator(".profile-sidebar pre").first.wait_for(state="visible")
assert_no_horizontal_overflow(page, ".profile-layout")
finally:
page.request.post(
f"{BASE_URL}/profile/update",
form={"bio": "", "location": "", "git_link": "", "website": ""},
)