Datefields from KnockoutJS - NextensArelB/SwaggerGenerationTool GitHub Wiki
There are alot of validations, background calculations and page refreshes in the fiscal applications. In most parts of the fiscal applications a user can be too fast with his input. Most of the time on all environments except production this is even manually reproducible with enough typing speed. This is a serious issue for datefields, because of its extra format validation. If we would use the "manual input keys" function in karate, our datefields get populated wrong 9 out of 10 times. This is of course unacceptable:
All I tried was write down 15-12-2022 but it put the first 1 at the end of the datefield.
The solution is asigning a value to the element instead of "typing" the text. Although the datefield will show the value asigned, the value will not be picked up by any function within the application. To enable the use of the value of a datefield we call a JavaScript function in our code which triggers a JQuery change event. Originally the change event code was written in native JavaScript, but some old uses of the datefield in some aangiftepages did not respond to this event while the JQuery event did work.
The JQuery function:
This function is called from a feature while giving a locator as the argument:
This solution always works unless the webbrowser is frozen, but that is a bug on itself of course.
Because of the background function being triggered and most environments being slow, we put in (when necessary) a small delay of less than a second to give the application the chance to execute its code.