You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm unable to use a handler when using karate.websocket(), as intented in the documentation.
The test is:
@ws-test
Feature: public test
@websocket
Scenario: only listening to websocket messages
* def handler = function(msg) { karate.log('received:', msg); return msg.startsWith('hello'); }
* def socket = karate.webSocket('wss://ws.postman-echo.com/raw', handler)
* socket.send('hello world')
* listen 5000
* print listenResult
And the error I'm getting is:
[ERROR] Failures:
[ERROR] ExamplesTest.testParallel:15 js failed:
>>>>
01: karate.webSocket('wss://ws.postman-echo.com/raw', handler)
<<<<
org.graalvm.polyglot.PolyglotException: Cannot invoke "org.graalvm.polyglot.SourceSection.getCharacters()" because the return value of "org.graalvm.polyglot.Value.getSourceLocation()" is null
- com.intuit.karate.graal.JsFunction$Executable.<init>(JsFunction.java:95)
- com.intuit.karate.graal.JsFunction$Executable.<init>(JsFunction.java:89)
- com.intuit.karate.graal.JsFunction$Instantiable.<init>(JsFunction.java:132)
- com.intuit.karate.graal.JsLambda.<init>(JsLambda.java:37)
- com.intuit.karate.core.ScenarioBridge.webSocket(ScenarioBridge.java:1110)
- com.intuit.karate.core.ScenarioBridge.webSocket(ScenarioBridge.java:1101)
- <js>.:program(Unnamed:1)
classpath:examples/websocket/websocket.feature:7 ==> expected: <0> but was: <1>
This is something that only happens in karate 1.4.1, using 1.4.0 works normally and it calls the handler function and retrieve the messages as intended.
I've tried to use karate.toJava to call the handler, but didn't help.
@jrx-sjg thanks for the report, and it may take a while to get to this. I also wanted to be transparent about the fact that the websocket feature has not been very successful because of its design. recently we re-thought how to test async systems in general and are releasing a set of capabilities which will be closed-source. if you are interested I can let you know when websocket support lands, you can see a preview here: https://github.com/karatelabs/karate-addons/blob/main/karate-websocket/README.md
My questions are? Will be the open-source basic websocket implementation fixed? What license will be necessary to get access to karate-websocket addon?
Having websocket support was something that made us decide to use karate in our company. However, the fact that it doesn't work in the latest version is something that blocks us a lot.
Hi all.
I'm unable to use a handler when using karate.websocket(), as intented in the documentation.
The test is:
And the error I'm getting is:
This is something that only happens in karate 1.4.1, using 1.4.0 works normally and it calls the handler function and retrieve the messages as intended.
I've tried to use
karate.toJava
to call the handler, but didn't help.I've tested everything in a new minimal maven karate template as explained in https://github.com/karatelabs/karate/wiki/How-to-Submit-an-Issue, and you can replicate everything in the code in the attached .zip using the command:
mvn compile test
karate-template.zip
The text was updated successfully, but these errors were encountered: