Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added view integration tests, updated other tests
- Loading branch information
1 parent
2115138
commit 42dcca8
Showing
8 changed files
with
103 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,22 @@ | ||
setup: | ||
rm -rf node_modules | ||
npm cache clean | ||
npm install | ||
|
||
test: | ||
npm install | ||
scripts/test | ||
|
||
test-quick: | ||
scripts/test | ||
|
||
start: | ||
npm start | ||
|
||
open: | ||
(sleep 2 && open http://localhost:3000) & | ||
npm start | ||
|
||
test: | ||
scripts/test | ||
|
||
.PHONY: start open test | ||
|
||
.PHONY: setup test test-quick start open |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
extends ../shared/layout | ||
|
||
block title | ||
| Dashboard - Components test | ||
|
||
block content | ||
.dash-header | ||
.half-drop | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#!/bin/bash | ||
|
||
TESTS=`find lib -name '*.test.js'` | ||
TESTS=`find lib -name '*.test.js' && find test -name '*.test.js'` | ||
|
||
node_modules/.bin/mocha -R list $TESTS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
var should = require('should'); | ||
var Zombie = require('zombie'); | ||
var assert = require('assert'); | ||
|
||
var utils = require('../lib/shared/test.utils'); | ||
|
||
utils.startApp(3002); | ||
|
||
describe('Browser', function() { | ||
describe('of an unregistered user', function() { | ||
var browser = new Zombie(); | ||
it('should be able to view the landing page', function(done) { | ||
browser.visit('http://localhost:3002', function() { | ||
assert.ok(browser.success); | ||
browser.text('title').should.include('Sign in'); | ||
return done(); | ||
}); | ||
}); | ||
it('should not be able to view the dashboard', function(done) { | ||
browser.visit('http://localhost:3002/dashboard', function() { | ||
assert.ok(browser.success); | ||
browser.text('title').should.include('Sign in'); | ||
browser.text('.flash-messages').should.include('Please log in first'); | ||
return done(); | ||
}); | ||
}); | ||
}); | ||
describe('of a registered user', function() { | ||
var browser = new Zombie(); | ||
it('should be able to view the landing page', function(done) { | ||
browser.visit('http://localhost:3002', function() { | ||
assert.ok(browser.success); | ||
browser.text('title').should.include('Sign in'); | ||
return done(); | ||
}); | ||
}); | ||
it('should get an error with bad credentials', function(done) { | ||
browser | ||
.fill('email', 'test@dummy.com') | ||
.fill('password', 'wrong') | ||
.pressButton('Sign in') | ||
.then(function() { | ||
assert.ok(browser.success); | ||
browser.text('title').should.include('Sign in'); | ||
browser.text('.flash-messages').should.include('Sorry, that username or password was not found'); | ||
return done(); | ||
}) | ||
.fail(done); | ||
}); | ||
it('should be able to sign in with good credentials', function(done) { | ||
browser | ||
.fill('email', 'test@dummy.com') | ||
.fill('password', 'bacon') | ||
.pressButton('Sign in') | ||
.then(function() { | ||
assert.ok(browser.success); | ||
browser.text('title').should.include('Dashboard'); | ||
return done(); | ||
}) | ||
.fail(done); | ||
}); | ||
it('should be able to reload the dashboard', function(done) { | ||
browser.visit('http://localhost:3002/dashboard', function() { | ||
assert.ok(browser.success); | ||
browser.text('title').should.include('Dashboard'); | ||
return done(); | ||
}); | ||
}); | ||
it('should be able to sign out', function(done) { | ||
browser.clickLink('Sign out', function() { | ||
assert.ok(browser.success); | ||
browser.text('title').should.include('Sign in'); | ||
browser.text('.flash-messages').should.include('You have been signed out'); | ||
return done(); | ||
}); | ||
}); | ||
}); | ||
}); |