From 98fed22b63cdc3544c3cc08c145cd5ce91a175e4 Mon Sep 17 00:00:00 2001 From: ciregenz Date: Wed, 29 Jul 2026 10:28:48 -0700 Subject: [PATCH] [eric] browser: split the opener-wait tests out at the file cap --- backend/tests/test_browser_send_script.py | 26 ---------------- backend/tests/test_opener_wait_settles.py | 37 +++++++++++++++++++++++ 2 files changed, 37 insertions(+), 26 deletions(-) create mode 100644 backend/tests/test_opener_wait_settles.py diff --git a/backend/tests/test_browser_send_script.py b/backend/tests/test_browser_send_script.py index 7d27777c..8a854b1d 100644 --- a/backend/tests/test_browser_send_script.py +++ b/backend/tests/test_browser_send_script.py @@ -286,29 +286,3 @@ async def test_login_wall_url_declines_before_any_fill(): current_url="https://x.com/i/flow/login") assert r is None assert not calls["clicks"] - - -@pytest.mark.asyncio -async def test_opener_wait_stops_once_the_surface_settles(): - """A budget spent waiting on a page that has stopped changing is pure cost. - - Fixed budgets were wrong in both directions: 1.8s missed gmail and linkedin, 5.3s still missed - a cold gmail compose window, and just raising the number taxes every run that was never going - to work. The stop condition is now page stability, so an opener that leads nowhere gives up as - soon as two reads match instead of sleeping out the rest.""" - # Opener clicked, then the same composer-less page twice: identical reads = nothing coming. - r, calls = await run(TASK, PROFILE, [PROFILE, PROFILE, PROFILE, PROFILE, PROFILE, PROFILE]) - assert r is None - # 6 sleeps were budgeted; settling must cut the reads well short of consuming them all. - assert calls["list"] < 9, f"kept polling a settled page: {calls['list']} reads" - - -@pytest.mark.asyncio -async def test_opener_wait_still_catches_a_late_composer(): - """The other direction: a surface that is still mounting must not be abandoned early, which is - the failure that made gmail intermittent.""" - # Changing reads (so never 'settled'), composer only on the 4th look. - late = [PROFILE, PROFILE, PROFILE, PROFILE + "\n[99]