After lots of research and trial and error I have chosen the following stack for Frontend BDD testing:
I would like to avoid CasperJS run queues and use PhantomJS directly (through phantom-proxy) with callbacks in each step:
@World = (cb) ->
@phantom = require "phantom-proxy"
cb()
@Before (cb) ->
self = this
@phantom.create {}, (proxy) ->
self.proxy = proxy
self.page = proxy.page
cb()
@After (cb) ->
@proxy.end ->
cb()
@When /^I go to url "([^"]*)"$/, (url, cb) ->
@page.open url, ->
cb()
making the whole more logical and BDD-like.
Additionally, SpookyJS doesn't provide a full API for CasperJS.
The PhantomJS API, however, is quite low-level. Is there any other tool that provides CasperJS-like functionality (clicking, waiting for elements, etc) for Node.js without using run queues?
Mocha-PhantomJS might be just what you're looking for.
Alternatively, WebdriverJS has support for cucumber tests.
If you want to be more low-level you can try interfacing with the selenium-webdriver directly. Here's a demo on github.
Good luck!
I'd recommend Mocha which has a cucumber syntax add-on (mocha-cackes) and/or chai and it's plugins chai-jquery and chai-timers.
Also Karma comes with cucumber syntax support through the plugin karma-cucumber.
Both Karma and Mocha allow you to run your tests against real devices using launchers for saucelabs or browserstack for example.
Hope it helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With