fix: add live age badge and zoom cursor to bot screenshots, bind monitor on startup, and retry feed assertions in e2e tests

This commit is contained in:
2026-06-14 15:20:35 +00:00
parent d75d5dc6a8
commit 9ed611097d
5 changed files with 88 additions and 24 deletions
+17 -10
View File
@@ -24,6 +24,16 @@ def _profile(page, username):
def _click_toggle(page, category):
page.locator(f"[data-customization-toggle='{category}']").click()
page.locator(".dialog-overlay.visible .dialog-confirm").click()
def _goto_feed_until(page, predicate, timeout=5.0):
deadline = time.time() + timeout
content = ""
while time.time() < deadline:
page.goto(f"{BASE_URL}/feed", wait_until="domcontentloaded")
content = page.content()
if predicate(content):
return content
time.sleep(0.2)
return content
import re
from uuid import uuid4
from datetime import datetime, timedelta, timezone
@@ -415,15 +425,13 @@ def test_global_toggle_suppresses_rendering_and_persists(bob):
sentinel = f"sentinel-{int(time.time() * 1000)}"
_seed_global_css(uid, sentinel)
page.goto(f"{BASE_URL}/feed", wait_until="domcontentloaded")
assert sentinel in page.content()
assert sentinel in _goto_feed_until(page, lambda c: sentinel in c)
_profile(page, user["username"])
_click_toggle(page, "global")
expect(page.locator("[data-customization-toggle='global']")).to_have_text("Enable")
page.goto(f"{BASE_URL}/feed", wait_until="domcontentloaded")
assert sentinel not in page.content()
assert sentinel not in _goto_feed_until(page, lambda c: sentinel not in c)
_profile(page, user["username"])
expect(page.locator("[data-customization-toggle='global']")).to_have_text("Enable")
@@ -433,8 +441,7 @@ def test_global_toggle_suppresses_rendering_and_persists(bob):
_click_toggle(page, "global")
expect(page.locator("[data-customization-toggle='global']")).to_have_text("Disable")
page.goto(f"{BASE_URL}/feed", wait_until="domcontentloaded")
assert sentinel in page.content()
assert sentinel in _goto_feed_until(page, lambda c: sentinel in c)
def test_pagetype_toggle_is_independent(bob):
@@ -452,16 +459,16 @@ def test_pagetype_toggle_is_independent(bob):
"user", uid, page_type, "css", f".{page_sentinel} {{ color: blue; }}"
)
page.goto(f"{BASE_URL}/feed", wait_until="domcontentloaded")
body = page.content()
body = _goto_feed_until(
page, lambda c: global_sentinel in c and page_sentinel in c
)
assert global_sentinel in body
assert page_sentinel in body
_profile(page, user["username"])
_click_toggle(page, "pagetype")
page.goto(f"{BASE_URL}/feed", wait_until="domcontentloaded")
body = page.content()
body = _goto_feed_until(page, lambda c: page_sentinel not in c)
assert global_sentinel in body
assert page_sentinel not in body