Keep composers usable, group actions and notifications, and drop the tool-count cap

Comment and post layouts stay full width on small screens. Secondary actions live in the More menu. Notifications can be grouped and throttled, and Enter can submit when that profile setting is on. Emulated-tool models accept large catalogs, with reserved names aliased on the wire and the catalog cached per owner. A dropped service-worker navigation is retried once. The test server waits 120s to finish importing before it is stopped.
This commit is contained in:
2026-11-12 15:29:27 +01:00
parent dbdd0d29dd
commit 8a48e3ef85
103 changed files with 2680 additions and 378 deletions
+87 -1
View File
@@ -1,7 +1,7 @@
# retoor <retoor@molodetz.nl>
from playwright.sync_api import expect
from tests.conftest import BASE_URL
from tests.conftest import BASE_URL, assert_no_horizontal_overflow
from tests.e2e.post import create_post
@@ -43,6 +43,92 @@ def test_cancel_inline_edit(alice):
expect(page.locator(".comment-text:has-text('Keep this body')")).to_be_visible()
def _composer_metrics(textarea):
return textarea.evaluate(
"""el => {
const form = el.closest("form");
const actions = form.querySelector(".comment-form-actions");
const field = el.getBoundingClientRect();
const formBox = form.getBoundingClientRect();
const actionBox = actions.getBoundingClientRect();
const column = document.querySelector(".post-page, .feed-main");
const columnBox = column ? column.getBoundingClientRect() : formBox;
return {
field: field.width,
fieldHeight: field.height,
form: formBox.width,
column: columnBox.width,
actionsTop: actionBox.top,
actionsWidth: actionBox.width,
fieldBottom: field.bottom,
overflow: document.documentElement.scrollWidth - document.documentElement.clientWidth,
};
}"""
)
def _assert_composer_has_room(metrics, minimum_field, full_width=False):
slack = 8 if full_width else 64
assert metrics["field"] >= metrics["form"] - slack, metrics
assert metrics["field"] >= minimum_field, metrics
assert metrics["fieldHeight"] < 90, metrics
assert metrics["actionsTop"] >= metrics["fieldBottom"] - 2, metrics
assert metrics["actionsWidth"] <= metrics["form"] + 1, metrics
assert metrics["overflow"] <= 1, metrics
def _check_composer(page, textarea, minimum_field, full_width, min_column):
textarea.fill("helps a lot.")
metrics = _composer_metrics(textarea)
_assert_composer_has_room(metrics, minimum_field, full_width)
assert metrics["column"] >= min_column, metrics
def test_comment_composer_field_keeps_its_width(alice):
page, _ = alice
page.set_viewport_size({"width": 1280, "height": 800})
create_post(page, "devlog", "Post for the comment composer width")
_post_comment(page, "Parent for the reply box")
composer = page.locator(".comment-form:not(.comment-reply-form) textarea[name='content']").last
_check_composer(page, composer, 320, False, 480)
page.locator("[data-action='reply']").last.click()
reply = page.locator(".comment-reply-form textarea[name='content']")
expect(reply).to_be_visible()
_check_composer(page, reply, 320, False, 480)
page.set_viewport_size({"width": 768, "height": 1024})
_check_composer(page, reply, 280, False, 480)
page.set_viewport_size({"width": 390, "height": 844})
_check_composer(page, reply, 200, True, 300)
_check_composer(page, composer, 200, True, 300)
page.set_viewport_size({"width": 360, "height": 740})
_check_composer(page, reply, 180, True, 280)
assert_no_horizontal_overflow(page, ".post-page-layout")
page.set_viewport_size({"width": 1280, "height": 800})
page.goto(f"{BASE_URL}/feed", wait_until="domcontentloaded")
card = page.locator(".post-card").filter(has_text="Parent for the reply box").first
expect(card).to_be_visible()
card.locator("[data-action='reply']").first.click()
feed_reply = card.locator(".comment-reply-form textarea[name='content']")
expect(feed_reply).to_be_visible()
_check_composer(page, feed_reply, 200, False, 480)
page.set_viewport_size({"width": 768, "height": 1024})
_check_composer(page, feed_reply, 200, False, 400)
page.set_viewport_size({"width": 390, "height": 844})
_check_composer(page, feed_reply, 160, True, 300)
page.set_viewport_size({"width": 360, "height": 740})
_check_composer(page, feed_reply, 140, True, 280)
assert_no_horizontal_overflow(page, ".feed-layout")
def test_non_owner_sees_no_edit_button(alice, bob):
page, _ = alice
create_post(page, "random", "Post owned by alice")