Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/carhartl/guard-phantomjs
Phantomjs guard automatically runs PhantomJS with a driver and a URL, usually a web server hosting tests. It executes the tests and displays the test result.
https://github.com/carhartl/guard-phantomjs
Last synced: 26 days ago
JSON representation
Phantomjs guard automatically runs PhantomJS with a driver and a URL, usually a web server hosting tests. It executes the tests and displays the test result.
- Host: GitHub
- URL: https://github.com/carhartl/guard-phantomjs
- Owner: carhartl
- License: mit
- Created: 2011-03-30T09:57:04.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2011-05-08T20:05:40.000Z (over 13 years ago)
- Last Synced: 2024-05-09T19:30:13.935Z (6 months ago)
- Language: Ruby
- Homepage:
- Size: 390 KB
- Stars: 11
- Watchers: 3
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.rdoc
- License: LICENSE
Awesome Lists containing this project
README
= guard-phantomjs
Phantomjs guard automatically runs PhantomJS with a driver and a URL, usually a web server hosting tests. It executes the tests and displays the test result.
- Tested on Ruby 1.8.7 & 1.9.2.
== Install
Please be sure to have {Guard}[https://github.com/guard/guard] installed before continue.
Add guard definition to your Guardfile by running this command:
guard init phantomjs
Jasmine runner:
if (phantom.state.length === 0) {
if (phantom.args.length !== 1) {
console.log('Usage: run-jasmine.js URL');
phantom.exit();
} else {
phantom.state = 'run-jasmine';
phantom.open(phantom.args[0]);
}
} else {
window.setInterval(function () {
if (document.body.querySelector('.finished-at')) {
console.log(document.body.querySelector('.description').innerText);
var failed = document.body.querySelectorAll('div.jasmine_reporter .spec.failed .description');
for (var i = 0, desc; desc = failed[i]; i++) {
var message = [desc.title, desc.nextSibling.querySelector('.resultMessage.fail').innerText];
console.log(message.join(' => '));
}
phantom.exit(failed.length);
}
}, 100);
}Save runner and pass its location to the guard as :runner option, see Options below.
== Usage
Please read {Guard usage doc}[https://github.com/guard/guard#readme]
== Options
The location of the test runner:
guard 'phantomjs', :runner => '...' do
...
endThe url of the webserver hosting the test suite:
guard 'phantomjs', :server => '...' do
...
end== Development
- Source hosted at {GitHub}[https://github.com/guard/guard-phantomjs]
- Report issues, questions, feature requests on {GitHub Issues}[https://github.com/guard/guard-phantomjs/issues]Pull requests are very welcome! Make sure your patches are well tested. Please create a topic branch for every separate change you make.
== Authors
{Klaus Hartl}[https://github.com/carhartl]