Hey so i have a javascript function in a separate file.
function polling_orderitem_CNCL(source_id, condition) {
var i = 0;
while (i < 10) {
var result = karate.call('./polling/get_order_item.feature', {SourceId : source_id});
var sCode = result.response.data.attributes.statusCode;
karate.log('poll response', greeting);
if (greeting == condition) {
karate.log('condition satisfied, exiting');
return;
}
karate.log('sleeping');
java.lang.Thread.sleep(1000);
i++;
}
}
And im calling it in my feature file like so
* def waitUntil_CNCL = read('./polling/polling_orderitem_CNCL.js')
* call waitUntil_CNCL(ciSourceId, 'CNCL')
While running it i get the following error
[ERROR] Scenario: Get order and orderitem and verifications Time
elapsed: 0.003 s <<< ERROR
java.lang.RuntimeException: javascript evaluation failed: 'CNCL')
Caused by: javax.script.ScriptException:
<eval>:1:6 Expected ; but found )
'CNCL')
java.lang.Thread.sleep(1000);im confused. Java inside js?!