Home > phasmine

phasmine

Phasmine is a project mainly written in JAVASCRIPT and COFFEESCRIPT, it's free.

Jasmine integrated with PhantomJS, so that I can test page interactions.

phasmine

Write Jasmine specs and check the webpages with PhantomJS. Similar to capybara-webkit.

Install

You only need phasmine.js and the lib directory from this git repo.

Usage

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.

Acknowledgements

  • PhantomJS
  • Jasmine
  • Qasmine
  • Brian Theado and Peter Lyons for their interact.coffee script
Previous:UART-Test