fix(humanize): share timeout budget in select_option (follow-up to #307) - #354
Open
Kumario1 wants to merge 2 commits into
Open
fix(humanize): share timeout budget in select_option (follow-up to #307)#354Kumario1 wants to merge 2 commits into
Kumario1 wants to merge 2 commits into
Conversation
added 2 commits
June 5, 2026 15:52
CloakHQ#307 fixed the multi-wait timeout bug for click/dblclick/hover/ dragAndDrop on frame and ElementHandle, but the select_option paths were missed: each computes a shared deadline for actionability + hover, then calls the native select_option with the ORIGINAL full timeout instead of the remaining budget. A slow <select> could therefore wait up to ~2x the requested timeout. Thread the remaining budget into the native call across all variants: - page-level _human_select_option (sync + async) - ElementHandle _human_el_select_option (sync + async), both the move-failed early return and the normal path - frame _frame_select_option (sync + async) — add a shared deadline - Locator _humanized_select_option (sync + async) now delegates to the page-level method (like click/hover/fill) so there is a single source of truth for the budget instead of a second hover+native wait Refs CloakHQ#307.
Adds TestSelectOptionTimeoutBudget: the page-level native select_option receives the remaining budget (< requested) rather than the full timeout, the Locator wrapper delegates to page.select_option with the forwarded timeout, and the frame wrapper shares one deadline across hover + native select. Each would fail against the pre-fix behaviour (full timeout / no delegation). Refs CloakHQ#307.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #307.
58ccdb6fixed the multi-wait timeout bug (a 5s timeout waiting ~15s) forclick/dblclick/hover/dragAndDropon frame and ElementHandle bysharing a single
deadline+remainingMs()budget. Theselect_optionpaths were missed and still have the same class of bug.
Each
select_optionhelper computes a shared deadline for the actionability +hover steps, but then calls the native
select_optionwith the originalfull
timeoutinstead of the remaining budget — so the native call restarts theclock. A slow
<select>can therefore wait up to ~2× the requested timeout.The frame-level wrapper didn't even compute a deadline (full timeout to both the
hover and the native select).
Changes
Thread the remaining budget into the native call across every variant:
_human_select_option(sync + async)_human_el_select_option(sync + async) — both themove-failed early-return and the normal path
_frame_select_option(sync + async) — add a shared deadline_humanized_select_option(sync + async) now delegates topage.select_option(likeclick/hover/fillalready do), so there's asingle source of truth for the budget instead of a second hover + native wait
Testing
New
TestSelectOptionTimeoutBudget:select_optionreceives the remaining budget (< 5000), not the full timeoutLocator.select_optiondelegates topage.select_optionwith the forwarded timeoutselect_optionshares one deadline across hover + native selectEach test fails against the pre-fix behaviour. Full
tests/test_humanize_unit.pyrun: 76 passed; the only failures are 5 async tests that also fail on a clean
mainhere (the env has nopytest-asyncioconfigured) — unrelated to this change.