Fix Devii open-trigger race and close two flaky e2e waits

DeviiTerminal bound [data-devii-open] click listeners only after the
async /devii/session fetch resolved, silently dropping early clicks.
Switch to a single delegated document listener bound in the
constructor, matching the ModalManager/dp-lightbox pattern.

The steal-confirm and comment-vote e2e tests asserted DOM state right
after a click with no wait for the triggering POST to land, racing the
server under CI load. Wrap those clicks in page.expect_response.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-16 02:02:34 +02:00
co-authored by Claude Sonnet 5
parent fa8751a4ca
commit 8db0efff29
3 changed files with 19 additions and 10 deletions
+4 -1
View File
@@ -114,7 +114,10 @@ def test_comment_voted_state_persists(alice):
expect(
page.locator(".comment-text:has-text('Comment whose vote should persist')")
).to_be_visible()
page.locator(".comment-vote-btn").first.click()
with page.expect_response(
lambda r: "/votes/" in r.url and r.request.method == "POST"
):
page.locator(".comment-vote-btn").first.click()
expect(page.locator(".comment-vote-btn").first).to_have_class(
re.compile(r"\bvoted\b")
)