testbench
testbench copied to clipboard
selectByText for ComboBoxElement not working when there is an element selected
When there is an element selected by default in the combobox, and the selectByText is used, this previous element is not clear. The text for the new element is written and append to the old. so no new value is found.
I was reviewing the code for selectByText:
public void selectByText(String text) { if (this.isReadOnly()) { throw new ReadOnlyException(this); } else if (!this.isTextInputAllowed()) { this.selectByTextFromPopup(text); } else { this.getInputField().clear(); this.getInputField().sendKeys(new CharSequence[]{text}); this.selectSuggestion(text); } }
and doing debugging seems that the this.getInputField().clear(); line is doing nothing. So the new String is sent without clear the combo content.
For previous versions of Firefox it´s working fine. But for latest one is not. Also in Chrome is not working.
I´m using TestBench: 5.2.0, Vaadin: 8 Firefox: 65.0 Chrome: 72.0.3626.96
Thanks in advance.
This looks like a duplicate of #1122, I won't close it because it seems to also be affecting Firefox now.
There is an open PR to fix ComboBoxElement#clear()
implementation https://github.com/vaadin/framework/pull/11430 I'll add a comment so that FF is also checked
Updating to a more recent version of vaadin-testbench-api
should do it:
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-testbench-api</artifactId>
<version>8.8.3</version>
<scope>test</scope>
</dependency>