cucumberjs-chromedriver
Making local BDD easier.
Getting started
npm install cucumberjs -g
npm install cucumberjs-chromedriver --save-dev
create a feature ./example.feature
Feature: Example feature As a user of cucumber.js I want to have documentation on cucumber So that I can concentrate on building awesome applications Scenario: Reading documentation When I am on the Cucumber.js GitHub repository Then I should see "cucumber" in the page title
create a world file ./local-world.js
moduleexports = ;
this injects cucumberjs-chromedriver into the necessary hooks to start and stop the chromedriver. See Api for more advanced topics.
create a step file ./example.steps.js
var chai = chaiAsPromised = ; chai; chai; module { this; this;};
notice this is requiring more npm installs (but you don't have to use chai if you don't want to)
npm install chai --save-dev
npm install chai-as-promised --save-dev
And run your tests...
cucumberjs example.feature -r local-world.js -r example.steps.js --contentPath=http://github.com/cucumber/cucumber-js/
cucumberjs has conventions so you don't have to be so explicity, but I find them to confuse more than help...
Api
What is injected into the World?
property | description |
---|---|
browser | this is a browser instance from wd.js |
browser.pause() | returns a promise that will never resolve. This makes it easy to stop a test at a certain point in the workflow to manually inspect in the chromedriver browser. Ctr+C to kill the process. |
browser.SPECIAL_KEYS | wd Special Keys so you don't need to require wd just for the keys |
How do I debug what webdriver is doing?
Pass debug through the CLI --debug
when starting cucumberjs
and it will output webdriver debugging.
How do I extend the world?
module{ // you can pass `contentPath` or `debug` through here instead of the CLI if you want ; // cache the World factory provided by `cucumberjs-chromedriver` var chromeDriverWorldFactory = thisWorld; // create a new WorldFactory this{ // now you can do stuff before ; };};
Running Locally
npm install
npm test