Skip to content

Instantly share code, notes, and snippets.

@JasperH8g
Last active August 29, 2015 14:04
Show Gist options
  • Save JasperH8g/3ad5ad760ddf0d6e0a45 to your computer and use it in GitHub Desktop.
Save JasperH8g/3ad5ad760ddf0d6e0a45 to your computer and use it in GitHub Desktop.
Functional test with Node, Phantom and Jasmine
// npm install phantom
// npm install jasmine-node
// ./node_modules/jasmine-node/bin/jasmine-node phantom-and-jasmine.spec.js
var phantom = require('phantom');
describe("A suite", function() {
it("should open google.com", function(done) {
phantom.create(function(ph) {
ph.createPage(function(page) {
page.open("http://www.google.com", function(status) {
expect(status).toBe("success");
page.evaluate(function() {
return document.title;
}, function(result) {
expect(result).toBe("Google");
ph.exit();
done();
});
});
});
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment