Write Jasmine specs and check the webpages with PhantomJS. Similar to capybara-webkit.
You only need phasmine.js
and the lib
directory from this git repo.
Write your Jasmine spec and place it into a .js
file (for example JQuerySiteSpec.js
).
describe('Phasmine', function() {
it('can search the jQuery site', function() {
var actions = [
function(page) {
page.open('http://docs.jquery.com/Main_Page');
},
function(page) {
page.evaluate(function() {
$('input[name="search"]').val('bind');
$('button[name="go"]').click();
});
},
function(page) {
var result = page.evaluate(function() {
return $('body').text();
});
expect(result).toContain('Search results');
}
];
runActions(actions, this);
});
});
Run it with phantomjs phasmine.js -tr JQuerySiteSpec.js
The output is in SpecRunner.html
.
- PhantomJS
- Jasmine
- Qasmine
- Brian Theado and Peter Lyons for their interact.coffee script