Giter Club home page Giter Club logo

growlnotify's Introduction

Sencha Test Suite Growl Notifier

This script will notify SpecRunner.html to re-run the test suite if it detects any source code changes.

Requirements

  • Node v0.2.4
  • Socket.IO
  • Growl
  • growlnotifier
  • afplay (for playing sounds)

Installation

Install growl and growlnotify - growlnotify is in the 'Extras' folder of the Growl dmg.

Run the following commands. Please note this installs node into $HOME/local - if you already have node installed please see install.sh for manual installation

git clone [email protected]:nick/GrowlNotify.git
cd GrowlNotify
./install.sh

Edit the 'srcDir' variable at the top of autotest.js

Paste the following code before the </head> tag in ScriptRunner.html

<!-- Growl notifier. Served from a CDN to minimise hassle -->
<script src="http://cdn.socket.io/stable/socket.io.js"></script>         
<script type="text/javascript">
    if(window.io) {
        var socket = new io.Socket('localhost', {port: 3001});
        var socketReconnect;

        socket.on('connect', function(){ 
            console.log('Socket.IO Connected OK');
            if(socketReconnect) {
                window.location.reload(); // Re-run the tests if we have to re-connect
            } else {
                socket.send("RUNNING"); // Sending the 'Running Tests' command                        
            }
        }) ;
        socket.on('message', function(msg){
            var shouldReload = msg.match(/updated/i);
            if(shouldReload) { // There's been a change in the source
                window.location.reload();
            }
        }) 
        socket.on('disconnect', function() { 
            console.log('Socket.IO Disconnected')
            // Try to reconnect every 5 seconds to the backend
            socketReconnect = setInterval(function() {
                console.log('Attempting Socket.IO reconnect');
                socket.connect();
            }, 5000)
        });
        socket.connect();
        
        SenchaReporter.prototype._renderResults = SenchaReporter.prototype.renderResults;
        SenchaReporter.prototype.renderResults = function(runner) {
            this._renderResults(runner);
            var fails = jasmine.getEnv().currentRunner().results().failedCount;
            if(socket) socket.send("ERRORS: " + fails)
        }
    } else {
        console.log("The Socket.IO script was not loaded")
    }
</script>
<!-- End of Growl notifier -->

How to use

./autotest.sh

growlnotify's People

Contributors

edspencer avatar nick avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

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.