meteor-cucumber-protractor

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

README.md

cucumber-protractor

Protractor support for CucumberJS

Usage

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/world.coffee

module.exports = ->

  @World = Cucumber.World.Protractor

Use the Protractor API from within your step definitions:

# app/tests/features/step_definitions/protractorStepDefinitions.coffee

module.exports = ->

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

  @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