Created: 2014-05-18 20:38
Updated: 2014-05-18 21:24


Protractor support for CucumberJS


NOTE: Protractor requires an AngularJS app to be present on the url under test.

Add to your Meteor app via Meteorite:

$ mrt add cucumber-protractor

Set the world constructor to Cucumber.World.Protractor in a support helper:

# app/tests/features/support/

module.exports = ->

  @World = Cucumber.World.Protractor

Use the Protractor API from within your step definitions:

# app/tests/features/step_definitions/

module.exports = ->

  @Given /^I am a website visitor using protractor$/, (callback) ->
    return callback new Error 'Protractor not available' unless @browser?

  @When /^I go to the home page with protractor$/, (callback) ->
    # @home() is a helper to navigate to the app's root url
    @home().then callback, callback

  @Then 'I should see "$text" using protractor', (text, callback) ->
    # @driver is an instance of a Protractor driver
    @browser.getPageSource().then (source) ->
      return callback() unless -1 is source.indexOf text 
      callback new Error "Expected to find #{text} on page"
    , callback
Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more