-
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
Documentation #388
Comments
Would be nice to have a globalSetup() documentation for v2. This made it work:
|
Re-opening because I do think good docs is still an issue. |
@vlucas what approach are you taking on docs? |
I am currently trying to use GitBook: https://vlucas.gitbooks.io/frisby/ I planned on pointing the main frisbyjs.com domain there when finished. It's free for open source projects. |
It's using a separate repo, right? I find the documentation generate from code way easier to keep in synch with code - like in jsdoc. I guess that for approaching it this way, we would need some CI (travis?) and a place to dump the built doc. |
I agree in principle, but I have never seen a pure generated doc file that I have actually really liked and found helpful, with useful examples of usage. |
The documentation at http://frisbyjs.com/docs/api/ is using obsolete methods (.create, .expectStatus etc) which cause errors when you are getting started with frisby and pull in the latest stuff (v2). Feels unnecessary. Thanks for a nice tool. |
I just pointed the main frisbyjs.com domain to gitbook, so it will point there when it is fully resolved. |
The lack of documentation is a real issue here. I have used v1 before and I liked it. Now we're trying out the v2 version but it's a real struggle with the current docs. Is this being worked on or should we try an another alternative? |
The docs are actively being worked on. What specifically is lacking that is blocking you? |
Please add examples on how to reuse cookies for authenticated sessions. Few APIs will lack authentication. E.g.: const apiBase = "some-url";
const user = {
username: "my-name",
password: "*****"
};
const sessionCookieName = "session-cookie-name=";
let sessionId = null;
it("Login and save session successfully", doneCb => {
const frb = frisby.post(`${apiBase}/login`, user);
frb.expect("status", 200);
// validate content of user model
frb.then(resp => {
const cookie = resp.headers.get("set-cookie");
const sidStart = cookie.indexOf(sessionCookieName) + sessionCookieName.length;
const sessionId = cookie.substring(sidStart, cookie.indexOf(";", sidStart));
console.log("SID", sessionId); // FIXME: don't print!
frb.done(done);
});
} |
hello, does frisby support async/await?
|
Yes. here is sample code. const frisby = require('frisby');
describe('should be a teapot', function() {
it('should be a teapot', async () => {
await frisby.get('http://httpbin.org/status/418').expect('status', 418);
return frisby.get('http://httpbin.org/status/200').expect('status', 200);
});
}); |
Any update on docs? V2 docs are awfully incomplete ... we are probably going to switch to a combo of Mocha/Chai/Supertest because of this |
@Archanian Understood. Is there anything specific that you were looking for that you feel is missing? |
Something as comprehensive as the docs that used to exist for the previous version would be a start, they were excellent. I can't give you specific examples because I myself know how to use the library pretty well, and have been using it for years. But for new developers on our team it is quite challenging, trying to learn and pick it up is very difficult when the current docs are so minimal. |
I just updated the website to list all the assertions and the nested HTTP spec example from the |
Awesome, thanks for the rapid response! |
@vlucas could you add a note in the docs about accessing the raw response, please? |
On next release, client will get raw response. Sample code const frisby = require('frisby');
const fs = require('fs');
it('save binary response', () => {
return frisby.setup({ request: { rawBody: true } })
.get('https://camo.githubusercontent.com/3f129b5ddde3ab0026f2d4c5460c4f15a8788bb8/68747470733a2f2f7777772e6672697362796a732e636f6d2f6173736574732f6672697362796a732e706e67')
.expect('status', 200)
.expect('header', 'Content-Type', 'image/png')
.then(res => {
let buf = Buffer.from(res.body);
return new Promise((resolve, reject) => {
fs.writeFile('res.body.png', buf, err => {
if (err) reject();
resolve();
});
});
});
}); Please wait a moment. |
Accessing the raw body is now available in the latest version |
Documentation is lacking for FrisbyJS v2. The README quickly shows howto get(), I managed to post by guessing the second parameter is the post body. Now I am struggling to find howto add headers.
ie: Expected 'TypeError: frisby.get(...).addHeader is not a function
I could spend some time getting familiar with the code but I'm lazy :-)
The text was updated successfully, but these errors were encountered: