Created
January 22, 2016 21:25
-
-
Save grantmacken/70daa7f8b5d83a8f0a38 to your computer and use it in GitHub Desktop.
tapping a website with tape and phantom invoked with prove
This file contains hidden or 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
#!/usr/bin/env node | |
var test = require('tape'); | |
var phantom = require('phantom'); | |
var properties = require('properties-parser').read('./config'); | |
var website = 'http://' + properties.NAME | |
test('example tap test using phantom and tape', function (t) { | |
t.plan(2); | |
phantom.create(function (ph) { | |
ph.createPage(function (page) { | |
page.open(website, function (status) { | |
t.equal(status, 'success', 'status should success'); | |
page.evaluate(function () { return document.title; }, function (result) { | |
t.equal(result, properties.NAME, 'home page document title should repo name'); | |
ph.exit(); | |
}); | |
}); | |
}); | |
}); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
place tests in the t directory
use 'prove -v' to invoke tap tests
Oh yes prove can handle this even though it is node.
Crawl thru the site and test the things you have worked on.
Pretend you are a USER moving around the site
test if your data is feeding your templates etc
An easy way doing functional website tests in a ci enviroment