I have a 10 scenarios, all of them must have 1 min delay after executing background. I call my delay function in background. The problem is that all scenarios call background, and I have to wait 10 minutes.
Is there a way to call my wait function one for all scenarios?
This is my background and one of my scenarios:
Background:
* call read('classpath:cleanup.feature')
* def login = call read('classpath:init/init.user.feature')
* def sleep =
"""
function(seconds){
for(i = 0; i <= seconds; i++)
{
java.lang.Thread.sleep(1*1000);
karate.log(i);
}
}
"""
* call sleep 60
Scenario: Correct
# Step one: requesting a verification code
Given url karate.get('urlBase') + "account/resendMobileActivationVerificationCode"
And request {"mobile": #(defaultMobile)}
And header X-Authorization = login.token
And header NESBA-Authorization = login.nesba
When method post
Then status 200
And match response ==
"""
{
"status":0,
"message":"#(status0persianMessage)",
"result": true
}
"""
Use callonce
:
* callonce sleep 60
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With