Reputation: 357
Using Karate I need to use assertion (negative assertion) but I need some repetitive check.
Example: when I delete application, it takes some time when it is removed from User Interface. I need to check If the app name is still there or not (every 3 seconds). If it is not present (the appName do not exist on page) then next test steps follow.
For assertion I use:
assert !locate('{//*[normalize-space(text()) = \'' + appName + '\']}').exists
Could you please help me with idea how to do periodically (every 3 sec) check the appName existence? Thank you.
Upvotes: 1
Views: 1207
Reputation: 58153
Use waitUntil()
* def fun = function(){ return !locate('#foo').exists ? true : null }
* waitUntil(fun)
EDIT: please also note this API revision we will be doing for 0.9.6 final: https://github.com/intuit/karate/issues/1148
Upvotes: 1