Skip to content

Instantly share code, notes, and snippets.

@grantmacken
Created January 22, 2016 21:25
Show Gist options
  • Save grantmacken/70daa7f8b5d83a8f0a38 to your computer and use it in GitHub Desktop.
Save grantmacken/70daa7f8b5d83a8f0a38 to your computer and use it in GitHub Desktop.
tapping a website with tape and phantom invoked with prove
#!/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();
});
});
});
});
});
@grantmacken
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment