-
Notifications
You must be signed in to change notification settings - Fork 200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Running a frisby test from within a promise #127
Comments
+1 This will be magnificent. I have to collect a lot of information from an API. |
This would be very helpful. If I am using an internal promise, then there is no way to have these tests run without this. |
I was able to work around this by using Jasmine's beforeEach() and it() beforeEach(function(done) { aPromise().then(function(response){
}) }); it("contains spec with an expectation", function() { }) On Tue, Sep 23, 2014 at 4:50 PM, Diablomarcus notifications@github.com
|
That definitely works. I would prefer a way to not have to wrap all of my frisby test in external jasmine wrappers, but your solution seems to work. Thanks @dguerrier |
I've created a fork that allows you to use Promises from within frisby. Check it out at https://github.com/bgdavidx/frisby The API is the same; however you can use |
+1 for official support |
Here is a work around since it is based off of Jasmine and can use For example: 'use strict';
const frisby = require('frisby');
const api = require('./api-helpers');
// api.before returns a promise and is a local file which returns module exports
// describe() & it() are from Jasmine
describe('Products ', () => {
it("retrieves the products collection", (done) => {
api.before('Products', 'getCollection').then((seedData) => {
frisby.create('Ensure products collection is correct ')
.addHeaders(seedData.meta.headers)
.get('http://yoursite.dev/api/products')
.expectHeader('Content-Type', 'application/json')
.expectStatus(200)
.toss();
done();
});
});
}); |
Frisby v2.0 will fix this (see #316) since it uses promises internally. There is even a new API method that you can call to return the internal promise object from |
any update on Frisby v2.0 |
Frsiby v2.0 alpha is here and ready to use. It is now in the |
Is there anyway to get a frisby test to run if it's inside of a promise? I'm using an API based on promises to make API calls to set up the data for tests. If i were to use frisby's http calls it would pollute the test and require a ton of nested callbacks. I would like to simply do something like this.
theAPIcall().then(function(data){
frisby.create('Very useful for HTML, text, or raw output')
.get('http://asciime.heroku.com/generate_ascii?s=Frisby.js')
.inspectBody()
.toss()
});
The text was updated successfully, but these errors were encountered: