-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
Describe the bug
SelectionFeatureIT.testSelectionFeature (and potentially other tests) exhibits flaky behavior where assertions intermittently fail because the terminal buffer hasn't been updated yet when the assertion runs.
Observed Behavior
The test randomly fails at different assertion points with stale values:
term.sendKeys(Keys.BACK_SPACE);
assertThat(term.currentLine(), is("abc")); // Sometimes fails with "abcd"
term.sendKeys(Keys.DELETE);
assertThat(term.currentLine(), is("b")); // Sometimes fails with "ab"Root Cause
When sendKeys() sends a keystroke to the terminal:
- The key event handler in
xterm-console-mixin.tscallsterminal.write()with an escape sequence terminal.write()is asynchronous - xterm.js batches writes for performance- The CSI handler (e.g.,
backspace(),deleteChar()) processes the escape sequence later - The test's assertion runs before the write queue is processed
The currentLine property is a computed getter that reads fresh from the buffer, but the buffer itself hasn't been updated yet.
Expected behavior
Integration test must pass
Minimal reproducible example
SelectionFeatureIT
Add-on Version
3.2.1-SNAPSHOT
Vaadin Version
25.0.3
Additional information
No response
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Inbox (needs triage)