spec/spec_helper.js.coffee
16b675df
 casper = require('casper').create()
 
 casper.login = ->
   @fill('form[action="/sessions"]', {
     jid: 'testovaci1@jabbim.cz'
     password: 'heslo'
   }, true)
 
   casper.echo 'Loading roster. This may take some time.'
 
   casper.waitFor(->
     #test
     casper.evaluate(->
       __utils__.findAll('#js-inactive-friends ul li').length >= 2
     )
   , ->
     # on success
     casper.echo('loaded roster')
   , ->
     # on timeout
     casper.die('roster not loaded', 1)
   )
 
 casper.inactiveListLength = ->
   casper.evaluate(-> __utils__.findAll('#js-inactive-friends ul li').length)
 
 casper.activeListLength = ->
   casper.evaluate(-> __utils__.findAll('#js-active-friends ul li').length)
 
 casper.tabsLength = ->
d5ab0abf
   casper.evaluate(-> __utils__.findAll('#js-tabbar .tab').length)
16b675df
 
 exports.Fantomas = casper