I recently updated Karate from 1.2.0 and Java 8 to 1.4.1 and Java 11. Previously I had defined Javascript Functions and Java Types globally in karate-config.js, which were used frequently.
config.isValidDateTime = read('classpath:validators/datetime-validator.js')
config.TimestampObject = Java.type('utils.Timestamp')
For the Java Types, this no longer seems to work, I cannot execute the methods. When I call e.g.
* set userProfile.firstName = UserMockHelper.getRandomFirstName();
I receive the error message:
org.graalvm.polyglot.PolyglotException: ReferenceError: "UserMockHelper" is not defined
The Javascript function can still be executed directly in the scenario, but it does not work within a JSON validation, such as
And match response.docs[0] contains { timestamp: "#? isValidDateTime(_)" }
I now always get the following error message:
TypeError: execute on {} failed due to: Message not supported.