Created: 2014-05-18 20:37
Updated: 2016-05-03 08:09


Selenium WebDriver support for CucumberJS


Add to your Meteor app via Meteorite:

$ mrt add cucumber-selenium

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

# app/tests/features/support/

module.exports = ->

  @World = Cucumber.World.Selenium

Use the Selenium WebDriverJS API from within your step definitions:

# app/tests/features/step_definitions/

module.exports = ->

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

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

  @Then 'I should see "$text" using selenium', (text, callback) ->
    # @driver is an instance of a WebDriverJS driver
    @driver.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