nathanboktae/mocha-casperjs

CasperJS Includes option

Closed this issue · 2 comments

If this option is supported, it is possible to write some helper functions for CasperJS.

There should be no reason this shouldn't work, though I haven't tested. The reason I haven't tested it is because it's a wrapper around require() and I want my code to specify what it needs, and not rely on command line parameters for my test code to be correct.

Here's how I organize my helper functions:

casper-extensions.coffee:

casper.waitThenClick = (selector, timeout) ->
  @waitForSelector selector, (-> @click selector), null, timeout
 # etc...

some-tests.coffee

require '../modules/casper-extensions'

describe 'My Website', ->
  # tests that use waitThenClick

Closing this as if the option doesn't work, I don't want to include it as it is a bad practice. Use require()