I am facing an issue with my automated tests using selenium.
The problem lies with a particular input field in a web form:
<input data-bind="value: searchText, valueUpdate: 'afterkeydown'"></input>
Here is the model associated with this input field:
this.searchText = ko.observable('');
this.invert = ko.observable(false);
this.defferedSearchFilter = ko.pureComputed(function() {
return {
text: this.searchText(),
invert: this.invert()
}
}, this).extend({ rateLimit: { timeout: params.throttleInterval || 500, method: 'notifyWhenChangesStop' } });
The list is filtered based on the value in the defferedSearchFilter
variable. The autotest verifies this filter using the following algorithm:
- Enter value %95% in the input field
- Wait for filtration
- Check items in the list by clicking on them, as some information is hidden within the items.
However, occasionally (less than 1% of the time), the computed field fires twice because it does not detect the last entered symbol. For instance, logs collected from selenium and chrome confirm this:
Selenium: [2017-07-17 15:41:31,224] (DEBUG) Fill By.CssSelector: .col3 .entityContent #linkListFastSearch_0, value to input: %95% - success
At this point, selenium takes a screenshot. The value in the input is %95%
Chrome: [5624:5680:0717/154131.625:INFO:CONSOLE(42)] "FastSearch id = 4 changed. New text = "%95"", source: http://localhost/WebUI/Scripts/uicontrols/basic/fastsearch.js (42)
After filtration, selenium clicks on an item. Selenium: [2017-07-17 15:41:34,686] (DEBUG) Click By.CssSelector: [id='linkTargetCode_95'] - success
And after the throttle interval, the computed field changes to the correct value. Chrome: [5624:5680:0717/154134.802:INFO:CONSOLE(42)] "FastSearch id = 4 changed. New text = "%95%"", source: http://localhost/WebUI/Scripts/uicontrols/basic/fastsearch.js (42)
Has anyone else experienced a similar issue?