-
Notifications
You must be signed in to change notification settings - Fork 201
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Timeout's and other callbacks #200
Comments
The problem is with the time when done is being called: https://github.com/vlucas/frisby/blob/master/lib/frisby.js#L1149 You execute each callback (which might delay other callbacks) and finally call done(). I'm think promises could provide a clean solution to this problem: extend's prototype frisby with a function afterP which takes a function that should return a promise. To keep existing functionality working, the execution of after() also returns a promise that is also added to the Q.all() that waits for all promises to resolve and when resolved, jasmine's done is called. |
Yes... I'm having a tough time structuring some more complex tests due to this structure. Ex. I want to log in, use a response from that login to perform an auth'd operation, use the response from that to call one other api, etc. I haven't found a good way to orchestrate API flows without something like promises. |
This is possible now with Frisby v2 since it does not call any of the Jasmine methods directly. Please check it out and try v2. |
Is there a way to do a timeout on the client side (or functions that asynchronous, other than the requests built in in frisby) and make sure that the result of expect's that happen inside of the callback get added to the correct test?
This prints out:
The scenario I want to test is: I query a REST endpoint and I expect the server behind the REST api to return a response. After returning the response the server does runs followup code (payment) which is supposed to take max X time.
After X time I want to query another REST endpoint and I expect some stuff on the result to show that the system process actually worked.
Kind regards
Ben
The text was updated successfully, but these errors were encountered: