Apologies if this has been answered before, I spent most of today looking and found some similar issues but nothing that answered my specific problem.
I am posting to a TransactionAPI with 'TransactionID'-> sleeping thread for 10 minutes (because this is ensures that the transaction posts in the next step) -> calling read api with
Then match response.results[*].trans.id contains TransactionID
this currently works, but sleep isn't great.. and I wanted to take full advantage of karate. The [*] is because the new TransactionID appears in the final index of the returned array response. so the first time it calls the readAPI it gets an array of [5], and the new TransactionID will appear in [6] (and I couldn't figure out how to make it get array.length + 1 and wait for that one to appear)
Reading the responses here Karate framework retry until not working as expected and the linked ones inside i tried a few things:
And retry until response.results[-1].trans.id.includes('TransactionID')
And retry until response.results[(@.length-1)].trans.id.includes('TransactionID')
These return an error:
org.graalvm.polyglot.PolyglotException: SyntaxError: Unnamed:1:18 Expected an operand but found error
I tried the in-line javascript function mentioned in the above link, but could not get it to work either.
Javascript function mentioned:
* def isValid = function(x){ return karate.match(x, { tokens: '##[_ > 0]' }).pass }
# ...
And retry until isValid(response)