Files
devplacepy/tests/e2e/notifications/grouping.py
T
retoor 8a48e3ef85
DevPlace CI / test (push) Failing after 3h10m39s
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.
2026-11-12 15:29:27 +01:00

55 lines
1.9 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# retoor <retoor@molodetz.nl>
from datetime import datetime, timezone
from playwright.sync_api import expect
from tests.conftest import BASE_URL
from devplacepy.database import get_table, refresh_snapshot
from devplacepy.utils import generate_uid
JSON = {"Accept": "application/json"}
def _seed_votes(user_uid, count=4):
now = datetime.now(timezone.utc).isoformat()
table = get_table("notifications")
for i in range(count):
table.insert(
{
"uid": generate_uid(),
"user_uid": user_uid,
"type": "vote",
"message": f"voter-{i} ++'d your post",
"related_uid": user_uid,
"target_url": "/posts/grouped-seed",
"read": False,
"created_at": now,
}
)
refresh_snapshot()
def test_grouped_notifications_card(alice, seeded_db):
page, user = alice
uid = get_table("users").find_one(username=user["username"])["uid"]
_seed_votes(uid)
try:
page.goto(f"{BASE_URL}/notifications", wait_until="domcontentloaded")
card = page.locator("[data-notification-group]").first
expect(card).to_be_visible(timeout=10000)
expect(card.locator(".notif-group-count")).to_have_text("×4")
finally:
get_table("notifications").delete(user_uid=uid, target_url="/posts/grouped-seed")
refresh_snapshot()
def test_grouping_toggle_on_profile_notifications_tab(alice):
page, user = alice
username = user["username"]
page.goto(f"{BASE_URL}/profile/{username}?tab=notifications", wait_until="domcontentloaded")
panel = page.locator("[data-notif-prefs]")
expect(panel.locator("form[action$='/notifications/grouping']")).to_be_attached()
expect(panel.locator("form[action$='/notifications/throttling']")).to_be_attached()
expect(page.locator("[data-enter-to-submit-card]")).to_be_attached()