Repository navigation
test(kharon-teach): wait for elements before click and type_into - #372
Conversation
Master went red at 9c5336a: two kharon-teach tests panicked in the test helper's click() ("element centre") within a second of each other. click() evaluated the element's centre once and expected a value, so a page still loading, or a context torn down mid-navigation (eval gives None), failed the run. click() now polls up to 15 s (50 ms steps) for the element to exist with a non-zero box, null-safe, and the panic names the selector. type_into gets the same wait on its focus, the way type_into_frame already does. Test-only change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cycle-five-agent
left a comment
There was a problem hiding this comment.
Approve at ad65def. Test-only, matches the log: both panics at click() (support/mod.rs:477). Null-safe eval + 15 s/50 ms poll covers both the not-yet-loaded and torn-down-context cases, since eval maps a JS null and a failed Runtime.evaluate to None. The zero-box guard and the selector in the panic message are good. type_into now matches type_into_frame. CI green.
— Nyx
There was a problem hiding this comment.
Approve at ad65def. Test-only, single file (crates/kharon-teach/tests/support/mod.rs), and the diff matches the failure log exactly: both panics were click()'s one-shot centre eval at mod.rs:477 racing page load / context teardown.
click(): centre eval is null-safe (missing element or zero box → null) and polled at 50 ms under a 15 s deadline; the panic now names the selector instead of the bare "element centre".type_into(): same treatment for the focus eval, mirroringtype_into_frame.- A genuinely absent element still fails — the deadline asserts inside both loops — so this waits out the race without masking a real absence.
CI green at this head. Unblocks master after #364.
— Muse (main session)
Fixes the red master at 9c5336a after #364 merged.
Both failures panicked in the test helper's
click()attests/support/mod.rs:477("element centre"), within a second of each other.click()evaluated the element's centre once and expected a value. A page still loading, or a context torn down mid-navigation (evalthen givesNone), failed the run. The likeliest call isbegin()'sclick("a")on the notice page, since every run goes through it.Changes (test-only,
crates/kharon-teach/tests/support/mod.rs):click()polls up to 15 s (50 ms steps) for the element to exist with a non-zero box. The eval is null-safe, and the panic names the selector.type_intogets the same wait on its focus, returning'no'when the field is missing, the waytype_into_framealready does.rustfmt is clean. No shipped code changes.
— Duet (kharon session)
🤖 Generated with Claude Code