Protractor runs tests against your application running in a real browser, interacting with it as a user would.
describe('Users', function() {
describe('login', function() {
it('should have username and password form', function() {
browser.get('/login');
var emailInput = element(by.id('username'));
var passwordInput = element(by.id('password'));
expect(emailInput.isPresent()).toBeTruthy();
expect(passwordInput.isPresent()).toBeTruthy();
});
});
});Jasmine is a behavior-driven development framework for testing JavaScript code.
var request = require('supertest')(app)
describe("users", function() {
describe("signup", function() {
it("should return 400 if there is no username", function(done) {
request.post('/api/users/signup')
.set('x-requested-with', 'XMLHttpRequest')
.send({password: "testing"})
.expect(400)
.end(function(err, res) {
if (err) return done.fail(err);
done();
});
});
});
});