Giter Site home page Giter Site logo

benrosenblum / guard-phantomjs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from carhartl/guard-phantomjs

1.0 1.0 1.0 101 KB

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.

License: MIT License

Ruby 100.00%

guard-phantomjs's Introduction

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 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

Options

The location of the test runner:

guard 'phantomjs', :runner => '...' do
  ...
end

The url of the webserver hosting the test suite:

guard 'phantomjs', :server => '...' do
  ...
end

Development

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

guard-phantomjs's People

Contributors

carhartl avatar

Stargazers

Ben Rosenblum avatar

Watchers

Ben Rosenblum avatar

Forkers

primerevenue

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.