javascript - How to set values ​​in a form automatically with Node.js -


i'm doing lot of requests , want see status code, there areas require authenticated access want check.
this isn't test end-to -end, not useful use zombie.js or nightwatch.js.

there possibility fill login form , making requests go after?

have seen supertest?

npm install supertest --save-dev 

you can use simulate request , check execution or status code.

var request = require('supertest')   , express = require('express');  var app = express();  app.get('/user', function(req, res){   res.send(200, { name: 'tobi' }); });  request(app)   .get('/user')   .expect('content-type', /json/)   .expect('content-length', '20')   .expect(200)   .end(function(err, res){     if (err) throw err;   }); 

with mocha:

describe('get /users', function(){   it('respond json', function(done){     request(app)       .get('/user')       .set('accept', 'application/json')       .expect('content-type', /json/)       .expect(200, done);   }) }) 

Comments

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -