forked from retoor/devplacepy
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:
@@ -128,7 +128,8 @@ def test_steal_takes_build_and_pays_thief(bob):
|
||||
steal.click()
|
||||
confirm_btn = page.locator(".dialog-confirm")
|
||||
confirm_btn.wait_for(state="visible")
|
||||
confirm_btn.click()
|
||||
with page.expect_response(lambda r: "/steal" in r.url and r.request.method == "POST"):
|
||||
confirm_btn.click()
|
||||
expect(page.locator("form[data-game-action='steal']")).to_have_count(0)
|
||||
page.wait_for_timeout(400)
|
||||
assert _farm_coins("bob_test") == 18
|
||||
@@ -165,7 +166,8 @@ def test_victim_notification_names_the_raider_and_the_amount(bob):
|
||||
steal.click()
|
||||
confirm_btn = page.locator(".dialog-confirm")
|
||||
confirm_btn.wait_for(state="visible")
|
||||
confirm_btn.click()
|
||||
with page.expect_response(lambda r: "/steal" in r.url and r.request.method == "POST"):
|
||||
confirm_btn.click()
|
||||
expect(page.locator("form[data-game-action='steal']")).to_have_count(0)
|
||||
page.wait_for_timeout(400)
|
||||
note = get_table("notifications").find_one(
|
||||
|
||||
Reference in New Issue
Block a user