How to use timeout inside spec handler #355
Answered
by
ASaiAnudeep
JyotiPMallick
asked this question in
Q&A
-
From my component test I am using the spech handler for few of my workflows. I am experiencing some slowness in my application so how to add time out inside the spec handler. For example : addSpecHandler("login", ({ spec }) => {
spec.post(`${LOGIN_URL}`);
spec.withJson({
mobileNo: "9876543211",
referralCode: "string",
});
spec.expectStatus(200);
spec.stores("BEARER_TOKEN", "jwt");
}); I want to use timeout in the above handler, I tried with addSpecHandler('login', ({spec}) => {
setTimeout(() => {
spec.post(`${LOGIN_URL}`);
spec.withJson({
mobileNo: "9876543211",
referralCode: "string",
});
spec.expectStatus(200);
spec.stores('BEARER_TOKEN', 'jwt');
}, 15000);
}); But not working |
Beta Was this translation helpful? Give feedback.
Answered by
ASaiAnudeep
May 21, 2024
Replies: 1 comment
-
Try using withRequestTimeout addSpecHandler("login", ({ spec }) => {
spec.withRequestTimeout(10000)
spec.post(`${LOGIN_URL}`);
spec.withJson({
mobileNo: "9876543211",
referralCode: "string",
});
spec.expectStatus(200);
spec.stores("BEARER_TOKEN", "jwt");
});
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
JyotiPMallick
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Try using withRequestTimeout